Side navigation
#1862 closed bug (wontfix)
Opened October 30, 2007 04:37PM UTC
Closed March 31, 2008 02:21AM UTC
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.
Forgot to include the brackets: