@leafer-draw/worker 2.0.2 → 2.0.3
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.cjs +6 -4
- package/dist/worker.esm.js +6 -4
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +100 -46
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +102 -47
- 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
|
@@ -233,6 +233,7 @@ var LeaferUI = function(exports) {
|
|
|
233
233
|
}
|
|
234
234
|
destroy() {
|
|
235
235
|
this.__input = this.__middle = null;
|
|
236
|
+
if (this.__complexData) this.__complexData.destroy();
|
|
236
237
|
}
|
|
237
238
|
}
|
|
238
239
|
const IncrementId = {
|
|
@@ -323,6 +324,7 @@ var LeaferUI = function(exports) {
|
|
|
323
324
|
};
|
|
324
325
|
const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
|
|
325
326
|
const {round: round$3, pow: pow$1, max: max$3, floor: floor$2, PI: PI$3} = Math;
|
|
327
|
+
const tempScaleData$1 = {};
|
|
326
328
|
const MathHelper = {
|
|
327
329
|
within(value, min, max) {
|
|
328
330
|
if (isObject(min)) max = min.max, min = min.min;
|
|
@@ -366,6 +368,24 @@ var LeaferUI = function(exports) {
|
|
|
366
368
|
} else if (scale) MathHelper.assignScale(scaleData, scale);
|
|
367
369
|
return scaleData;
|
|
368
370
|
},
|
|
371
|
+
getScaleFixedData(worldScaleData, scaleFixed, unscale, abs, _localScaleData) {
|
|
372
|
+
let {scaleX: scaleX, scaleY: scaleY} = worldScaleData;
|
|
373
|
+
if (abs || scaleFixed) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY);
|
|
374
|
+
if (scaleFixed) {
|
|
375
|
+
if (scaleFixed === true) {
|
|
376
|
+
scaleX = scaleY = unscale ? 1 : 1 / scaleX;
|
|
377
|
+
} else {
|
|
378
|
+
let minScale;
|
|
379
|
+
if (isNumber(scaleFixed)) minScale = scaleFixed; else if (scaleFixed === "zoom-in") minScale = 1;
|
|
380
|
+
if (minScale) {
|
|
381
|
+
if (scaleX > minScale || scaleY > minScale) scaleX = scaleY = unscale ? 1 : 1 / scaleX; else scaleX = scaleY = unscale ? 1 : 1 / minScale;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
tempScaleData$1.scaleX = scaleX;
|
|
386
|
+
tempScaleData$1.scaleY = scaleY;
|
|
387
|
+
return tempScaleData$1;
|
|
388
|
+
},
|
|
369
389
|
assignScale(scaleData, scale) {
|
|
370
390
|
if (isNumber(scale)) {
|
|
371
391
|
scaleData.scaleX = scaleData.scaleY = scale;
|
|
@@ -845,8 +865,8 @@ var LeaferUI = function(exports) {
|
|
|
845
865
|
if (isObject(originPoints[0])) points = [], originPoints.forEach(p => points.push(p.x, p.y));
|
|
846
866
|
return points;
|
|
847
867
|
},
|
|
848
|
-
isSame(t, point) {
|
|
849
|
-
return float$1(t.x) === float$1(point.x) && float$1(t.y) === float$1(point.y);
|
|
868
|
+
isSame(t, point, quick) {
|
|
869
|
+
return quick ? t.x === point.x && t.y === point.y : float$1(t.x) === float$1(point.x) && float$1(t.y) === float$1(point.y);
|
|
850
870
|
},
|
|
851
871
|
reset(t) {
|
|
852
872
|
P$5.reset(t);
|
|
@@ -918,8 +938,8 @@ var LeaferUI = function(exports) {
|
|
|
918
938
|
getAtan2(to) {
|
|
919
939
|
return PointHelper.getAtan2(this, to);
|
|
920
940
|
}
|
|
921
|
-
isSame(point) {
|
|
922
|
-
return PointHelper.isSame(this, point);
|
|
941
|
+
isSame(point, quick) {
|
|
942
|
+
return PointHelper.isSame(this, point, quick);
|
|
923
943
|
}
|
|
924
944
|
reset() {
|
|
925
945
|
PointHelper.reset(this);
|
|
@@ -1163,9 +1183,9 @@ var LeaferUI = function(exports) {
|
|
|
1163
1183
|
}
|
|
1164
1184
|
if (!onlyBoxSize) to.x += box.x, to.y += box.y;
|
|
1165
1185
|
},
|
|
1166
|
-
getPoint(around, box, to) {
|
|
1186
|
+
getPoint(around, box, to, onlyBoxSize = true) {
|
|
1167
1187
|
if (!to) to = {};
|
|
1168
|
-
AroundHelper.toPoint(around, box, to,
|
|
1188
|
+
AroundHelper.toPoint(around, box, to, onlyBoxSize);
|
|
1169
1189
|
return to;
|
|
1170
1190
|
}
|
|
1171
1191
|
};
|
|
@@ -1420,6 +1440,9 @@ var LeaferUI = function(exports) {
|
|
|
1420
1440
|
y: y + height
|
|
1421
1441
|
} ];
|
|
1422
1442
|
},
|
|
1443
|
+
getPoint(t, around, onlyBoxSize = false, to) {
|
|
1444
|
+
return AroundHelper.getPoint(around, t, to, onlyBoxSize);
|
|
1445
|
+
},
|
|
1423
1446
|
hitRadiusPoint(t, point, pointMatrix) {
|
|
1424
1447
|
if (pointMatrix) point = PointHelper.tempToInnerRadiusPointOf(point, pointMatrix);
|
|
1425
1448
|
return point.x >= t.x - point.radiusX && point.x <= t.x + t.width + point.radiusX && (point.y >= t.y - point.radiusY && point.y <= t.y + t.height + point.radiusY);
|
|
@@ -1588,6 +1611,9 @@ var LeaferUI = function(exports) {
|
|
|
1588
1611
|
getPoints() {
|
|
1589
1612
|
return BoundsHelper.getPoints(this);
|
|
1590
1613
|
}
|
|
1614
|
+
getPoint(around, onlyBoxSize, to) {
|
|
1615
|
+
return BoundsHelper.getPoint(this, around, onlyBoxSize, to);
|
|
1616
|
+
}
|
|
1591
1617
|
hitPoint(point, pointMatrix) {
|
|
1592
1618
|
return BoundsHelper.hitPoint(this, point, pointMatrix);
|
|
1593
1619
|
}
|
|
@@ -3861,6 +3887,7 @@ var LeaferUI = function(exports) {
|
|
|
3861
3887
|
return image;
|
|
3862
3888
|
},
|
|
3863
3889
|
recycle(image) {
|
|
3890
|
+
if (image.parent) image = image.parent;
|
|
3864
3891
|
image.use--;
|
|
3865
3892
|
setTimeout(() => {
|
|
3866
3893
|
if (!image.use) {
|
|
@@ -4026,8 +4053,10 @@ var LeaferUI = function(exports) {
|
|
|
4026
4053
|
return undefined;
|
|
4027
4054
|
}
|
|
4028
4055
|
clearLevels(_checkUse) {}
|
|
4056
|
+
destroyFilter() {}
|
|
4029
4057
|
destroy() {
|
|
4030
4058
|
this.clearLevels();
|
|
4059
|
+
this.destroyFilter();
|
|
4031
4060
|
const {view: view} = this;
|
|
4032
4061
|
if (view && view.close) view.close();
|
|
4033
4062
|
this.config = {
|
|
@@ -4198,7 +4227,6 @@ var LeaferUI = function(exports) {
|
|
|
4198
4227
|
if (this.__setAttr(key, value)) {
|
|
4199
4228
|
const data = this.__;
|
|
4200
4229
|
DataHelper.stintSet(data, "__useDim", data.dim || data.bright || data.dimskip);
|
|
4201
|
-
this.__layout.surfaceChange();
|
|
4202
4230
|
}
|
|
4203
4231
|
}
|
|
4204
4232
|
}));
|
|
@@ -4243,7 +4271,6 @@ var LeaferUI = function(exports) {
|
|
|
4243
4271
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4244
4272
|
set(value) {
|
|
4245
4273
|
if (this.__setAttr(key, value)) {
|
|
4246
|
-
this.__layout.surfaceChange();
|
|
4247
4274
|
this.waitParent(() => {
|
|
4248
4275
|
this.parent.__layout.childrenSortChange();
|
|
4249
4276
|
});
|
|
@@ -4277,7 +4304,6 @@ var LeaferUI = function(exports) {
|
|
|
4277
4304
|
set(value) {
|
|
4278
4305
|
if (this.__setAttr(key, value)) {
|
|
4279
4306
|
this.__layout.hitCanvasChanged = true;
|
|
4280
|
-
if (Debug.showBounds === "hit") this.__layout.surfaceChange();
|
|
4281
4307
|
if (this.leafer) this.leafer.updateCursor();
|
|
4282
4308
|
}
|
|
4283
4309
|
}
|
|
@@ -4465,6 +4491,10 @@ var LeaferUI = function(exports) {
|
|
|
4465
4491
|
if (layout.stateStyleChanged) leaf.updateState();
|
|
4466
4492
|
if (layout.opacityChanged) updateAllWorldOpacity(leaf);
|
|
4467
4493
|
leaf.__updateChange();
|
|
4494
|
+
if (layout.surfaceChanged) {
|
|
4495
|
+
if (leaf.__hasComplex) L.updateComplex(leaf);
|
|
4496
|
+
layout.surfaceChanged = false;
|
|
4497
|
+
}
|
|
4468
4498
|
},
|
|
4469
4499
|
updateAllChange(leaf) {
|
|
4470
4500
|
updateChange$1(leaf);
|
|
@@ -4489,6 +4519,9 @@ var LeaferUI = function(exports) {
|
|
|
4489
4519
|
if (!fromWorld) fromWorld = leaf.__nowWorld;
|
|
4490
4520
|
if (leaf.__worldFlipped || Platform.fullImageShadow) currentCanvas.copyWorldByReset(fromCanvas, fromWorld, leaf.__nowWorld, blendMode, onlyResetTransform); else currentCanvas.copyWorldToInner(fromCanvas, fromWorld, leaf.__layout.renderBounds, blendMode);
|
|
4491
4521
|
},
|
|
4522
|
+
renderComplex(_leaf, _canvas, _options) {},
|
|
4523
|
+
updateComplex(_leaf) {},
|
|
4524
|
+
checkComplex(_leaf) {},
|
|
4492
4525
|
moveWorld(t, x, y = 0, isInnerPoint, transition) {
|
|
4493
4526
|
const local = isObject(x) ? Object.assign({}, x) : {
|
|
4494
4527
|
x: x,
|
|
@@ -4600,6 +4633,9 @@ var LeaferUI = function(exports) {
|
|
|
4600
4633
|
divideParent(matrix, relative.scrollWorldTransform);
|
|
4601
4634
|
return temp ? matrix : Object.assign({}, matrix);
|
|
4602
4635
|
},
|
|
4636
|
+
updateScaleFixedWorld(_t) {},
|
|
4637
|
+
updateOuterBounds(_t) {},
|
|
4638
|
+
cacheId(_t) {},
|
|
4603
4639
|
drop(t, parent, index, resize) {
|
|
4604
4640
|
t.setTransform(L.getRelativeWorld(t, parent, true), resize);
|
|
4605
4641
|
parent.add(t, index);
|
|
@@ -4646,7 +4682,8 @@ var LeaferUI = function(exports) {
|
|
|
4646
4682
|
return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localStrokeBounds;
|
|
4647
4683
|
},
|
|
4648
4684
|
localRenderBounds(target) {
|
|
4649
|
-
|
|
4685
|
+
const {__: __, __layout: __layout} = target;
|
|
4686
|
+
return __.eraser || __.visible === 0 ? null : __layout.localOuterBounds || __layout.localRenderBounds;
|
|
4650
4687
|
},
|
|
4651
4688
|
maskLocalBoxBounds(target, index) {
|
|
4652
4689
|
return checkMask(target, index) && target.__localBoxBounds;
|
|
@@ -4655,7 +4692,8 @@ var LeaferUI = function(exports) {
|
|
|
4655
4692
|
return checkMask(target, index) && target.__layout.localStrokeBounds;
|
|
4656
4693
|
},
|
|
4657
4694
|
maskLocalRenderBounds(target, index) {
|
|
4658
|
-
|
|
4695
|
+
const {__layout: __layout} = target;
|
|
4696
|
+
return checkMask(target, index) && (__layout.localOuterBounds || __layout.localRenderBounds);
|
|
4659
4697
|
},
|
|
4660
4698
|
excludeRenderBounds(child, options) {
|
|
4661
4699
|
if (options.bounds && !options.bounds.hit(child.__world, options.matrix)) return true;
|
|
@@ -5164,7 +5202,6 @@ var LeaferUI = function(exports) {
|
|
|
5164
5202
|
}
|
|
5165
5203
|
opacityChange() {
|
|
5166
5204
|
this.opacityChanged = true;
|
|
5167
|
-
this.surfaceChanged || this.surfaceChange();
|
|
5168
5205
|
}
|
|
5169
5206
|
childrenSortChange() {
|
|
5170
5207
|
if (!this.childrenSortChanged) {
|
|
@@ -5579,6 +5616,7 @@ var LeaferUI = function(exports) {
|
|
|
5579
5616
|
const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
|
|
5580
5617
|
multiplyParent$2(this.__local || __layout, parent ? parent.__scrollWorld || parent.__world : defaultWorld, __world, !!__layout.affectScaleOrRotation, __);
|
|
5581
5618
|
if (__scrollWorld) translateInner(Object.assign(__scrollWorld, __world), __.scrollX, __.scrollY);
|
|
5619
|
+
if (__layout.scaleFixed) LeafHelper.updateScaleFixedWorld(this);
|
|
5582
5620
|
},
|
|
5583
5621
|
__updateLocalMatrix() {
|
|
5584
5622
|
if (this.__local) {
|
|
@@ -5607,6 +5645,7 @@ var LeaferUI = function(exports) {
|
|
|
5607
5645
|
__updateWorldBounds() {
|
|
5608
5646
|
const {__layout: __layout, __world: __world} = this;
|
|
5609
5647
|
toOuterOf$2(__layout.renderBounds, __world, __world);
|
|
5648
|
+
if (this.__hasComplex) LeafHelper.checkComplex(this);
|
|
5610
5649
|
if (__layout.resized) {
|
|
5611
5650
|
if (__layout.resized === "inner") this.__onUpdateSize();
|
|
5612
5651
|
if (this.__hasLocalEvent) BoundsEvent.emitLocal(this);
|
|
@@ -5656,6 +5695,7 @@ var LeaferUI = function(exports) {
|
|
|
5656
5695
|
layout.renderChanged = undefined;
|
|
5657
5696
|
if (this.parent) this.parent.__layout.renderChange();
|
|
5658
5697
|
}
|
|
5698
|
+
if (layout.outerScale) LeafHelper.updateOuterBounds(this);
|
|
5659
5699
|
layout.resized || (layout.resized = "local");
|
|
5660
5700
|
layout.boundsChanged = undefined;
|
|
5661
5701
|
},
|
|
@@ -5721,7 +5761,7 @@ var LeaferUI = function(exports) {
|
|
|
5721
5761
|
const data = this.__;
|
|
5722
5762
|
if (data.bright && !options.topRendering) return options.topList.add(this);
|
|
5723
5763
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5724
|
-
canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
|
|
5764
|
+
canvas.opacity = options.ignoreOpacity ? 1 : options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
|
|
5725
5765
|
if (this.__.__single) {
|
|
5726
5766
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
5727
5767
|
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
@@ -5773,7 +5813,7 @@ var LeaferUI = function(exports) {
|
|
|
5773
5813
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
5774
5814
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
5775
5815
|
this.__renderBranch(tempCanvas, options);
|
|
5776
|
-
canvas.opacity = options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
|
|
5816
|
+
canvas.opacity = options.ignoreOpacity ? 1 : options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
|
|
5777
5817
|
canvas.copyWorldByReset(tempCanvas, nowWorld, nowWorld, data.__blendMode, true);
|
|
5778
5818
|
tempCanvas.recycle(nowWorld);
|
|
5779
5819
|
} else {
|
|
@@ -5789,7 +5829,7 @@ var LeaferUI = function(exports) {
|
|
|
5789
5829
|
const {children: children} = this;
|
|
5790
5830
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5791
5831
|
child = children[i];
|
|
5792
|
-
excludeRenderBounds$1(child, options) || (child.
|
|
5832
|
+
excludeRenderBounds$1(child, options) || (child.__hasComplex ? LeafHelper.renderComplex(child, canvas, options) : child.__render(canvas, options));
|
|
5793
5833
|
}
|
|
5794
5834
|
}
|
|
5795
5835
|
},
|
|
@@ -5802,12 +5842,12 @@ var LeaferUI = function(exports) {
|
|
|
5802
5842
|
}
|
|
5803
5843
|
}
|
|
5804
5844
|
};
|
|
5805
|
-
const tempScaleData$1 = {};
|
|
5806
5845
|
const {LEAF: LEAF, create: create} = IncrementId;
|
|
5807
5846
|
const {stintSet: stintSet$4} = DataHelper;
|
|
5808
5847
|
const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
|
|
5809
5848
|
const {toOuterOf: toOuterOf$1} = BoundsHelper;
|
|
5810
5849
|
const {copy: copy$2, move: move$2} = PointHelper;
|
|
5850
|
+
const {getScaleFixedData: getScaleFixedData} = MathHelper;
|
|
5811
5851
|
const {moveLocal: moveLocal, zoomOfLocal: zoomOfLocal, rotateOfLocal: rotateOfLocal, skewOfLocal: skewOfLocal, moveWorld: moveWorld, zoomOfWorld: zoomOfWorld, rotateOfWorld: rotateOfWorld, skewOfWorld: skewOfWorld, transform: transform, transformWorld: transformWorld, setTransform: setTransform, getFlipTransform: getFlipTransform, getLocalOrigin: getLocalOrigin, getRelativeWorld: getRelativeWorld, drop: drop} = LeafHelper;
|
|
5812
5852
|
exports.Leaf = class Leaf {
|
|
5813
5853
|
get tag() {
|
|
@@ -5965,6 +6005,7 @@ var LeaferUI = function(exports) {
|
|
|
5965
6005
|
this.__level = this.parent ? this.parent.__level + 1 : 1;
|
|
5966
6006
|
if (this.animation) this.__runAnimation("in");
|
|
5967
6007
|
if (this.__bubbleMap) this.__emitLifeEvent(ChildEvent.MOUNTED);
|
|
6008
|
+
if (leafer.cacheId) LeafHelper.cacheId(this);
|
|
5968
6009
|
} else {
|
|
5969
6010
|
this.__emitLifeEvent(ChildEvent.UNMOUNTED);
|
|
5970
6011
|
}
|
|
@@ -6094,13 +6135,8 @@ var LeaferUI = function(exports) {
|
|
|
6094
6135
|
if (scaleX < 0) scaleX = -scaleX;
|
|
6095
6136
|
return scaleX > 1 ? scaleX : 1;
|
|
6096
6137
|
}
|
|
6097
|
-
getRenderScaleData(abs, scaleFixed) {
|
|
6098
|
-
|
|
6099
|
-
if (abs) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY);
|
|
6100
|
-
if (scaleFixed === true || scaleFixed === "zoom-in" && scaleX > 1 && scaleY > 1) scaleX = scaleY = 1;
|
|
6101
|
-
tempScaleData$1.scaleX = scaleX;
|
|
6102
|
-
tempScaleData$1.scaleY = scaleY;
|
|
6103
|
-
return tempScaleData$1;
|
|
6138
|
+
getRenderScaleData(abs, scaleFixed, unscale = true) {
|
|
6139
|
+
return getScaleFixedData(ImageManager.patternLocked ? this.__world : this.__nowWorld || this.__world, scaleFixed, unscale, abs);
|
|
6104
6140
|
}
|
|
6105
6141
|
getTransform(relative) {
|
|
6106
6142
|
return this.__layout.getTransform(relative || "local");
|
|
@@ -6262,7 +6298,6 @@ var LeaferUI = function(exports) {
|
|
|
6262
6298
|
__drawHitPath(_canvas) {}
|
|
6263
6299
|
__updateHitCanvas() {}
|
|
6264
6300
|
__render(_canvas, _options) {}
|
|
6265
|
-
__renderComplex(_canvas, _options) {}
|
|
6266
6301
|
__drawFast(_canvas, _options) {}
|
|
6267
6302
|
__draw(_canvas, _options, _originCanvas) {}
|
|
6268
6303
|
__clip(_canvas, _options) {}
|
|
@@ -6273,7 +6308,7 @@ var LeaferUI = function(exports) {
|
|
|
6273
6308
|
__drawPath(_canvas) {}
|
|
6274
6309
|
__drawRenderPath(_canvas) {}
|
|
6275
6310
|
__updatePath() {}
|
|
6276
|
-
__updateRenderPath() {}
|
|
6311
|
+
__updateRenderPath(_updateCache) {}
|
|
6277
6312
|
getMotionPathData() {
|
|
6278
6313
|
return Plugin.need("path");
|
|
6279
6314
|
}
|
|
@@ -6341,9 +6376,11 @@ var LeaferUI = function(exports) {
|
|
|
6341
6376
|
return 0;
|
|
6342
6377
|
}
|
|
6343
6378
|
__updateRenderSpread() {
|
|
6379
|
+
let layout;
|
|
6344
6380
|
const {children: children} = this;
|
|
6345
6381
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
6346
|
-
|
|
6382
|
+
layout = children[i].__layout;
|
|
6383
|
+
if (layout.renderSpread || layout.localOuterBounds) return 1;
|
|
6347
6384
|
}
|
|
6348
6385
|
return 0;
|
|
6349
6386
|
}
|
|
@@ -6598,7 +6635,7 @@ var LeaferUI = function(exports) {
|
|
|
6598
6635
|
this.levelMap = null;
|
|
6599
6636
|
}
|
|
6600
6637
|
}
|
|
6601
|
-
const version = "2.0.
|
|
6638
|
+
const version = "2.0.3";
|
|
6602
6639
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6603
6640
|
get allowBackgroundColor() {
|
|
6604
6641
|
return true;
|
|
@@ -7248,7 +7285,9 @@ var LeaferUI = function(exports) {
|
|
|
7248
7285
|
set(value) {
|
|
7249
7286
|
this.__setAttr(key, value);
|
|
7250
7287
|
if (value) this.__.__useEffect = true;
|
|
7251
|
-
|
|
7288
|
+
const layout = this.__layout;
|
|
7289
|
+
layout.renderChanged || layout.renderChange();
|
|
7290
|
+
layout.surfaceChange();
|
|
7252
7291
|
}
|
|
7253
7292
|
}));
|
|
7254
7293
|
}
|
|
@@ -7441,15 +7480,16 @@ var LeaferUI = function(exports) {
|
|
|
7441
7480
|
this.__needComputePaint = undefined;
|
|
7442
7481
|
}
|
|
7443
7482
|
__getRealStrokeWidth(childStyle) {
|
|
7444
|
-
let {strokeWidth: strokeWidth,
|
|
7483
|
+
let {strokeWidth: strokeWidth, strokeScaleFixed: strokeScaleFixed} = this;
|
|
7445
7484
|
if (childStyle) {
|
|
7446
7485
|
if (childStyle.strokeWidth) strokeWidth = childStyle.strokeWidth;
|
|
7447
|
-
if (!isUndefined(childStyle.
|
|
7486
|
+
if (!isUndefined(childStyle.strokeScaleFixed)) strokeScaleFixed = childStyle.strokeScaleFixed;
|
|
7487
|
+
}
|
|
7488
|
+
if (strokeScaleFixed) {
|
|
7489
|
+
const {scaleX: scaleX} = this.__leaf.getRenderScaleData(true, strokeScaleFixed, false);
|
|
7490
|
+
if (scaleX !== 1) return strokeWidth * scaleX;
|
|
7448
7491
|
}
|
|
7449
|
-
|
|
7450
|
-
const scale = this.__leaf.getClampRenderScale();
|
|
7451
|
-
return scale > 1 ? strokeWidth / scale : strokeWidth;
|
|
7452
|
-
} else return strokeWidth;
|
|
7492
|
+
return strokeWidth;
|
|
7453
7493
|
}
|
|
7454
7494
|
__setPaint(attrName, value) {
|
|
7455
7495
|
this.__setInput(attrName, value);
|
|
@@ -7617,7 +7657,7 @@ var LeaferUI = function(exports) {
|
|
|
7617
7657
|
const data = this.__, {strokeAlign: strokeAlign, __maxStrokeWidth: strokeWidth} = data, box = this.__box;
|
|
7618
7658
|
if ((data.stroke || data.hitStroke === "all") && strokeWidth && strokeAlign !== "inside") {
|
|
7619
7659
|
boxSpread = spread = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
|
|
7620
|
-
if (!data.__boxStroke) {
|
|
7660
|
+
if (!data.__boxStroke || data.__useArrow) {
|
|
7621
7661
|
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * spread;
|
|
7622
7662
|
const storkeCapAddWidth = data.strokeCap === "none" ? 0 : strokeWidth;
|
|
7623
7663
|
spread += Math.max(miterLimitAddWidth, storkeCapAddWidth);
|
|
@@ -7768,6 +7808,12 @@ var LeaferUI = function(exports) {
|
|
|
7768
7808
|
get isFrame() {
|
|
7769
7809
|
return false;
|
|
7770
7810
|
}
|
|
7811
|
+
set strokeWidthFixed(value) {
|
|
7812
|
+
this.strokeScaleFixed = value;
|
|
7813
|
+
}
|
|
7814
|
+
get strokeWidthFixed() {
|
|
7815
|
+
return this.strokeScaleFixed;
|
|
7816
|
+
}
|
|
7771
7817
|
set scale(value) {
|
|
7772
7818
|
MathHelper.assignScale(this, value);
|
|
7773
7819
|
}
|
|
@@ -7823,6 +7869,9 @@ var LeaferUI = function(exports) {
|
|
|
7823
7869
|
getPathString(curve, pathForRender, floatLength) {
|
|
7824
7870
|
return PathConvert.stringify(this.getPath(curve, pathForRender), floatLength);
|
|
7825
7871
|
}
|
|
7872
|
+
asPath(curve, pathForRender) {
|
|
7873
|
+
this.path = this.getPath(curve, pathForRender);
|
|
7874
|
+
}
|
|
7826
7875
|
load() {
|
|
7827
7876
|
this.__.__computePaint();
|
|
7828
7877
|
}
|
|
@@ -7832,16 +7881,18 @@ var LeaferUI = function(exports) {
|
|
|
7832
7881
|
data.lazy && !this.__inLazyBounds && !Export.running ? data.__needComputePaint = true : data.__computePaint();
|
|
7833
7882
|
}
|
|
7834
7883
|
}
|
|
7835
|
-
__updateRenderPath() {
|
|
7884
|
+
__updateRenderPath(updateCache) {
|
|
7836
7885
|
const data = this.__;
|
|
7837
7886
|
if (data.path) {
|
|
7838
7887
|
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
7839
|
-
if (data.__useArrow) PathArrow.addArrows(this);
|
|
7888
|
+
if (data.__useArrow) PathArrow.addArrows(this, updateCache);
|
|
7840
7889
|
} else data.__pathForRender && (data.__pathForRender = undefined);
|
|
7841
7890
|
}
|
|
7842
7891
|
__drawRenderPath(canvas) {
|
|
7892
|
+
const data = this.__;
|
|
7843
7893
|
canvas.beginPath();
|
|
7844
|
-
|
|
7894
|
+
if (data.__useArrow) PathArrow.updateArrow(this);
|
|
7895
|
+
this.__drawPathByData(canvas, data.__pathForRender);
|
|
7845
7896
|
}
|
|
7846
7897
|
__drawPath(canvas) {
|
|
7847
7898
|
canvas.beginPath();
|
|
@@ -7890,6 +7941,7 @@ var LeaferUI = function(exports) {
|
|
|
7890
7941
|
static setEditOuter(_toolName) {}
|
|
7891
7942
|
static setEditInner(_editorName) {}
|
|
7892
7943
|
destroy() {
|
|
7944
|
+
this.__.__willDestroy = true;
|
|
7893
7945
|
this.fill = this.stroke = null;
|
|
7894
7946
|
if (this.__animate) this.killAnimate();
|
|
7895
7947
|
super.destroy();
|
|
@@ -7950,7 +8002,7 @@ var LeaferUI = function(exports) {
|
|
|
7950
8002
|
__decorate([ strokeType(undefined, true) ], exports.UI.prototype, "stroke", void 0);
|
|
7951
8003
|
__decorate([ strokeType("inside") ], exports.UI.prototype, "strokeAlign", void 0);
|
|
7952
8004
|
__decorate([ strokeType(1, true) ], exports.UI.prototype, "strokeWidth", void 0);
|
|
7953
|
-
__decorate([ strokeType(false) ], exports.UI.prototype, "
|
|
8005
|
+
__decorate([ strokeType(false) ], exports.UI.prototype, "strokeScaleFixed", void 0);
|
|
7954
8006
|
__decorate([ strokeType("none") ], exports.UI.prototype, "strokeCap", void 0);
|
|
7955
8007
|
__decorate([ strokeType("miter") ], exports.UI.prototype, "strokeJoin", void 0);
|
|
7956
8008
|
__decorate([ strokeType() ], exports.UI.prototype, "dashPattern", void 0);
|
|
@@ -8524,9 +8576,9 @@ var LeaferUI = function(exports) {
|
|
|
8524
8576
|
return "Ellipse";
|
|
8525
8577
|
}
|
|
8526
8578
|
__updatePath() {
|
|
8527
|
-
const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} =
|
|
8579
|
+
const data = this.__, {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = data;
|
|
8528
8580
|
const rx = width / 2, ry = height / 2;
|
|
8529
|
-
const path =
|
|
8581
|
+
const path = data.path = [];
|
|
8530
8582
|
let open;
|
|
8531
8583
|
if (innerRadius) {
|
|
8532
8584
|
if (startAngle || endAngle) {
|
|
@@ -8548,7 +8600,7 @@ var LeaferUI = function(exports) {
|
|
|
8548
8600
|
}
|
|
8549
8601
|
}
|
|
8550
8602
|
if (!open) closePath$2(path);
|
|
8551
|
-
if (Platform.ellipseToCurve)
|
|
8603
|
+
if (Platform.ellipseToCurve || data.__useArrow) data.path = this.getPath(true);
|
|
8552
8604
|
}
|
|
8553
8605
|
};
|
|
8554
8606
|
__decorate([ dataProcessor(EllipseData) ], exports.Ellipse.prototype, "__", void 0);
|
|
@@ -8938,8 +8990,8 @@ var LeaferUI = function(exports) {
|
|
|
8938
8990
|
canvas.save();
|
|
8939
8991
|
if (item.transform) canvas.transform(item.transform);
|
|
8940
8992
|
if (originPaint.scaleFixed) {
|
|
8941
|
-
const {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
8942
|
-
if (
|
|
8993
|
+
const {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, originPaint.scaleFixed, false);
|
|
8994
|
+
if (scaleX !== 1) canvas.scale(scaleX, scaleY);
|
|
8943
8995
|
}
|
|
8944
8996
|
if (originPaint.blendMode) canvas.blendMode = originPaint.blendMode;
|
|
8945
8997
|
fillPathOrText(ui, canvas, renderOptions);
|
|
@@ -9336,6 +9388,7 @@ var LeaferUI = function(exports) {
|
|
|
9336
9388
|
const clip = transform && !transform.onlyScale || data.path || data.cornerRadius;
|
|
9337
9389
|
if (clip || opacity && opacity < 1 || blendMode) leafPaint.complex = clip ? 2 : true;
|
|
9338
9390
|
}
|
|
9391
|
+
if (paint.filter) PaintImage.applyFilter(leafPaint, image, paint.filter, ui);
|
|
9339
9392
|
return true;
|
|
9340
9393
|
}
|
|
9341
9394
|
function onLoad(ui, event) {
|
|
@@ -9539,7 +9592,7 @@ var LeaferUI = function(exports) {
|
|
|
9539
9592
|
let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
|
|
9540
9593
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
9541
9594
|
if (!(Platform.image.isLarge(paint.image, scaleX, scaleY) && !paint.data.repeat)) {
|
|
9542
|
-
const {image: image, data: data} = paint, {opacity: opacity
|
|
9595
|
+
const {image: image, data: data} = paint, {opacity: opacity} = paint.originPaint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
|
|
9543
9596
|
let imageMatrix, xGap, yGap, {width: width, height: height} = image;
|
|
9544
9597
|
if (fixScale) scaleX *= fixScale, scaleY *= fixScale;
|
|
9545
9598
|
width *= scaleX;
|
|
@@ -9555,7 +9608,7 @@ var LeaferUI = function(exports) {
|
|
|
9555
9608
|
if (transform) copy$1(imageMatrix, transform);
|
|
9556
9609
|
scale(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
9557
9610
|
}
|
|
9558
|
-
const imageCanvas = image.getCanvas(width, height, opacity,
|
|
9611
|
+
const imageCanvas = image.getCanvas(width, height, opacity, undefined, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
|
|
9559
9612
|
const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
9560
9613
|
paint.style = pattern;
|
|
9561
9614
|
paint.patternId = id;
|
|
@@ -9641,6 +9694,7 @@ var LeaferUI = function(exports) {
|
|
|
9641
9694
|
if (!recycleMap) recycleMap = {};
|
|
9642
9695
|
recycleMap[url] = true;
|
|
9643
9696
|
ImageManager.recyclePaint(paint);
|
|
9697
|
+
if (data.__willDestroy && image.parent) PaintImage.recycleFilter(image, data.__leaf);
|
|
9644
9698
|
if (image.loading) {
|
|
9645
9699
|
if (!input) {
|
|
9646
9700
|
input = data.__input && data.__input[attrName] || [];
|