Bug Tracker

Opened 12 years ago

Closed 12 years ago

#1862 closed bug (wontfix)

iResizable overwrites '0' limits with default values

Reported by: Qazzian Owned by: stefan
Priority: minor Milestone: 1.2.2
Component: interface Version: 1.2.1
Keywords: iresizable Cc:
Blocked by: Blocking:

Description

When building a new resizable object, if any of the limits are set to 0 then a hard coded default will overwrite it. This is because iResize.build() checks if the value evaluates to true before overwriting and 0 evaluates to false. Here is an extract from iresizable.js, line 337:

el.resizeOptions.minLeft = options.minLeft || -1000;

To fix this I added a strict equality check to each option like so: [starting from line 331]

el.resizeOptions = options;
el.resizeOptions.minWidth = options.minWidth   || options.minWidth  === 0 ? 0 : -10;
el.resizeOptions.minHeight = options.minHeight || options.minHeight === 0 ? 0 : -10;
el.resizeOptions.maxWidth = options.maxWidth   || options.maxWidth  === 0 ? 0 : -3000;
el.resizeOptions.maxHeight = options.maxHeight || options.maxHeight === 0 ? 0 : -3000;
el.resizeOptions.minTop = options.minTop       || options.minTop    === 0 ? 0 : -1000;
el.resizeOptions.minLeft = options.minLeft     || options.minLeft   === 0 ? 0 : -1000;
el.resizeOptions.maxRight = options.maxRight   || options.maxRight  === 0 ? 0 : 3000;
el.resizeOptions.maxBottom = options.maxBottom || options.maxBottom === 0 ? 0 : 3000;

This should differentiate between an option not being set and an option being specifically set to 0.

Change History (2)

comment:1 Changed 12 years ago by Qazzian

Forgot to include the brackets:

el.resizeOptions.minWidth = options.minWidth   || (options.minWidth  === 0 ? 0 : -10);
el.resizeOptions.minHeight = options.minHeight || (options.minHeight === 0 ? 0 : -10);
el.resizeOptions.maxWidth = options.maxWidth   || (options.maxWidth  === 0 ? 0 : -3000);
el.resizeOptions.maxHeight = options.maxHeight || (options.maxHeight === 0 ? 0 : -3000);
el.resizeOptions.minTop = options.minTop       || (options.minTop    === 0 ? 0 : -1000);
el.resizeOptions.minLeft = options.minLeft     || (options.minLeft   === 0 ? 0 : -1000);
el.resizeOptions.maxRight = options.maxRight   || (options.maxRight  === 0 ? 0 : 3000);
el.resizeOptions.maxBottom = options.maxBottom || (options.maxBottom === 0 ? 0 : 3000);

comment:2 Changed 12 years ago by scott.gonzal

Resolution: wontfix
Status: newclosed

Interface is no longer supported; consider switching to jQuery UI.

Note: See TracTickets for help on using tickets.