# Module cocos.layer.scrolling

This module defines the ScrollableLayer and ScrollingManager classes.

# Controlling Scrolling

You have two options for scrolling:

1. automatically scroll the map but stop at the map edges, and
2. scroll the map an allow the edge of the map to be displayed.

The ScrollingManager has a concept of "focus" which is the pixel position of the player's view focus (usually the center of the player sprite itself, but the player may be allowed to move the view around, or you may move it around for them to highlight something else in the scene). The ScrollingManager is clever enough to manage many layers and handle scaling them.

Two methods are available for setting the map focus:

set_focus(x, y)
  Attempt to set the focus to the pixel coordinates given. The layer(s) contained in the ScrollingManager are moved accordingly. If a layer would be moved outside of its define px_width, px_height then the scrolling is restricted. The resultant restricted focal point is stored on the ScrollingManager as restricted_fx and restricted_fy.
force_focus(x, y)
  Force setting the focus to the pixel coordinates given. The layer(s) contained in the ScrollingManager are moved accordingly regardless of whether any out-of-bounds cells would be displayed. The .fx and .fy attributes are still set, but they'll always be set to the supplied x and y values.

## Classes

| ScrollableLayer A Cocos Layer that is scrollable in a Scene.
| ScrollingManager Manages scrolling of Layers in a Cocos Scene.

## Variables

| __package__ = ``'``cocos.layer``'``