Skip to content

Transformer boundBoxFunc resize limit problem #1968

@fallingleaflun

Description

@fallingleaflun

Description: I tried using the official demo to limit the scaling area, but I found that when my mouse moves quickly, directly returning an oldBox makes it impossible to reach the boundary. When we move around the edge, we have to drag the mouse slowly to reach the maximum limit. To address this, I manually modified the returned box to:

{
  ...oldBox,
  width: (MAX_SCALE_SIZE * newBox.width) / newBox.height,
  height: MAX_SCALE_SIZE,
}

Code: my demo

However, I found that when I drag the top-left, top-right, or bottom-left anchor, if the mouse moves quickly near the limit, the entire shape will move to the right or downward. I think this is because the origin of the image is the top-left corner, but I can't think of any solution. Please help! 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions