Crop Example

Allowing the user to select an arbitrary portion of the canvas.

  1. Draw layer(s) to canvas and make them unselectable
  2. Draw an invisible layer to the canvas, and programmatically select it
  3. Listen for the layer-deselect event and prevent it so the user can't de-select the crop area.
  4. Use the cropToLayer method to get the cropped image behind the selected invisible layer.

Full Canvas

Cropped Region