Skip to main content

Bug Tracker

Side navigation

#825 closed enhancement (fixed)

Opened January 16, 2007 04:31PM UTC

Closed January 17, 2007 12:13PM UTC

iresizable: onDrag can return the new element position

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

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]);
Attachments (0)
Change History (1)

Changed January 17, 2007 12:13PM UTC by stefan comment:1

resolution: → fixed
status: newclosed

Added and commited to SVN