Skip to content

[V2] Get dynamic zoom + translatable selection at the same time #1244

@golden-kiwi

Description

@golden-kiwi

cropperjs version: 2.0.0

When I set dynamic on cropper-selection I can no longer drag the selection, only the image+selection together

I would like to have all these at the same time:

  • dynamic zoom (on mouse wheel or zoom button click)
  • translatable selection (on mouse click and drag)
  • translatable image (on mouse click and drag)

Here's an example:

<cropper-canvas background>
  <cropper-image rotatable scalable skewable translatable></cropper-image>
  <cropper-shade hidden></cropper-shade>
  <cropper-handle action="move" plain></cropper-handle>
  <!-- either -->
  <cropper-selection initial-coverage="0.5" movable resizable zoomable dynamic> <!-- dynamic zoom but selection not translatable-->
  <!-- or -->
  <cropper-selection initial-coverage="0.5" movable resizable zoomable> <!-- no dynamic zoom but selection is translatable-->
    <cropper-grid role="grid" covered></cropper-grid>
    <cropper-crosshair centered></cropper-crosshair>
    <cropper-handle action="move" theme-color="rgba(255, 255, 255, 0.35)"></cropper-handle>
    <cropper-handle action="n-resize"></cropper-handle>
    <cropper-handle action="e-resize"></cropper-handle>
    <cropper-handle action="s-resize"></cropper-handle>
    <cropper-handle action="w-resize"></cropper-handle>
    <cropper-handle action="ne-resize"></cropper-handle>
    <cropper-handle action="nw-resize"></cropper-handle>
    <cropper-handle action="se-resize"></cropper-handle>
    <cropper-handle action="sw-resize"></cropper-handle>
  </cropper-selection>
</cropper-canvas>

Based on:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions