Bug Tracker

Ticket #825 (closed enhancement: fixed)

Opened 8 years ago

Last modified 8 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:

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]);

Change History

comment:1 Changed 8 years ago by stefan

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

Added and commited to SVN

Note: See TracTickets for help on using tickets.