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

Bounds parameter doesn't work for scaling #243

@kota-yata

Description

@kota-yata

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?

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