Bug Tracker


Ticket #825 (closed enhancement: fixed)

Opened 7 years ago

Last modified 7 years ago

iresizable: onDrag can return the new element position

Reported by: sebastien@… Owned by: stefan
Priority: major Milestone:
Component: interface Version:
Keywords: resizable drag Cc:
Blocking: Blocked by:


If we want to limit drag or to make dragging "snap to grid", we need a way for the onDrag callback to return a modified position for the element. Here is a usage example to move a resizable by steps of 50 pixels:

Resizable ( { onDrag:function(x,y){return [ Math.floor(x/50)*50, Math.floor(y/50)*50 }}) )

Here is a very simple patch against r1096 that enables this:

<                       var new_pos = jQuery.iResize.dragged.resizeOptions.onDrag.apply(jQuery.iResize.dragged, [newLeft, newTop]);
<                       if ( typeof(new_pos) != "undefined" ) {
<                               newLeft = new_pos[0];
<                               newTop  = new_pos[1];
<                       }
>                       jQuery.iResize.dragged.resizeOptions.onDrag.apply(jQuery.iResize.dragged, [newLeft, newTop]);

Change History

comment:1 Changed 7 years ago by stefan

  • Status changed from new to closed
  • Resolution set to fixed

Added and commited to SVN

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.


Add a comment

Modify Ticket

as closed

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.