daybrush / moveable

Moveable! Draggable! Resizable! Scalable! Rotatable! Warpable! Pinchable! Groupable! Snappable!
https://daybrush.com/moveable/
MIT License
9.9k stars 611 forks source link

OnBound Event #970

Open jadiagaurang opened 1 year ago

jadiagaurang commented 1 year ago

Environments

Description

I have set up bounds for the container to limit dragging and resizing within a defined area.

bounds = {
    left: 0,
    top: 0,
    right: me.canvasContainerWidth,
    bottom: me.canvasContainerHeight
};

I want to implement a feature when the container grows from the bottom when an element reaches the bottom bound, especially for contentEditable text elements.

daybrush commented 1 year ago

@jadiagaurang

okay. I'll add it in the next version.

daybrush commented 1 year ago

@jadiagaurang

onBound={e => {
   // { left: false, top: false, right: false, ... }
   console.log(e.bounds, e.innerBounds);
}}
jadiagaurang commented 1 year ago

@daybrush Thanks!

jadiagaurang commented 1 year ago

Hi @daybrush,

I am facing an issue where onBound event doesn't get triggered when an Element is touched to the edges of the bounds using dragTarget, but it gets triggered when dragging an element itself (dragTargetSelf: true)

If an Element touches the bottom bound, I am trying to grow a container.

Here is a video to demo.

https://github.com/daybrush/moveable/assets/430637/53373815-72c5-4cf3-8406-115dbf01929d

I would appreciate any help!

jadiagaurang commented 1 year ago

Hi @daybrush I would like to follow up in my previous comment. Do you know how to trigger onBound Event when an Element is moved using dragTarget?