Skip to main content

Bug Tracker

Side navigation

#2019 closed feature (fixed)

Opened December 06, 2007 02:18PM UTC

Closed March 05, 2008 03:31AM UTC

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

Reported by: djot Owned by: braeker
Priority: minor Milestone: 1.2.2
Component: ui Version: 1.2.1
Keywords: ui, resizable, grid, snap Cc:
Blocked by: Blocking:
Description

-

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

-

Attachments (0)
Change History (4)

Changed February 18, 2008 02:11PM UTC by braeker comment:1

owner: → braeker

Changed February 27, 2008 02:22AM UTC by briang comment:2

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

Changed February 27, 2008 06:43AM UTC by briang comment:3

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.

Changed March 05, 2008 03:31AM UTC by braeker comment:4

resolution: → fixed
status: newclosed