Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ee09858

Browse files
committed
update gridstack.js
1 parent 4ed87f6 commit ee09858

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

gridstack.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
}
102102
};
103103

104-
GridStackEngine.prototype._prepare_node = function (node, moving) {
104+
GridStackEngine.prototype._prepare_node = function (node, resizing) {
105105
node = _.defaults(node || {}, {width: 1, height: 1, x: 0, y: 0 });
106106

107107
node.x = parseInt('' + node.x);
@@ -128,11 +128,11 @@
128128
}
129129

130130
if (node.x + node.width > this.width) {
131-
if (moving) {
132-
node.x = this.width - node.width;
131+
if (resizing) {
132+
node.width = this.width - node.x;
133133
}
134134
else {
135-
node.width = this.width - node.x;
135+
node.x = this.width - node.width;
136136
}
137137
}
138138

@@ -213,15 +213,15 @@
213213
return node;
214214
}
215215

216-
var moving = node.x != x;
216+
var resizing = node.width != width;
217217
node._dirty = true;
218218

219219
node.x = x;
220220
node.y = y;
221221
node.width = width;
222222
node.height = height;
223223

224-
node = this._prepare_node(node, moving);
224+
node = this._prepare_node(node, resizing);
225225

226226
this._fix_collisions(node);
227227
if (!no_pack) {
@@ -255,7 +255,7 @@
255255
this.container = $(el);
256256

257257
this.opts = _.defaults(opts || {}, {
258-
width: 12,
258+
width: this.container.attr('data-gs-width') || 12,
259259
item_class: 'grid-stack-item',
260260
placeholder_class: 'grid-stack-placeholder',
261261
handle: '.grid-stack-item-content',

0 commit comments

Comments
 (0)