moveable icon indicating copy to clipboard operation
moveable copied to clipboard

Resize event edges/corners

Open RicardoLimaDev opened this issue 7 years ago • 8 comments

How can i get the edges in which a resize is occurring? eg: Top-left, Bottom Left... is that possible?

RicardoLimaDev avatar Aug 15 '19 13:08 RicardoLimaDev

@RicardoLimaDev

Is this what you said?

I plan to support this feature in a version that will be released in 8.19.

daybrush avatar Aug 16 '19 05:08 daybrush

@RicardoLimaDev

Moveable 0.7.0 is released. edge drag is possible when the edge option is enabled.

new Moveable(document.body, {
    resizable: true,
    edge: true,
});

daybrush avatar Aug 19 '19 19:08 daybrush

@daybrush It seems @RicardoLimaDev says that he would like to detect which control we're dragging using an event metadata.

madyankin avatar Aug 20 '19 13:08 madyankin

@outpunk @RicardoLimaDev Maybe you're right. I'll add it to the next feature.

daybrush avatar Aug 22 '19 16:08 daybrush

@outpunk @RicardoLimaDev Maybe you're right. I'll add it to the next feature.

Thanks!

RicardoLimaDev avatar Aug 22 '19 19:08 RicardoLimaDev

@RicardoLimaDev moveable 0.9.0 is released. react-moveable 0.12.1 is released. preact-moveable 0.11.2 is released. ngx-moveable 0.5.1 is released.

React code is as follows.

onResize={({ direction }) => {
   // [1, 1] => right, bottom
   // [-1, -1] => left, top
  // [0, -1] => center, top
    console.log(direction);
}}

Thank you :)

daybrush avatar Sep 29 '19 13:09 daybrush

It's also possible to know the direction in the onResizeEnd event?

kauly avatar Jul 23 '24 14:07 kauly

@kauly I think onResizeEnd essencially do not have any direction .

I don't know if it is helpful for you, but you can access the last resize event by using lastEvent.

onResizeEnd={(endEvent) => {
          if (endEvent.lastEvent == null) {
            return;
          }
          lastEvent.direction
        }}

kounorimich avatar Oct 15 '24 02:10 kounorimich