uiik 1.3.0-beta.3 → 1.3.0-beta.4
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/index.esm.js +60 -45
- package/index.js +63 -49
- package/package.json +1 -1
- package/utils.d.ts +1 -1
package/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* uiik v1.3.0-beta.
|
|
2
|
+
* uiik v1.3.0-beta.4
|
|
3
3
|
* A UI interactions kit includes draggable, splittable, rotatable, selectable, etc.
|
|
4
4
|
* https://github.com/holyhigh2/uiik
|
|
5
5
|
* c) 2021-2023 @holyhigh2 may be freely distributed under the MIT license
|
|
@@ -9,6 +9,7 @@ import { find, map, toArray, each, reject, includes, some, flatMap, size } from
|
|
|
9
9
|
import { get, assign, merge } from 'myfx/object';
|
|
10
10
|
import { split, test } from 'myfx/string';
|
|
11
11
|
import { compact, findIndex } from 'myfx/array';
|
|
12
|
+
import { closest } from 'myfx/tree';
|
|
12
13
|
import { alphaId } from 'myfx/utils';
|
|
13
14
|
|
|
14
15
|
/******************************************************************************
|
|
@@ -284,41 +285,59 @@ function getStyleSize(el, cStyle) {
|
|
|
284
285
|
const h = parseFloat(cStyle.height);
|
|
285
286
|
return { w, h };
|
|
286
287
|
}
|
|
287
|
-
const EXP_MATRIX = /matrix\((?<a>[\d.-]+)\s*,\s*(?<b>[\d.-]+)\s*,\s*(?<c>[\d.-]+)\s*,\s*(?<d>[\d.-]+)\s*,\s*(?<
|
|
288
|
-
function getMatrixInfo(
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
288
|
+
const EXP_MATRIX = /matrix\((?<a>[\d.-]+)\s*,\s*(?<b>[\d.-]+)\s*,\s*(?<c>[\d.-]+)\s*,\s*(?<d>[\d.-]+)\s*,\s*(?<e>[\d.-]+)\s*,\s*(?<f>[\d.-]+)\s*\)/;
|
|
289
|
+
function getMatrixInfo(el, recur = false) {
|
|
290
|
+
const rs = _getMatrixInfo(el);
|
|
291
|
+
if (recur) {
|
|
292
|
+
let p = el.parentElement;
|
|
293
|
+
while (p && p.tagName !== "BODY") {
|
|
294
|
+
let prs = _getMatrixInfo(p);
|
|
295
|
+
rs.scale *= prs.scale;
|
|
296
|
+
p = p.parentElement;
|
|
296
297
|
}
|
|
297
|
-
elCStyle = window.getComputedStyle(elCStyle);
|
|
298
298
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
if (
|
|
306
|
-
|
|
307
|
-
b = parseFloat(matched.groups.b);
|
|
308
|
-
parseFloat(matched.groups.c);
|
|
309
|
-
parseFloat(matched.groups.d);
|
|
310
|
-
x = parseFloat(matched.groups.x);
|
|
311
|
-
y = parseFloat(matched.groups.y);
|
|
299
|
+
return rs;
|
|
300
|
+
}
|
|
301
|
+
function _getMatrixInfo(el) {
|
|
302
|
+
const rs = { scale: 1, angle: 0, x: 0, y: 0 };
|
|
303
|
+
let a = 1, b = 0;
|
|
304
|
+
let elCStyle;
|
|
305
|
+
if (el instanceof SVGGraphicsElement || el instanceof HTMLElement) {
|
|
306
|
+
elCStyle = window.getComputedStyle(el);
|
|
312
307
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
308
|
+
let matrix = _getMatrix(elCStyle.transform);
|
|
309
|
+
if (matrix) {
|
|
310
|
+
a = matrix.a;
|
|
311
|
+
b = matrix.b;
|
|
312
|
+
matrix.c;
|
|
313
|
+
matrix.d;
|
|
314
|
+
rs.x = matrix.e;
|
|
315
|
+
rs.y = matrix.f;
|
|
316
316
|
}
|
|
317
|
-
const rs = { scale: 1, angle: 0, x, y };
|
|
318
317
|
rs.scale = Math.sqrt(a * a + b * b);
|
|
319
318
|
rs.angle = Math.round(Math.atan2(b, a) * (180 / Math.PI));
|
|
320
319
|
return rs;
|
|
321
320
|
}
|
|
321
|
+
function _getMatrix(transform) {
|
|
322
|
+
let matrix = null;
|
|
323
|
+
if (window.WebKitCSSMatrix) {
|
|
324
|
+
matrix = new WebKitCSSMatrix(transform);
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
const matched = transform.match(EXP_MATRIX);
|
|
328
|
+
if (matched && matched.groups) {
|
|
329
|
+
matrix = {
|
|
330
|
+
a: parseFloat(matched.groups.a),
|
|
331
|
+
b: parseFloat(matched.groups.b),
|
|
332
|
+
c: parseFloat(matched.groups.c),
|
|
333
|
+
d: parseFloat(matched.groups.d),
|
|
334
|
+
e: parseFloat(matched.groups.e),
|
|
335
|
+
f: parseFloat(matched.groups.f),
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return matrix;
|
|
340
|
+
}
|
|
322
341
|
function getPointInContainer(event, el, elRect, elCStyle, matrixInfo) {
|
|
323
342
|
if (!elRect) {
|
|
324
343
|
elRect = el.getBoundingClientRect();
|
|
@@ -327,7 +346,7 @@ function getPointInContainer(event, el, elRect, elCStyle, matrixInfo) {
|
|
|
327
346
|
elCStyle = window.getComputedStyle(el);
|
|
328
347
|
}
|
|
329
348
|
if (!matrixInfo) {
|
|
330
|
-
matrixInfo = getMatrixInfo(
|
|
349
|
+
matrixInfo = getMatrixInfo(el, true);
|
|
331
350
|
}
|
|
332
351
|
const scale = matrixInfo.scale;
|
|
333
352
|
let x = event.clientX -
|
|
@@ -344,7 +363,7 @@ function getRectInContainer(el, container) {
|
|
|
344
363
|
const elRect = el.getBoundingClientRect();
|
|
345
364
|
const containerRect = container.getBoundingClientRect();
|
|
346
365
|
const elCStyle = window.getComputedStyle(container);
|
|
347
|
-
const matrixInfo = getMatrixInfo(
|
|
366
|
+
const matrixInfo = getMatrixInfo(container);
|
|
348
367
|
const scale = matrixInfo.scale;
|
|
349
368
|
let x = elRect.x -
|
|
350
369
|
containerRect.x -
|
|
@@ -389,7 +408,7 @@ function getVertex(el, ox, oy) {
|
|
|
389
408
|
const h = parseFloat(cStyle.height);
|
|
390
409
|
const { originX, originY } = parseOxy(ox, oy, w, h);
|
|
391
410
|
const { x, y, sx, sy } = el instanceof SVGGraphicsElement ? getCenterXySVG(el, originX, originY) : getCenterXy(el);
|
|
392
|
-
const { angle } = getMatrixInfo(
|
|
411
|
+
const { angle } = getMatrixInfo(el);
|
|
393
412
|
return calcVertex(w, h, x, y, sx, sy, angle * ONE_ANG);
|
|
394
413
|
}
|
|
395
414
|
function calcVertex(w, h, cx, cy, sx, sy, radian) {
|
|
@@ -1209,7 +1228,6 @@ class Resizable extends Uii {
|
|
|
1209
1228
|
break;
|
|
1210
1229
|
}
|
|
1211
1230
|
if (changeW) {
|
|
1212
|
-
console.log(minWidth, 'xxxxxx', w);
|
|
1213
1231
|
if (minWidth && w < minWidth)
|
|
1214
1232
|
w = minWidth;
|
|
1215
1233
|
if (maxWidth && w > maxWidth)
|
|
@@ -1384,7 +1402,7 @@ class Draggable extends Uii {
|
|
|
1384
1402
|
snapOptions: {
|
|
1385
1403
|
tolerance: 10,
|
|
1386
1404
|
},
|
|
1387
|
-
self:
|
|
1405
|
+
self: false
|
|
1388
1406
|
}, opts));
|
|
1389
1407
|
_Draggable_instances.add(this);
|
|
1390
1408
|
_Draggable_handleMap.set(this, new WeakMap());
|
|
@@ -1448,7 +1466,7 @@ class Draggable extends Uii {
|
|
|
1448
1466
|
draggableList = bindTarget.querySelectorAll(eleString);
|
|
1449
1467
|
initStyle(draggableList);
|
|
1450
1468
|
}
|
|
1451
|
-
let findRs =
|
|
1469
|
+
let findRs = closest(t, node => includes(draggableList, node), 'parentNode');
|
|
1452
1470
|
if (!findRs)
|
|
1453
1471
|
return true;
|
|
1454
1472
|
const dragDom = findRs;
|
|
@@ -1457,7 +1475,7 @@ class Draggable extends Uii {
|
|
|
1457
1475
|
return true;
|
|
1458
1476
|
}
|
|
1459
1477
|
if (opts.self && dragDom !== t)
|
|
1460
|
-
return;
|
|
1478
|
+
return true;
|
|
1461
1479
|
const onPointerDown = opts.onPointerDown;
|
|
1462
1480
|
if (onPointerDown && onPointerDown({ draggable: dragDom }, ev) === false)
|
|
1463
1481
|
return true;
|
|
@@ -1472,11 +1490,8 @@ class Draggable extends Uii {
|
|
|
1472
1490
|
const offsetXy = getPointInContainer(ev, dragDom);
|
|
1473
1491
|
let offsetPointX = offsetXy.x;
|
|
1474
1492
|
let offsetPointY = offsetXy.y;
|
|
1475
|
-
const matrixInfo = getMatrixInfo(dragDom);
|
|
1493
|
+
const matrixInfo = getMatrixInfo(dragDom, true);
|
|
1476
1494
|
const currentXy = getPointInContainer(ev, offsetParent, offsetParentRect, offsetParentCStyle);
|
|
1477
|
-
const matrixInfoParent = getMatrixInfo(offsetParent);
|
|
1478
|
-
offsetPointX = offsetPointX / (matrixInfo.scale * matrixInfoParent.scale);
|
|
1479
|
-
offsetPointY = offsetPointY / (matrixInfo.scale * matrixInfoParent.scale);
|
|
1480
1495
|
if (matrixInfo.angle != 0) {
|
|
1481
1496
|
offsetPointX = currentXy.x - matrixInfo.x;
|
|
1482
1497
|
offsetPointY = currentXy.y - matrixInfo.y;
|
|
@@ -1847,7 +1862,7 @@ class Droppable extends Uii {
|
|
|
1847
1862
|
this.registerEvent(droppable, "mouseenter", (e) => {
|
|
1848
1863
|
if (!__classPrivateFieldGet(this, _Droppable_active, "f"))
|
|
1849
1864
|
return;
|
|
1850
|
-
if (
|
|
1865
|
+
if (__classPrivateFieldGet(this, _Droppable_active, "f") === droppable)
|
|
1851
1866
|
return;
|
|
1852
1867
|
if (opts.hoverClass) {
|
|
1853
1868
|
each(split(opts.hoverClass, ' '), cls => {
|
|
@@ -1862,7 +1877,7 @@ class Droppable extends Uii {
|
|
|
1862
1877
|
this.registerEvent(droppable, "mouseleave", (e) => {
|
|
1863
1878
|
if (!__classPrivateFieldGet(this, _Droppable_active, "f"))
|
|
1864
1879
|
return;
|
|
1865
|
-
if (
|
|
1880
|
+
if (__classPrivateFieldGet(this, _Droppable_active, "f") === droppable)
|
|
1866
1881
|
return;
|
|
1867
1882
|
if (opts.hoverClass) {
|
|
1868
1883
|
each(split(opts.hoverClass, ' '), cls => {
|
|
@@ -1877,14 +1892,14 @@ class Droppable extends Uii {
|
|
|
1877
1892
|
this.registerEvent(droppable, "mousemove", (e) => {
|
|
1878
1893
|
if (!__classPrivateFieldGet(this, _Droppable_active, "f"))
|
|
1879
1894
|
return;
|
|
1880
|
-
if (
|
|
1895
|
+
if (__classPrivateFieldGet(this, _Droppable_active, "f") === droppable)
|
|
1881
1896
|
return;
|
|
1882
1897
|
opts.onOver && opts.onOver({ draggable: __classPrivateFieldGet(this, _Droppable_active, "f"), droppable }, e);
|
|
1883
1898
|
});
|
|
1884
1899
|
this.registerEvent(droppable, "mouseup", (e) => {
|
|
1885
1900
|
if (!__classPrivateFieldGet(this, _Droppable_active, "f"))
|
|
1886
1901
|
return;
|
|
1887
|
-
if (
|
|
1902
|
+
if (__classPrivateFieldGet(this, _Droppable_active, "f") === droppable)
|
|
1888
1903
|
return;
|
|
1889
1904
|
if (opts.hoverClass) {
|
|
1890
1905
|
each(split(opts.hoverClass, ' '), cls => {
|
|
@@ -2227,7 +2242,7 @@ _Selectable__detector = new WeakMap(), _Selectable__lastSelected = new WeakMap()
|
|
|
2227
2242
|
if (onPointerDown && onPointerDown(ev) === false)
|
|
2228
2243
|
return true;
|
|
2229
2244
|
let originPos = "";
|
|
2230
|
-
let matrixInfo = getMatrixInfo(
|
|
2245
|
+
let matrixInfo = getMatrixInfo(currentTarget);
|
|
2231
2246
|
const startxy = getPointInContainer(ev, con, currentRect, currentCStyle, matrixInfo);
|
|
2232
2247
|
let hitPosX = startxy.x;
|
|
2233
2248
|
let hitPosY = startxy.y;
|
|
@@ -2755,7 +2770,7 @@ function newSortable(container, opts) {
|
|
|
2755
2770
|
return new Sortable(container, opts);
|
|
2756
2771
|
}
|
|
2757
2772
|
|
|
2758
|
-
var version = "1.3.0-beta.
|
|
2773
|
+
var version = "1.3.0-beta.4";
|
|
2759
2774
|
var repository = {
|
|
2760
2775
|
type: "git",
|
|
2761
2776
|
url: "https://github.com/holyhigh2/uiik"
|
package/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* uiik v1.3.0-beta.
|
|
2
|
+
* uiik v1.3.0-beta.4
|
|
3
3
|
* A UI interactions kit includes draggable, splittable, rotatable, selectable, etc.
|
|
4
4
|
* https://github.com/holyhigh2/uiik
|
|
5
5
|
* c) 2021-2023 @holyhigh2 may be freely distributed under the MIT license
|
|
6
6
|
*/
|
|
7
7
|
(function (global, factory) {
|
|
8
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('myfx/is'), require('myfx/collection'), require('myfx/object'), require('myfx/string'), require('myfx/array'), require('myfx/utils')) :
|
|
9
|
-
typeof define === 'function' && define.amd ? define(['exports', 'myfx/is', 'myfx/collection', 'myfx/object', 'myfx/string', 'myfx/array', 'myfx/utils'], factory) :
|
|
10
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.uiik = {}, global.is, global.collection, global.object, global.string, global.array, global.utils));
|
|
11
|
-
})(this, (function (exports, is, collection, object, string, array, utils) { 'use strict';
|
|
8
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('myfx/is'), require('myfx/collection'), require('myfx/object'), require('myfx/string'), require('myfx/array'), require('myfx/tree'), require('myfx/utils')) :
|
|
9
|
+
typeof define === 'function' && define.amd ? define(['exports', 'myfx/is', 'myfx/collection', 'myfx/object', 'myfx/string', 'myfx/array', 'myfx/tree', 'myfx/utils'], factory) :
|
|
10
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.uiik = {}, global.is, global.collection, global.object, global.string, global.array, global.tree, global.utils));
|
|
11
|
+
})(this, (function (exports, is, collection, object, string, array, tree, utils) { 'use strict';
|
|
12
12
|
|
|
13
13
|
/******************************************************************************
|
|
14
14
|
Copyright (c) Microsoft Corporation.
|
|
@@ -283,41 +283,59 @@
|
|
|
283
283
|
const h = parseFloat(cStyle.height);
|
|
284
284
|
return { w, h };
|
|
285
285
|
}
|
|
286
|
-
const EXP_MATRIX = /matrix\((?<a>[\d.-]+)\s*,\s*(?<b>[\d.-]+)\s*,\s*(?<c>[\d.-]+)\s*,\s*(?<d>[\d.-]+)\s*,\s*(?<
|
|
287
|
-
function getMatrixInfo(
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
286
|
+
const EXP_MATRIX = /matrix\((?<a>[\d.-]+)\s*,\s*(?<b>[\d.-]+)\s*,\s*(?<c>[\d.-]+)\s*,\s*(?<d>[\d.-]+)\s*,\s*(?<e>[\d.-]+)\s*,\s*(?<f>[\d.-]+)\s*\)/;
|
|
287
|
+
function getMatrixInfo(el, recur = false) {
|
|
288
|
+
const rs = _getMatrixInfo(el);
|
|
289
|
+
if (recur) {
|
|
290
|
+
let p = el.parentElement;
|
|
291
|
+
while (p && p.tagName !== "BODY") {
|
|
292
|
+
let prs = _getMatrixInfo(p);
|
|
293
|
+
rs.scale *= prs.scale;
|
|
294
|
+
p = p.parentElement;
|
|
295
295
|
}
|
|
296
|
-
elCStyle = window.getComputedStyle(elCStyle);
|
|
297
296
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
if (
|
|
305
|
-
|
|
306
|
-
b = parseFloat(matched.groups.b);
|
|
307
|
-
parseFloat(matched.groups.c);
|
|
308
|
-
parseFloat(matched.groups.d);
|
|
309
|
-
x = parseFloat(matched.groups.x);
|
|
310
|
-
y = parseFloat(matched.groups.y);
|
|
297
|
+
return rs;
|
|
298
|
+
}
|
|
299
|
+
function _getMatrixInfo(el) {
|
|
300
|
+
const rs = { scale: 1, angle: 0, x: 0, y: 0 };
|
|
301
|
+
let a = 1, b = 0;
|
|
302
|
+
let elCStyle;
|
|
303
|
+
if (el instanceof SVGGraphicsElement || el instanceof HTMLElement) {
|
|
304
|
+
elCStyle = window.getComputedStyle(el);
|
|
311
305
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
306
|
+
let matrix = _getMatrix(elCStyle.transform);
|
|
307
|
+
if (matrix) {
|
|
308
|
+
a = matrix.a;
|
|
309
|
+
b = matrix.b;
|
|
310
|
+
matrix.c;
|
|
311
|
+
matrix.d;
|
|
312
|
+
rs.x = matrix.e;
|
|
313
|
+
rs.y = matrix.f;
|
|
315
314
|
}
|
|
316
|
-
const rs = { scale: 1, angle: 0, x, y };
|
|
317
315
|
rs.scale = Math.sqrt(a * a + b * b);
|
|
318
316
|
rs.angle = Math.round(Math.atan2(b, a) * (180 / Math.PI));
|
|
319
317
|
return rs;
|
|
320
318
|
}
|
|
319
|
+
function _getMatrix(transform) {
|
|
320
|
+
let matrix = null;
|
|
321
|
+
if (window.WebKitCSSMatrix) {
|
|
322
|
+
matrix = new WebKitCSSMatrix(transform);
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
const matched = transform.match(EXP_MATRIX);
|
|
326
|
+
if (matched && matched.groups) {
|
|
327
|
+
matrix = {
|
|
328
|
+
a: parseFloat(matched.groups.a),
|
|
329
|
+
b: parseFloat(matched.groups.b),
|
|
330
|
+
c: parseFloat(matched.groups.c),
|
|
331
|
+
d: parseFloat(matched.groups.d),
|
|
332
|
+
e: parseFloat(matched.groups.e),
|
|
333
|
+
f: parseFloat(matched.groups.f),
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return matrix;
|
|
338
|
+
}
|
|
321
339
|
function getPointInContainer(event, el, elRect, elCStyle, matrixInfo) {
|
|
322
340
|
if (!elRect) {
|
|
323
341
|
elRect = el.getBoundingClientRect();
|
|
@@ -326,7 +344,7 @@
|
|
|
326
344
|
elCStyle = window.getComputedStyle(el);
|
|
327
345
|
}
|
|
328
346
|
if (!matrixInfo) {
|
|
329
|
-
matrixInfo = getMatrixInfo(
|
|
347
|
+
matrixInfo = getMatrixInfo(el, true);
|
|
330
348
|
}
|
|
331
349
|
const scale = matrixInfo.scale;
|
|
332
350
|
let x = event.clientX -
|
|
@@ -343,7 +361,7 @@
|
|
|
343
361
|
const elRect = el.getBoundingClientRect();
|
|
344
362
|
const containerRect = container.getBoundingClientRect();
|
|
345
363
|
const elCStyle = window.getComputedStyle(container);
|
|
346
|
-
const matrixInfo = getMatrixInfo(
|
|
364
|
+
const matrixInfo = getMatrixInfo(container);
|
|
347
365
|
const scale = matrixInfo.scale;
|
|
348
366
|
let x = elRect.x -
|
|
349
367
|
containerRect.x -
|
|
@@ -388,7 +406,7 @@
|
|
|
388
406
|
const h = parseFloat(cStyle.height);
|
|
389
407
|
const { originX, originY } = parseOxy(ox, oy, w, h);
|
|
390
408
|
const { x, y, sx, sy } = el instanceof SVGGraphicsElement ? getCenterXySVG(el, originX, originY) : getCenterXy(el);
|
|
391
|
-
const { angle } = getMatrixInfo(
|
|
409
|
+
const { angle } = getMatrixInfo(el);
|
|
392
410
|
return calcVertex(w, h, x, y, sx, sy, angle * ONE_ANG);
|
|
393
411
|
}
|
|
394
412
|
function calcVertex(w, h, cx, cy, sx, sy, radian) {
|
|
@@ -1208,7 +1226,6 @@
|
|
|
1208
1226
|
break;
|
|
1209
1227
|
}
|
|
1210
1228
|
if (changeW) {
|
|
1211
|
-
console.log(minWidth, 'xxxxxx', w);
|
|
1212
1229
|
if (minWidth && w < minWidth)
|
|
1213
1230
|
w = minWidth;
|
|
1214
1231
|
if (maxWidth && w > maxWidth)
|
|
@@ -1383,7 +1400,7 @@
|
|
|
1383
1400
|
snapOptions: {
|
|
1384
1401
|
tolerance: 10,
|
|
1385
1402
|
},
|
|
1386
|
-
self:
|
|
1403
|
+
self: false
|
|
1387
1404
|
}, opts));
|
|
1388
1405
|
_Draggable_instances.add(this);
|
|
1389
1406
|
_Draggable_handleMap.set(this, new WeakMap());
|
|
@@ -1447,7 +1464,7 @@
|
|
|
1447
1464
|
draggableList = bindTarget.querySelectorAll(eleString);
|
|
1448
1465
|
initStyle(draggableList);
|
|
1449
1466
|
}
|
|
1450
|
-
let findRs =
|
|
1467
|
+
let findRs = tree.closest(t, node => collection.includes(draggableList, node), 'parentNode');
|
|
1451
1468
|
if (!findRs)
|
|
1452
1469
|
return true;
|
|
1453
1470
|
const dragDom = findRs;
|
|
@@ -1456,7 +1473,7 @@
|
|
|
1456
1473
|
return true;
|
|
1457
1474
|
}
|
|
1458
1475
|
if (opts.self && dragDom !== t)
|
|
1459
|
-
return;
|
|
1476
|
+
return true;
|
|
1460
1477
|
const onPointerDown = opts.onPointerDown;
|
|
1461
1478
|
if (onPointerDown && onPointerDown({ draggable: dragDom }, ev) === false)
|
|
1462
1479
|
return true;
|
|
@@ -1471,11 +1488,8 @@
|
|
|
1471
1488
|
const offsetXy = getPointInContainer(ev, dragDom);
|
|
1472
1489
|
let offsetPointX = offsetXy.x;
|
|
1473
1490
|
let offsetPointY = offsetXy.y;
|
|
1474
|
-
const matrixInfo = getMatrixInfo(dragDom);
|
|
1491
|
+
const matrixInfo = getMatrixInfo(dragDom, true);
|
|
1475
1492
|
const currentXy = getPointInContainer(ev, offsetParent, offsetParentRect, offsetParentCStyle);
|
|
1476
|
-
const matrixInfoParent = getMatrixInfo(offsetParent);
|
|
1477
|
-
offsetPointX = offsetPointX / (matrixInfo.scale * matrixInfoParent.scale);
|
|
1478
|
-
offsetPointY = offsetPointY / (matrixInfo.scale * matrixInfoParent.scale);
|
|
1479
1493
|
if (matrixInfo.angle != 0) {
|
|
1480
1494
|
offsetPointX = currentXy.x - matrixInfo.x;
|
|
1481
1495
|
offsetPointY = currentXy.y - matrixInfo.y;
|
|
@@ -1846,7 +1860,7 @@
|
|
|
1846
1860
|
this.registerEvent(droppable, "mouseenter", (e) => {
|
|
1847
1861
|
if (!__classPrivateFieldGet(this, _Droppable_active, "f"))
|
|
1848
1862
|
return;
|
|
1849
|
-
if (
|
|
1863
|
+
if (__classPrivateFieldGet(this, _Droppable_active, "f") === droppable)
|
|
1850
1864
|
return;
|
|
1851
1865
|
if (opts.hoverClass) {
|
|
1852
1866
|
collection.each(string.split(opts.hoverClass, ' '), cls => {
|
|
@@ -1861,7 +1875,7 @@
|
|
|
1861
1875
|
this.registerEvent(droppable, "mouseleave", (e) => {
|
|
1862
1876
|
if (!__classPrivateFieldGet(this, _Droppable_active, "f"))
|
|
1863
1877
|
return;
|
|
1864
|
-
if (
|
|
1878
|
+
if (__classPrivateFieldGet(this, _Droppable_active, "f") === droppable)
|
|
1865
1879
|
return;
|
|
1866
1880
|
if (opts.hoverClass) {
|
|
1867
1881
|
collection.each(string.split(opts.hoverClass, ' '), cls => {
|
|
@@ -1876,14 +1890,14 @@
|
|
|
1876
1890
|
this.registerEvent(droppable, "mousemove", (e) => {
|
|
1877
1891
|
if (!__classPrivateFieldGet(this, _Droppable_active, "f"))
|
|
1878
1892
|
return;
|
|
1879
|
-
if (
|
|
1893
|
+
if (__classPrivateFieldGet(this, _Droppable_active, "f") === droppable)
|
|
1880
1894
|
return;
|
|
1881
1895
|
opts.onOver && opts.onOver({ draggable: __classPrivateFieldGet(this, _Droppable_active, "f"), droppable }, e);
|
|
1882
1896
|
});
|
|
1883
1897
|
this.registerEvent(droppable, "mouseup", (e) => {
|
|
1884
1898
|
if (!__classPrivateFieldGet(this, _Droppable_active, "f"))
|
|
1885
1899
|
return;
|
|
1886
|
-
if (
|
|
1900
|
+
if (__classPrivateFieldGet(this, _Droppable_active, "f") === droppable)
|
|
1887
1901
|
return;
|
|
1888
1902
|
if (opts.hoverClass) {
|
|
1889
1903
|
collection.each(string.split(opts.hoverClass, ' '), cls => {
|
|
@@ -2226,7 +2240,7 @@
|
|
|
2226
2240
|
if (onPointerDown && onPointerDown(ev) === false)
|
|
2227
2241
|
return true;
|
|
2228
2242
|
let originPos = "";
|
|
2229
|
-
let matrixInfo = getMatrixInfo(
|
|
2243
|
+
let matrixInfo = getMatrixInfo(currentTarget);
|
|
2230
2244
|
const startxy = getPointInContainer(ev, con, currentRect, currentCStyle, matrixInfo);
|
|
2231
2245
|
let hitPosX = startxy.x;
|
|
2232
2246
|
let hitPosY = startxy.y;
|
|
@@ -2754,7 +2768,7 @@
|
|
|
2754
2768
|
return new Sortable(container, opts);
|
|
2755
2769
|
}
|
|
2756
2770
|
|
|
2757
|
-
var version = "1.3.0-beta.
|
|
2771
|
+
var version = "1.3.0-beta.4";
|
|
2758
2772
|
var repository = {
|
|
2759
2773
|
type: "git",
|
|
2760
2774
|
url: "https://github.com/holyhigh2/uiik"
|
package/package.json
CHANGED
package/utils.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export declare function getStyleSize(el: HTMLElement | SVGGraphicsElement, cStyl
|
|
|
26
26
|
w: number;
|
|
27
27
|
h: number;
|
|
28
28
|
};
|
|
29
|
-
export declare function getMatrixInfo(
|
|
29
|
+
export declare function getMatrixInfo(el: HTMLElement | SVGGraphicsElement, recur?: boolean): {
|
|
30
30
|
scale: number;
|
|
31
31
|
angle: number;
|
|
32
32
|
x: number;
|