@get-set/gs-sortable 0.0.19 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,278 +1,247 @@
1
- import types from "../constants/types";
2
- import { getOffsetFromWindow, getTranslateCoord } from "./general";
3
-
4
- const calculateOnSort = (ref) => {
5
- const params = ref.currentParams;
6
- if (!params.takeClone) {
7
- const $items = [...ref.grid.children];
8
- const itemsCount = $items.filter(
9
- (x) => !x.classList.contains("gs-sortable-item-inmove")
10
- ).length;
11
- const info = window.GSSortableConfigue.draggableInfo;
12
- let {
13
- containerPT,
14
- containerPL,
15
- currentHeight,
16
- currentWidth,
17
- itemWidth,
18
- gapX,
19
- gapY,
20
- } = ref.uiData;
21
-
22
- let currentLeft = containerPL;
23
- let currentTop = containerPT;
24
- let maxHeight = 0;
25
-
26
- let placeholderSeted = info === undefined;
27
- let inProcessEl = undefined;
28
- const containerCoord = getOffsetFromWindow(info.ref.grid);
29
- if (info !== undefined) {
30
- const $el = info.$el;
31
- const elCoord = getOffsetFromWindow($el);
32
- inProcessEl = {
33
- height: $el.offsetHeight,
34
- width: $el.offsetWidth,
35
- top: elCoord.top - containerCoord.top,
36
- left: elCoord.left - containerCoord.left,
37
- };
38
- }
39
- let plIndex = info.index;
40
- let colHeight = 0;
41
-
42
- let itIndex = 0;
43
-
44
- $items.map((el) => {
45
- if (!el.classList.contains("gs-sortable-item-inmove")) {
46
- const height = el.offsetHeight;
47
- const width = el.offsetWidth;
48
- if (params.type == types.column) {
49
- if (!placeholderSeted) {
50
- let placeholderTop =
51
- currentTop == containerPT ? containerPT : currentTop + gapY;
52
- let placeholderLeft = containerPL;
53
-
54
- if (
55
- Math.abs(placeholderTop - inProcessEl.top) <
56
- inProcessEl.height / 2 &&
57
- Math.abs(placeholderLeft - inProcessEl.left) <
58
- inProcessEl.width / 2
59
- ) {
60
- info.newTop = placeholderTop;
61
- info.newLeft = placeholderLeft;
62
- placeholderSeted = true;
63
- plIndex = itIndex;
64
- }
65
- }
66
- if (!el.classList.contains("gs-sortable-placeholder")) {
67
- if (currentTop == containerPT) {
68
- currentTop = containerPT + height;
69
- currentHeight = currentHeight + height;
70
- } else {
71
- currentTop = currentTop + gapY + height;
72
- currentHeight = currentHeight + height + gapY;
73
- }
74
- }
75
- } else if (params.type == types.row) {
76
- if (!placeholderSeted) {
77
- let placeholderLeft =
78
- currentLeft == containerPL ? containerPL : currentLeft + gapX;
79
- let placeholderTop = containerPT;
80
- if (
81
- Math.abs(placeholderTop - inProcessEl.top) <
82
- inProcessEl.height / 2 &&
83
- Math.abs(placeholderLeft - inProcessEl.left) <
84
- inProcessEl.width / 2
85
- ) {
86
- info.newTop = placeholderTop;
87
- info.newLeft = placeholderLeft;
88
- placeholderSeted = true;
89
- plIndex = itIndex;
90
- }
91
- }
92
- if (!el.classList.contains("gs-sortable-placeholder")) {
93
- if (currentLeft == containerPL) {
94
- currentLeft = containerPL + width;
95
- currentWidth = currentWidth + width;
96
- } else {
97
- currentLeft = currentLeft + gapX + width;
98
- currentWidth = currentWidth + width + gapX;
99
- }
100
- if (height > maxHeight) {
101
- maxHeight = height;
102
- }
103
- }
104
- } else if (params.type == types.grid) {
105
- const placeholderLeft =
106
- itIndex % params.count == 0
107
- ? containerPL
108
- : containerPL + (itIndex % params.count) * (itemWidth + gapX);
109
- const placeholderTop = currentTop;
110
- if (
111
- Math.abs(placeholderTop - inProcessEl.top) <
112
- inProcessEl.height / 2 &&
113
- Math.abs(placeholderLeft - inProcessEl.left) < inProcessEl.width / 2
114
- ) {
115
- info.newTop = placeholderTop;
116
- info.newLeft = placeholderLeft;
117
- placeholderSeted = true;
118
- plIndex = itIndex;
119
- }
120
- if (!el.classList.contains("gs-sortable-placeholder")) {
121
- const top = currentTop;
122
- if (height > colHeight) {
123
- colHeight = height;
124
- }
125
- if (
126
- itIndex % params.count === params.count - 1 ||
127
- itIndex === itemsCount - 1
128
- ) {
129
- if (top === containerPT) {
130
- currentHeight = currentHeight + colHeight;
131
- } else {
132
- currentHeight = currentHeight + colHeight + gapY;
133
- }
134
- currentTop = currentTop + colHeight + gapY;
135
- colHeight = 0;
136
- }
137
- }
138
- }
139
- itIndex += 1;
140
- }
141
- });
142
- {
143
- info.index = plIndex;
144
- let {
145
- containerPT,
146
- containerPL,
147
- currentHeight,
148
- currentWidth,
149
- itemWidth,
150
- gapX,
151
- gapY,
152
- } = ref.uiData;
153
-
154
- currentLeft = containerPL;
155
- currentTop = containerPT;
156
- itIndex = 0;
157
- $items.map((el) => {
158
- if (!el.classList.contains("gs-sortable-item-inmove")) {
159
- const height = el.offsetHeight;
160
- const width = el.offsetWidth;
161
- if (params.type == types.column) {
162
- if (itIndex == plIndex) {
163
- info.placeholder.style.left = `${containerPL}px`;
164
- info.newLeft = containerPL;
165
- if (currentTop == containerPT) {
166
- info.newTop = containerPT;
167
- info.placeholder.style.top = `${containerPT}px`;
168
- currentTop = containerPT + inProcessEl.height;
169
- } else {
170
- info.newTop = currentTop + gapY;
171
- info.placeholder.style.top = `${currentTop + gapY}px`;
172
- currentTop = currentTop + gapY + inProcessEl.height;
173
- }
174
- }
175
- if (!el.classList.contains("gs-sortable-placeholder")) {
176
- el.style.left = `${containerPL}px`;
177
- if (currentTop == containerPT) {
178
- el.style.top = `${containerPT}px`;
179
- currentTop = containerPT + height;
180
- currentHeight = currentHeight + height;
181
- } else {
182
- el.style.top = `${currentTop + gapY}px`;
183
- currentTop = currentTop + gapY + height;
184
- currentHeight = currentHeight + height + gapY;
185
- }
186
- }
187
- } else if (params.type == types.row) {
188
- if (itIndex == plIndex) {
189
- info.placeholder.style.top = `${containerPT}px`;
190
- info.newTop = containerPT;
191
- if (currentLeft == containerPL) {
192
- info.newLeft = containerPL;
193
- info.placeholder.style.left = `${containerPL}px`;
194
- currentLeft = containerPL + inProcessEl.width;
195
- } else {
196
- info.newLeft = currentLeft + gapX;
197
- info.placeholder.style.left = `${currentLeft + gapX}px`;
198
- currentLeft = currentLeft + gapX + inProcessEl.width;
199
- }
200
- }
201
- if (!el.classList.contains("gs-sortable-placeholder")) {
202
- el.style.top = `${containerPT}px`;
203
- if (currentLeft == containerPL) {
204
- el.style.left = `${containerPL}px`;
205
- currentLeft = containerPL + width;
206
- currentWidth = currentWidth + width;
207
- } else {
208
- el.style.left = `${currentLeft + gapX}px`;
209
- currentLeft = currentLeft + gapX + width;
210
- currentWidth = currentWidth + width + gapX;
211
- }
212
- }
213
- if (height > maxHeight) {
214
- maxHeight = height;
215
- }
216
- } else if (params.type == types.grid) {
217
- if (itIndex == plIndex) {
218
- const left =
219
- itIndex % params.count == 0
220
- ? containerPL
221
- : containerPL + (itIndex % params.count) * (itemWidth + gapX);
222
- const top = currentTop;
223
- if (inProcessEl.height > colHeight) {
224
- colHeight = inProcessEl.height;
225
- }
226
- if (
227
- itIndex % params.count === params.count - 1 ||
228
- itIndex === itemsCount - 1
229
- ) {
230
- if (top === containerPT) {
231
- currentHeight = currentHeight + colHeight;
232
- } else {
233
- currentHeight = currentHeight + colHeight + gapY;
234
- }
235
- currentTop = currentTop + colHeight + gapY;
236
- colHeight = 0;
237
- ref.grid.style.height = `${currentHeight}px`;
238
- }
239
- itIndex += 1;
240
- info.newTop = top;
241
- info.newLeft = left;
242
- info.placeholder.style.left = `${left}px`;
243
- info.placeholder.style.top = `${top}px`;
244
- }
245
- if (!el.classList.contains("gs-sortable-placeholder")) {
246
- const left =
247
- itIndex % params.count == 0
248
- ? containerPL
249
- : containerPL + (itIndex % params.count) * (itemWidth + gapX);
250
- const top = currentTop;
251
- if (height > colHeight) {
252
- colHeight = height;
253
- }
254
- if (
255
- itIndex % params.count === params.count - 1 ||
256
- itIndex === itemsCount - 1
257
- ) {
258
- if (top === containerPT) {
259
- currentHeight = currentHeight + colHeight;
260
- } else {
261
- currentHeight = currentHeight + colHeight + gapY;
262
- }
263
- currentTop = currentTop + colHeight + gapY;
264
- colHeight = 0;
265
- ref.grid.style.height = `${currentHeight}px`;
266
- }
267
- el.style.left = `${left}px`;
268
- el.style.top = `${top}px`;
269
- }
270
- }
271
- itIndex += 1;
272
- }
273
- });
274
- }
275
- }
276
- };
277
-
278
- export default calculateOnSort;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _types = _interopRequireDefault(require("../constants/types"));
8
+ var _general = require("./general");
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
10
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
11
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
13
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
14
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
15
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
16
+ var calculateOnSort = function calculateOnSort(ref) {
17
+ var params = ref.currentParams;
18
+ if (!params.takeClone) {
19
+ var $items = _toConsumableArray(ref.grid.children);
20
+ var itemsCount = $items.filter(function (x) {
21
+ return !x.classList.contains("gs-sortable-item-inmove");
22
+ }).length;
23
+ var info = window.GSSortableConfigue.draggableInfo;
24
+ var _ref$uiData = ref.uiData,
25
+ containerPT = _ref$uiData.containerPT,
26
+ containerPL = _ref$uiData.containerPL,
27
+ currentHeight = _ref$uiData.currentHeight,
28
+ currentWidth = _ref$uiData.currentWidth,
29
+ itemWidth = _ref$uiData.itemWidth,
30
+ gapX = _ref$uiData.gapX,
31
+ gapY = _ref$uiData.gapY;
32
+ var currentLeft = containerPL;
33
+ var currentTop = containerPT;
34
+ var maxHeight = 0;
35
+ var placeholderSeted = info === undefined;
36
+ var inProcessEl = undefined;
37
+ var containerCoord = (0, _general.getOffsetFromWindow)(info.ref.grid);
38
+ if (info !== undefined) {
39
+ var $el = info.$el;
40
+ var elCoord = (0, _general.getOffsetFromWindow)($el);
41
+ inProcessEl = {
42
+ height: $el.offsetHeight,
43
+ width: $el.offsetWidth,
44
+ top: elCoord.top - containerCoord.top,
45
+ left: elCoord.left - containerCoord.left
46
+ };
47
+ }
48
+ var plIndex = info.index;
49
+ var colHeight = 0;
50
+ var itIndex = 0;
51
+ $items.map(function (el) {
52
+ if (!el.classList.contains("gs-sortable-item-inmove")) {
53
+ var height = el.offsetHeight;
54
+ var width = el.offsetWidth;
55
+ if (params.type == _types["default"].column) {
56
+ if (!placeholderSeted) {
57
+ var placeholderTop = currentTop == containerPT ? containerPT : currentTop + gapY;
58
+ var placeholderLeft = containerPL;
59
+ if (Math.abs(placeholderTop - inProcessEl.top) < inProcessEl.height / 2 && Math.abs(placeholderLeft - inProcessEl.left) < inProcessEl.width / 2) {
60
+ info.newTop = placeholderTop;
61
+ info.newLeft = placeholderLeft;
62
+ placeholderSeted = true;
63
+ plIndex = itIndex;
64
+ }
65
+ }
66
+ if (!el.classList.contains("gs-sortable-placeholder")) {
67
+ if (currentTop == containerPT) {
68
+ currentTop = containerPT + height;
69
+ currentHeight = currentHeight + height;
70
+ } else {
71
+ currentTop = currentTop + gapY + height;
72
+ currentHeight = currentHeight + height + gapY;
73
+ }
74
+ }
75
+ } else if (params.type == _types["default"].row) {
76
+ if (!placeholderSeted) {
77
+ var _placeholderLeft = currentLeft == containerPL ? containerPL : currentLeft + gapX;
78
+ var _placeholderTop = containerPT;
79
+ if (Math.abs(_placeholderTop - inProcessEl.top) < inProcessEl.height / 2 && Math.abs(_placeholderLeft - inProcessEl.left) < inProcessEl.width / 2) {
80
+ info.newTop = _placeholderTop;
81
+ info.newLeft = _placeholderLeft;
82
+ placeholderSeted = true;
83
+ plIndex = itIndex;
84
+ }
85
+ }
86
+ if (!el.classList.contains("gs-sortable-placeholder")) {
87
+ if (currentLeft == containerPL) {
88
+ currentLeft = containerPL + width;
89
+ currentWidth = currentWidth + width;
90
+ } else {
91
+ currentLeft = currentLeft + gapX + width;
92
+ currentWidth = currentWidth + width + gapX;
93
+ }
94
+ if (height > maxHeight) {
95
+ maxHeight = height;
96
+ }
97
+ }
98
+ } else if (params.type == _types["default"].grid) {
99
+ var _placeholderLeft2 = itIndex % params.count == 0 ? containerPL : containerPL + itIndex % params.count * (itemWidth + gapX);
100
+ var _placeholderTop2 = currentTop;
101
+ if (Math.abs(_placeholderTop2 - inProcessEl.top) < inProcessEl.height / 2 && Math.abs(_placeholderLeft2 - inProcessEl.left) < inProcessEl.width / 2) {
102
+ info.newTop = _placeholderTop2;
103
+ info.newLeft = _placeholderLeft2;
104
+ placeholderSeted = true;
105
+ plIndex = itIndex;
106
+ }
107
+ if (!el.classList.contains("gs-sortable-placeholder")) {
108
+ var top = currentTop;
109
+ if (height > colHeight) {
110
+ colHeight = height;
111
+ }
112
+ if (itIndex % params.count === params.count - 1 || itIndex === itemsCount - 1) {
113
+ if (top === containerPT) {
114
+ currentHeight = currentHeight + colHeight;
115
+ } else {
116
+ currentHeight = currentHeight + colHeight + gapY;
117
+ }
118
+ currentTop = currentTop + colHeight + gapY;
119
+ colHeight = 0;
120
+ }
121
+ }
122
+ }
123
+ itIndex += 1;
124
+ }
125
+ });
126
+ {
127
+ info.index = plIndex;
128
+ var _ref$uiData2 = ref.uiData,
129
+ _containerPT = _ref$uiData2.containerPT,
130
+ _containerPL = _ref$uiData2.containerPL,
131
+ _currentHeight = _ref$uiData2.currentHeight,
132
+ _currentWidth = _ref$uiData2.currentWidth,
133
+ _itemWidth = _ref$uiData2.itemWidth,
134
+ _gapX = _ref$uiData2.gapX,
135
+ _gapY = _ref$uiData2.gapY;
136
+ currentLeft = _containerPL;
137
+ currentTop = _containerPT;
138
+ itIndex = 0;
139
+ $items.map(function (el) {
140
+ if (!el.classList.contains("gs-sortable-item-inmove")) {
141
+ var height = el.offsetHeight;
142
+ var width = el.offsetWidth;
143
+ if (params.type == _types["default"].column) {
144
+ if (itIndex == plIndex) {
145
+ info.placeholder.style.left = "".concat(_containerPL, "px");
146
+ info.newLeft = _containerPL;
147
+ if (currentTop == _containerPT) {
148
+ info.newTop = _containerPT;
149
+ info.placeholder.style.top = "".concat(_containerPT, "px");
150
+ currentTop = _containerPT + inProcessEl.height;
151
+ } else {
152
+ info.newTop = currentTop + _gapY;
153
+ info.placeholder.style.top = "".concat(currentTop + _gapY, "px");
154
+ currentTop = currentTop + _gapY + inProcessEl.height;
155
+ }
156
+ }
157
+ if (!el.classList.contains("gs-sortable-placeholder")) {
158
+ el.style.left = "".concat(_containerPL, "px");
159
+ if (currentTop == _containerPT) {
160
+ el.style.top = "".concat(_containerPT, "px");
161
+ currentTop = _containerPT + height;
162
+ _currentHeight = _currentHeight + height;
163
+ } else {
164
+ el.style.top = "".concat(currentTop + _gapY, "px");
165
+ currentTop = currentTop + _gapY + height;
166
+ _currentHeight = _currentHeight + height + _gapY;
167
+ }
168
+ }
169
+ } else if (params.type == _types["default"].row) {
170
+ if (itIndex == plIndex) {
171
+ info.placeholder.style.top = "".concat(_containerPT, "px");
172
+ info.newTop = _containerPT;
173
+ if (currentLeft == _containerPL) {
174
+ info.newLeft = _containerPL;
175
+ info.placeholder.style.left = "".concat(_containerPL, "px");
176
+ currentLeft = _containerPL + inProcessEl.width;
177
+ } else {
178
+ info.newLeft = currentLeft + _gapX;
179
+ info.placeholder.style.left = "".concat(currentLeft + _gapX, "px");
180
+ currentLeft = currentLeft + _gapX + inProcessEl.width;
181
+ }
182
+ }
183
+ if (!el.classList.contains("gs-sortable-placeholder")) {
184
+ el.style.top = "".concat(_containerPT, "px");
185
+ if (currentLeft == _containerPL) {
186
+ el.style.left = "".concat(_containerPL, "px");
187
+ currentLeft = _containerPL + width;
188
+ _currentWidth = _currentWidth + width;
189
+ } else {
190
+ el.style.left = "".concat(currentLeft + _gapX, "px");
191
+ currentLeft = currentLeft + _gapX + width;
192
+ _currentWidth = _currentWidth + width + _gapX;
193
+ }
194
+ }
195
+ if (height > maxHeight) {
196
+ maxHeight = height;
197
+ }
198
+ } else if (params.type == _types["default"].grid) {
199
+ if (itIndex == plIndex) {
200
+ var left = itIndex % params.count == 0 ? _containerPL : _containerPL + itIndex % params.count * (_itemWidth + _gapX);
201
+ var top = currentTop;
202
+ if (inProcessEl.height > colHeight) {
203
+ colHeight = inProcessEl.height;
204
+ }
205
+ if (itIndex % params.count === params.count - 1 || itIndex === itemsCount - 1) {
206
+ if (top === _containerPT) {
207
+ _currentHeight = _currentHeight + colHeight;
208
+ } else {
209
+ _currentHeight = _currentHeight + colHeight + _gapY;
210
+ }
211
+ currentTop = currentTop + colHeight + _gapY;
212
+ colHeight = 0;
213
+ ref.grid.style.height = "".concat(_currentHeight, "px");
214
+ }
215
+ itIndex += 1;
216
+ info.newTop = top;
217
+ info.newLeft = left;
218
+ info.placeholder.style.left = "".concat(left, "px");
219
+ info.placeholder.style.top = "".concat(top, "px");
220
+ }
221
+ if (!el.classList.contains("gs-sortable-placeholder")) {
222
+ var _left = itIndex % params.count == 0 ? _containerPL : _containerPL + itIndex % params.count * (_itemWidth + _gapX);
223
+ var _top = currentTop;
224
+ if (height > colHeight) {
225
+ colHeight = height;
226
+ }
227
+ if (itIndex % params.count === params.count - 1 || itIndex === itemsCount - 1) {
228
+ if (_top === _containerPT) {
229
+ _currentHeight = _currentHeight + colHeight;
230
+ } else {
231
+ _currentHeight = _currentHeight + colHeight + _gapY;
232
+ }
233
+ currentTop = currentTop + colHeight + _gapY;
234
+ colHeight = 0;
235
+ ref.grid.style.height = "".concat(_currentHeight, "px");
236
+ }
237
+ el.style.left = "".concat(_left, "px");
238
+ el.style.top = "".concat(_top, "px");
239
+ }
240
+ }
241
+ itIndex += 1;
242
+ }
243
+ });
244
+ }
245
+ }
246
+ };
247
+ var _default = exports["default"] = calculateOnSort;
@@ -1,28 +1,26 @@
1
- import { getOffsetFromWindow } from './general';
2
-
3
- const checkItemInContainer = (grid, el) => {
4
- const gridOffset = getOffsetFromWindow(grid);
5
- const elOffset = getOffsetFromWindow(el);
6
- const gridTop = gridOffset.top;
7
- const gridLeft = gridOffset.left;
8
- const elTop = elOffset.top;
9
- const elLeft = elOffset.left;
10
-
11
- const offsetTopFromGrid = elTop - gridTop;
12
- const offsetLeftFromGrid = elLeft - gridLeft;
13
- const elHeight = el.offsetHeight;
14
- const elWidth = el.offsetWidth;
15
- const gridHeight = grid.offsetHeight;
16
- const gridWidth = grid.offsetWidth;
17
- if (
18
- offsetTopFromGrid >= (-1 * elHeight) / 2 &&
19
- offsetLeftFromGrid >= (-1 * elWidth) / 2 &&
20
- offsetTopFromGrid <= gridHeight - elHeight / 2 &&
21
- offsetLeftFromGrid <= gridWidth - elWidth / 2
22
- ) {
23
- return true;
24
- }
25
- return false;
26
- };
27
-
28
- export default checkItemInContainer;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _general = require("./general");
8
+ var checkItemInContainer = function checkItemInContainer(grid, el) {
9
+ var gridOffset = (0, _general.getOffsetFromWindow)(grid);
10
+ var elOffset = (0, _general.getOffsetFromWindow)(el);
11
+ var gridTop = gridOffset.top;
12
+ var gridLeft = gridOffset.left;
13
+ var elTop = elOffset.top;
14
+ var elLeft = elOffset.left;
15
+ var offsetTopFromGrid = elTop - gridTop;
16
+ var offsetLeftFromGrid = elLeft - gridLeft;
17
+ var elHeight = el.offsetHeight;
18
+ var elWidth = el.offsetWidth;
19
+ var gridHeight = grid.offsetHeight;
20
+ var gridWidth = grid.offsetWidth;
21
+ if (offsetTopFromGrid >= -1 * elHeight / 2 && offsetLeftFromGrid >= -1 * elWidth / 2 && offsetTopFromGrid <= gridHeight - elHeight / 2 && offsetLeftFromGrid <= gridWidth - elWidth / 2) {
22
+ return true;
23
+ }
24
+ return false;
25
+ };
26
+ var _default = exports["default"] = checkItemInContainer;