Skip to main content

Search and Top Navigation

#2748 closed enhancement (fixed)

Opened April 26, 2008 08:22PM UTC

Closed May 21, 2008 03:42AM UTC

Last modified February 26, 2009 12:06PM UTC

Resizable: snap to grid

Reported by: telega Owned by: eduardo
Priority: minor Milestone: 1.5
Component: ui.core Version: 1.2.3
Keywords: Cc:
Blocked by: Blocking:
Description

Hi

I found that snap to grid functionality, similar to the Draggable "grid" can be easily added to current Resizable implementation. The change is only 2 lines of code:

1) The first line - add grid option to the list of default options:

    //Prepare the passed options
    this.options = $.extend({
      ...
      grid: [1, 1]
    }, options);

2) The second line - calculate width/height change value using grid option - modify change() method, right after the line, where "val" is calculated:

      var change = function(a,b) {
        ...
        var val = ...
        val = val - val % o.grid[isth ? 0 : 1];

I've implemented this feature because I need it for my project. Maybe others find it useful too.

Regards,

telega

Attachments (0)
Change History (4)

Changed April 30, 2008 09:15AM UTC by paul comment:1

owner: paulbraeker

Changed May 21, 2008 03:42AM UTC by braeker comment:2

resolution: → fixed
status: newclosed

Changed May 24, 2008 03:39AM UTC by comment:3

milestone: 1.2.4

Milestone 1.2.4 deleted

Changed February 26, 2009 12:06PM UTC by paul comment:4

milestone: → 1.5