@leafer/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 +11 -0
- package/dist/worker.esm.js +2 -0
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +334 -146
- 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 +363 -147
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +25 -24
- package/src/index.ts +1 -0
package/dist/worker.module.js
CHANGED
|
@@ -252,6 +252,7 @@ class LeafData {
|
|
|
252
252
|
}
|
|
253
253
|
destroy() {
|
|
254
254
|
this.__input = this.__middle = null;
|
|
255
|
+
if (this.__complexData) this.__complexData.destroy();
|
|
255
256
|
}
|
|
256
257
|
}
|
|
257
258
|
|
|
@@ -350,6 +351,8 @@ const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumbe
|
|
|
350
351
|
|
|
351
352
|
const {round: round$6, pow: pow$2, max: max$6, floor: floor$3, PI: PI$4} = Math;
|
|
352
353
|
|
|
354
|
+
const tempScaleData$1 = {};
|
|
355
|
+
|
|
353
356
|
const MathHelper = {
|
|
354
357
|
within(value, min, max) {
|
|
355
358
|
if (isObject(min)) max = min.max, min = min.min;
|
|
@@ -393,6 +396,24 @@ const MathHelper = {
|
|
|
393
396
|
} else if (scale) MathHelper.assignScale(scaleData, scale);
|
|
394
397
|
return scaleData;
|
|
395
398
|
},
|
|
399
|
+
getScaleFixedData(worldScaleData, scaleFixed, unscale, abs, _localScaleData) {
|
|
400
|
+
let {scaleX: scaleX, scaleY: scaleY} = worldScaleData;
|
|
401
|
+
if (abs || scaleFixed) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY);
|
|
402
|
+
if (scaleFixed) {
|
|
403
|
+
if (scaleFixed === true) {
|
|
404
|
+
scaleX = scaleY = unscale ? 1 : 1 / scaleX;
|
|
405
|
+
} else {
|
|
406
|
+
let minScale;
|
|
407
|
+
if (isNumber(scaleFixed)) minScale = scaleFixed; else if (scaleFixed === "zoom-in") minScale = 1;
|
|
408
|
+
if (minScale) {
|
|
409
|
+
if (scaleX > minScale || scaleY > minScale) scaleX = scaleY = unscale ? 1 : 1 / scaleX; else scaleX = scaleY = unscale ? 1 : 1 / minScale;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
tempScaleData$1.scaleX = scaleX;
|
|
414
|
+
tempScaleData$1.scaleY = scaleY;
|
|
415
|
+
return tempScaleData$1;
|
|
416
|
+
},
|
|
396
417
|
assignScale(scaleData, scale) {
|
|
397
418
|
if (isNumber(scale)) {
|
|
398
419
|
scaleData.scaleX = scaleData.scaleY = scale;
|
|
@@ -889,8 +910,8 @@ const PointHelper = {
|
|
|
889
910
|
if (isObject(originPoints[0])) points = [], originPoints.forEach(p => points.push(p.x, p.y));
|
|
890
911
|
return points;
|
|
891
912
|
},
|
|
892
|
-
isSame(t, point) {
|
|
893
|
-
return float$5(t.x) === float$5(point.x) && float$5(t.y) === float$5(point.y);
|
|
913
|
+
isSame(t, point, quick) {
|
|
914
|
+
return quick ? t.x === point.x && t.y === point.y : float$5(t.x) === float$5(point.x) && float$5(t.y) === float$5(point.y);
|
|
894
915
|
},
|
|
895
916
|
reset(t) {
|
|
896
917
|
P$7.reset(t);
|
|
@@ -965,8 +986,8 @@ class Point {
|
|
|
965
986
|
getAtan2(to) {
|
|
966
987
|
return PointHelper.getAtan2(this, to);
|
|
967
988
|
}
|
|
968
|
-
isSame(point) {
|
|
969
|
-
return PointHelper.isSame(this, point);
|
|
989
|
+
isSame(point, quick) {
|
|
990
|
+
return PointHelper.isSame(this, point, quick);
|
|
970
991
|
}
|
|
971
992
|
reset() {
|
|
972
993
|
PointHelper.reset(this);
|
|
@@ -1222,9 +1243,9 @@ const AroundHelper = {
|
|
|
1222
1243
|
}
|
|
1223
1244
|
if (!onlyBoxSize) to.x += box.x, to.y += box.y;
|
|
1224
1245
|
},
|
|
1225
|
-
getPoint(around, box, to) {
|
|
1246
|
+
getPoint(around, box, to, onlyBoxSize = true) {
|
|
1226
1247
|
if (!to) to = {};
|
|
1227
|
-
AroundHelper.toPoint(around, box, to,
|
|
1248
|
+
AroundHelper.toPoint(around, box, to, onlyBoxSize);
|
|
1228
1249
|
return to;
|
|
1229
1250
|
}
|
|
1230
1251
|
};
|
|
@@ -1491,6 +1512,9 @@ const BoundsHelper = {
|
|
|
1491
1512
|
y: y + height
|
|
1492
1513
|
} ];
|
|
1493
1514
|
},
|
|
1515
|
+
getPoint(t, around, onlyBoxSize = false, to) {
|
|
1516
|
+
return AroundHelper.getPoint(around, t, to, onlyBoxSize);
|
|
1517
|
+
},
|
|
1494
1518
|
hitRadiusPoint(t, point, pointMatrix) {
|
|
1495
1519
|
if (pointMatrix) point = PointHelper.tempToInnerRadiusPointOf(point, pointMatrix);
|
|
1496
1520
|
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);
|
|
@@ -1662,6 +1686,9 @@ class Bounds {
|
|
|
1662
1686
|
getPoints() {
|
|
1663
1687
|
return BoundsHelper.getPoints(this);
|
|
1664
1688
|
}
|
|
1689
|
+
getPoint(around, onlyBoxSize, to) {
|
|
1690
|
+
return BoundsHelper.getPoint(this, around, onlyBoxSize, to);
|
|
1691
|
+
}
|
|
1665
1692
|
hitPoint(point, pointMatrix) {
|
|
1666
1693
|
return BoundsHelper.hitPoint(this, point, pointMatrix);
|
|
1667
1694
|
}
|
|
@@ -4102,6 +4129,7 @@ const ImageManager = {
|
|
|
4102
4129
|
return image;
|
|
4103
4130
|
},
|
|
4104
4131
|
recycle(image) {
|
|
4132
|
+
if (image.parent) image = image.parent;
|
|
4105
4133
|
image.use--;
|
|
4106
4134
|
setTimeout(() => {
|
|
4107
4135
|
if (!image.use) {
|
|
@@ -4270,8 +4298,10 @@ class LeaferImage {
|
|
|
4270
4298
|
return undefined;
|
|
4271
4299
|
}
|
|
4272
4300
|
clearLevels(_checkUse) {}
|
|
4301
|
+
destroyFilter() {}
|
|
4273
4302
|
destroy() {
|
|
4274
4303
|
this.clearLevels();
|
|
4304
|
+
this.destroyFilter();
|
|
4275
4305
|
const {view: view} = this;
|
|
4276
4306
|
if (view && view.close) view.close();
|
|
4277
4307
|
this.config = {
|
|
@@ -4468,7 +4498,6 @@ function dimType(defaultValue) {
|
|
|
4468
4498
|
if (this.__setAttr(key, value)) {
|
|
4469
4499
|
const data = this.__;
|
|
4470
4500
|
DataHelper.stintSet(data, "__useDim", data.dim || data.bright || data.dimskip);
|
|
4471
|
-
this.__layout.surfaceChange();
|
|
4472
4501
|
}
|
|
4473
4502
|
}
|
|
4474
4503
|
}));
|
|
@@ -4518,7 +4547,6 @@ function sortType(defaultValue) {
|
|
|
4518
4547
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4519
4548
|
set(value) {
|
|
4520
4549
|
if (this.__setAttr(key, value)) {
|
|
4521
|
-
this.__layout.surfaceChange();
|
|
4522
4550
|
this.waitParent(() => {
|
|
4523
4551
|
this.parent.__layout.childrenSortChange();
|
|
4524
4552
|
});
|
|
@@ -4555,7 +4583,6 @@ function hitType(defaultValue) {
|
|
|
4555
4583
|
set(value) {
|
|
4556
4584
|
if (this.__setAttr(key, value)) {
|
|
4557
4585
|
this.__layout.hitCanvasChanged = true;
|
|
4558
|
-
if (Debug.showBounds === "hit") this.__layout.surfaceChange();
|
|
4559
4586
|
if (this.leafer) this.leafer.updateCursor();
|
|
4560
4587
|
}
|
|
4561
4588
|
}
|
|
@@ -4761,6 +4788,10 @@ const LeafHelper = {
|
|
|
4761
4788
|
if (layout.stateStyleChanged) leaf.updateState();
|
|
4762
4789
|
if (layout.opacityChanged) updateAllWorldOpacity(leaf);
|
|
4763
4790
|
leaf.__updateChange();
|
|
4791
|
+
if (layout.surfaceChanged) {
|
|
4792
|
+
if (leaf.__hasComplex) L$4.updateComplex(leaf);
|
|
4793
|
+
layout.surfaceChanged = false;
|
|
4794
|
+
}
|
|
4764
4795
|
},
|
|
4765
4796
|
updateAllChange(leaf) {
|
|
4766
4797
|
updateChange$1(leaf);
|
|
@@ -4785,6 +4816,9 @@ const LeafHelper = {
|
|
|
4785
4816
|
if (!fromWorld) fromWorld = leaf.__nowWorld;
|
|
4786
4817
|
if (leaf.__worldFlipped || Platform.fullImageShadow) currentCanvas.copyWorldByReset(fromCanvas, fromWorld, leaf.__nowWorld, blendMode, onlyResetTransform); else currentCanvas.copyWorldToInner(fromCanvas, fromWorld, leaf.__layout.renderBounds, blendMode);
|
|
4787
4818
|
},
|
|
4819
|
+
renderComplex(_leaf, _canvas, _options) {},
|
|
4820
|
+
updateComplex(_leaf) {},
|
|
4821
|
+
checkComplex(_leaf) {},
|
|
4788
4822
|
moveWorld(t, x, y = 0, isInnerPoint, transition) {
|
|
4789
4823
|
const local = isObject(x) ? Object.assign({}, x) : {
|
|
4790
4824
|
x: x,
|
|
@@ -4896,6 +4930,9 @@ const LeafHelper = {
|
|
|
4896
4930
|
divideParent(matrix$3, relative.scrollWorldTransform);
|
|
4897
4931
|
return temp ? matrix$3 : Object.assign({}, matrix$3);
|
|
4898
4932
|
},
|
|
4933
|
+
updateScaleFixedWorld(_t) {},
|
|
4934
|
+
updateOuterBounds(_t) {},
|
|
4935
|
+
cacheId(_t) {},
|
|
4899
4936
|
drop(t, parent, index, resize) {
|
|
4900
4937
|
t.setTransform(L$4.getRelativeWorld(t, parent, true), resize);
|
|
4901
4938
|
parent.add(t, index);
|
|
@@ -4946,7 +4983,8 @@ const LeafBoundsHelper = {
|
|
|
4946
4983
|
return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localStrokeBounds;
|
|
4947
4984
|
},
|
|
4948
4985
|
localRenderBounds(target) {
|
|
4949
|
-
|
|
4986
|
+
const {__: __, __layout: __layout} = target;
|
|
4987
|
+
return __.eraser || __.visible === 0 ? null : __layout.localOuterBounds || __layout.localRenderBounds;
|
|
4950
4988
|
},
|
|
4951
4989
|
maskLocalBoxBounds(target, index) {
|
|
4952
4990
|
return checkMask(target, index) && target.__localBoxBounds;
|
|
@@ -4955,7 +4993,8 @@ const LeafBoundsHelper = {
|
|
|
4955
4993
|
return checkMask(target, index) && target.__layout.localStrokeBounds;
|
|
4956
4994
|
},
|
|
4957
4995
|
maskLocalRenderBounds(target, index) {
|
|
4958
|
-
|
|
4996
|
+
const {__layout: __layout} = target;
|
|
4997
|
+
return checkMask(target, index) && (__layout.localOuterBounds || __layout.localRenderBounds);
|
|
4959
4998
|
},
|
|
4960
4999
|
excludeRenderBounds(child, options) {
|
|
4961
5000
|
if (options.bounds && !options.bounds.hit(child.__world, options.matrix)) return true;
|
|
@@ -5079,12 +5118,12 @@ const BranchHelper = {
|
|
|
5079
5118
|
w.height *= scaleY;
|
|
5080
5119
|
w.scaleX *= scaleX;
|
|
5081
5120
|
w.scaleY *= scaleY;
|
|
5082
|
-
if (branch.isBranch) scale$
|
|
5121
|
+
if (branch.isBranch) scale$3(branch, x, y, scaleX, scaleY, a, b);
|
|
5083
5122
|
}
|
|
5084
5123
|
}
|
|
5085
5124
|
};
|
|
5086
5125
|
|
|
5087
|
-
const {pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack: pushAllBranchStack, updateBoundsByBranchStack: updateBoundsByBranchStack, move: move$9, scale: scale$
|
|
5126
|
+
const {pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack: pushAllBranchStack, updateBoundsByBranchStack: updateBoundsByBranchStack, move: move$9, scale: scale$3} = BranchHelper;
|
|
5088
5127
|
|
|
5089
5128
|
const WaitHelper = {
|
|
5090
5129
|
run(wait) {
|
|
@@ -5475,7 +5514,6 @@ class LeafLayout {
|
|
|
5475
5514
|
}
|
|
5476
5515
|
opacityChange() {
|
|
5477
5516
|
this.opacityChanged = true;
|
|
5478
|
-
this.surfaceChanged || this.surfaceChange();
|
|
5479
5517
|
}
|
|
5480
5518
|
childrenSortChange() {
|
|
5481
5519
|
if (!this.childrenSortChanged) {
|
|
@@ -5968,6 +6006,7 @@ const LeafMatrix = {
|
|
|
5968
6006
|
const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
|
|
5969
6007
|
multiplyParent$2(this.__local || __layout, parent ? parent.__scrollWorld || parent.__world : defaultWorld, __world, !!__layout.affectScaleOrRotation, __);
|
|
5970
6008
|
if (__scrollWorld) translateInner(Object.assign(__scrollWorld, __world), __.scrollX, __.scrollY);
|
|
6009
|
+
if (__layout.scaleFixed) LeafHelper.updateScaleFixedWorld(this);
|
|
5971
6010
|
},
|
|
5972
6011
|
__updateLocalMatrix() {
|
|
5973
6012
|
if (this.__local) {
|
|
@@ -5993,7 +6032,7 @@ const {updateMatrix: updateMatrix$3, updateAllMatrix: updateAllMatrix$3} = LeafH
|
|
|
5993
6032
|
|
|
5994
6033
|
const {updateBounds: updateBounds$2} = BranchHelper;
|
|
5995
6034
|
|
|
5996
|
-
const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$
|
|
6035
|
+
const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$4, copy: copy$6} = BoundsHelper;
|
|
5997
6036
|
|
|
5998
6037
|
const {toBounds: toBounds$1} = PathBounds;
|
|
5999
6038
|
|
|
@@ -6001,6 +6040,7 @@ const LeafBounds = {
|
|
|
6001
6040
|
__updateWorldBounds() {
|
|
6002
6041
|
const {__layout: __layout, __world: __world} = this;
|
|
6003
6042
|
toOuterOf$2(__layout.renderBounds, __world, __world);
|
|
6043
|
+
if (this.__hasComplex) LeafHelper.checkComplex(this);
|
|
6004
6044
|
if (__layout.resized) {
|
|
6005
6045
|
if (__layout.resized === "inner") this.__onUpdateSize();
|
|
6006
6046
|
if (this.__hasLocalEvent) BoundsEvent.emitLocal(this);
|
|
@@ -6050,6 +6090,7 @@ const LeafBounds = {
|
|
|
6050
6090
|
layout.renderChanged = undefined;
|
|
6051
6091
|
if (this.parent) this.parent.__layout.renderChange();
|
|
6052
6092
|
}
|
|
6093
|
+
if (layout.outerScale) LeafHelper.updateOuterBounds(this);
|
|
6053
6094
|
layout.resized || (layout.resized = "local");
|
|
6054
6095
|
layout.boundsChanged = undefined;
|
|
6055
6096
|
},
|
|
@@ -6100,11 +6141,11 @@ const LeafBounds = {
|
|
|
6100
6141
|
},
|
|
6101
6142
|
__updateStrokeBounds(_bounds) {
|
|
6102
6143
|
const layout = this.__layout;
|
|
6103
|
-
copyAndSpread$
|
|
6144
|
+
copyAndSpread$4(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
|
|
6104
6145
|
},
|
|
6105
6146
|
__updateRenderBounds(_bounds) {
|
|
6106
6147
|
const layout = this.__layout, {renderSpread: renderSpread} = layout;
|
|
6107
|
-
isNumber(renderSpread) && renderSpread <= 0 ? copy$6(layout.renderBounds, layout.strokeBounds) : copyAndSpread$
|
|
6148
|
+
isNumber(renderSpread) && renderSpread <= 0 ? copy$6(layout.renderBounds, layout.strokeBounds) : copyAndSpread$4(layout.renderBounds, layout.boxBounds, renderSpread);
|
|
6108
6149
|
}
|
|
6109
6150
|
};
|
|
6110
6151
|
|
|
@@ -6116,7 +6157,7 @@ const LeafRender = {
|
|
|
6116
6157
|
const data = this.__;
|
|
6117
6158
|
if (data.bright && !options.topRendering) return options.topList.add(this);
|
|
6118
6159
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
6119
|
-
canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
|
|
6160
|
+
canvas.opacity = options.ignoreOpacity ? 1 : options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
|
|
6120
6161
|
if (this.__.__single) {
|
|
6121
6162
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
6122
6163
|
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
@@ -6170,7 +6211,7 @@ const BranchRender = {
|
|
|
6170
6211
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
6171
6212
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
6172
6213
|
this.__renderBranch(tempCanvas, options);
|
|
6173
|
-
canvas.opacity = options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
|
|
6214
|
+
canvas.opacity = options.ignoreOpacity ? 1 : options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
|
|
6174
6215
|
canvas.copyWorldByReset(tempCanvas, nowWorld, nowWorld, data.__blendMode, true);
|
|
6175
6216
|
tempCanvas.recycle(nowWorld);
|
|
6176
6217
|
} else {
|
|
@@ -6186,7 +6227,7 @@ const BranchRender = {
|
|
|
6186
6227
|
const {children: children} = this;
|
|
6187
6228
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
6188
6229
|
child = children[i];
|
|
6189
|
-
excludeRenderBounds$1(child, options) || (child.
|
|
6230
|
+
excludeRenderBounds$1(child, options) || (child.__hasComplex ? LeafHelper.renderComplex(child, canvas, options) : child.__render(canvas, options));
|
|
6190
6231
|
}
|
|
6191
6232
|
}
|
|
6192
6233
|
},
|
|
@@ -6200,11 +6241,9 @@ const BranchRender = {
|
|
|
6200
6241
|
}
|
|
6201
6242
|
};
|
|
6202
6243
|
|
|
6203
|
-
const tempScaleData$1 = {};
|
|
6204
|
-
|
|
6205
6244
|
const {LEAF: LEAF, create: create} = IncrementId;
|
|
6206
6245
|
|
|
6207
|
-
const {stintSet: stintSet$
|
|
6246
|
+
const {stintSet: stintSet$6} = DataHelper;
|
|
6208
6247
|
|
|
6209
6248
|
const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
|
|
6210
6249
|
|
|
@@ -6212,6 +6251,8 @@ const {toOuterOf: toOuterOf$1} = BoundsHelper;
|
|
|
6212
6251
|
|
|
6213
6252
|
const {copy: copy$5, move: move$8} = PointHelper;
|
|
6214
6253
|
|
|
6254
|
+
const {getScaleFixedData: getScaleFixedData$1} = MathHelper;
|
|
6255
|
+
|
|
6215
6256
|
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;
|
|
6216
6257
|
|
|
6217
6258
|
let Leaf = class Leaf {
|
|
@@ -6370,6 +6411,7 @@ let Leaf = class Leaf {
|
|
|
6370
6411
|
this.__level = this.parent ? this.parent.__level + 1 : 1;
|
|
6371
6412
|
if (this.animation) this.__runAnimation("in");
|
|
6372
6413
|
if (this.__bubbleMap) this.__emitLifeEvent(ChildEvent.MOUNTED);
|
|
6414
|
+
if (leafer.cacheId) LeafHelper.cacheId(this);
|
|
6373
6415
|
} else {
|
|
6374
6416
|
this.__emitLifeEvent(ChildEvent.UNMOUNTED);
|
|
6375
6417
|
}
|
|
@@ -6487,8 +6529,8 @@ let Leaf = class Leaf {
|
|
|
6487
6529
|
const cameraWorld = this.__cameraWorld, world = this.__world;
|
|
6488
6530
|
multiplyParent$1(world, options.matrix, cameraWorld, undefined, world);
|
|
6489
6531
|
toOuterOf$1(this.__layout.renderBounds, cameraWorld, cameraWorld);
|
|
6490
|
-
stintSet$
|
|
6491
|
-
stintSet$
|
|
6532
|
+
stintSet$6(cameraWorld, "half", world.half);
|
|
6533
|
+
stintSet$6(cameraWorld, "ignorePixelSnap", world.ignorePixelSnap);
|
|
6492
6534
|
return cameraWorld;
|
|
6493
6535
|
} else {
|
|
6494
6536
|
return this.__world;
|
|
@@ -6499,13 +6541,8 @@ let Leaf = class Leaf {
|
|
|
6499
6541
|
if (scaleX < 0) scaleX = -scaleX;
|
|
6500
6542
|
return scaleX > 1 ? scaleX : 1;
|
|
6501
6543
|
}
|
|
6502
|
-
getRenderScaleData(abs, scaleFixed) {
|
|
6503
|
-
|
|
6504
|
-
if (abs) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY);
|
|
6505
|
-
if (scaleFixed === true || scaleFixed === "zoom-in" && scaleX > 1 && scaleY > 1) scaleX = scaleY = 1;
|
|
6506
|
-
tempScaleData$1.scaleX = scaleX;
|
|
6507
|
-
tempScaleData$1.scaleY = scaleY;
|
|
6508
|
-
return tempScaleData$1;
|
|
6544
|
+
getRenderScaleData(abs, scaleFixed, unscale = true) {
|
|
6545
|
+
return getScaleFixedData$1(ImageManager.patternLocked ? this.__world : this.__nowWorld || this.__world, scaleFixed, unscale, abs);
|
|
6509
6546
|
}
|
|
6510
6547
|
getTransform(relative) {
|
|
6511
6548
|
return this.__layout.getTransform(relative || "local");
|
|
@@ -6667,7 +6704,6 @@ let Leaf = class Leaf {
|
|
|
6667
6704
|
__drawHitPath(_canvas) {}
|
|
6668
6705
|
__updateHitCanvas() {}
|
|
6669
6706
|
__render(_canvas, _options) {}
|
|
6670
|
-
__renderComplex(_canvas, _options) {}
|
|
6671
6707
|
__drawFast(_canvas, _options) {}
|
|
6672
6708
|
__draw(_canvas, _options, _originCanvas) {}
|
|
6673
6709
|
__clip(_canvas, _options) {}
|
|
@@ -6678,7 +6714,7 @@ let Leaf = class Leaf {
|
|
|
6678
6714
|
__drawPath(_canvas) {}
|
|
6679
6715
|
__drawRenderPath(_canvas) {}
|
|
6680
6716
|
__updatePath() {}
|
|
6681
|
-
__updateRenderPath() {}
|
|
6717
|
+
__updateRenderPath(_updateCache) {}
|
|
6682
6718
|
getMotionPathData() {
|
|
6683
6719
|
return Plugin.need("path");
|
|
6684
6720
|
}
|
|
@@ -6752,9 +6788,11 @@ let Branch = class Branch extends Leaf {
|
|
|
6752
6788
|
return 0;
|
|
6753
6789
|
}
|
|
6754
6790
|
__updateRenderSpread() {
|
|
6791
|
+
let layout;
|
|
6755
6792
|
const {children: children} = this;
|
|
6756
6793
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
6757
|
-
|
|
6794
|
+
layout = children[i].__layout;
|
|
6795
|
+
if (layout.renderSpread || layout.localOuterBounds) return 1;
|
|
6758
6796
|
}
|
|
6759
6797
|
return 0;
|
|
6760
6798
|
}
|
|
@@ -7013,7 +7051,7 @@ class LeafLevelList {
|
|
|
7013
7051
|
}
|
|
7014
7052
|
}
|
|
7015
7053
|
|
|
7016
|
-
const version = "2.0.
|
|
7054
|
+
const version = "2.0.3";
|
|
7017
7055
|
|
|
7018
7056
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
7019
7057
|
get allowBackgroundColor() {
|
|
@@ -7852,7 +7890,7 @@ class Selector {
|
|
|
7852
7890
|
this.config = {};
|
|
7853
7891
|
if (userConfig) this.config = DataHelper.default(userConfig, this.config);
|
|
7854
7892
|
this.picker = new Picker(this.target = target, this);
|
|
7855
|
-
this.finder = Creator.finder && Creator.finder();
|
|
7893
|
+
this.finder = Creator.finder && Creator.finder(target, this.config);
|
|
7856
7894
|
}
|
|
7857
7895
|
getByPoint(hitPoint, hitRadius, options) {
|
|
7858
7896
|
const {target: target, picker: picker} = this;
|
|
@@ -7894,7 +7932,9 @@ function effectType(defaultValue) {
|
|
|
7894
7932
|
set(value) {
|
|
7895
7933
|
this.__setAttr(key, value);
|
|
7896
7934
|
if (value) this.__.__useEffect = true;
|
|
7897
|
-
|
|
7935
|
+
const layout = this.__layout;
|
|
7936
|
+
layout.renderChanged || layout.renderChange();
|
|
7937
|
+
layout.surfaceChange();
|
|
7898
7938
|
}
|
|
7899
7939
|
}));
|
|
7900
7940
|
}
|
|
@@ -7997,7 +8037,7 @@ const Transition = {
|
|
|
7997
8037
|
|
|
7998
8038
|
const {parse: parse, objectToCanvasData: objectToCanvasData} = PathConvert;
|
|
7999
8039
|
|
|
8000
|
-
const {stintSet: stintSet$
|
|
8040
|
+
const {stintSet: stintSet$5} = DataHelper, {hasTransparent: hasTransparent$2} = ColorConvert;
|
|
8001
8041
|
|
|
8002
8042
|
const emptyPaint = {
|
|
8003
8043
|
originPaint: {}
|
|
@@ -8066,7 +8106,7 @@ class UIData extends LeafData {
|
|
|
8066
8106
|
setFill(value) {
|
|
8067
8107
|
if (this.__naturalWidth) this.__removeNaturalSize();
|
|
8068
8108
|
if (isString(value) || !value) {
|
|
8069
|
-
stintSet$
|
|
8109
|
+
stintSet$5(this, "__isTransparentFill", hasTransparent$2(value));
|
|
8070
8110
|
this.__isFills && this.__removePaint("fill", true);
|
|
8071
8111
|
this._fill = value;
|
|
8072
8112
|
} else if (isObject(value)) {
|
|
@@ -8075,7 +8115,7 @@ class UIData extends LeafData {
|
|
|
8075
8115
|
}
|
|
8076
8116
|
setStroke(value) {
|
|
8077
8117
|
if (isString(value) || !value) {
|
|
8078
|
-
stintSet$
|
|
8118
|
+
stintSet$5(this, "__isTransparentStroke", hasTransparent$2(value));
|
|
8079
8119
|
this.__isStrokes && this.__removePaint("stroke", true);
|
|
8080
8120
|
this._stroke = value;
|
|
8081
8121
|
} else if (isObject(value)) {
|
|
@@ -8108,15 +8148,16 @@ class UIData extends LeafData {
|
|
|
8108
8148
|
this.__needComputePaint = undefined;
|
|
8109
8149
|
}
|
|
8110
8150
|
__getRealStrokeWidth(childStyle) {
|
|
8111
|
-
let {strokeWidth: strokeWidth,
|
|
8151
|
+
let {strokeWidth: strokeWidth, strokeScaleFixed: strokeScaleFixed} = this;
|
|
8112
8152
|
if (childStyle) {
|
|
8113
8153
|
if (childStyle.strokeWidth) strokeWidth = childStyle.strokeWidth;
|
|
8114
|
-
if (!isUndefined(childStyle.
|
|
8154
|
+
if (!isUndefined(childStyle.strokeScaleFixed)) strokeScaleFixed = childStyle.strokeScaleFixed;
|
|
8115
8155
|
}
|
|
8116
|
-
if (
|
|
8117
|
-
const
|
|
8118
|
-
|
|
8119
|
-
}
|
|
8156
|
+
if (strokeScaleFixed) {
|
|
8157
|
+
const {scaleX: scaleX} = this.__leaf.getRenderScaleData(true, strokeScaleFixed, false);
|
|
8158
|
+
if (scaleX !== 1) return strokeWidth * scaleX;
|
|
8159
|
+
}
|
|
8160
|
+
return strokeWidth;
|
|
8120
8161
|
}
|
|
8121
8162
|
__setPaint(attrName, value) {
|
|
8122
8163
|
this.__setInput(attrName, value);
|
|
@@ -8133,11 +8174,11 @@ class UIData extends LeafData {
|
|
|
8133
8174
|
if (removeInput) this.__removeInput(attrName);
|
|
8134
8175
|
PaintImage.recycleImage(attrName, this);
|
|
8135
8176
|
if (attrName === "fill") {
|
|
8136
|
-
stintSet$
|
|
8177
|
+
stintSet$5(this, "__isAlphaPixelFill", undefined);
|
|
8137
8178
|
this._fill = this.__isFills = undefined;
|
|
8138
8179
|
} else {
|
|
8139
|
-
stintSet$
|
|
8140
|
-
stintSet$
|
|
8180
|
+
stintSet$5(this, "__isAlphaPixelStroke", undefined);
|
|
8181
|
+
stintSet$5(this, "__hasMultiStrokeStyle", undefined);
|
|
8141
8182
|
this._stroke = this.__isStrokes = undefined;
|
|
8142
8183
|
}
|
|
8143
8184
|
}
|
|
@@ -8302,7 +8343,7 @@ const UIBounds = {
|
|
|
8302
8343
|
const data = this.__, {strokeAlign: strokeAlign, __maxStrokeWidth: strokeWidth} = data, box = this.__box;
|
|
8303
8344
|
if ((data.stroke || data.hitStroke === "all") && strokeWidth && strokeAlign !== "inside") {
|
|
8304
8345
|
boxSpread = spread = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
|
|
8305
|
-
if (!data.__boxStroke) {
|
|
8346
|
+
if (!data.__boxStroke || data.__useArrow) {
|
|
8306
8347
|
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * spread;
|
|
8307
8348
|
const storkeCapAddWidth = data.strokeCap === "none" ? 0 : strokeWidth;
|
|
8308
8349
|
spread += Math.max(miterLimitAddWidth, storkeCapAddWidth);
|
|
@@ -8332,23 +8373,23 @@ const UIBounds = {
|
|
|
8332
8373
|
}
|
|
8333
8374
|
};
|
|
8334
8375
|
|
|
8335
|
-
const {stintSet: stintSet$
|
|
8376
|
+
const {stintSet: stintSet$4} = DataHelper;
|
|
8336
8377
|
|
|
8337
8378
|
const UIRender = {
|
|
8338
8379
|
__updateChange() {
|
|
8339
8380
|
const data = this.__;
|
|
8340
8381
|
if (data.__useStroke) {
|
|
8341
8382
|
const useStroke = data.__useStroke = !!(data.stroke && data.strokeWidth);
|
|
8342
|
-
stintSet$
|
|
8343
|
-
stintSet$
|
|
8383
|
+
stintSet$4(this.__world, "half", useStroke && data.strokeAlign === "center" && data.strokeWidth % 2);
|
|
8384
|
+
stintSet$4(data, "__fillAfterStroke", useStroke && data.strokeAlign === "outside" && data.fill && !data.__isTransparentFill);
|
|
8344
8385
|
}
|
|
8345
8386
|
if (data.__useEffect) {
|
|
8346
8387
|
const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
8347
|
-
stintSet$
|
|
8388
|
+
stintSet$4(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !Effect.isTransformShadow(shadow[0]) && fill && !data.__isTransparentFill && !(isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
|
|
8348
8389
|
data.__useEffect = !!(shadow || otherEffect);
|
|
8349
8390
|
}
|
|
8350
8391
|
data.__checkSingle();
|
|
8351
|
-
stintSet$
|
|
8392
|
+
stintSet$4(data, "__complex", data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
8352
8393
|
},
|
|
8353
8394
|
__drawFast(canvas, options) {
|
|
8354
8395
|
drawFast(this, canvas, options);
|
|
@@ -8459,6 +8500,12 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8459
8500
|
get isFrame() {
|
|
8460
8501
|
return false;
|
|
8461
8502
|
}
|
|
8503
|
+
set strokeWidthFixed(value) {
|
|
8504
|
+
this.strokeScaleFixed = value;
|
|
8505
|
+
}
|
|
8506
|
+
get strokeWidthFixed() {
|
|
8507
|
+
return this.strokeScaleFixed;
|
|
8508
|
+
}
|
|
8462
8509
|
set scale(value) {
|
|
8463
8510
|
MathHelper.assignScale(this, value);
|
|
8464
8511
|
}
|
|
@@ -8514,6 +8561,9 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8514
8561
|
getPathString(curve, pathForRender, floatLength) {
|
|
8515
8562
|
return PathConvert.stringify(this.getPath(curve, pathForRender), floatLength);
|
|
8516
8563
|
}
|
|
8564
|
+
asPath(curve, pathForRender) {
|
|
8565
|
+
this.path = this.getPath(curve, pathForRender);
|
|
8566
|
+
}
|
|
8517
8567
|
load() {
|
|
8518
8568
|
this.__.__computePaint();
|
|
8519
8569
|
}
|
|
@@ -8523,16 +8573,18 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8523
8573
|
data.lazy && !this.__inLazyBounds && !Export.running ? data.__needComputePaint = true : data.__computePaint();
|
|
8524
8574
|
}
|
|
8525
8575
|
}
|
|
8526
|
-
__updateRenderPath() {
|
|
8576
|
+
__updateRenderPath(updateCache) {
|
|
8527
8577
|
const data = this.__;
|
|
8528
8578
|
if (data.path) {
|
|
8529
8579
|
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
8530
|
-
if (data.__useArrow) PathArrow.addArrows(this);
|
|
8580
|
+
if (data.__useArrow) PathArrow.addArrows(this, updateCache);
|
|
8531
8581
|
} else data.__pathForRender && (data.__pathForRender = undefined);
|
|
8532
8582
|
}
|
|
8533
8583
|
__drawRenderPath(canvas) {
|
|
8584
|
+
const data = this.__;
|
|
8534
8585
|
canvas.beginPath();
|
|
8535
|
-
|
|
8586
|
+
if (data.__useArrow) PathArrow.updateArrow(this);
|
|
8587
|
+
this.__drawPathByData(canvas, data.__pathForRender);
|
|
8536
8588
|
}
|
|
8537
8589
|
__drawPath(canvas) {
|
|
8538
8590
|
canvas.beginPath();
|
|
@@ -8581,6 +8633,7 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8581
8633
|
static setEditOuter(_toolName) {}
|
|
8582
8634
|
static setEditInner(_editorName) {}
|
|
8583
8635
|
destroy() {
|
|
8636
|
+
this.__.__willDestroy = true;
|
|
8584
8637
|
this.fill = this.stroke = null;
|
|
8585
8638
|
if (this.__animate) this.killAnimate();
|
|
8586
8639
|
super.destroy();
|
|
@@ -8697,7 +8750,7 @@ __decorate([ strokeType("inside") ], UI.prototype, "strokeAlign", void 0);
|
|
|
8697
8750
|
|
|
8698
8751
|
__decorate([ strokeType(1, true) ], UI.prototype, "strokeWidth", void 0);
|
|
8699
8752
|
|
|
8700
|
-
__decorate([ strokeType(false) ], UI.prototype, "
|
|
8753
|
+
__decorate([ strokeType(false) ], UI.prototype, "strokeScaleFixed", void 0);
|
|
8701
8754
|
|
|
8702
8755
|
__decorate([ strokeType("none") ], UI.prototype, "strokeCap", void 0);
|
|
8703
8756
|
|
|
@@ -9329,9 +9382,9 @@ let Ellipse = class Ellipse extends UI {
|
|
|
9329
9382
|
return "Ellipse";
|
|
9330
9383
|
}
|
|
9331
9384
|
__updatePath() {
|
|
9332
|
-
const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} =
|
|
9385
|
+
const data = this.__, {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = data;
|
|
9333
9386
|
const rx = width / 2, ry = height / 2;
|
|
9334
|
-
const path =
|
|
9387
|
+
const path = data.path = [];
|
|
9335
9388
|
let open;
|
|
9336
9389
|
if (innerRadius) {
|
|
9337
9390
|
if (startAngle || endAngle) {
|
|
@@ -9353,7 +9406,7 @@ let Ellipse = class Ellipse extends UI {
|
|
|
9353
9406
|
}
|
|
9354
9407
|
}
|
|
9355
9408
|
if (!open) closePath$2(path);
|
|
9356
|
-
if (Platform.ellipseToCurve)
|
|
9409
|
+
if (Platform.ellipseToCurve || data.__useArrow) data.path = this.getPath(true);
|
|
9357
9410
|
}
|
|
9358
9411
|
};
|
|
9359
9412
|
|
|
@@ -9577,7 +9630,7 @@ __decorate([ resizeType() ], Canvas.prototype, "contextSettings", void 0);
|
|
|
9577
9630
|
|
|
9578
9631
|
Canvas = __decorate([ registerUI() ], Canvas);
|
|
9579
9632
|
|
|
9580
|
-
const {copyAndSpread: copyAndSpread$
|
|
9633
|
+
const {copyAndSpread: copyAndSpread$3, includes: includes, spread: spread, setList: setList} = BoundsHelper, {stintSet: stintSet$3} = DataHelper;
|
|
9581
9634
|
|
|
9582
9635
|
let Text = class Text extends UI {
|
|
9583
9636
|
get __tag() {
|
|
@@ -9594,9 +9647,9 @@ let Text = class Text extends UI {
|
|
|
9594
9647
|
data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
|
|
9595
9648
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * .7) / 2;
|
|
9596
9649
|
data.__font = `${italic ? "italic " : ""}${textCase === "small-caps" ? "small-caps " : ""}${fontWeight !== "normal" ? fontWeight + " " : ""}${fontSize || 12}px ${fontFamily || "caption"}`;
|
|
9597
|
-
stintSet$
|
|
9598
|
-
stintSet$
|
|
9599
|
-
stintSet$
|
|
9650
|
+
stintSet$3(data, "__padding", padding && MathHelper.fourNumber(padding));
|
|
9651
|
+
stintSet$3(data, "__clipText", textOverflow !== "show" && !data.__autoSize);
|
|
9652
|
+
stintSet$3(data, "__isCharMode", width || height || data.__letterSpacing || textCase !== "none");
|
|
9600
9653
|
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === "") ? data.placeholder : data.text, this.__);
|
|
9601
9654
|
}
|
|
9602
9655
|
__updateBoxBounds() {
|
|
@@ -9631,7 +9684,7 @@ let Text = class Text extends UI {
|
|
|
9631
9684
|
}
|
|
9632
9685
|
__updateRenderBounds() {
|
|
9633
9686
|
const {renderBounds: renderBounds, renderSpread: renderSpread} = this.__layout;
|
|
9634
|
-
copyAndSpread$
|
|
9687
|
+
copyAndSpread$3(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
9635
9688
|
if (this.__box) this.__box.__layout.renderBounds = renderBounds;
|
|
9636
9689
|
}
|
|
9637
9690
|
__updateChange() {
|
|
@@ -9893,7 +9946,7 @@ let App = class App extends Leafer {
|
|
|
9893
9946
|
if (this.viewReady) this.renderer.update();
|
|
9894
9947
|
}
|
|
9895
9948
|
__render(canvas, options) {
|
|
9896
|
-
if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options.bounds));
|
|
9949
|
+
if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options.bounds, undefined, undefined, true));
|
|
9897
9950
|
}
|
|
9898
9951
|
__onResize(event) {
|
|
9899
9952
|
this.forEach(leafer => leafer.resize(event));
|
|
@@ -11336,8 +11389,8 @@ function fills(fills, ui, canvas, renderOptions) {
|
|
|
11336
11389
|
canvas.save();
|
|
11337
11390
|
if (item.transform) canvas.transform(item.transform);
|
|
11338
11391
|
if (originPaint.scaleFixed) {
|
|
11339
|
-
const {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
11340
|
-
if (
|
|
11392
|
+
const {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, originPaint.scaleFixed, false);
|
|
11393
|
+
if (scaleX !== 1) canvas.scale(scaleX, scaleY);
|
|
11341
11394
|
}
|
|
11342
11395
|
if (originPaint.blendMode) canvas.blendMode = originPaint.blendMode;
|
|
11343
11396
|
fillPathOrText(ui, canvas, renderOptions);
|
|
@@ -11508,7 +11561,7 @@ function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas, renderO
|
|
|
11508
11561
|
}
|
|
11509
11562
|
}
|
|
11510
11563
|
|
|
11511
|
-
const {getSpread: getSpread, copyAndSpread: copyAndSpread$
|
|
11564
|
+
const {getSpread: getSpread, copyAndSpread: copyAndSpread$2, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$7, getIntersectData: getIntersectData} = BoundsHelper;
|
|
11512
11565
|
|
|
11513
11566
|
const tempBounds$2 = {};
|
|
11514
11567
|
|
|
@@ -11516,7 +11569,7 @@ function shape(ui, current, options) {
|
|
|
11516
11569
|
const canvas = current.getSameCanvas();
|
|
11517
11570
|
const currentBounds = current.bounds, nowWorld = ui.__nowWorld, layout = ui.__layout;
|
|
11518
11571
|
const nowWorldShapeBounds = ui.__nowWorldShapeBounds || (ui.__nowWorldShapeBounds = {});
|
|
11519
|
-
toOuterOf(layout.strokeSpread ? (copyAndSpread$
|
|
11572
|
+
toOuterOf(layout.strokeSpread ? (copyAndSpread$2(tempBounds$2, layout.boxBounds, layout.strokeSpread),
|
|
11520
11573
|
tempBounds$2) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
|
|
11521
11574
|
let bounds, renderBounds, matrix, fitMatrix, shapeBounds, worldCanvas;
|
|
11522
11575
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
@@ -11572,7 +11625,7 @@ function shape(ui, current, options) {
|
|
|
11572
11625
|
|
|
11573
11626
|
let recycleMap;
|
|
11574
11627
|
|
|
11575
|
-
const {stintSet: stintSet} = DataHelper, {hasTransparent: hasTransparent$1} = ColorConvert;
|
|
11628
|
+
const {stintSet: stintSet$2} = DataHelper, {hasTransparent: hasTransparent$1} = ColorConvert;
|
|
11576
11629
|
|
|
11577
11630
|
function compute(attrName, ui) {
|
|
11578
11631
|
const data = ui.__, leafPaints = [];
|
|
@@ -11596,12 +11649,12 @@ function compute(attrName, ui) {
|
|
|
11596
11649
|
isTransparent = true;
|
|
11597
11650
|
}
|
|
11598
11651
|
if (attrName === "fill") {
|
|
11599
|
-
stintSet(data, "__isAlphaPixelFill", isAlphaPixel);
|
|
11600
|
-
stintSet(data, "__isTransparentFill", isTransparent);
|
|
11652
|
+
stintSet$2(data, "__isAlphaPixelFill", isAlphaPixel);
|
|
11653
|
+
stintSet$2(data, "__isTransparentFill", isTransparent);
|
|
11601
11654
|
} else {
|
|
11602
|
-
stintSet(data, "__isAlphaPixelStroke", isAlphaPixel);
|
|
11603
|
-
stintSet(data, "__isTransparentStroke", isTransparent);
|
|
11604
|
-
stintSet(data, "__hasMultiStrokeStyle", maxChildStrokeWidth);
|
|
11655
|
+
stintSet$2(data, "__isAlphaPixelStroke", isAlphaPixel);
|
|
11656
|
+
stintSet$2(data, "__isTransparentStroke", isTransparent);
|
|
11657
|
+
stintSet$2(data, "__hasMultiStrokeStyle", maxChildStrokeWidth);
|
|
11605
11658
|
}
|
|
11606
11659
|
} else {
|
|
11607
11660
|
data.__removePaint(attrName, false);
|
|
@@ -11674,12 +11727,12 @@ const PaintModule = {
|
|
|
11674
11727
|
|
|
11675
11728
|
let cache$1, box$2 = new Bounds;
|
|
11676
11729
|
|
|
11677
|
-
const {isSame: isSame} = BoundsHelper;
|
|
11730
|
+
const {isSame: isSame$1} = BoundsHelper;
|
|
11678
11731
|
|
|
11679
11732
|
function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
11680
11733
|
let leafPaint, event;
|
|
11681
11734
|
const image = ImageManager.get(paint, paint.type);
|
|
11682
|
-
if (cache$1 && paint === cache$1.paint && isSame(boxBounds, cache$1.boxBounds)) {
|
|
11735
|
+
if (cache$1 && paint === cache$1.paint && isSame$1(boxBounds, cache$1.boxBounds)) {
|
|
11683
11736
|
leafPaint = cache$1.leafPaint;
|
|
11684
11737
|
} else {
|
|
11685
11738
|
leafPaint = {
|
|
@@ -11758,6 +11811,7 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
|
|
|
11758
11811
|
const clip = transform && !transform.onlyScale || data.path || data.cornerRadius;
|
|
11759
11812
|
if (clip || opacity && opacity < 1 || blendMode) leafPaint.complex = clip ? 2 : true;
|
|
11760
11813
|
}
|
|
11814
|
+
if (paint.filter) PaintImage.applyFilter(leafPaint, image, paint.filter, ui);
|
|
11761
11815
|
return true;
|
|
11762
11816
|
}
|
|
11763
11817
|
|
|
@@ -11965,7 +12019,7 @@ function layout$3(transform, box, x, y, scaleX, scaleY, rotation, skew) {
|
|
|
11965
12019
|
translate(transform, box.x + x, box.y + y);
|
|
11966
12020
|
}
|
|
11967
12021
|
|
|
11968
|
-
const {get: get$1, scale: scale$
|
|
12022
|
+
const {get: get$1, scale: scale$2, copy: copy$4} = MatrixHelper;
|
|
11969
12023
|
|
|
11970
12024
|
const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$6} = Math;
|
|
11971
12025
|
|
|
@@ -11985,7 +12039,7 @@ function createPattern(paint, ui, canvas, renderOptions) {
|
|
|
11985
12039
|
let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
|
|
11986
12040
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
11987
12041
|
if (!(Platform.image.isLarge(paint.image, scaleX, scaleY) && !paint.data.repeat)) {
|
|
11988
|
-
const {image: image, data: data} = paint, {opacity: opacity
|
|
12042
|
+
const {image: image, data: data} = paint, {opacity: opacity} = paint.originPaint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
|
|
11989
12043
|
let imageMatrix, xGap, yGap, {width: width, height: height} = image;
|
|
11990
12044
|
if (fixScale) scaleX *= fixScale, scaleY *= fixScale;
|
|
11991
12045
|
width *= scaleX;
|
|
@@ -11999,9 +12053,9 @@ function createPattern(paint, ui, canvas, renderOptions) {
|
|
|
11999
12053
|
scaleY *= getFloorScale(height + (yGap || 0));
|
|
12000
12054
|
imageMatrix = get$1();
|
|
12001
12055
|
if (transform) copy$4(imageMatrix, transform);
|
|
12002
|
-
scale$
|
|
12056
|
+
scale$2(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
12003
12057
|
}
|
|
12004
|
-
const imageCanvas = image.getCanvas(width, height, opacity,
|
|
12058
|
+
const imageCanvas = image.getCanvas(width, height, opacity, undefined, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
|
|
12005
12059
|
const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
12006
12060
|
paint.style = pattern;
|
|
12007
12061
|
paint.patternId = id;
|
|
@@ -12092,6 +12146,7 @@ function recycleImage(attrName, data) {
|
|
|
12092
12146
|
if (!recycleMap) recycleMap = {};
|
|
12093
12147
|
recycleMap[url] = true;
|
|
12094
12148
|
ImageManager.recyclePaint(paint);
|
|
12149
|
+
if (data.__willDestroy && image.parent) PaintImage.recycleFilter(image, data.__leaf);
|
|
12095
12150
|
if (image.loading) {
|
|
12096
12151
|
if (!input) {
|
|
12097
12152
|
input = data.__input && data.__input[attrName] || [];
|
|
@@ -13055,8 +13110,11 @@ function targetAttr(fn) {
|
|
|
13055
13110
|
});
|
|
13056
13111
|
if (isObject(check)) value = check; else if (check === false) return;
|
|
13057
13112
|
}
|
|
13058
|
-
t.
|
|
13059
|
-
|
|
13113
|
+
const {dimOthers: dimOthers, bright: bright} = t.editBox.mergedConfig || t.config;
|
|
13114
|
+
if (!isUndefined(dimOthers) || !isUndefined(bright)) {
|
|
13115
|
+
t.setDimOthers(false);
|
|
13116
|
+
t.setBright(false);
|
|
13117
|
+
}
|
|
13060
13118
|
if (isArray(value) && value.length > 1 && value[0].locked) value.splice(0, 1);
|
|
13061
13119
|
if (t.single) {
|
|
13062
13120
|
delete t.element.syncEventer;
|
|
@@ -13081,7 +13139,8 @@ function mergeConfigAttr() {
|
|
|
13081
13139
|
return (target, key) => {
|
|
13082
13140
|
defineKey(target, key, {
|
|
13083
13141
|
get() {
|
|
13084
|
-
const {config: config, element: element, dragPoint: dragPoint, editBox: editBox, app: app} = this, mergeConfig = Object.assign({}, config);
|
|
13142
|
+
const {config: config, element: element, dragPoint: dragPoint, editBox: editBox, editTool: editTool, innerEditor: innerEditor, app: app} = this, mergeConfig = Object.assign({}, config);
|
|
13143
|
+
if (innerEditor) innerEditor.editConfig && Object.assign(mergeConfig, innerEditor.editConfig); else if (editTool) editTool.editConfig && Object.assign(mergeConfig, editTool.editConfig);
|
|
13085
13144
|
if (element && element.editConfig) {
|
|
13086
13145
|
let {editConfig: editConfig} = element;
|
|
13087
13146
|
if (editConfig.hover || editConfig.hoverStyle) {
|
|
@@ -13984,8 +14043,10 @@ class EditBox extends Group {
|
|
|
13984
14043
|
const {editMask: editMask} = editor;
|
|
13985
14044
|
const {middlePoint: middlePoint, resizeable: resizeable, rotateable: rotateable, hideOnSmall: hideOnSmall, editBox: editBox, mask: mask, dimOthers: dimOthers, bright: bright, spread: spread, hideRotatePoints: hideRotatePoints, hideResizeLines: hideResizeLines} = mergeConfig;
|
|
13986
14045
|
editMask.visible = mask ? true : 0;
|
|
13987
|
-
|
|
13988
|
-
|
|
14046
|
+
if (!isUndefined(dimOthers) || !isUndefined(bright)) {
|
|
14047
|
+
editor.setDimOthers(dimOthers);
|
|
14048
|
+
editor.setBright(!!dimOthers || bright);
|
|
14049
|
+
}
|
|
13989
14050
|
if (spread) BoundsHelper.spread(bounds, spread);
|
|
13990
14051
|
if (this.view.worldOpacity) {
|
|
13991
14052
|
const {width: width, height: height} = bounds;
|
|
@@ -14004,7 +14065,8 @@ class EditBox extends Group {
|
|
|
14004
14065
|
resizeL = resizeLines[(i - 1) / 2];
|
|
14005
14066
|
resizeL.set(point);
|
|
14006
14067
|
resizeL.visible = resizeP.visible && !hideResizeLines;
|
|
14007
|
-
resizeP.visible
|
|
14068
|
+
if (resizeP.visible) resizeP.visible = !!middlePoint;
|
|
14069
|
+
if (rotateP.visible) rotateP.visible = !!middlePoint;
|
|
14008
14070
|
if ((i + 1) / 2 % 2) {
|
|
14009
14071
|
resizeL.width = width + resizeL.height;
|
|
14010
14072
|
if (hideOnSmall && resizeP.width * 2 > width) resizeP.visible = false;
|
|
@@ -16958,7 +17020,7 @@ Arrow = __decorate([ registerUI() ], Arrow);
|
|
|
16958
17020
|
|
|
16959
17021
|
const {M: M$2, L: L$2, C: C$2, Q: Q$1, O: O$1} = PathCommandMap;
|
|
16960
17022
|
|
|
16961
|
-
const {rotate: rotate$1, copyFrom: copyFrom$1, scale: scale} = PointHelper;
|
|
17023
|
+
const {rotate: rotate$1, copyFrom: copyFrom$1, scale: scale$1} = PointHelper;
|
|
16962
17024
|
|
|
16963
17025
|
const point$1 = {};
|
|
16964
17026
|
|
|
@@ -17005,7 +17067,7 @@ const PathMatrixHelper = {
|
|
|
17005
17067
|
function setPoint$2(data, startIndex, x, y, scaleX, scaleY, rotation, origin) {
|
|
17006
17068
|
copyFrom$1(point$1, data[startIndex], data[startIndex + 1]);
|
|
17007
17069
|
if (rotation) rotate$1(point$1, rotation, origin);
|
|
17008
|
-
if (scaleX) scale(point$1, scaleX, scaleY);
|
|
17070
|
+
if (scaleX) scale$1(point$1, scaleX, scaleY);
|
|
17009
17071
|
data[startIndex] = x + point$1.x;
|
|
17010
17072
|
data[startIndex + 1] = y + point$1.y;
|
|
17011
17073
|
}
|
|
@@ -17014,12 +17076,14 @@ const {layout: layout$2, rotate: rotate} = PathMatrixHelper;
|
|
|
17014
17076
|
|
|
17015
17077
|
const {getAngle: getAngle} = PointHelper;
|
|
17016
17078
|
|
|
17017
|
-
const
|
|
17079
|
+
const zero = {
|
|
17080
|
+
x: 0
|
|
17081
|
+
}, half = {
|
|
17018
17082
|
x: -.5
|
|
17019
17083
|
};
|
|
17020
17084
|
|
|
17021
17085
|
const angle = {
|
|
17022
|
-
connect:
|
|
17086
|
+
connect: zero,
|
|
17023
17087
|
offset: {
|
|
17024
17088
|
x: -.71,
|
|
17025
17089
|
bevelJoin: .36,
|
|
@@ -17040,73 +17104,110 @@ const angleSide = {
|
|
|
17040
17104
|
|
|
17041
17105
|
const triangleLinePath = [ 1, -3, 0, 2, -3, -2, 2, 0, 0, 2, -3, 2, 2, -3, 0 ];
|
|
17042
17106
|
|
|
17043
|
-
const
|
|
17044
|
-
connect:
|
|
17107
|
+
const triangleFill = {
|
|
17108
|
+
connect: zero,
|
|
17045
17109
|
offset: {
|
|
17046
17110
|
x: -.9,
|
|
17047
17111
|
bevelJoin: .624,
|
|
17048
17112
|
roundJoin: .4
|
|
17049
17113
|
},
|
|
17050
|
-
path: [ ...triangleLinePath
|
|
17051
|
-
dashPath: [ 1, -2, 0, 2, -.5, 0 ]
|
|
17114
|
+
path: [ ...triangleLinePath ]
|
|
17052
17115
|
};
|
|
17053
17116
|
|
|
17054
|
-
const
|
|
17117
|
+
const triangle = DataHelper.clone(triangleFill);
|
|
17055
17118
|
|
|
17056
|
-
|
|
17057
|
-
|
|
17058
|
-
|
|
17059
|
-
|
|
17060
|
-
|
|
17061
|
-
|
|
17062
|
-
|
|
17063
|
-
path: [ ...
|
|
17064
|
-
dashPath: [ 1, -3, 0, 2, -.5, 0 ]
|
|
17119
|
+
triangle.path = [ ...triangleLinePath, 1, -2.05, 1.1, 2, -2.05, -1.1 ];
|
|
17120
|
+
|
|
17121
|
+
triangle.dashPath = [ 1, -2, 0, 2, -.5, 0 ];
|
|
17122
|
+
|
|
17123
|
+
const triangleFlipFill = {
|
|
17124
|
+
connect: zero,
|
|
17125
|
+
offset: half,
|
|
17126
|
+
path: [ ...triangleFill.path ]
|
|
17065
17127
|
};
|
|
17066
17128
|
|
|
17067
17129
|
const triangleFlip = {
|
|
17130
|
+
connect: zero,
|
|
17068
17131
|
offset: half,
|
|
17069
17132
|
path: [ ...triangle.path ],
|
|
17070
17133
|
dashPath: [ 1, -2.5, 0, 2, -1, 0 ]
|
|
17071
17134
|
};
|
|
17072
17135
|
|
|
17136
|
+
rotate(triangleFlipFill.path, 180, {
|
|
17137
|
+
x: -1.5,
|
|
17138
|
+
y: 0
|
|
17139
|
+
});
|
|
17140
|
+
|
|
17073
17141
|
rotate(triangleFlip.path, 180, {
|
|
17074
17142
|
x: -1.5,
|
|
17075
17143
|
y: 0
|
|
17076
17144
|
});
|
|
17077
17145
|
|
|
17146
|
+
const arrowLinePath = [ 1, -3, 0, 2, -3.5, -1.8, 2, 0, 0, 2, -3.5, 1.8, 2, -3, 0 ];
|
|
17147
|
+
|
|
17148
|
+
const arrowFill = {
|
|
17149
|
+
connect: zero,
|
|
17150
|
+
offset: {
|
|
17151
|
+
x: -1.1,
|
|
17152
|
+
bevelJoin: .872,
|
|
17153
|
+
roundJoin: .6
|
|
17154
|
+
},
|
|
17155
|
+
path: [ ...arrowLinePath ]
|
|
17156
|
+
};
|
|
17157
|
+
|
|
17158
|
+
const arrow = DataHelper.clone(arrowFill);
|
|
17159
|
+
|
|
17160
|
+
arrow.path = [ ...arrowLinePath, 1, -2.25, .95, 2, -2.25, -.95 ];
|
|
17161
|
+
|
|
17162
|
+
arrow.dashPath = [ 1, -3, 0, 2, -.5, 0 ];
|
|
17163
|
+
|
|
17078
17164
|
const circleLine = {
|
|
17079
17165
|
connect: {
|
|
17080
|
-
x: -1.
|
|
17166
|
+
x: -1.8
|
|
17081
17167
|
},
|
|
17082
17168
|
path: [ 1, 1.8, -.1, 2, 1.8, 0, 26, 0, 0, 1.8, 0, 359, 0 ]
|
|
17083
17169
|
};
|
|
17084
17170
|
|
|
17085
|
-
const
|
|
17171
|
+
const circleFill = {
|
|
17086
17172
|
connect: {
|
|
17087
17173
|
x: .5
|
|
17088
17174
|
},
|
|
17089
|
-
path: [ ...circleLine.path
|
|
17090
|
-
dashPath: [ 1, -.5, 0, 2, .5, 0 ]
|
|
17175
|
+
path: [ ...circleLine.path ]
|
|
17091
17176
|
};
|
|
17092
17177
|
|
|
17178
|
+
const circle = DataHelper.clone(circleFill);
|
|
17179
|
+
|
|
17180
|
+
circle.path = [ ...circleLine.path, 1, 0, 0, 26, 0, 0, 1, 0, 360, 0 ];
|
|
17181
|
+
|
|
17182
|
+
circle.dashPath = [ 1, -.5, 0, 2, .5, 0 ];
|
|
17183
|
+
|
|
17093
17184
|
const squareLine = {
|
|
17094
17185
|
connect: {
|
|
17095
|
-
x: -1.
|
|
17186
|
+
x: -1.4
|
|
17096
17187
|
},
|
|
17097
17188
|
path: [ 1, -1.4, 0, 2, -1.4, -1.4, 2, 1.4, -1.4, 2, 1.4, 1.4, 2, -1.4, 1.4, 2, -1.4, 0 ]
|
|
17098
17189
|
};
|
|
17099
17190
|
|
|
17191
|
+
const squareFill = {
|
|
17192
|
+
path: [ ...squareLine.path ]
|
|
17193
|
+
};
|
|
17194
|
+
|
|
17100
17195
|
const square = {
|
|
17101
17196
|
path: [ ...squareLine.path, 2, -1.4, -.49, 2, 1, -.49, 1, -1.4, .49, 2, 1, .49 ]
|
|
17102
17197
|
};
|
|
17103
17198
|
|
|
17104
17199
|
const diamondLine = DataHelper.clone(squareLine);
|
|
17105
17200
|
|
|
17201
|
+
diamondLine.connect.x = -1.9;
|
|
17202
|
+
|
|
17203
|
+
const diamondFill = DataHelper.clone(squareFill);
|
|
17204
|
+
|
|
17106
17205
|
const diamond = DataHelper.clone(square);
|
|
17107
17206
|
|
|
17108
17207
|
rotate(diamondLine.path, 45);
|
|
17109
17208
|
|
|
17209
|
+
rotate(diamondFill.path, 45);
|
|
17210
|
+
|
|
17110
17211
|
rotate(diamond.path, 45);
|
|
17111
17212
|
|
|
17112
17213
|
const mark = {
|
|
@@ -17129,19 +17230,34 @@ const arrows = {
|
|
|
17129
17230
|
mark: mark
|
|
17130
17231
|
};
|
|
17131
17232
|
|
|
17233
|
+
const fillArrows = {
|
|
17234
|
+
triangle: triangleFill,
|
|
17235
|
+
"triangle-flip": triangleFlipFill,
|
|
17236
|
+
arrow: arrowFill,
|
|
17237
|
+
circle: circleFill,
|
|
17238
|
+
square: squareFill,
|
|
17239
|
+
diamond: diamondFill
|
|
17240
|
+
};
|
|
17241
|
+
|
|
17132
17242
|
function getArrowPath(ui, arrow, from, to, size, connectOffset, hasDashPattern) {
|
|
17133
|
-
let pathData, scale;
|
|
17243
|
+
let pathData, scale = 1, rotation = 0, fill;
|
|
17134
17244
|
const {strokeCap: strokeCap, strokeJoin: strokeJoin} = ui.__;
|
|
17135
17245
|
if (isObject(arrow)) {
|
|
17136
17246
|
if (arrow.type) {
|
|
17137
|
-
scale = arrow.scale;
|
|
17247
|
+
scale = arrow.scale || 1;
|
|
17248
|
+
rotation = arrow.rotation || 0;
|
|
17138
17249
|
pathData = arrows[arrow.type];
|
|
17250
|
+
if (scale > 1) {
|
|
17251
|
+
const fillData = fillArrows[arrow.type];
|
|
17252
|
+
if (fillData) pathData = fillData, fill = true;
|
|
17253
|
+
}
|
|
17139
17254
|
} else pathData = arrow;
|
|
17140
17255
|
} else {
|
|
17141
17256
|
pathData = arrows[arrow];
|
|
17142
17257
|
}
|
|
17258
|
+
if (!fill) fill = pathData.fill;
|
|
17143
17259
|
const {offset: offset, connect: connect, path: path, dashPath: dashPath} = pathData;
|
|
17144
|
-
let connectX = connect ? connect.x : 0;
|
|
17260
|
+
let connectX = connect ? connect.x * scale : 0;
|
|
17145
17261
|
let offsetX = offset ? offset.x : 0;
|
|
17146
17262
|
const data = [ ...path ];
|
|
17147
17263
|
if (hasDashPattern && dashPath) data.push(...dashPath);
|
|
@@ -17149,28 +17265,38 @@ function getArrowPath(ui, arrow, from, to, size, connectOffset, hasDashPattern)
|
|
|
17149
17265
|
if (offset) {
|
|
17150
17266
|
if (strokeJoin === "round" && offset.roundJoin) offsetX += offset.roundJoin; else if (strokeJoin === "bevel" && offset.bevelJoin) offsetX += offset.bevelJoin;
|
|
17151
17267
|
}
|
|
17152
|
-
if (scale) layout$2(data, 0, 0, scale, scale);
|
|
17268
|
+
if (scale !== 1) layout$2(data, 0, 0, scale, scale);
|
|
17153
17269
|
if (offsetX) layout$2(data, offsetX, 0);
|
|
17154
|
-
layout$2(data, to.x, to.y, size, size, getAngle(from, to));
|
|
17270
|
+
layout$2(data, to.x, to.y, size, size, getAngle(from, to) + rotation);
|
|
17155
17271
|
connectOffset.x = (connectX + offsetX) * size;
|
|
17156
|
-
|
|
17272
|
+
const arrowData = {
|
|
17273
|
+
data: data
|
|
17274
|
+
};
|
|
17275
|
+
if (fill) arrowData.fill = fill;
|
|
17276
|
+
return arrowData;
|
|
17157
17277
|
}
|
|
17158
17278
|
|
|
17159
17279
|
const {M: M$1, L: L$1, C: C$1, Q: Q, Z: Z$1, N: N, D: D, X: X, G: G, F: F, O: O, P: P, U: U} = PathCommandMap;
|
|
17160
17280
|
|
|
17161
|
-
const {copy: copy, copyFrom: copyFrom, getDistancePoint: getDistancePoint} = PointHelper;
|
|
17281
|
+
const {copy: copy, copyFrom: copyFrom, getDistancePoint: getDistancePoint, isSame: isSame} = PointHelper;
|
|
17282
|
+
|
|
17283
|
+
const {stintSet: stintSet$1} = DataHelper;
|
|
17162
17284
|
|
|
17163
17285
|
const connectPoint = {};
|
|
17164
17286
|
|
|
17165
17287
|
const first = {}, second = {};
|
|
17166
17288
|
|
|
17167
|
-
const last = {}, now = {};
|
|
17289
|
+
const old = {}, last = {}, now = {};
|
|
17168
17290
|
|
|
17169
17291
|
const PathArrowModule = {
|
|
17170
17292
|
list: arrows,
|
|
17171
|
-
|
|
17172
|
-
|
|
17293
|
+
fillList: fillArrows,
|
|
17294
|
+
addArrows(ui, updateCache) {
|
|
17295
|
+
const uData = ui.__;
|
|
17296
|
+
const {startArrow: startArrow, endArrow: endArrow, __strokeWidth: strokeWidth, dashPattern: dashPattern, __pathForRender: data, cornerRadius: cornerRadius} = uData;
|
|
17173
17297
|
const clonePathForArrow = !cornerRadius;
|
|
17298
|
+
if (!updateCache) uData.__strokeWidthCache = strokeWidth;
|
|
17299
|
+
let startArrowPath, singleStartArrow, endArrowPath, singleEndArrow;
|
|
17174
17300
|
let command, i = 0, len = data.length, count = 0, useStartArrow = startArrow && startArrow !== "none";
|
|
17175
17301
|
while (i < len) {
|
|
17176
17302
|
command = data[i];
|
|
@@ -17178,6 +17304,7 @@ const PathArrowModule = {
|
|
|
17178
17304
|
case M$1:
|
|
17179
17305
|
case L$1:
|
|
17180
17306
|
if (count < 2 || i + 6 >= len) {
|
|
17307
|
+
copy(old, now);
|
|
17181
17308
|
copyFrom(now, data[i + 1], data[i + 2]);
|
|
17182
17309
|
if (!count && useStartArrow) copy(first, now);
|
|
17183
17310
|
}
|
|
@@ -17185,12 +17312,18 @@ const PathArrowModule = {
|
|
|
17185
17312
|
break;
|
|
17186
17313
|
|
|
17187
17314
|
case C$1:
|
|
17188
|
-
if (count === 1 || i + 7 >= len - 3)
|
|
17315
|
+
if (count === 1 || i + 7 >= len - 3) {
|
|
17316
|
+
copyPoints(data, last, now, i + 3);
|
|
17317
|
+
old.x = data[i + 1], old.y = data[i + 2];
|
|
17318
|
+
}
|
|
17189
17319
|
i += 7;
|
|
17190
17320
|
break;
|
|
17191
17321
|
|
|
17192
17322
|
case Q:
|
|
17193
|
-
if (count === 1 || i + 5 >= len - 3)
|
|
17323
|
+
if (count === 1 || i + 5 >= len - 3) {
|
|
17324
|
+
copyPoints(data, last, now, i + 1);
|
|
17325
|
+
copy(old, last);
|
|
17326
|
+
}
|
|
17194
17327
|
i += 5;
|
|
17195
17328
|
break;
|
|
17196
17329
|
|
|
@@ -17228,6 +17361,7 @@ const PathArrowModule = {
|
|
|
17228
17361
|
case U:
|
|
17229
17362
|
if (count === 1 || i + 6 >= len - 3) {
|
|
17230
17363
|
copyPoints(data, last, now, i + 1);
|
|
17364
|
+
copy(old, last);
|
|
17231
17365
|
if (i + 6 !== len) {
|
|
17232
17366
|
now.x -= (now.x - last.x) / 10;
|
|
17233
17367
|
now.y -= (now.y - last.y) / 10;
|
|
@@ -17238,13 +17372,13 @@ const PathArrowModule = {
|
|
|
17238
17372
|
}
|
|
17239
17373
|
count++;
|
|
17240
17374
|
if (count === 1 && command !== M$1) return;
|
|
17241
|
-
if (count === 2 && useStartArrow) copy(second, command === L$1 ? now : last);
|
|
17375
|
+
if (count === 2 && useStartArrow) copy(second, command === L$1 ? now : isSame(old, first) ? last : old);
|
|
17242
17376
|
if (i === len) {
|
|
17243
|
-
const path =
|
|
17244
|
-
const pathForArrow = ui.__.__pathForArrow = [];
|
|
17377
|
+
const path = uData.__pathForRender = clonePathForArrow ? [ ...data ] : data;
|
|
17245
17378
|
if (useStartArrow) {
|
|
17246
|
-
|
|
17247
|
-
|
|
17379
|
+
startArrowPath = getArrowPath(ui, startArrow, second, first, strokeWidth, connectPoint, !!dashPattern);
|
|
17380
|
+
singleStartArrow = startArrowPath.fill || dashPattern;
|
|
17381
|
+
if (!singleStartArrow) path.push(...startArrowPath.data);
|
|
17248
17382
|
if (connectPoint.x) {
|
|
17249
17383
|
getDistancePoint(first, second, -connectPoint.x, true);
|
|
17250
17384
|
path[1] = second.x;
|
|
@@ -17252,8 +17386,10 @@ const PathArrowModule = {
|
|
|
17252
17386
|
}
|
|
17253
17387
|
}
|
|
17254
17388
|
if (endArrow && endArrow !== "none") {
|
|
17255
|
-
|
|
17256
|
-
|
|
17389
|
+
if (isSame(last, now)) copy(last, old);
|
|
17390
|
+
endArrowPath = getArrowPath(ui, endArrow, last, now, strokeWidth, connectPoint, !!dashPattern);
|
|
17391
|
+
singleEndArrow = endArrowPath.fill || dashPattern;
|
|
17392
|
+
if (!singleEndArrow) path.push(...endArrowPath.data);
|
|
17257
17393
|
if (connectPoint.x) {
|
|
17258
17394
|
getDistancePoint(now, last, -connectPoint.x, true);
|
|
17259
17395
|
let index;
|
|
@@ -17280,10 +17416,21 @@ const PathArrowModule = {
|
|
|
17280
17416
|
} else {
|
|
17281
17417
|
copy(last, now);
|
|
17282
17418
|
}
|
|
17419
|
+
stintSet$1(uData, "__startArrowPath", singleStartArrow && startArrowPath);
|
|
17420
|
+
stintSet$1(uData, "__endArrowPath", singleEndArrow && endArrowPath);
|
|
17283
17421
|
}
|
|
17284
17422
|
},
|
|
17285
|
-
|
|
17423
|
+
updateArrow(ui) {
|
|
17424
|
+
const data = ui.__;
|
|
17425
|
+
if (data.strokeScaleFixed) {
|
|
17426
|
+
if (data.__strokeWidthCache !== data.__strokeWidth) {
|
|
17427
|
+
ui.__updateRenderPath(true);
|
|
17428
|
+
}
|
|
17429
|
+
}
|
|
17430
|
+
},
|
|
17431
|
+
register(name, data, fillData) {
|
|
17286
17432
|
this.list[name] = data;
|
|
17433
|
+
if (fillData) this.fillList[name] = data;
|
|
17287
17434
|
},
|
|
17288
17435
|
get(name) {
|
|
17289
17436
|
return this.list[name];
|
|
@@ -17309,12 +17456,26 @@ UI.addAttr("endArrow", "none", arrowType);
|
|
|
17309
17456
|
Object.assign(PathArrow, PathArrowModule);
|
|
17310
17457
|
|
|
17311
17458
|
Object.assign(Paint, {
|
|
17312
|
-
strokeArrow(
|
|
17313
|
-
|
|
17459
|
+
strokeArrow(stroke, ui, canvas, _renderOptions) {
|
|
17460
|
+
const {__startArrowPath: __startArrowPath, __endArrowPath: __endArrowPath, dashPattern: dashPattern} = ui.__;
|
|
17461
|
+
if (dashPattern) canvas.dashPattern = null;
|
|
17462
|
+
if (__startArrowPath) {
|
|
17463
|
+
canvas.beginPath();
|
|
17464
|
+
ui.__drawPathByData(canvas, __startArrowPath.data);
|
|
17465
|
+
canvas.stroke();
|
|
17466
|
+
if (__startArrowPath.fill) {
|
|
17467
|
+
canvas.fillStyle = stroke;
|
|
17468
|
+
canvas.fill();
|
|
17469
|
+
}
|
|
17470
|
+
}
|
|
17471
|
+
if (__endArrowPath) {
|
|
17314
17472
|
canvas.beginPath();
|
|
17315
|
-
ui.__drawPathByData(canvas,
|
|
17316
|
-
canvas.dashPattern = null;
|
|
17473
|
+
ui.__drawPathByData(canvas, __endArrowPath.data);
|
|
17317
17474
|
canvas.stroke();
|
|
17475
|
+
if (__endArrowPath.fill) {
|
|
17476
|
+
canvas.fillStyle = stroke;
|
|
17477
|
+
canvas.fill();
|
|
17478
|
+
}
|
|
17318
17479
|
}
|
|
17319
17480
|
}
|
|
17320
17481
|
});
|
|
@@ -17776,7 +17937,7 @@ UI.addAttr("autoHeight", undefined, autoBoundsType);
|
|
|
17776
17937
|
|
|
17777
17938
|
UI.addAttr("autoBox", undefined, boundsType);
|
|
17778
17939
|
|
|
17779
|
-
const {copyAndSpread: copyAndSpread} = BoundsHelper;
|
|
17940
|
+
const {copyAndSpread: copyAndSpread$1} = BoundsHelper;
|
|
17780
17941
|
|
|
17781
17942
|
box$1.__updateFlowLayout = function() {
|
|
17782
17943
|
const {leaferIsCreated: leaferIsCreated, flow: flow} = this;
|
|
@@ -17808,7 +17969,7 @@ box$1.__updateContentBounds = function() {
|
|
|
17808
17969
|
const same = layout.contentBounds === layout.boxBounds;
|
|
17809
17970
|
if (padding) {
|
|
17810
17971
|
if (same) layout.shrinkContent();
|
|
17811
|
-
copyAndSpread(layout.contentBounds, layout.boxBounds, padding, true);
|
|
17972
|
+
copyAndSpread$1(layout.contentBounds, layout.boxBounds, padding, true);
|
|
17812
17973
|
} else {
|
|
17813
17974
|
if (!same) layout.shrinkContentCancel();
|
|
17814
17975
|
}
|
|
@@ -17830,7 +17991,7 @@ box$1.__updateBoxBounds = function(secondLayout) {
|
|
|
17830
17991
|
boxBounds.width = data.width, boxBounds.x = 0;
|
|
17831
17992
|
}
|
|
17832
17993
|
}
|
|
17833
|
-
flow && secondLayout && data.padding && copyAndSpread(boxBounds, boxBounds, data.padding, false, data.__autoSize ? null : data.__autoWidth ? "width" : "height");
|
|
17994
|
+
flow && secondLayout && data.padding && copyAndSpread$1(boxBounds, boxBounds, data.padding, false, data.__autoSize ? null : data.__autoWidth ? "width" : "height");
|
|
17834
17995
|
this.__updateNaturalSize();
|
|
17835
17996
|
} else {
|
|
17836
17997
|
this.__updateRectBoxBounds();
|
|
@@ -19814,9 +19975,7 @@ const {Yes: Yes, NoAndSkip: NoAndSkip, YesAndSkip: YesAndSkip} = Answer;
|
|
|
19814
19975
|
const idCondition = {}, classNameCondition = {}, tagCondition = {};
|
|
19815
19976
|
|
|
19816
19977
|
class Finder {
|
|
19817
|
-
constructor(target) {
|
|
19818
|
-
this.innerIdMap = {};
|
|
19819
|
-
this.idMap = {};
|
|
19978
|
+
constructor(target, _config) {
|
|
19820
19979
|
this.methods = {
|
|
19821
19980
|
id: (leaf, name) => leaf.id === name ? (this.target && (this.idMap[name] = leaf),
|
|
19822
19981
|
1) : 0,
|
|
@@ -19826,6 +19985,13 @@ class Finder {
|
|
|
19826
19985
|
tag: (leaf, name) => leaf.__tag === name ? 1 : 0,
|
|
19827
19986
|
tags: (leaf, nameMap) => nameMap[leaf.__tag] ? 1 : 0
|
|
19828
19987
|
};
|
|
19988
|
+
this.idMap = {};
|
|
19989
|
+
this.innerIdMap = {};
|
|
19990
|
+
const app = target && target.app;
|
|
19991
|
+
if (app) {
|
|
19992
|
+
app.idMap ? this.idMap = app.idMap : app.idMap = this.idMap;
|
|
19993
|
+
app.innerIdMap ? this.innerIdMap = app.innerIdMap : app.innerIdMap = this.innerIdMap;
|
|
19994
|
+
}
|
|
19829
19995
|
if (this.target = target) this.__listenEvents();
|
|
19830
19996
|
}
|
|
19831
19997
|
getBy(condition, branch, one, options) {
|
|
@@ -19952,8 +20118,14 @@ ui.findOne = function(condition, options) {
|
|
|
19952
20118
|
|
|
19953
20119
|
Plugin.add("find");
|
|
19954
20120
|
|
|
19955
|
-
Creator.finder = function(target) {
|
|
19956
|
-
return new Finder(target);
|
|
20121
|
+
Creator.finder = function(target, config) {
|
|
20122
|
+
return new Finder(target, config);
|
|
20123
|
+
};
|
|
20124
|
+
|
|
20125
|
+
LeafHelper.cacheId = function(t) {
|
|
20126
|
+
const {leafer: leafer, id: id} = t;
|
|
20127
|
+
if (id) leafer.app.idMap[id] = t;
|
|
20128
|
+
if (leafer.cacheInnerId) leafer.app.innerIdMap[t.innerId] = t;
|
|
19957
20129
|
};
|
|
19958
20130
|
|
|
19959
20131
|
const {setPoint: setPoint, addPoint: addPoint, toBounds: toBounds} = TwoPointBoundsHelper;
|
|
@@ -20246,7 +20418,7 @@ const config = {
|
|
|
20246
20418
|
style: {
|
|
20247
20419
|
dragBoundsType: "outer",
|
|
20248
20420
|
strokeAlign: "center",
|
|
20249
|
-
|
|
20421
|
+
strokeScaleFixed: "zoom-in",
|
|
20250
20422
|
width: 6,
|
|
20251
20423
|
height: 6,
|
|
20252
20424
|
opacity: .5,
|
|
@@ -20495,4 +20667,48 @@ Scroller.registerTheme("dark", {
|
|
|
20495
20667
|
}
|
|
20496
20668
|
});
|
|
20497
20669
|
|
|
20670
|
+
const {stintSet: stintSet} = DataHelper;
|
|
20671
|
+
|
|
20672
|
+
function scaleFixedType(defaultValue) {
|
|
20673
|
+
return decorateLeafAttr(defaultValue, key => attr({
|
|
20674
|
+
set(value) {
|
|
20675
|
+
if (this.__setAttr(key, value)) {
|
|
20676
|
+
const layout = this.__layout;
|
|
20677
|
+
doBoundsType(this);
|
|
20678
|
+
if (!isNumber(value)) value = value ? 1 : 0;
|
|
20679
|
+
stintSet(layout, "scaleFixed", value);
|
|
20680
|
+
stintSet(layout, "outerScale", value ? 1 / value : 0);
|
|
20681
|
+
if (!layout.outerScale && layout.localOuterBounds) layout.localOuterBounds = undefined;
|
|
20682
|
+
}
|
|
20683
|
+
}
|
|
20684
|
+
}));
|
|
20685
|
+
}
|
|
20686
|
+
|
|
20687
|
+
const {scale: scale} = MatrixHelper;
|
|
20688
|
+
|
|
20689
|
+
const {copyAndSpread: copyAndSpread} = BoundsHelper;
|
|
20690
|
+
|
|
20691
|
+
const {getScaleFixedData: getScaleFixedData} = MathHelper;
|
|
20692
|
+
|
|
20693
|
+
LeafHelper.updateScaleFixedWorld = function(t) {
|
|
20694
|
+
const {__world: __world, __: __} = t, {scaleX: scaleX, scaleY: scaleY} = getScaleFixedData(__world, __.scaleFixed);
|
|
20695
|
+
if (scaleX !== 1) {
|
|
20696
|
+
scale(__world, scaleX, scaleY);
|
|
20697
|
+
__world.scaleX *= scaleX, __world.scaleY *= scaleY;
|
|
20698
|
+
}
|
|
20699
|
+
};
|
|
20700
|
+
|
|
20701
|
+
LeafHelper.updateOuterBounds = function(t) {
|
|
20702
|
+
const layout = t.__layout, {localRenderBounds: localRenderBounds} = layout;
|
|
20703
|
+
const localOuterBounds = layout.localOuterBounds || (layout.localOuterBounds = {});
|
|
20704
|
+
const {width: width, height: height} = localRenderBounds;
|
|
20705
|
+
const scale = layout.outerScale - 1;
|
|
20706
|
+
copyAndSpread(localOuterBounds, localRenderBounds, [ height * scale, width * scale ]);
|
|
20707
|
+
if (t.parent) t.parent.__layout.renderChange();
|
|
20708
|
+
};
|
|
20709
|
+
|
|
20710
|
+
Plugin.add("scale-fixed");
|
|
20711
|
+
|
|
20712
|
+
UI.addAttr("scaleFixed", undefined, scaleFixedType);
|
|
20713
|
+
|
|
20498
20714
|
export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, FourNumberHelper, Frame, FrameData, Group, GroupData, HTMLText, HTMLTextData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferFilm, LeaferImage, LeaferTypeCreator, LeaferVideo, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, Scroller, SelectArea, Selector, Star, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TextEditor, TouchEvent, TransformTool, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite$1 as isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, motionPathType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$3 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$4 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|