fix #460: fix cellWidth method

This commit is contained in:
Pavel Reznikov 2016-08-16 21:43:28 -07:00
parent b09ae61fe2
commit 11b6292d31
4 changed files with 14 additions and 12 deletions

5
dist/gridstack.js vendored
View file

@ -1043,7 +1043,7 @@
var o = $(this);
self.grid.cleanNodes();
self.grid.beginUpdate(node);
cellWidth = Math.ceil(o.outerWidth() / o.attr('data-gs-width'));
cellWidth = self.cellWidth();
var strictCellHeight = Math.ceil(o.outerHeight() / o.attr('data-gs-height'));
cellHeight = self.container.height() / parseInt(self.container.attr('data-gs-current-height'));
self.placeholder
@ -1494,8 +1494,7 @@
};
GridStack.prototype.cellWidth = function() {
var o = this.container.children('.' + this.opts.itemClass).first();
return Math.ceil(o.outerWidth() / parseInt(o.attr('data-gs-width'), 10));
return Math.round(this.container.outerWidth() / this.opts.width);
};
GridStack.prototype.getCellFromPixel = function(position, useOffset) {

14
dist/gridstack.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1043,7 +1043,7 @@
var o = $(this);
self.grid.cleanNodes();
self.grid.beginUpdate(node);
cellWidth = Math.ceil(o.outerWidth() / o.attr('data-gs-width'));
cellWidth = self.cellWidth();
var strictCellHeight = Math.ceil(o.outerHeight() / o.attr('data-gs-height'));
cellHeight = self.container.height() / parseInt(self.container.attr('data-gs-current-height'));
self.placeholder
@ -1494,8 +1494,7 @@
};
GridStack.prototype.cellWidth = function() {
var o = this.container.children('.' + this.opts.itemClass).first();
return Math.ceil(o.outerWidth() / parseInt(o.attr('data-gs-width'), 10));
return Math.round(this.container.outerWidth() / this.opts.width);
};
GridStack.prototype.getCellFromPixel = function(position, useOffset) {