Opened 17 years ago
Closed 17 years ago
#825 closed enhancement (fixed)
iresizable: onDrag can return the new element position
Reported by: | Owned by: | stefan | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | interface | Version: | |
Keywords: | resizable drag | Cc: | |
Blocked by: | Blocking: |
Description
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:
92,96c92 < 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]);
Note: See
TracTickets for help on using
tickets.
Added and commited to SVN