Skip to main content
Language

Configure Snapping

PhotoEditor SDK supports several configuration options to customize the snapping behavior globally for all sprites in the editor. For a detailed explanation of how to configure different editor views, refer to this guide.

In this example configuration, the editor's snapping behavior is configured to act as a guide for the user to see where the sprites should be placed. A use case could be that an application displays the photos both in rectangular as well as in circular shapes which requires the editor to indicate in which area the sprites' visibility is best.

Rotational snapping#

Sprites snap based on their rotation. By default, the sprites snap to angles in 45-degree steps (0, 45 ... 315)

enabled#

By default, the snapping is enabled when rotating a sprite. In this example, this behavior is disabled since only the outer positional snapping guides are needed.

Positional snapping#

Sprites also snap based on their position on the canvas.

Inner positional snapping#

By default, sprites snap to the horizontal and vertical center lines. In this example, the inner positional snapping behavior is disabled.

snapToVerticalCenterLine#

If set to true (by default) the center of the sprite snaps to a vertical line indicating the center of the photo. In this example, this behavior is disabled since only the outer positional snapping guides are needed.

snapToHorizontalCenterLine#

If set to true (by default) By default the center of the sprite snaps to a horizontal line indicating the center of the photo. In this example, this behavior is disabled since only the outer positional snapping guides are needed.

Outer positional snapping#

Sprites snap to the border of the photo along horizontal and vertical lines. By default, these lines are placed at a distance of 10% of the smaller side of the photo from the border (corresponding to 0.1). In this example, we want to increase this distance to 15% to define the visibility of the photo.