Opened 15 years ago

Closed 15 years ago

Last modified 14 years ago

#2019 closed feature (fixed)

ui.resizable misses option "snap to grid" and "animation/fx"

Reported by: djot Owned by: eduardo
Priority: minor Milestone: 1.5
Component: ui.core Version: 1.2.1
Keywords: ui, resizable, grid, snap Cc:
Blocked by: Blocking:


- Hi,

The resizables miss the option to snap to a grid (e.g. snap to 5px grid only).

Not for me, but other will ask for animation/fx options.

djot -

Change History (6)

comment:1 Changed 15 years ago by braeker

Owner: set to braeker

comment:2 Changed 15 years ago by briang

+1 - I have a need for this. It may be useful for resizable to mimic the features of slider for steps/stepping.

comment:3 Changed 15 years ago by briang

Well, I needed it, so I tried to hack it. I took a cue from the slider which supports this behaviour. Here are the changes relative to the published 1.5b:

line 35-36:

      autohide: false,
      stepping: 0

Insert at line 388:

		if(o.stepping > 0) {
			var steps = Math.round(mod / o.stepping) * o.stepping;
			val = val + mod - steps;
			mod = steps;

Then pass a new option when building the resizable:

$(".package").resizable({ handles: 'w, e', autohide: true, stepping: 20, containment: 'parent'});

That will make the bars move in 20 pixel increments. There is some strange behavior caused when you move through your step range where the opposite end of the resizable briefly shrinks and then returns to its original size when the selected handle moves another pixel or two. It's caused by the code above interacting with the existing width/height modifier but I was unable to determine how to fix it. I thought some more skilled eyes might see the issue.

comment:4 Changed 15 years ago by braeker

Resolution: fixed
Status: newclosed

comment:5 Changed 15 years ago by (none)

Milestone: 1.2.2

Milestone 1.2.2 deleted

comment:6 Changed 14 years ago by paul

Milestone: 1.5
Note: See TracTickets for help on using tickets.