merge with master
This commit is contained in:
commit
74a6ad6847
|
@ -480,6 +480,7 @@ Changes
|
||||||
- fix jQuery `size()` ([#486](https://github.com/troolee/gridstack.js/issues/486)).
|
- fix jQuery `size()` ([#486](https://github.com/troolee/gridstack.js/issues/486)).
|
||||||
- update _notify to allow detach ([#411](https://github.com/troolee/gridstack.js/issues/411)).
|
- update _notify to allow detach ([#411](https://github.com/troolee/gridstack.js/issues/411)).
|
||||||
- fix code that checks for jquery-ui ([#481](https://github.com/troolee/gridstack.js/issues/481)).
|
- fix code that checks for jquery-ui ([#481](https://github.com/troolee/gridstack.js/issues/481)).
|
||||||
|
- fix `cellWidth` calculation on empty grid
|
||||||
|
|
||||||
#### v0.2.5 (2016-03-02)
|
#### v0.2.5 (2016-03-02)
|
||||||
|
|
||||||
|
|
5
dist/gridstack.js
vendored
5
dist/gridstack.js
vendored
|
@ -1043,7 +1043,7 @@
|
||||||
var o = $(this);
|
var o = $(this);
|
||||||
self.grid.cleanNodes();
|
self.grid.cleanNodes();
|
||||||
self.grid.beginUpdate(node);
|
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'));
|
var strictCellHeight = Math.ceil(o.outerHeight() / o.attr('data-gs-height'));
|
||||||
cellHeight = self.container.height() / parseInt(self.container.attr('data-gs-current-height'));
|
cellHeight = self.container.height() / parseInt(self.container.attr('data-gs-current-height'));
|
||||||
self.placeholder
|
self.placeholder
|
||||||
|
@ -1494,8 +1494,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
GridStack.prototype.cellWidth = function() {
|
GridStack.prototype.cellWidth = function() {
|
||||||
var o = this.container.children('.' + this.opts.itemClass).first();
|
return Math.round(this.container.outerWidth() / this.opts.width);
|
||||||
return Math.ceil(o.outerWidth() / parseInt(o.attr('data-gs-width'), 10));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GridStack.prototype.getCellFromPixel = function(position, useOffset) {
|
GridStack.prototype.getCellFromPixel = function(position, useOffset) {
|
||||||
|
|
4
dist/gridstack.min.js
vendored
4
dist/gridstack.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/gridstack.min.map
vendored
2
dist/gridstack.min.map
vendored
File diff suppressed because one or more lines are too long
|
@ -220,14 +220,27 @@ describe('gridstack', function() {
|
||||||
afterEach(function() {
|
afterEach(function() {
|
||||||
document.body.removeChild(document.getElementsByClassName('grid-stack')[0]);
|
document.body.removeChild(document.getElementsByClassName('grid-stack')[0]);
|
||||||
});
|
});
|
||||||
it('should return 96.', function() {
|
it('should return 1/12th of container width.', function() {
|
||||||
var options = {
|
var options = {
|
||||||
cellHeight: 80,
|
cellHeight: 80,
|
||||||
verticalMargin: 10
|
verticalMargin: 10,
|
||||||
|
width: 12
|
||||||
};
|
};
|
||||||
$('.grid-stack').gridstack(options);
|
$('.grid-stack').gridstack(options);
|
||||||
var grid = $('.grid-stack').data('gridstack');
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
expect(grid.cellWidth()).toBe(96);
|
var res = Math.round($('.grid-stack').outerWidth() / 12);
|
||||||
|
expect(grid.cellWidth()).toBe(res);
|
||||||
|
});
|
||||||
|
it('should return 1/10th of container width.', function() {
|
||||||
|
var options = {
|
||||||
|
cellHeight: 80,
|
||||||
|
verticalMargin: 10,
|
||||||
|
width: 10
|
||||||
|
};
|
||||||
|
$('.grid-stack').gridstack(options);
|
||||||
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
|
var res = Math.round($('.grid-stack').outerWidth() / 10);
|
||||||
|
expect(grid.cellWidth()).toBe(res);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1043,7 +1043,7 @@
|
||||||
var o = $(this);
|
var o = $(this);
|
||||||
self.grid.cleanNodes();
|
self.grid.cleanNodes();
|
||||||
self.grid.beginUpdate(node);
|
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'));
|
var strictCellHeight = Math.ceil(o.outerHeight() / o.attr('data-gs-height'));
|
||||||
cellHeight = self.container.height() / parseInt(self.container.attr('data-gs-current-height'));
|
cellHeight = self.container.height() / parseInt(self.container.attr('data-gs-current-height'));
|
||||||
self.placeholder
|
self.placeholder
|
||||||
|
@ -1494,8 +1494,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
GridStack.prototype.cellWidth = function() {
|
GridStack.prototype.cellWidth = function() {
|
||||||
var o = this.container.children('.' + this.opts.itemClass).first();
|
return Math.round(this.container.outerWidth() / this.opts.width);
|
||||||
return Math.ceil(o.outerWidth() / parseInt(o.attr('data-gs-width'), 10));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GridStack.prototype.getCellFromPixel = function(position, useOffset) {
|
GridStack.prototype.getCellFromPixel = function(position, useOffset) {
|
||||||
|
|
Loading…
Reference in a new issue