@leafer-draw/worker 2.2.11 → 2.3.0
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/dist/worker.js +57 -22
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +61 -23
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +7 -7
package/dist/worker.js
CHANGED
|
@@ -433,7 +433,7 @@ var LeaferUI = function(exports) {
|
|
|
433
433
|
};
|
|
434
434
|
}
|
|
435
435
|
const {sin: sin$5, cos: cos$5, acos: acos, sqrt: sqrt$3} = Math;
|
|
436
|
-
const {float: float$
|
|
436
|
+
const {float: float$3} = MathHelper;
|
|
437
437
|
const tempPoint$4 = {};
|
|
438
438
|
function getWorld() {
|
|
439
439
|
return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), {
|
|
@@ -681,12 +681,12 @@ var LeaferUI = function(exports) {
|
|
|
681
681
|
const cosR = c / scaleY;
|
|
682
682
|
rotation = PI_2 - (d > 0 ? acos(-cosR) : -acos(cosR));
|
|
683
683
|
}
|
|
684
|
-
const cosR = float$
|
|
684
|
+
const cosR = float$3(cos$5(rotation));
|
|
685
685
|
const sinR = sin$5(rotation);
|
|
686
|
-
scaleX = float$
|
|
687
|
-
skewX = cosR ? float$
|
|
688
|
-
skewY = cosR ? float$
|
|
689
|
-
rotation = float$
|
|
686
|
+
scaleX = float$3(scaleX), scaleY = float$3(scaleY);
|
|
687
|
+
skewX = cosR ? float$3((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
|
|
688
|
+
skewY = cosR ? float$3((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
|
|
689
|
+
rotation = float$3(rotation / OneRadian);
|
|
690
690
|
} else {
|
|
691
691
|
scaleX = a;
|
|
692
692
|
scaleY = d;
|
|
@@ -728,7 +728,7 @@ var LeaferUI = function(exports) {
|
|
|
728
728
|
}
|
|
729
729
|
};
|
|
730
730
|
const M$6 = MatrixHelper;
|
|
731
|
-
const {float: float$
|
|
731
|
+
const {float: float$2} = MathHelper;
|
|
732
732
|
const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
|
|
733
733
|
const {sin: sin$4, cos: cos$4, abs: abs$5, sqrt: sqrt$2, atan2: atan2$2, min: min$1, round: round$2} = Math;
|
|
734
734
|
const PointHelper = {
|
|
@@ -871,7 +871,7 @@ var LeaferUI = function(exports) {
|
|
|
871
871
|
return points;
|
|
872
872
|
},
|
|
873
873
|
isSame(t, point, quick) {
|
|
874
|
-
return quick ? t.x === point.x && t.y === point.y : float$
|
|
874
|
+
return quick ? t.x === point.x && t.y === point.y : float$2(t.x) === float$2(point.x) && float$2(t.y) === float$2(point.y);
|
|
875
875
|
},
|
|
876
876
|
reset(t) {
|
|
877
877
|
t.x = t.y = 0;
|
|
@@ -1206,7 +1206,7 @@ var LeaferUI = function(exports) {
|
|
|
1206
1206
|
};
|
|
1207
1207
|
const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$2} = TwoPointBoundsHelper;
|
|
1208
1208
|
const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
|
|
1209
|
-
const {float: float, fourNumber: fourNumber} = MathHelper;
|
|
1209
|
+
const {float: float$1, fourNumber: fourNumber} = MathHelper;
|
|
1210
1210
|
const {floor: floor$1, ceil: ceil$1} = Math;
|
|
1211
1211
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
1212
1212
|
const point = {};
|
|
@@ -1375,10 +1375,10 @@ var LeaferUI = function(exports) {
|
|
|
1375
1375
|
}
|
|
1376
1376
|
},
|
|
1377
1377
|
float(t, maxLength) {
|
|
1378
|
-
t.x = float(t.x, maxLength);
|
|
1379
|
-
t.y = float(t.y, maxLength);
|
|
1380
|
-
t.width = float(t.width, maxLength);
|
|
1381
|
-
t.height = float(t.height, maxLength);
|
|
1378
|
+
t.x = float$1(t.x, maxLength);
|
|
1379
|
+
t.y = float$1(t.y, maxLength);
|
|
1380
|
+
t.width = float$1(t.width, maxLength);
|
|
1381
|
+
t.height = float$1(t.height, maxLength);
|
|
1382
1382
|
},
|
|
1383
1383
|
add(t, bounds, isPoint) {
|
|
1384
1384
|
right$1 = t.x + t.width;
|
|
@@ -3516,6 +3516,7 @@ var LeaferUI = function(exports) {
|
|
|
3516
3516
|
const {M: M, L: L$1, Z: Z} = PathCommandMap;
|
|
3517
3517
|
const {getCenterX: getCenterX, getCenterY: getCenterY} = PointHelper;
|
|
3518
3518
|
const {arcTo: arcTo} = PathCommandDataHelper;
|
|
3519
|
+
const {float: float} = MathHelper;
|
|
3519
3520
|
const PathCorner = {
|
|
3520
3521
|
smooth(data, cornerRadius, _cornerSmoothing) {
|
|
3521
3522
|
let command, lastCommand, commandLen, startXIndex, startYIndex, smoothLen;
|
|
@@ -3556,7 +3557,7 @@ var LeaferUI = function(exports) {
|
|
|
3556
3557
|
break;
|
|
3557
3558
|
|
|
3558
3559
|
case Z:
|
|
3559
|
-
arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY, three);
|
|
3560
|
+
if (float(x) === float(startX) && float(y) === float(startY)) x = lastX, y = lastY; else arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY, three);
|
|
3560
3561
|
break;
|
|
3561
3562
|
|
|
3562
3563
|
default:
|
|
@@ -4718,10 +4719,11 @@ var LeaferUI = function(exports) {
|
|
|
4718
4719
|
hasOffset(t) {
|
|
4719
4720
|
return t.offsetX || t.offsetY;
|
|
4720
4721
|
},
|
|
4721
|
-
hasParent(p, parent) {
|
|
4722
|
+
hasParent(p, parent, minLevel) {
|
|
4722
4723
|
if (!parent) return false;
|
|
4723
4724
|
while (p) {
|
|
4724
4725
|
if (parent === p) return true;
|
|
4726
|
+
if (minLevel && p.__level === minLevel) return;
|
|
4725
4727
|
p = p.parent;
|
|
4726
4728
|
}
|
|
4727
4729
|
},
|
|
@@ -4738,6 +4740,9 @@ var LeaferUI = function(exports) {
|
|
|
4738
4740
|
onAnimate && onAnimate();
|
|
4739
4741
|
}
|
|
4740
4742
|
};
|
|
4743
|
+
function isTrackChanges(leafer) {
|
|
4744
|
+
return leafer && leafer.config.trackChanges;
|
|
4745
|
+
}
|
|
4741
4746
|
const L = LeafHelper;
|
|
4742
4747
|
const {updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$1, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange} = L;
|
|
4743
4748
|
function getTempLocal(t, worldPoint) {
|
|
@@ -4785,6 +4790,16 @@ var LeaferUI = function(exports) {
|
|
|
4785
4790
|
sort(a, b) {
|
|
4786
4791
|
return a.__.zIndex === b.__.zIndex ? a.__tempNumber - b.__tempNumber : a.__.zIndex - b.__.zIndex;
|
|
4787
4792
|
},
|
|
4793
|
+
zIndex(branch, child, index) {
|
|
4794
|
+
const {children: children} = branch, before = children[index - 1], after = children[index];
|
|
4795
|
+
if (before && after) {
|
|
4796
|
+
if (child.zIndex < before.zIndex || child.zIndex > after.zIndex) child.zIndex = (before.zIndex + after.zIndex) / 2;
|
|
4797
|
+
} else if (before) {
|
|
4798
|
+
if (child.zIndex < before.zIndex) child.zIndex = before.zIndex + 1;
|
|
4799
|
+
} else if (after) {
|
|
4800
|
+
if (child.zIndex > after.zIndex) child.zIndex = after.zIndex - 1;
|
|
4801
|
+
}
|
|
4802
|
+
},
|
|
4788
4803
|
pushAllChildBranch(branch, leafList) {
|
|
4789
4804
|
branch.__tempNumber = 1;
|
|
4790
4805
|
if (branch.__.__childBranchNumber) {
|
|
@@ -5669,7 +5684,7 @@ var LeaferUI = function(exports) {
|
|
|
5669
5684
|
},
|
|
5670
5685
|
emitPropertyEvent(type, name, oldValue, newValue) {
|
|
5671
5686
|
const {leafer: leafer} = this;
|
|
5672
|
-
if (leafer
|
|
5687
|
+
if (isTrackChanges(leafer) || leafer.zoomLayer === this) {
|
|
5673
5688
|
const event = new PropertyEvent(type, this, name, oldValue, newValue);
|
|
5674
5689
|
this.isLeafer || this.hasEvent(type) && this.emitEvent(event);
|
|
5675
5690
|
leafer.emitEvent(event);
|
|
@@ -6105,7 +6120,6 @@ var LeaferUI = function(exports) {
|
|
|
6105
6120
|
}
|
|
6106
6121
|
}
|
|
6107
6122
|
__bindFrame(frame) {
|
|
6108
|
-
if (this.isFrame && frame !== null) frame = this;
|
|
6109
6123
|
this.frame = frame;
|
|
6110
6124
|
if (this.isBranch) {
|
|
6111
6125
|
const {children: children} = this;
|
|
@@ -6410,14 +6424,17 @@ var LeaferUI = function(exports) {
|
|
|
6410
6424
|
}
|
|
6411
6425
|
if (child.parent) child.parent.remove(child);
|
|
6412
6426
|
child.parent = this;
|
|
6413
|
-
noIndex
|
|
6427
|
+
if (noIndex) this.children.push(child); else {
|
|
6428
|
+
BranchHelper.zIndex(this, child, index);
|
|
6429
|
+
this.children.splice(index, 0, child);
|
|
6430
|
+
}
|
|
6414
6431
|
if (child.isBranch) this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1;
|
|
6415
6432
|
const childLayout = child.__layout;
|
|
6416
6433
|
childLayout.boxChanged || childLayout.boxChange();
|
|
6417
6434
|
childLayout.matrixChanged || childLayout.matrixChange();
|
|
6418
6435
|
if (child.__parentChange) child.__parentChange.forEach(item => item(this, child));
|
|
6419
6436
|
if (child.__bubbleMap) child.__emitLifeEvent(ChildEvent.ADD);
|
|
6420
|
-
if (this.
|
|
6437
|
+
if (this.frame) child.__bindFrame(this.frame);
|
|
6421
6438
|
if (this.leafer) {
|
|
6422
6439
|
child.__bindLeafer(this.leafer);
|
|
6423
6440
|
if (this.leafer.created) this.__emitChildEvent(ChildEvent.ADD, child);
|
|
@@ -6477,11 +6494,11 @@ var LeaferUI = function(exports) {
|
|
|
6477
6494
|
if (this.leafer.hitCanvasManager) this.leafer.hitCanvasManager.clear();
|
|
6478
6495
|
}
|
|
6479
6496
|
}
|
|
6480
|
-
if (
|
|
6497
|
+
if (child.frame && !child.isFrame) child.__bindFrame(null);
|
|
6481
6498
|
}
|
|
6482
6499
|
__emitChildEvent(type, child) {
|
|
6483
6500
|
const {leafer: leafer} = this;
|
|
6484
|
-
if (leafer
|
|
6501
|
+
if (isTrackChanges(leafer) || leafer.zoomLayer === this) {
|
|
6485
6502
|
const event = new ChildEvent(type, child, this);
|
|
6486
6503
|
if (this.hasEvent(type) && !this.isLeafer) this.emitEvent(event);
|
|
6487
6504
|
leafer.emitEvent(event);
|
|
@@ -6634,7 +6651,12 @@ var LeaferUI = function(exports) {
|
|
|
6634
6651
|
this.levelMap = null;
|
|
6635
6652
|
}
|
|
6636
6653
|
}
|
|
6637
|
-
const version = "2.
|
|
6654
|
+
const version = "2.3.0";
|
|
6655
|
+
if (typeof globalThis !== "undefined") {
|
|
6656
|
+
const globalLeafer = globalThis.Leafer || (globalThis.Leafer = {});
|
|
6657
|
+
globalLeafer.version = version;
|
|
6658
|
+
globalLeafer.Plugin = Plugin;
|
|
6659
|
+
}
|
|
6638
6660
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6639
6661
|
get allowBackgroundColor() {
|
|
6640
6662
|
return true;
|
|
@@ -7338,6 +7360,16 @@ var LeaferUI = function(exports) {
|
|
|
7338
7360
|
});
|
|
7339
7361
|
};
|
|
7340
7362
|
}
|
|
7363
|
+
function frameType() {
|
|
7364
|
+
return (target, key) => {
|
|
7365
|
+
defineKey(target, key, {
|
|
7366
|
+
set(_value) {},
|
|
7367
|
+
get() {
|
|
7368
|
+
return this;
|
|
7369
|
+
}
|
|
7370
|
+
});
|
|
7371
|
+
};
|
|
7372
|
+
}
|
|
7341
7373
|
function createAttr(defaultValue) {
|
|
7342
7374
|
return (target, key) => {
|
|
7343
7375
|
defineKey(target, key, createDescriptor(key, defaultValue));
|
|
@@ -8590,6 +8622,7 @@ var LeaferUI = function(exports) {
|
|
|
8590
8622
|
return true;
|
|
8591
8623
|
}
|
|
8592
8624
|
};
|
|
8625
|
+
__decorate([ frameType() ], exports.Frame.prototype, "frame", void 0);
|
|
8593
8626
|
__decorate([ dataProcessor(FrameData) ], exports.Frame.prototype, "__", void 0);
|
|
8594
8627
|
__decorate([ surfaceType("#FFFFFF") ], exports.Frame.prototype, "fill", void 0);
|
|
8595
8628
|
__decorate([ affectRenderBoundsType("hide") ], exports.Frame.prototype, "overflow", void 0);
|
|
@@ -10709,6 +10742,7 @@ var LeaferUI = function(exports) {
|
|
|
10709
10742
|
exports.emptyData = emptyData;
|
|
10710
10743
|
exports.eraserType = eraserType;
|
|
10711
10744
|
exports.extraPropertyEventMap = extraPropertyEventMap;
|
|
10745
|
+
exports.frameType = frameType;
|
|
10712
10746
|
exports.getBoundsData = getBoundsData;
|
|
10713
10747
|
exports.getDescriptor = getDescriptor;
|
|
10714
10748
|
exports.getMatrixData = getMatrixData;
|
|
@@ -10722,6 +10756,7 @@ var LeaferUI = function(exports) {
|
|
|
10722
10756
|
exports.isNumber = isNumber;
|
|
10723
10757
|
exports.isObject = isObject;
|
|
10724
10758
|
exports.isString = isString;
|
|
10759
|
+
exports.isTrackChanges = isTrackChanges;
|
|
10725
10760
|
exports.isUndefined = isUndefined;
|
|
10726
10761
|
exports.layoutProcessor = layoutProcessor;
|
|
10727
10762
|
exports.leaferTransformAttrMap = leaferTransformAttrMap;
|