Skip to content
This repository has been archived by the owner on Nov 9, 2021. It is now read-only.

Bounds parameter doesn't work for scaling #243

Open
kota-yata opened this issue Mar 19, 2021 · 0 comments
Open

Bounds parameter doesn't work for scaling #243

kota-yata opened this issue Mar 19, 2021 · 0 comments

Comments

@kota-yata
Copy link

I set the bound parameter bounds: { left: 0, top: 100, right: 300, bottom: 500 }, }, and it works correctly for dragging. However scaling doesn't stop even when edge of the target beyond the bounds.

I tried to limit using DOMRect like so:

const targetRect: DOMRect = event.target.getBoundingClientRect();
let isOnEdge: boolean = false;
if (targetRect.top < this.moveable.bounds.top || targetRect.bottom > this.moveable.bounds.bottom) isOnEdge = true;
if (targetRect.left < this.moveable.bounds.left || targetRect.right > this.moveable.bounds.right) isOnEdge = true;
if (!isOnEdge) event.target.style.transform = event.transform;

In this case, I can't scale the target anymore once isOnEdge turns true since targetRect has already been out of the bounds. How can I limit the target scaling?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant