Skip to content

Commit 83ac5af

Browse files
committed
Merge pull request #310 from crazydrecksack/master
[BUGFIX] offset problems for dragging and scaling with a lot of columns
2 parents fc571d8 + 9c644ee commit 83ac5af

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

dist/gridstack.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@
635635
var o = $(this);
636636
self.grid.clean_nodes();
637637
self.grid.begin_update(node);
638-
cell_width = Math.ceil(o.outerWidth() / o.attr('data-gs-width'));
638+
cell_width = o.outerWidth() / o.attr('data-gs-width');
639639
cell_height = self.opts.cell_height + self.opts.vertical_margin;
640640
self.placeholder
641641
.attr('data-gs-x', o.attr('data-gs-x'))
@@ -645,7 +645,7 @@
645645
.show();
646646
node.el = self.placeholder;
647647

648-
el.resizable('option', 'minWidth', cell_width * (node.min_width || 1));
648+
el.resizable('option', 'minWidth', Math.round(cell_width * (node.min_width || 1)));
649649
el.resizable('option', 'minHeight', self.opts.cell_height * (node.min_height || 1));
650650
};
651651

src/gridstack.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@
640640
var o = $(this);
641641
self.grid.clean_nodes();
642642
self.grid.begin_update(node);
643-
cell_width = Math.ceil(o.outerWidth() / o.attr('data-gs-width'));
643+
cell_width = o.outerWidth() / o.attr('data-gs-width');
644644
cell_height = self.opts.cell_height + self.opts.vertical_margin;
645645
self.placeholder
646646
.attr('data-gs-x', o.attr('data-gs-x'))
@@ -650,7 +650,7 @@
650650
.show();
651651
node.el = self.placeholder;
652652

653-
el.resizable('option', 'minWidth', cell_width * (node.min_width || 1));
653+
el.resizable('option', 'minWidth', Math.round(cell_width * (node.min_width || 1)));
654654
el.resizable('option', 'minHeight', self.opts.cell_height * (node.min_height || 1));
655655
};
656656

0 commit comments

Comments
 (0)