@cocreate/position 1.1.30 → 1.1.31
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.
- package/CHANGELOG.md +8 -0
- package/package.json +3 -3
- package/src/position.js +5 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [1.1.31](https://github.com/CoCreate-app/CoCreate-position/compare/v1.1.30...v1.1.31) (2022-12-27)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* bump dependencies ([62bc69b](https://github.com/CoCreate-app/CoCreate-position/commit/62bc69b73b8ce36b3345f41f81e906595d71823d))
|
|
7
|
+
* removed param this.isHeader ([24d5439](https://github.com/CoCreate-app/CoCreate-position/commit/24d5439778ec9f727b3d5f8266733a044b5befb4))
|
|
8
|
+
|
|
1
9
|
## [1.1.30](https://github.com/CoCreate-app/CoCreate-position/compare/v1.1.29...v1.1.30) (2022-12-25)
|
|
2
10
|
|
|
3
11
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/position",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.31",
|
|
4
4
|
"description": "Make any element draggable and movable. Customizable via attributes, great for popups, alerts, multitasking and displaying multiple views.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"position",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"webpack-log": "^3.0.1"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@cocreate/docs": "^1.4.
|
|
64
|
-
"@cocreate/observer": "^1.5.
|
|
63
|
+
"@cocreate/docs": "^1.4.26",
|
|
64
|
+
"@cocreate/observer": "^1.5.48"
|
|
65
65
|
}
|
|
66
66
|
}
|
package/src/position.js
CHANGED
|
@@ -31,7 +31,6 @@ function position(el, container, options) {
|
|
|
31
31
|
this.clickedInfo = null;
|
|
32
32
|
this.preSnapped = null;
|
|
33
33
|
this.isSnap = false;
|
|
34
|
-
this.isHeader = true;
|
|
35
34
|
|
|
36
35
|
this._createGhost(this.container.getAttribute("data-ghost-class"));
|
|
37
36
|
this._initEvent();
|
|
@@ -136,7 +135,7 @@ position.prototype = {
|
|
|
136
135
|
this.isSnap = true;
|
|
137
136
|
}
|
|
138
137
|
|
|
139
|
-
|
|
138
|
+
let ghost_info = {
|
|
140
139
|
x: this.rect.x,
|
|
141
140
|
y: this.rect.y,
|
|
142
141
|
w: this.rect.width,
|
|
@@ -205,7 +204,7 @@ position.prototype = {
|
|
|
205
204
|
__animate: function () {
|
|
206
205
|
let c_info = this.clickedInfo;
|
|
207
206
|
|
|
208
|
-
|
|
207
|
+
let eventName = null;
|
|
209
208
|
|
|
210
209
|
if (c_info && c_info.isMoving) {
|
|
211
210
|
/**
|
|
@@ -273,10 +272,7 @@ position.prototype = {
|
|
|
273
272
|
},
|
|
274
273
|
|
|
275
274
|
_isMovable() {
|
|
276
|
-
|
|
277
|
-
// if (this.isHeader) {
|
|
278
|
-
// width -= 120;
|
|
279
|
-
// }
|
|
275
|
+
let width = this.rect.width;
|
|
280
276
|
return this.point.x > 0 && this.point.x < width && this.point.y > 0 && this.point.y < this.dragAreaHeight;
|
|
281
277
|
},
|
|
282
278
|
|
|
@@ -285,12 +281,12 @@ position.prototype = {
|
|
|
285
281
|
* move: element-moving, element-moveend, element-movestart
|
|
286
282
|
**/
|
|
287
283
|
createEvent(eventName) {
|
|
288
|
-
|
|
284
|
+
const event = new CustomEvent(eventName, { detail: { element: this.el, instance: this } });
|
|
289
285
|
this.el.dispatchEvent(event);
|
|
290
286
|
},
|
|
291
287
|
|
|
292
288
|
_createGhost: function (ghostClass) {
|
|
293
|
-
|
|
289
|
+
let node = document.createElement("div");
|
|
294
290
|
if (!ghostClass) {
|
|
295
291
|
ghostClass = "snap-ghost";
|
|
296
292
|
}
|