@leafer/miniapp 2.0.1 → 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/miniapp.cjs +11 -0
- package/dist/miniapp.esm.js +2 -0
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.esm.min.js.map +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.min.cjs.map +1 -1
- package/dist/miniapp.module.js +477 -196
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +23 -22
- package/src/index.ts +1 -0
package/dist/miniapp.module.js
CHANGED
|
@@ -213,6 +213,7 @@ class LeafData {
|
|
|
213
213
|
}
|
|
214
214
|
destroy() {
|
|
215
215
|
this.__input = this.__middle = null;
|
|
216
|
+
if (this.__complexData) this.__complexData.destroy();
|
|
216
217
|
}
|
|
217
218
|
}
|
|
218
219
|
|
|
@@ -311,6 +312,8 @@ const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumbe
|
|
|
311
312
|
|
|
312
313
|
const {round: round$6, pow: pow$2, max: max$6, floor: floor$3, PI: PI$4} = Math;
|
|
313
314
|
|
|
315
|
+
const tempScaleData$1 = {};
|
|
316
|
+
|
|
314
317
|
const MathHelper = {
|
|
315
318
|
within(value, min, max) {
|
|
316
319
|
if (isObject(min)) max = min.max, min = min.min;
|
|
@@ -354,6 +357,24 @@ const MathHelper = {
|
|
|
354
357
|
} else if (scale) MathHelper.assignScale(scaleData, scale);
|
|
355
358
|
return scaleData;
|
|
356
359
|
},
|
|
360
|
+
getScaleFixedData(worldScaleData, scaleFixed, unscale, abs, _localScaleData) {
|
|
361
|
+
let {scaleX: scaleX, scaleY: scaleY} = worldScaleData;
|
|
362
|
+
if (abs || scaleFixed) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY);
|
|
363
|
+
if (scaleFixed) {
|
|
364
|
+
if (scaleFixed === true) {
|
|
365
|
+
scaleX = scaleY = unscale ? 1 : 1 / scaleX;
|
|
366
|
+
} else {
|
|
367
|
+
let minScale;
|
|
368
|
+
if (isNumber(scaleFixed)) minScale = scaleFixed; else if (scaleFixed === "zoom-in") minScale = 1;
|
|
369
|
+
if (minScale) {
|
|
370
|
+
if (scaleX > minScale || scaleY > minScale) scaleX = scaleY = unscale ? 1 : 1 / scaleX; else scaleX = scaleY = unscale ? 1 : 1 / minScale;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
tempScaleData$1.scaleX = scaleX;
|
|
375
|
+
tempScaleData$1.scaleY = scaleY;
|
|
376
|
+
return tempScaleData$1;
|
|
377
|
+
},
|
|
357
378
|
assignScale(scaleData, scale) {
|
|
358
379
|
if (isNumber(scale)) {
|
|
359
380
|
scaleData.scaleX = scaleData.scaleY = scale;
|
|
@@ -850,8 +871,8 @@ const PointHelper = {
|
|
|
850
871
|
if (isObject(originPoints[0])) points = [], originPoints.forEach(p => points.push(p.x, p.y));
|
|
851
872
|
return points;
|
|
852
873
|
},
|
|
853
|
-
isSame(t, point) {
|
|
854
|
-
return float$5(t.x) === float$5(point.x) && float$5(t.y) === float$5(point.y);
|
|
874
|
+
isSame(t, point, quick) {
|
|
875
|
+
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);
|
|
855
876
|
},
|
|
856
877
|
reset(t) {
|
|
857
878
|
P$7.reset(t);
|
|
@@ -926,8 +947,8 @@ class Point {
|
|
|
926
947
|
getAtan2(to) {
|
|
927
948
|
return PointHelper.getAtan2(this, to);
|
|
928
949
|
}
|
|
929
|
-
isSame(point) {
|
|
930
|
-
return PointHelper.isSame(this, point);
|
|
950
|
+
isSame(point, quick) {
|
|
951
|
+
return PointHelper.isSame(this, point, quick);
|
|
931
952
|
}
|
|
932
953
|
reset() {
|
|
933
954
|
PointHelper.reset(this);
|
|
@@ -1183,9 +1204,9 @@ const AroundHelper = {
|
|
|
1183
1204
|
}
|
|
1184
1205
|
if (!onlyBoxSize) to.x += box.x, to.y += box.y;
|
|
1185
1206
|
},
|
|
1186
|
-
getPoint(around, box, to) {
|
|
1207
|
+
getPoint(around, box, to, onlyBoxSize = true) {
|
|
1187
1208
|
if (!to) to = {};
|
|
1188
|
-
AroundHelper.toPoint(around, box, to,
|
|
1209
|
+
AroundHelper.toPoint(around, box, to, onlyBoxSize);
|
|
1189
1210
|
return to;
|
|
1190
1211
|
}
|
|
1191
1212
|
};
|
|
@@ -1452,6 +1473,9 @@ const BoundsHelper = {
|
|
|
1452
1473
|
y: y + height
|
|
1453
1474
|
} ];
|
|
1454
1475
|
},
|
|
1476
|
+
getPoint(t, around, onlyBoxSize = false, to) {
|
|
1477
|
+
return AroundHelper.getPoint(around, t, to, onlyBoxSize);
|
|
1478
|
+
},
|
|
1455
1479
|
hitRadiusPoint(t, point, pointMatrix) {
|
|
1456
1480
|
if (pointMatrix) point = PointHelper.tempToInnerRadiusPointOf(point, pointMatrix);
|
|
1457
1481
|
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);
|
|
@@ -1623,6 +1647,9 @@ class Bounds {
|
|
|
1623
1647
|
getPoints() {
|
|
1624
1648
|
return BoundsHelper.getPoints(this);
|
|
1625
1649
|
}
|
|
1650
|
+
getPoint(around, onlyBoxSize, to) {
|
|
1651
|
+
return BoundsHelper.getPoint(this, around, onlyBoxSize, to);
|
|
1652
|
+
}
|
|
1626
1653
|
hitPoint(point, pointMatrix) {
|
|
1627
1654
|
return BoundsHelper.hitPoint(this, point, pointMatrix);
|
|
1628
1655
|
}
|
|
@@ -1897,7 +1924,10 @@ const UICreator = {
|
|
|
1897
1924
|
list$3[tag] = UI;
|
|
1898
1925
|
},
|
|
1899
1926
|
get(tag, data, x, y, width, height) {
|
|
1900
|
-
if (!list$3[tag])
|
|
1927
|
+
if (!list$3[tag]) {
|
|
1928
|
+
debug$h.warn("not register " + tag);
|
|
1929
|
+
return undefined;
|
|
1930
|
+
}
|
|
1901
1931
|
const ui = new list$3[tag](data);
|
|
1902
1932
|
if (!isUndefined(x)) {
|
|
1903
1933
|
ui.x = x;
|
|
@@ -3754,10 +3784,10 @@ function canvasPatch(drawer) {
|
|
|
3754
3784
|
const FileHelper = {
|
|
3755
3785
|
alphaPixelTypes: [ "png", "webp", "svg" ],
|
|
3756
3786
|
upperCaseTypeMap: {},
|
|
3757
|
-
|
|
3758
|
-
if (!type || type.startsWith(
|
|
3787
|
+
mimeType(type, base = "image") {
|
|
3788
|
+
if (!type || type.startsWith(base)) return type;
|
|
3759
3789
|
if (type === "jpg") type = "jpeg";
|
|
3760
|
-
return "
|
|
3790
|
+
return base + "/" + type;
|
|
3761
3791
|
},
|
|
3762
3792
|
fileType(filename) {
|
|
3763
3793
|
const l = filename.split(".");
|
|
@@ -3790,6 +3820,8 @@ const FileHelper = {
|
|
|
3790
3820
|
|
|
3791
3821
|
const F$2 = FileHelper;
|
|
3792
3822
|
|
|
3823
|
+
F$2.mineType = F$2.mimeType;
|
|
3824
|
+
|
|
3793
3825
|
F$2.alphaPixelTypes.forEach(type => F$2.upperCaseTypeMap[type] = type.toUpperCase());
|
|
3794
3826
|
|
|
3795
3827
|
const debug$c = Debug.get("TaskProcessor");
|
|
@@ -4034,6 +4066,9 @@ const debug$b = Debug.get("Resource");
|
|
|
4034
4066
|
|
|
4035
4067
|
const Resource = {
|
|
4036
4068
|
tasker: new TaskProcessor,
|
|
4069
|
+
queue: new TaskProcessor({
|
|
4070
|
+
parallel: 1
|
|
4071
|
+
}),
|
|
4037
4072
|
map: {},
|
|
4038
4073
|
get isComplete() {
|
|
4039
4074
|
return R.tasker.isComplete;
|
|
@@ -4070,6 +4105,12 @@ const Resource = {
|
|
|
4070
4105
|
R.set(key, value);
|
|
4071
4106
|
return value;
|
|
4072
4107
|
},
|
|
4108
|
+
loadFilm(_key, _format) {
|
|
4109
|
+
return undefined;
|
|
4110
|
+
},
|
|
4111
|
+
loadVideo(_key, _format) {
|
|
4112
|
+
return undefined;
|
|
4113
|
+
},
|
|
4073
4114
|
destroy() {
|
|
4074
4115
|
R.map = {};
|
|
4075
4116
|
}
|
|
@@ -4080,16 +4121,15 @@ const R = Resource;
|
|
|
4080
4121
|
const ImageManager = {
|
|
4081
4122
|
maxRecycled: 10,
|
|
4082
4123
|
recycledList: [],
|
|
4083
|
-
patternTasker:
|
|
4084
|
-
|
|
4085
|
-
}),
|
|
4086
|
-
get(config) {
|
|
4124
|
+
patternTasker: Resource.queue,
|
|
4125
|
+
get(config, type) {
|
|
4087
4126
|
let image = Resource.get(config.url);
|
|
4088
|
-
if (!image) Resource.set(config.url, image = Creator.image(config));
|
|
4127
|
+
if (!image) Resource.set(config.url, image = type === "film" ? Creator.film(config) : Creator.image(config));
|
|
4089
4128
|
image.use++;
|
|
4090
4129
|
return image;
|
|
4091
4130
|
},
|
|
4092
4131
|
recycle(image) {
|
|
4132
|
+
if (image.parent) image = image.parent;
|
|
4093
4133
|
image.use--;
|
|
4094
4134
|
setTimeout(() => {
|
|
4095
4135
|
if (!image.use) {
|
|
@@ -4120,7 +4160,7 @@ const ImageManager = {
|
|
|
4120
4160
|
if (config.format) return config.format === format;
|
|
4121
4161
|
const {url: url} = config;
|
|
4122
4162
|
if (url.startsWith("data:")) {
|
|
4123
|
-
if (url.startsWith("data:" + FileHelper.
|
|
4163
|
+
if (url.startsWith("data:" + FileHelper.mimeType(format))) return true;
|
|
4124
4164
|
} else {
|
|
4125
4165
|
if (url.includes("." + format) || url.includes("." + FileHelper.upperCaseTypeMap[format])) return true; else if (format === "png" && !url.includes(".")) return true;
|
|
4126
4166
|
}
|
|
@@ -4136,6 +4176,9 @@ const I$1 = ImageManager;
|
|
|
4136
4176
|
const {IMAGE: IMAGE, create: create$1} = IncrementId;
|
|
4137
4177
|
|
|
4138
4178
|
class LeaferImage {
|
|
4179
|
+
get tag() {
|
|
4180
|
+
return "Image";
|
|
4181
|
+
}
|
|
4139
4182
|
get url() {
|
|
4140
4183
|
return this.config.url;
|
|
4141
4184
|
}
|
|
@@ -4164,7 +4207,7 @@ class LeaferImage {
|
|
|
4164
4207
|
if (!this.loading) {
|
|
4165
4208
|
this.loading = true;
|
|
4166
4209
|
Resource.tasker.add(() => __awaiter(this, void 0, void 0, function*() {
|
|
4167
|
-
return yield Platform.origin.
|
|
4210
|
+
return yield Platform.origin["load" + this.tag](this.getLoadUrl(thumbSize), this.crossOrigin, this).then(img => {
|
|
4168
4211
|
if (thumbSize) this.setThumbView(img);
|
|
4169
4212
|
this.setView(img);
|
|
4170
4213
|
}).catch(e => {
|
|
@@ -4238,6 +4281,9 @@ class LeaferImage {
|
|
|
4238
4281
|
Platform.image.setPatternTransform(pattern, transform, paint);
|
|
4239
4282
|
return pattern;
|
|
4240
4283
|
}
|
|
4284
|
+
render(canvas, x, y, width, height, _leaf, _paint, _imageScaleX, _imageScaleY) {
|
|
4285
|
+
canvas.drawImage(this.view, x, y, width, height);
|
|
4286
|
+
}
|
|
4241
4287
|
getLoadUrl(_thumbSize) {
|
|
4242
4288
|
return this.url;
|
|
4243
4289
|
}
|
|
@@ -4252,8 +4298,10 @@ class LeaferImage {
|
|
|
4252
4298
|
return undefined;
|
|
4253
4299
|
}
|
|
4254
4300
|
clearLevels(_checkUse) {}
|
|
4301
|
+
destroyFilter() {}
|
|
4255
4302
|
destroy() {
|
|
4256
4303
|
this.clearLevels();
|
|
4304
|
+
this.destroyFilter();
|
|
4257
4305
|
const {view: view} = this;
|
|
4258
4306
|
if (view && view.close) view.close();
|
|
4259
4307
|
this.config = {
|
|
@@ -4264,6 +4312,18 @@ class LeaferImage {
|
|
|
4264
4312
|
}
|
|
4265
4313
|
}
|
|
4266
4314
|
|
|
4315
|
+
class LeaferFilm extends LeaferImage {
|
|
4316
|
+
get tag() {
|
|
4317
|
+
return "Film";
|
|
4318
|
+
}
|
|
4319
|
+
}
|
|
4320
|
+
|
|
4321
|
+
class LeaferVideo extends LeaferImage {
|
|
4322
|
+
get tag() {
|
|
4323
|
+
return "Video";
|
|
4324
|
+
}
|
|
4325
|
+
}
|
|
4326
|
+
|
|
4267
4327
|
function defineKey(target, key, descriptor, noConfigurable) {
|
|
4268
4328
|
if (!noConfigurable) descriptor.configurable = descriptor.enumerable = true;
|
|
4269
4329
|
Object.defineProperty(target, key, descriptor);
|
|
@@ -4438,7 +4498,6 @@ function dimType(defaultValue) {
|
|
|
4438
4498
|
if (this.__setAttr(key, value)) {
|
|
4439
4499
|
const data = this.__;
|
|
4440
4500
|
DataHelper.stintSet(data, "__useDim", data.dim || data.bright || data.dimskip);
|
|
4441
|
-
this.__layout.surfaceChange();
|
|
4442
4501
|
}
|
|
4443
4502
|
}
|
|
4444
4503
|
}));
|
|
@@ -4488,7 +4547,6 @@ function sortType(defaultValue) {
|
|
|
4488
4547
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4489
4548
|
set(value) {
|
|
4490
4549
|
if (this.__setAttr(key, value)) {
|
|
4491
|
-
this.__layout.surfaceChange();
|
|
4492
4550
|
this.waitParent(() => {
|
|
4493
4551
|
this.parent.__layout.childrenSortChange();
|
|
4494
4552
|
});
|
|
@@ -4525,7 +4583,6 @@ function hitType(defaultValue) {
|
|
|
4525
4583
|
set(value) {
|
|
4526
4584
|
if (this.__setAttr(key, value)) {
|
|
4527
4585
|
this.__layout.hitCanvasChanged = true;
|
|
4528
|
-
if (Debug.showBounds === "hit") this.__layout.surfaceChange();
|
|
4529
4586
|
if (this.leafer) this.leafer.updateCursor();
|
|
4530
4587
|
}
|
|
4531
4588
|
}
|
|
@@ -4731,6 +4788,10 @@ const LeafHelper = {
|
|
|
4731
4788
|
if (layout.stateStyleChanged) leaf.updateState();
|
|
4732
4789
|
if (layout.opacityChanged) updateAllWorldOpacity(leaf);
|
|
4733
4790
|
leaf.__updateChange();
|
|
4791
|
+
if (layout.surfaceChanged) {
|
|
4792
|
+
if (leaf.__hasComplex) L$4.updateComplex(leaf);
|
|
4793
|
+
layout.surfaceChanged = false;
|
|
4794
|
+
}
|
|
4734
4795
|
},
|
|
4735
4796
|
updateAllChange(leaf) {
|
|
4736
4797
|
updateChange$1(leaf);
|
|
@@ -4755,6 +4816,9 @@ const LeafHelper = {
|
|
|
4755
4816
|
if (!fromWorld) fromWorld = leaf.__nowWorld;
|
|
4756
4817
|
if (leaf.__worldFlipped || Platform.fullImageShadow) currentCanvas.copyWorldByReset(fromCanvas, fromWorld, leaf.__nowWorld, blendMode, onlyResetTransform); else currentCanvas.copyWorldToInner(fromCanvas, fromWorld, leaf.__layout.renderBounds, blendMode);
|
|
4757
4818
|
},
|
|
4819
|
+
renderComplex(_leaf, _canvas, _options) {},
|
|
4820
|
+
updateComplex(_leaf) {},
|
|
4821
|
+
checkComplex(_leaf) {},
|
|
4758
4822
|
moveWorld(t, x, y = 0, isInnerPoint, transition) {
|
|
4759
4823
|
const local = isObject(x) ? Object.assign({}, x) : {
|
|
4760
4824
|
x: x,
|
|
@@ -4866,6 +4930,9 @@ const LeafHelper = {
|
|
|
4866
4930
|
divideParent(matrix$3, relative.scrollWorldTransform);
|
|
4867
4931
|
return temp ? matrix$3 : Object.assign({}, matrix$3);
|
|
4868
4932
|
},
|
|
4933
|
+
updateScaleFixedWorld(_t) {},
|
|
4934
|
+
updateOuterBounds(_t) {},
|
|
4935
|
+
cacheId(_t) {},
|
|
4869
4936
|
drop(t, parent, index, resize) {
|
|
4870
4937
|
t.setTransform(L$4.getRelativeWorld(t, parent, true), resize);
|
|
4871
4938
|
parent.add(t, index);
|
|
@@ -4916,7 +4983,8 @@ const LeafBoundsHelper = {
|
|
|
4916
4983
|
return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localStrokeBounds;
|
|
4917
4984
|
},
|
|
4918
4985
|
localRenderBounds(target) {
|
|
4919
|
-
|
|
4986
|
+
const {__: __, __layout: __layout} = target;
|
|
4987
|
+
return __.eraser || __.visible === 0 ? null : __layout.localOuterBounds || __layout.localRenderBounds;
|
|
4920
4988
|
},
|
|
4921
4989
|
maskLocalBoxBounds(target, index) {
|
|
4922
4990
|
return checkMask(target, index) && target.__localBoxBounds;
|
|
@@ -4925,7 +4993,8 @@ const LeafBoundsHelper = {
|
|
|
4925
4993
|
return checkMask(target, index) && target.__layout.localStrokeBounds;
|
|
4926
4994
|
},
|
|
4927
4995
|
maskLocalRenderBounds(target, index) {
|
|
4928
|
-
|
|
4996
|
+
const {__layout: __layout} = target;
|
|
4997
|
+
return checkMask(target, index) && (__layout.localOuterBounds || __layout.localRenderBounds);
|
|
4929
4998
|
},
|
|
4930
4999
|
excludeRenderBounds(child, options) {
|
|
4931
5000
|
if (options.bounds && !options.bounds.hit(child.__world, options.matrix)) return true;
|
|
@@ -5049,12 +5118,12 @@ const BranchHelper = {
|
|
|
5049
5118
|
w.height *= scaleY;
|
|
5050
5119
|
w.scaleX *= scaleX;
|
|
5051
5120
|
w.scaleY *= scaleY;
|
|
5052
|
-
if (branch.isBranch) scale$
|
|
5121
|
+
if (branch.isBranch) scale$3(branch, x, y, scaleX, scaleY, a, b);
|
|
5053
5122
|
}
|
|
5054
5123
|
}
|
|
5055
5124
|
};
|
|
5056
5125
|
|
|
5057
|
-
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;
|
|
5058
5127
|
|
|
5059
5128
|
const WaitHelper = {
|
|
5060
5129
|
run(wait) {
|
|
@@ -5445,7 +5514,6 @@ class LeafLayout {
|
|
|
5445
5514
|
}
|
|
5446
5515
|
opacityChange() {
|
|
5447
5516
|
this.opacityChanged = true;
|
|
5448
|
-
this.surfaceChanged || this.surfaceChange();
|
|
5449
5517
|
}
|
|
5450
5518
|
childrenSortChange() {
|
|
5451
5519
|
if (!this.childrenSortChanged) {
|
|
@@ -5938,6 +6006,7 @@ const LeafMatrix = {
|
|
|
5938
6006
|
const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
|
|
5939
6007
|
multiplyParent$2(this.__local || __layout, parent ? parent.__scrollWorld || parent.__world : defaultWorld, __world, !!__layout.affectScaleOrRotation, __);
|
|
5940
6008
|
if (__scrollWorld) translateInner(Object.assign(__scrollWorld, __world), __.scrollX, __.scrollY);
|
|
6009
|
+
if (__layout.scaleFixed) LeafHelper.updateScaleFixedWorld(this);
|
|
5941
6010
|
},
|
|
5942
6011
|
__updateLocalMatrix() {
|
|
5943
6012
|
if (this.__local) {
|
|
@@ -5963,7 +6032,7 @@ const {updateMatrix: updateMatrix$3, updateAllMatrix: updateAllMatrix$3} = LeafH
|
|
|
5963
6032
|
|
|
5964
6033
|
const {updateBounds: updateBounds$2} = BranchHelper;
|
|
5965
6034
|
|
|
5966
|
-
const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$
|
|
6035
|
+
const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$4, copy: copy$6} = BoundsHelper;
|
|
5967
6036
|
|
|
5968
6037
|
const {toBounds: toBounds$1} = PathBounds;
|
|
5969
6038
|
|
|
@@ -5971,6 +6040,7 @@ const LeafBounds = {
|
|
|
5971
6040
|
__updateWorldBounds() {
|
|
5972
6041
|
const {__layout: __layout, __world: __world} = this;
|
|
5973
6042
|
toOuterOf$2(__layout.renderBounds, __world, __world);
|
|
6043
|
+
if (this.__hasComplex) LeafHelper.checkComplex(this);
|
|
5974
6044
|
if (__layout.resized) {
|
|
5975
6045
|
if (__layout.resized === "inner") this.__onUpdateSize();
|
|
5976
6046
|
if (this.__hasLocalEvent) BoundsEvent.emitLocal(this);
|
|
@@ -6020,6 +6090,7 @@ const LeafBounds = {
|
|
|
6020
6090
|
layout.renderChanged = undefined;
|
|
6021
6091
|
if (this.parent) this.parent.__layout.renderChange();
|
|
6022
6092
|
}
|
|
6093
|
+
if (layout.outerScale) LeafHelper.updateOuterBounds(this);
|
|
6023
6094
|
layout.resized || (layout.resized = "local");
|
|
6024
6095
|
layout.boundsChanged = undefined;
|
|
6025
6096
|
},
|
|
@@ -6070,11 +6141,11 @@ const LeafBounds = {
|
|
|
6070
6141
|
},
|
|
6071
6142
|
__updateStrokeBounds(_bounds) {
|
|
6072
6143
|
const layout = this.__layout;
|
|
6073
|
-
copyAndSpread$
|
|
6144
|
+
copyAndSpread$4(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
|
|
6074
6145
|
},
|
|
6075
6146
|
__updateRenderBounds(_bounds) {
|
|
6076
6147
|
const layout = this.__layout, {renderSpread: renderSpread} = layout;
|
|
6077
|
-
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);
|
|
6078
6149
|
}
|
|
6079
6150
|
};
|
|
6080
6151
|
|
|
@@ -6086,7 +6157,7 @@ const LeafRender = {
|
|
|
6086
6157
|
const data = this.__;
|
|
6087
6158
|
if (data.bright && !options.topRendering) return options.topList.add(this);
|
|
6088
6159
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
6089
|
-
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;
|
|
6090
6161
|
if (this.__.__single) {
|
|
6091
6162
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
6092
6163
|
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
@@ -6140,7 +6211,7 @@ const BranchRender = {
|
|
|
6140
6211
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
6141
6212
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
6142
6213
|
this.__renderBranch(tempCanvas, options);
|
|
6143
|
-
canvas.opacity = options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
|
|
6214
|
+
canvas.opacity = options.ignoreOpacity ? 1 : options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
|
|
6144
6215
|
canvas.copyWorldByReset(tempCanvas, nowWorld, nowWorld, data.__blendMode, true);
|
|
6145
6216
|
tempCanvas.recycle(nowWorld);
|
|
6146
6217
|
} else {
|
|
@@ -6152,9 +6223,11 @@ const BranchRender = {
|
|
|
6152
6223
|
if (this.__hasMask) {
|
|
6153
6224
|
this.__renderMask(canvas, options);
|
|
6154
6225
|
} else {
|
|
6226
|
+
let child;
|
|
6155
6227
|
const {children: children} = this;
|
|
6156
6228
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
6157
|
-
|
|
6229
|
+
child = children[i];
|
|
6230
|
+
excludeRenderBounds$1(child, options) || (child.__hasComplex ? LeafHelper.renderComplex(child, canvas, options) : child.__render(canvas, options));
|
|
6158
6231
|
}
|
|
6159
6232
|
}
|
|
6160
6233
|
},
|
|
@@ -6168,11 +6241,9 @@ const BranchRender = {
|
|
|
6168
6241
|
}
|
|
6169
6242
|
};
|
|
6170
6243
|
|
|
6171
|
-
const tempScaleData$1 = {};
|
|
6172
|
-
|
|
6173
6244
|
const {LEAF: LEAF, create: create} = IncrementId;
|
|
6174
6245
|
|
|
6175
|
-
const {stintSet: stintSet$
|
|
6246
|
+
const {stintSet: stintSet$6} = DataHelper;
|
|
6176
6247
|
|
|
6177
6248
|
const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
|
|
6178
6249
|
|
|
@@ -6180,6 +6251,8 @@ const {toOuterOf: toOuterOf$1} = BoundsHelper;
|
|
|
6180
6251
|
|
|
6181
6252
|
const {copy: copy$5, move: move$8} = PointHelper;
|
|
6182
6253
|
|
|
6254
|
+
const {getScaleFixedData: getScaleFixedData$1} = MathHelper;
|
|
6255
|
+
|
|
6183
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;
|
|
6184
6257
|
|
|
6185
6258
|
let Leaf = class Leaf {
|
|
@@ -6338,6 +6411,7 @@ let Leaf = class Leaf {
|
|
|
6338
6411
|
this.__level = this.parent ? this.parent.__level + 1 : 1;
|
|
6339
6412
|
if (this.animation) this.__runAnimation("in");
|
|
6340
6413
|
if (this.__bubbleMap) this.__emitLifeEvent(ChildEvent.MOUNTED);
|
|
6414
|
+
if (leafer.cacheId) LeafHelper.cacheId(this);
|
|
6341
6415
|
} else {
|
|
6342
6416
|
this.__emitLifeEvent(ChildEvent.UNMOUNTED);
|
|
6343
6417
|
}
|
|
@@ -6455,8 +6529,8 @@ let Leaf = class Leaf {
|
|
|
6455
6529
|
const cameraWorld = this.__cameraWorld, world = this.__world;
|
|
6456
6530
|
multiplyParent$1(world, options.matrix, cameraWorld, undefined, world);
|
|
6457
6531
|
toOuterOf$1(this.__layout.renderBounds, cameraWorld, cameraWorld);
|
|
6458
|
-
stintSet$
|
|
6459
|
-
stintSet$
|
|
6532
|
+
stintSet$6(cameraWorld, "half", world.half);
|
|
6533
|
+
stintSet$6(cameraWorld, "ignorePixelSnap", world.ignorePixelSnap);
|
|
6460
6534
|
return cameraWorld;
|
|
6461
6535
|
} else {
|
|
6462
6536
|
return this.__world;
|
|
@@ -6467,13 +6541,8 @@ let Leaf = class Leaf {
|
|
|
6467
6541
|
if (scaleX < 0) scaleX = -scaleX;
|
|
6468
6542
|
return scaleX > 1 ? scaleX : 1;
|
|
6469
6543
|
}
|
|
6470
|
-
getRenderScaleData(abs, scaleFixed) {
|
|
6471
|
-
|
|
6472
|
-
if (abs) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY);
|
|
6473
|
-
if (scaleFixed === true || scaleFixed === "zoom-in" && scaleX > 1 && scaleY > 1) scaleX = scaleY = 1;
|
|
6474
|
-
tempScaleData$1.scaleX = scaleX;
|
|
6475
|
-
tempScaleData$1.scaleY = scaleY;
|
|
6476
|
-
return tempScaleData$1;
|
|
6544
|
+
getRenderScaleData(abs, scaleFixed, unscale = true) {
|
|
6545
|
+
return getScaleFixedData$1(ImageManager.patternLocked ? this.__world : this.__nowWorld || this.__world, scaleFixed, unscale, abs);
|
|
6477
6546
|
}
|
|
6478
6547
|
getTransform(relative) {
|
|
6479
6548
|
return this.__layout.getTransform(relative || "local");
|
|
@@ -6645,7 +6714,7 @@ let Leaf = class Leaf {
|
|
|
6645
6714
|
__drawPath(_canvas) {}
|
|
6646
6715
|
__drawRenderPath(_canvas) {}
|
|
6647
6716
|
__updatePath() {}
|
|
6648
|
-
__updateRenderPath() {}
|
|
6717
|
+
__updateRenderPath(_updateCache) {}
|
|
6649
6718
|
getMotionPathData() {
|
|
6650
6719
|
return Plugin.need("path");
|
|
6651
6720
|
}
|
|
@@ -6719,9 +6788,11 @@ let Branch = class Branch extends Leaf {
|
|
|
6719
6788
|
return 0;
|
|
6720
6789
|
}
|
|
6721
6790
|
__updateRenderSpread() {
|
|
6791
|
+
let layout;
|
|
6722
6792
|
const {children: children} = this;
|
|
6723
6793
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
6724
|
-
|
|
6794
|
+
layout = children[i].__layout;
|
|
6795
|
+
if (layout.renderSpread || layout.localOuterBounds) return 1;
|
|
6725
6796
|
}
|
|
6726
6797
|
return 0;
|
|
6727
6798
|
}
|
|
@@ -6754,6 +6825,7 @@ let Branch = class Branch extends Leaf {
|
|
|
6754
6825
|
this.add(item, index);
|
|
6755
6826
|
noIndex || index++;
|
|
6756
6827
|
}); else child = UICreator.get(child.tag, child);
|
|
6828
|
+
if (!child) return;
|
|
6757
6829
|
}
|
|
6758
6830
|
if (child.parent) child.parent.remove(child);
|
|
6759
6831
|
child.parent = this;
|
|
@@ -6979,7 +7051,7 @@ class LeafLevelList {
|
|
|
6979
7051
|
}
|
|
6980
7052
|
}
|
|
6981
7053
|
|
|
6982
|
-
const version = "2.0.
|
|
7054
|
+
const version = "2.0.3";
|
|
6983
7055
|
|
|
6984
7056
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6985
7057
|
get allowBackgroundColor() {
|
|
@@ -7084,8 +7156,6 @@ class LeaferCanvas extends LeaferCanvasBase {
|
|
|
7084
7156
|
}
|
|
7085
7157
|
}
|
|
7086
7158
|
|
|
7087
|
-
const {mineType: mineType, fileType: fileType} = FileHelper;
|
|
7088
|
-
|
|
7089
7159
|
Object.assign(Creator, {
|
|
7090
7160
|
canvas: (options, manager) => new LeaferCanvas(options, manager),
|
|
7091
7161
|
image: options => new LeaferImage(options)
|
|
@@ -7101,12 +7171,12 @@ function useCanvas(_canvasType, app) {
|
|
|
7101
7171
|
};
|
|
7102
7172
|
return app.createOffscreenCanvas ? app.createOffscreenCanvas(data) : app.createOffScreenCanvas(data);
|
|
7103
7173
|
},
|
|
7104
|
-
canvasToDataURL: (canvas, type, quality) => canvas.toDataURL(
|
|
7174
|
+
canvasToDataURL: (canvas, type, quality) => canvas.toDataURL(FileHelper.mimeType(type), quality),
|
|
7105
7175
|
canvasToBolb: (canvas, type, quality) => canvas.toBuffer(type, {
|
|
7106
7176
|
quality: quality
|
|
7107
7177
|
}),
|
|
7108
7178
|
canvasSaveAs: (canvas, filePath, quality) => {
|
|
7109
|
-
let data = canvas.toDataURL(
|
|
7179
|
+
let data = canvas.toDataURL(FileHelper.mimeType(FileHelper.fileType(filePath)), quality);
|
|
7110
7180
|
data = data.substring(data.indexOf("64,") + 3);
|
|
7111
7181
|
return Platform.origin.download(data, filePath);
|
|
7112
7182
|
},
|
|
@@ -7140,7 +7210,7 @@ function useCanvas(_canvasType, app) {
|
|
|
7140
7210
|
});
|
|
7141
7211
|
});
|
|
7142
7212
|
},
|
|
7143
|
-
loadImage(src) {
|
|
7213
|
+
loadImage(src, _crossOrigin, _leaferImage) {
|
|
7144
7214
|
return new Promise((resolve, reject) => {
|
|
7145
7215
|
const img = Platform.canvas.view.createImage();
|
|
7146
7216
|
img.onload = () => {
|
|
@@ -7152,6 +7222,14 @@ function useCanvas(_canvasType, app) {
|
|
|
7152
7222
|
img.src = Platform.image.getRealURL(src);
|
|
7153
7223
|
});
|
|
7154
7224
|
},
|
|
7225
|
+
loadContent(url, responseType = "text") {
|
|
7226
|
+
return new Promise((resolve, reject) => app.request({
|
|
7227
|
+
url: url,
|
|
7228
|
+
responseType: responseType === "arrayBuffer" ? "arraybuffer" : "text",
|
|
7229
|
+
success: res => resolve(responseType === "json" && typeof res.data === "string" ? JSON.parse(res.data) : res.data),
|
|
7230
|
+
fail: reject
|
|
7231
|
+
}));
|
|
7232
|
+
},
|
|
7155
7233
|
noRepeat: "repeat-x"
|
|
7156
7234
|
};
|
|
7157
7235
|
Platform.miniapp = {
|
|
@@ -7703,7 +7781,7 @@ class Renderer {
|
|
|
7703
7781
|
getCellList() {
|
|
7704
7782
|
return undefined;
|
|
7705
7783
|
}
|
|
7706
|
-
addBlock(block) {
|
|
7784
|
+
addBlock(block, _leafList) {
|
|
7707
7785
|
if (!this.updateBlocks) this.updateBlocks = [];
|
|
7708
7786
|
this.updateBlocks.push(block);
|
|
7709
7787
|
}
|
|
@@ -7751,7 +7829,8 @@ class Renderer {
|
|
|
7751
7829
|
__onLayoutEnd(event) {
|
|
7752
7830
|
if (event.data) event.data.map(item => {
|
|
7753
7831
|
let empty;
|
|
7754
|
-
|
|
7832
|
+
const {updatedList: updatedList} = item;
|
|
7833
|
+
if (updatedList) updatedList.list.some(leaf => {
|
|
7755
7834
|
empty = !leaf.__world.width || !leaf.__world.height;
|
|
7756
7835
|
if (empty) {
|
|
7757
7836
|
if (!leaf.isLeafer) debug$6.tip(leaf.innerName, ": empty");
|
|
@@ -7759,7 +7838,7 @@ class Renderer {
|
|
|
7759
7838
|
}
|
|
7760
7839
|
return empty;
|
|
7761
7840
|
});
|
|
7762
|
-
this.addBlock(empty ? this.canvas.bounds : item.updatedBounds);
|
|
7841
|
+
this.addBlock(empty ? this.canvas.bounds : item.updatedBounds, updatedList);
|
|
7763
7842
|
});
|
|
7764
7843
|
}
|
|
7765
7844
|
emitRender(type, bounds, options) {
|
|
@@ -7965,7 +8044,7 @@ class Selector {
|
|
|
7965
8044
|
this.config = {};
|
|
7966
8045
|
if (userConfig) this.config = DataHelper.default(userConfig, this.config);
|
|
7967
8046
|
this.picker = new Picker(this.target = target, this);
|
|
7968
|
-
this.finder = Creator.finder && Creator.finder();
|
|
8047
|
+
this.finder = Creator.finder && Creator.finder(target, this.config);
|
|
7969
8048
|
}
|
|
7970
8049
|
getByPoint(hitPoint, hitRadius, options) {
|
|
7971
8050
|
const {target: target, picker: picker} = this;
|
|
@@ -8007,7 +8086,9 @@ function effectType(defaultValue) {
|
|
|
8007
8086
|
set(value) {
|
|
8008
8087
|
this.__setAttr(key, value);
|
|
8009
8088
|
if (value) this.__.__useEffect = true;
|
|
8010
|
-
|
|
8089
|
+
const layout = this.__layout;
|
|
8090
|
+
layout.renderChanged || layout.renderChange();
|
|
8091
|
+
layout.surfaceChange();
|
|
8011
8092
|
}
|
|
8012
8093
|
}));
|
|
8013
8094
|
}
|
|
@@ -8110,7 +8191,7 @@ const Transition = {
|
|
|
8110
8191
|
|
|
8111
8192
|
const {parse: parse, objectToCanvasData: objectToCanvasData} = PathConvert;
|
|
8112
8193
|
|
|
8113
|
-
const {stintSet: stintSet$
|
|
8194
|
+
const {stintSet: stintSet$5} = DataHelper, {hasTransparent: hasTransparent$2} = ColorConvert;
|
|
8114
8195
|
|
|
8115
8196
|
const emptyPaint = {
|
|
8116
8197
|
originPaint: {}
|
|
@@ -8179,7 +8260,7 @@ class UIData extends LeafData {
|
|
|
8179
8260
|
setFill(value) {
|
|
8180
8261
|
if (this.__naturalWidth) this.__removeNaturalSize();
|
|
8181
8262
|
if (isString(value) || !value) {
|
|
8182
|
-
stintSet$
|
|
8263
|
+
stintSet$5(this, "__isTransparentFill", hasTransparent$2(value));
|
|
8183
8264
|
this.__isFills && this.__removePaint("fill", true);
|
|
8184
8265
|
this._fill = value;
|
|
8185
8266
|
} else if (isObject(value)) {
|
|
@@ -8188,7 +8269,7 @@ class UIData extends LeafData {
|
|
|
8188
8269
|
}
|
|
8189
8270
|
setStroke(value) {
|
|
8190
8271
|
if (isString(value) || !value) {
|
|
8191
|
-
stintSet$
|
|
8272
|
+
stintSet$5(this, "__isTransparentStroke", hasTransparent$2(value));
|
|
8192
8273
|
this.__isStrokes && this.__removePaint("stroke", true);
|
|
8193
8274
|
this._stroke = value;
|
|
8194
8275
|
} else if (isObject(value)) {
|
|
@@ -8221,15 +8302,16 @@ class UIData extends LeafData {
|
|
|
8221
8302
|
this.__needComputePaint = undefined;
|
|
8222
8303
|
}
|
|
8223
8304
|
__getRealStrokeWidth(childStyle) {
|
|
8224
|
-
let {strokeWidth: strokeWidth,
|
|
8305
|
+
let {strokeWidth: strokeWidth, strokeScaleFixed: strokeScaleFixed} = this;
|
|
8225
8306
|
if (childStyle) {
|
|
8226
8307
|
if (childStyle.strokeWidth) strokeWidth = childStyle.strokeWidth;
|
|
8227
|
-
if (!isUndefined(childStyle.
|
|
8308
|
+
if (!isUndefined(childStyle.strokeScaleFixed)) strokeScaleFixed = childStyle.strokeScaleFixed;
|
|
8309
|
+
}
|
|
8310
|
+
if (strokeScaleFixed) {
|
|
8311
|
+
const {scaleX: scaleX} = this.__leaf.getRenderScaleData(true, strokeScaleFixed, false);
|
|
8312
|
+
if (scaleX !== 1) return strokeWidth * scaleX;
|
|
8228
8313
|
}
|
|
8229
|
-
|
|
8230
|
-
const scale = this.__leaf.getClampRenderScale();
|
|
8231
|
-
return scale > 1 ? strokeWidth / scale : strokeWidth;
|
|
8232
|
-
} else return strokeWidth;
|
|
8314
|
+
return strokeWidth;
|
|
8233
8315
|
}
|
|
8234
8316
|
__setPaint(attrName, value) {
|
|
8235
8317
|
this.__setInput(attrName, value);
|
|
@@ -8246,11 +8328,11 @@ class UIData extends LeafData {
|
|
|
8246
8328
|
if (removeInput) this.__removeInput(attrName);
|
|
8247
8329
|
PaintImage.recycleImage(attrName, this);
|
|
8248
8330
|
if (attrName === "fill") {
|
|
8249
|
-
stintSet$
|
|
8331
|
+
stintSet$5(this, "__isAlphaPixelFill", undefined);
|
|
8250
8332
|
this._fill = this.__isFills = undefined;
|
|
8251
8333
|
} else {
|
|
8252
|
-
stintSet$
|
|
8253
|
-
stintSet$
|
|
8334
|
+
stintSet$5(this, "__isAlphaPixelStroke", undefined);
|
|
8335
|
+
stintSet$5(this, "__hasMultiStrokeStyle", undefined);
|
|
8254
8336
|
this._stroke = this.__isStrokes = undefined;
|
|
8255
8337
|
}
|
|
8256
8338
|
}
|
|
@@ -8367,13 +8449,16 @@ class TextData extends UIData {
|
|
|
8367
8449
|
}
|
|
8368
8450
|
|
|
8369
8451
|
class ImageData extends RectData {
|
|
8452
|
+
get __urlType() {
|
|
8453
|
+
return "image";
|
|
8454
|
+
}
|
|
8370
8455
|
setUrl(value) {
|
|
8371
8456
|
this.__setImageFill(value);
|
|
8372
8457
|
this._url = value;
|
|
8373
8458
|
}
|
|
8374
8459
|
__setImageFill(value) {
|
|
8375
8460
|
this.fill = value ? {
|
|
8376
|
-
type:
|
|
8461
|
+
type: this.__urlType,
|
|
8377
8462
|
mode: "stretch",
|
|
8378
8463
|
url: value
|
|
8379
8464
|
} : undefined;
|
|
@@ -8412,7 +8497,7 @@ const UIBounds = {
|
|
|
8412
8497
|
const data = this.__, {strokeAlign: strokeAlign, __maxStrokeWidth: strokeWidth} = data, box = this.__box;
|
|
8413
8498
|
if ((data.stroke || data.hitStroke === "all") && strokeWidth && strokeAlign !== "inside") {
|
|
8414
8499
|
boxSpread = spread = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
|
|
8415
|
-
if (!data.__boxStroke) {
|
|
8500
|
+
if (!data.__boxStroke || data.__useArrow) {
|
|
8416
8501
|
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * spread;
|
|
8417
8502
|
const storkeCapAddWidth = data.strokeCap === "none" ? 0 : strokeWidth;
|
|
8418
8503
|
spread += Math.max(miterLimitAddWidth, storkeCapAddWidth);
|
|
@@ -8442,23 +8527,23 @@ const UIBounds = {
|
|
|
8442
8527
|
}
|
|
8443
8528
|
};
|
|
8444
8529
|
|
|
8445
|
-
const {stintSet: stintSet$
|
|
8530
|
+
const {stintSet: stintSet$4} = DataHelper;
|
|
8446
8531
|
|
|
8447
8532
|
const UIRender = {
|
|
8448
8533
|
__updateChange() {
|
|
8449
8534
|
const data = this.__;
|
|
8450
8535
|
if (data.__useStroke) {
|
|
8451
8536
|
const useStroke = data.__useStroke = !!(data.stroke && data.strokeWidth);
|
|
8452
|
-
stintSet$
|
|
8453
|
-
stintSet$
|
|
8537
|
+
stintSet$4(this.__world, "half", useStroke && data.strokeAlign === "center" && data.strokeWidth % 2);
|
|
8538
|
+
stintSet$4(data, "__fillAfterStroke", useStroke && data.strokeAlign === "outside" && data.fill && !data.__isTransparentFill);
|
|
8454
8539
|
}
|
|
8455
8540
|
if (data.__useEffect) {
|
|
8456
8541
|
const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
8457
|
-
stintSet$
|
|
8542
|
+
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"));
|
|
8458
8543
|
data.__useEffect = !!(shadow || otherEffect);
|
|
8459
8544
|
}
|
|
8460
8545
|
data.__checkSingle();
|
|
8461
|
-
stintSet$
|
|
8546
|
+
stintSet$4(data, "__complex", data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
8462
8547
|
},
|
|
8463
8548
|
__drawFast(canvas, options) {
|
|
8464
8549
|
drawFast(this, canvas, options);
|
|
@@ -8569,6 +8654,12 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8569
8654
|
get isFrame() {
|
|
8570
8655
|
return false;
|
|
8571
8656
|
}
|
|
8657
|
+
set strokeWidthFixed(value) {
|
|
8658
|
+
this.strokeScaleFixed = value;
|
|
8659
|
+
}
|
|
8660
|
+
get strokeWidthFixed() {
|
|
8661
|
+
return this.strokeScaleFixed;
|
|
8662
|
+
}
|
|
8572
8663
|
set scale(value) {
|
|
8573
8664
|
MathHelper.assignScale(this, value);
|
|
8574
8665
|
}
|
|
@@ -8624,6 +8715,9 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8624
8715
|
getPathString(curve, pathForRender, floatLength) {
|
|
8625
8716
|
return PathConvert.stringify(this.getPath(curve, pathForRender), floatLength);
|
|
8626
8717
|
}
|
|
8718
|
+
asPath(curve, pathForRender) {
|
|
8719
|
+
this.path = this.getPath(curve, pathForRender);
|
|
8720
|
+
}
|
|
8627
8721
|
load() {
|
|
8628
8722
|
this.__.__computePaint();
|
|
8629
8723
|
}
|
|
@@ -8633,16 +8727,18 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8633
8727
|
data.lazy && !this.__inLazyBounds && !Export.running ? data.__needComputePaint = true : data.__computePaint();
|
|
8634
8728
|
}
|
|
8635
8729
|
}
|
|
8636
|
-
__updateRenderPath() {
|
|
8730
|
+
__updateRenderPath(updateCache) {
|
|
8637
8731
|
const data = this.__;
|
|
8638
8732
|
if (data.path) {
|
|
8639
8733
|
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
8640
|
-
if (data.__useArrow) PathArrow.addArrows(this);
|
|
8734
|
+
if (data.__useArrow) PathArrow.addArrows(this, updateCache);
|
|
8641
8735
|
} else data.__pathForRender && (data.__pathForRender = undefined);
|
|
8642
8736
|
}
|
|
8643
8737
|
__drawRenderPath(canvas) {
|
|
8738
|
+
const data = this.__;
|
|
8644
8739
|
canvas.beginPath();
|
|
8645
|
-
|
|
8740
|
+
if (data.__useArrow) PathArrow.updateArrow(this);
|
|
8741
|
+
this.__drawPathByData(canvas, data.__pathForRender);
|
|
8646
8742
|
}
|
|
8647
8743
|
__drawPath(canvas) {
|
|
8648
8744
|
canvas.beginPath();
|
|
@@ -8691,6 +8787,7 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8691
8787
|
static setEditOuter(_toolName) {}
|
|
8692
8788
|
static setEditInner(_editorName) {}
|
|
8693
8789
|
destroy() {
|
|
8790
|
+
this.__.__willDestroy = true;
|
|
8694
8791
|
this.fill = this.stroke = null;
|
|
8695
8792
|
if (this.__animate) this.killAnimate();
|
|
8696
8793
|
super.destroy();
|
|
@@ -8807,7 +8904,7 @@ __decorate([ strokeType("inside") ], UI.prototype, "strokeAlign", void 0);
|
|
|
8807
8904
|
|
|
8808
8905
|
__decorate([ strokeType(1, true) ], UI.prototype, "strokeWidth", void 0);
|
|
8809
8906
|
|
|
8810
|
-
__decorate([ strokeType(false) ], UI.prototype, "
|
|
8907
|
+
__decorate([ strokeType(false) ], UI.prototype, "strokeScaleFixed", void 0);
|
|
8811
8908
|
|
|
8812
8909
|
__decorate([ strokeType("none") ], UI.prototype, "strokeCap", void 0);
|
|
8813
8910
|
|
|
@@ -8873,7 +8970,10 @@ let Group = class Group extends UI {
|
|
|
8873
8970
|
}
|
|
8874
8971
|
toJSON(options) {
|
|
8875
8972
|
const data = super.toJSON(options);
|
|
8876
|
-
if (!this.childlessJSON)
|
|
8973
|
+
if (!this.childlessJSON) {
|
|
8974
|
+
const children = data.children = [];
|
|
8975
|
+
this.children.forEach(child => child.skipJSON || children.push(child.toJSON(options)));
|
|
8976
|
+
}
|
|
8877
8977
|
return data;
|
|
8878
8978
|
}
|
|
8879
8979
|
pick(_hitPoint, _options) {
|
|
@@ -9022,12 +9122,12 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
9022
9122
|
this.emitLeafer(LeaferEvent.STOP);
|
|
9023
9123
|
}
|
|
9024
9124
|
}
|
|
9025
|
-
unlockLayout() {
|
|
9125
|
+
unlockLayout(updateLayout = true) {
|
|
9026
9126
|
this.layouter.start();
|
|
9027
|
-
this.updateLayout();
|
|
9127
|
+
if (updateLayout) this.updateLayout();
|
|
9028
9128
|
}
|
|
9029
|
-
lockLayout() {
|
|
9030
|
-
this.updateLayout();
|
|
9129
|
+
lockLayout(updateLayout = true) {
|
|
9130
|
+
if (updateLayout) this.updateLayout();
|
|
9031
9131
|
this.layouter.stop();
|
|
9032
9132
|
}
|
|
9033
9133
|
resize(size) {
|
|
@@ -9436,9 +9536,9 @@ let Ellipse = class Ellipse extends UI {
|
|
|
9436
9536
|
return "Ellipse";
|
|
9437
9537
|
}
|
|
9438
9538
|
__updatePath() {
|
|
9439
|
-
const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} =
|
|
9539
|
+
const data = this.__, {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = data;
|
|
9440
9540
|
const rx = width / 2, ry = height / 2;
|
|
9441
|
-
const path =
|
|
9541
|
+
const path = data.path = [];
|
|
9442
9542
|
let open;
|
|
9443
9543
|
if (innerRadius) {
|
|
9444
9544
|
if (startAngle || endAngle) {
|
|
@@ -9460,7 +9560,7 @@ let Ellipse = class Ellipse extends UI {
|
|
|
9460
9560
|
}
|
|
9461
9561
|
}
|
|
9462
9562
|
if (!open) closePath$2(path);
|
|
9463
|
-
if (Platform.ellipseToCurve)
|
|
9563
|
+
if (Platform.ellipseToCurve || data.__useArrow) data.path = this.getPath(true);
|
|
9464
9564
|
}
|
|
9465
9565
|
};
|
|
9466
9566
|
|
|
@@ -9684,7 +9784,7 @@ __decorate([ resizeType() ], Canvas.prototype, "contextSettings", void 0);
|
|
|
9684
9784
|
|
|
9685
9785
|
Canvas = __decorate([ registerUI() ], Canvas);
|
|
9686
9786
|
|
|
9687
|
-
const {copyAndSpread: copyAndSpread$
|
|
9787
|
+
const {copyAndSpread: copyAndSpread$3, includes: includes, spread: spread, setList: setList} = BoundsHelper, {stintSet: stintSet$3} = DataHelper;
|
|
9688
9788
|
|
|
9689
9789
|
let Text = class Text extends UI {
|
|
9690
9790
|
get __tag() {
|
|
@@ -9701,9 +9801,9 @@ let Text = class Text extends UI {
|
|
|
9701
9801
|
data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
|
|
9702
9802
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * .7) / 2;
|
|
9703
9803
|
data.__font = `${italic ? "italic " : ""}${textCase === "small-caps" ? "small-caps " : ""}${fontWeight !== "normal" ? fontWeight + " " : ""}${fontSize || 12}px ${fontFamily || "caption"}`;
|
|
9704
|
-
stintSet$
|
|
9705
|
-
stintSet$
|
|
9706
|
-
stintSet$
|
|
9804
|
+
stintSet$3(data, "__padding", padding && MathHelper.fourNumber(padding));
|
|
9805
|
+
stintSet$3(data, "__clipText", textOverflow !== "show" && !data.__autoSize);
|
|
9806
|
+
stintSet$3(data, "__isCharMode", width || height || data.__letterSpacing || textCase !== "none");
|
|
9707
9807
|
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === "") ? data.placeholder : data.text, this.__);
|
|
9708
9808
|
}
|
|
9709
9809
|
__updateBoxBounds() {
|
|
@@ -9738,7 +9838,7 @@ let Text = class Text extends UI {
|
|
|
9738
9838
|
}
|
|
9739
9839
|
__updateRenderBounds() {
|
|
9740
9840
|
const {renderBounds: renderBounds, renderSpread: renderSpread} = this.__layout;
|
|
9741
|
-
copyAndSpread$
|
|
9841
|
+
copyAndSpread$3(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
9742
9842
|
if (this.__box) this.__box.__layout.renderBounds = renderBounds;
|
|
9743
9843
|
}
|
|
9744
9844
|
__updateChange() {
|
|
@@ -10000,7 +10100,7 @@ let App = class App extends Leafer {
|
|
|
10000
10100
|
if (this.viewReady) this.renderer.update();
|
|
10001
10101
|
}
|
|
10002
10102
|
__render(canvas, options) {
|
|
10003
|
-
if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options.bounds));
|
|
10103
|
+
if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options.bounds, undefined, undefined, true));
|
|
10004
10104
|
}
|
|
10005
10105
|
__onResize(event) {
|
|
10006
10106
|
this.forEach(leafer => leafer.resize(event));
|
|
@@ -10820,6 +10920,7 @@ class InteractionBase {
|
|
|
10820
10920
|
this.checkPath(data, useDefaultPath);
|
|
10821
10921
|
this.downTime = Date.now();
|
|
10822
10922
|
this.emit(PointerEvent.BEFORE_DOWN, data);
|
|
10923
|
+
if (data.path.needUpdate) this.updateDownData(data);
|
|
10823
10924
|
this.emit(PointerEvent.DOWN, data);
|
|
10824
10925
|
if (PointerButton.left(data)) {
|
|
10825
10926
|
this.tapWait();
|
|
@@ -11554,8 +11655,8 @@ function fills(fills, ui, canvas, renderOptions) {
|
|
|
11554
11655
|
canvas.save();
|
|
11555
11656
|
if (item.transform) canvas.transform(item.transform);
|
|
11556
11657
|
if (originPaint.scaleFixed) {
|
|
11557
|
-
const {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
11558
|
-
if (
|
|
11658
|
+
const {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, originPaint.scaleFixed, false);
|
|
11659
|
+
if (scaleX !== 1) canvas.scale(scaleX, scaleY);
|
|
11559
11660
|
}
|
|
11560
11661
|
if (originPaint.blendMode) canvas.blendMode = originPaint.blendMode;
|
|
11561
11662
|
fillPathOrText(ui, canvas, renderOptions);
|
|
@@ -11726,7 +11827,7 @@ function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas, renderO
|
|
|
11726
11827
|
}
|
|
11727
11828
|
}
|
|
11728
11829
|
|
|
11729
|
-
const {getSpread: getSpread, copyAndSpread: copyAndSpread$
|
|
11830
|
+
const {getSpread: getSpread, copyAndSpread: copyAndSpread$2, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$7, getIntersectData: getIntersectData} = BoundsHelper;
|
|
11730
11831
|
|
|
11731
11832
|
const tempBounds$2 = {};
|
|
11732
11833
|
|
|
@@ -11734,7 +11835,7 @@ function shape(ui, current, options) {
|
|
|
11734
11835
|
const canvas = current.getSameCanvas();
|
|
11735
11836
|
const currentBounds = current.bounds, nowWorld = ui.__nowWorld, layout = ui.__layout;
|
|
11736
11837
|
const nowWorldShapeBounds = ui.__nowWorldShapeBounds || (ui.__nowWorldShapeBounds = {});
|
|
11737
|
-
toOuterOf(layout.strokeSpread ? (copyAndSpread$
|
|
11838
|
+
toOuterOf(layout.strokeSpread ? (copyAndSpread$2(tempBounds$2, layout.boxBounds, layout.strokeSpread),
|
|
11738
11839
|
tempBounds$2) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
|
|
11739
11840
|
let bounds, renderBounds, matrix, fitMatrix, shapeBounds, worldCanvas;
|
|
11740
11841
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
@@ -11790,7 +11891,7 @@ function shape(ui, current, options) {
|
|
|
11790
11891
|
|
|
11791
11892
|
let recycleMap;
|
|
11792
11893
|
|
|
11793
|
-
const {stintSet: stintSet} = DataHelper, {hasTransparent: hasTransparent$1} = ColorConvert;
|
|
11894
|
+
const {stintSet: stintSet$2} = DataHelper, {hasTransparent: hasTransparent$1} = ColorConvert;
|
|
11794
11895
|
|
|
11795
11896
|
function compute(attrName, ui) {
|
|
11796
11897
|
const data = ui.__, leafPaints = [];
|
|
@@ -11814,12 +11915,12 @@ function compute(attrName, ui) {
|
|
|
11814
11915
|
isTransparent = true;
|
|
11815
11916
|
}
|
|
11816
11917
|
if (attrName === "fill") {
|
|
11817
|
-
stintSet(data, "__isAlphaPixelFill", isAlphaPixel);
|
|
11818
|
-
stintSet(data, "__isTransparentFill", isTransparent);
|
|
11918
|
+
stintSet$2(data, "__isAlphaPixelFill", isAlphaPixel);
|
|
11919
|
+
stintSet$2(data, "__isTransparentFill", isTransparent);
|
|
11819
11920
|
} else {
|
|
11820
|
-
stintSet(data, "__isAlphaPixelStroke", isAlphaPixel);
|
|
11821
|
-
stintSet(data, "__isTransparentStroke", isTransparent);
|
|
11822
|
-
stintSet(data, "__hasMultiStrokeStyle", maxChildStrokeWidth);
|
|
11921
|
+
stintSet$2(data, "__isAlphaPixelStroke", isAlphaPixel);
|
|
11922
|
+
stintSet$2(data, "__isTransparentStroke", isTransparent);
|
|
11923
|
+
stintSet$2(data, "__hasMultiStrokeStyle", maxChildStrokeWidth);
|
|
11823
11924
|
}
|
|
11824
11925
|
} else {
|
|
11825
11926
|
data.__removePaint(attrName, false);
|
|
@@ -11829,11 +11930,14 @@ function compute(attrName, ui) {
|
|
|
11829
11930
|
function getLeafPaint(attrName, paint, ui) {
|
|
11830
11931
|
if (!isObject(paint) || paint.visible === false || paint.opacity === 0) return undefined;
|
|
11831
11932
|
let leafPaint;
|
|
11832
|
-
const {boxBounds: boxBounds} = ui.__layout;
|
|
11833
|
-
switch (
|
|
11933
|
+
const {boxBounds: boxBounds} = ui.__layout, {type: type} = paint;
|
|
11934
|
+
switch (type) {
|
|
11834
11935
|
case "image":
|
|
11936
|
+
case "film":
|
|
11937
|
+
case "video":
|
|
11835
11938
|
if (!paint.url) return undefined;
|
|
11836
11939
|
leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
11940
|
+
if (type !== "image") PaintImage[type](leafPaint);
|
|
11837
11941
|
break;
|
|
11838
11942
|
|
|
11839
11943
|
case "linear":
|
|
@@ -11849,7 +11953,7 @@ function getLeafPaint(attrName, paint, ui) {
|
|
|
11849
11953
|
break;
|
|
11850
11954
|
|
|
11851
11955
|
case "solid":
|
|
11852
|
-
const {
|
|
11956
|
+
const {color: color, opacity: opacity} = paint;
|
|
11853
11957
|
leafPaint = {
|
|
11854
11958
|
type: type,
|
|
11855
11959
|
style: ColorConvert.string(color, opacity)
|
|
@@ -11889,12 +11993,12 @@ const PaintModule = {
|
|
|
11889
11993
|
|
|
11890
11994
|
let cache$1, box$2 = new Bounds;
|
|
11891
11995
|
|
|
11892
|
-
const {isSame: isSame} = BoundsHelper;
|
|
11996
|
+
const {isSame: isSame$1} = BoundsHelper;
|
|
11893
11997
|
|
|
11894
11998
|
function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
11895
11999
|
let leafPaint, event;
|
|
11896
|
-
const image = ImageManager.get(paint);
|
|
11897
|
-
if (cache$1 && paint === cache$1.paint && isSame(boxBounds, cache$1.boxBounds)) {
|
|
12000
|
+
const image = ImageManager.get(paint, paint.type);
|
|
12001
|
+
if (cache$1 && paint === cache$1.paint && isSame$1(boxBounds, cache$1.boxBounds)) {
|
|
11898
12002
|
leafPaint = cache$1.leafPaint;
|
|
11899
12003
|
} else {
|
|
11900
12004
|
leafPaint = {
|
|
@@ -11954,8 +12058,8 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
11954
12058
|
}
|
|
11955
12059
|
|
|
11956
12060
|
function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds) {
|
|
11957
|
-
|
|
11958
|
-
|
|
12061
|
+
const data = ui.__;
|
|
12062
|
+
if (attrName === "fill" && !data.__naturalWidth) {
|
|
11959
12063
|
data.__naturalWidth = image.width / data.pixelRatio;
|
|
11960
12064
|
data.__naturalHeight = image.height / data.pixelRatio;
|
|
11961
12065
|
if (data.__autoSide) {
|
|
@@ -11967,7 +12071,13 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
|
|
|
11967
12071
|
return false;
|
|
11968
12072
|
}
|
|
11969
12073
|
}
|
|
11970
|
-
if (!leafPaint.data)
|
|
12074
|
+
if (!leafPaint.data) {
|
|
12075
|
+
PaintImage.createData(leafPaint, image, paint, boxBounds);
|
|
12076
|
+
const {transform: transform} = leafPaint.data, {opacity: opacity, blendMode: blendMode} = paint;
|
|
12077
|
+
const clip = transform && !transform.onlyScale || data.path || data.cornerRadius;
|
|
12078
|
+
if (clip || opacity && opacity < 1 || blendMode) leafPaint.complex = clip ? 2 : true;
|
|
12079
|
+
}
|
|
12080
|
+
if (paint.filter) PaintImage.applyFilter(leafPaint, image, paint.filter, ui);
|
|
11971
12081
|
return true;
|
|
11972
12082
|
}
|
|
11973
12083
|
|
|
@@ -12010,7 +12120,7 @@ function getPatternData(paint, box, image) {
|
|
|
12010
12120
|
if (paint.padding) box = tempBox.set(box).shrink(paint.padding);
|
|
12011
12121
|
if (paint.mode === "strench") paint.mode = "stretch";
|
|
12012
12122
|
const {width: width, height: height} = image;
|
|
12013
|
-
const {
|
|
12123
|
+
const {mode: mode, align: align, offset: offset, scale: scale, size: size, rotation: rotation, skew: skew, clipSize: clipSize, repeat: repeat, gap: gap, interlace: interlace} = paint;
|
|
12014
12124
|
const sameBox = box.width === width && box.height === height;
|
|
12015
12125
|
const data = {
|
|
12016
12126
|
mode: mode
|
|
@@ -12073,8 +12183,6 @@ function getPatternData(paint, box, image) {
|
|
|
12073
12183
|
data.scaleX = scaleX;
|
|
12074
12184
|
data.scaleY = scaleY;
|
|
12075
12185
|
}
|
|
12076
|
-
if (opacity && opacity < 1) data.opacity = opacity;
|
|
12077
|
-
if (filters) data.filters = filters;
|
|
12078
12186
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
12079
12187
|
if (interlace) data.interlace = isNumber(interlace) || interlace.type === "percent" ? {
|
|
12080
12188
|
type: "x",
|
|
@@ -12105,7 +12213,7 @@ const {get: get$2, set: set, rotateOfOuter: rotateOfOuter$1, translate: translat
|
|
|
12105
12213
|
|
|
12106
12214
|
function stretchMode(data, box, scaleX, scaleY) {
|
|
12107
12215
|
const transform = get$2(), {x: x, y: y} = box;
|
|
12108
|
-
if (x || y) translate(transform, x, y); else transform.onlyScale = true;
|
|
12216
|
+
if (x || y) translate(transform, x, y); else if (scaleX > 0 && scaleY > 0) transform.onlyScale = true;
|
|
12109
12217
|
scaleHelper(transform, scaleX, scaleY);
|
|
12110
12218
|
data.transform = transform;
|
|
12111
12219
|
}
|
|
@@ -12177,7 +12285,7 @@ function layout$3(transform, box, x, y, scaleX, scaleY, rotation, skew) {
|
|
|
12177
12285
|
translate(transform, box.x + x, box.y + y);
|
|
12178
12286
|
}
|
|
12179
12287
|
|
|
12180
|
-
const {get: get$1, scale: scale$
|
|
12288
|
+
const {get: get$1, scale: scale$2, copy: copy$4} = MatrixHelper;
|
|
12181
12289
|
|
|
12182
12290
|
const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$6} = Math;
|
|
12183
12291
|
|
|
@@ -12194,10 +12302,10 @@ function createPatternTask(paint, ui, canvas, renderOptions) {
|
|
|
12194
12302
|
}
|
|
12195
12303
|
|
|
12196
12304
|
function createPattern(paint, ui, canvas, renderOptions) {
|
|
12197
|
-
let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = scaleX + "-" + scaleY;
|
|
12305
|
+
let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
|
|
12198
12306
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
12199
12307
|
if (!(Platform.image.isLarge(paint.image, scaleX, scaleY) && !paint.data.repeat)) {
|
|
12200
|
-
const {image: image, data: data} = paint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
|
|
12308
|
+
const {image: image, data: data} = paint, {opacity: opacity} = paint.originPaint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
|
|
12201
12309
|
let imageMatrix, xGap, yGap, {width: width, height: height} = image;
|
|
12202
12310
|
if (fixScale) scaleX *= fixScale, scaleY *= fixScale;
|
|
12203
12311
|
width *= scaleX;
|
|
@@ -12211,9 +12319,9 @@ function createPattern(paint, ui, canvas, renderOptions) {
|
|
|
12211
12319
|
scaleY *= getFloorScale(height + (yGap || 0));
|
|
12212
12320
|
imageMatrix = get$1();
|
|
12213
12321
|
if (transform) copy$4(imageMatrix, transform);
|
|
12214
|
-
scale$
|
|
12322
|
+
scale$2(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
12215
12323
|
}
|
|
12216
|
-
const imageCanvas = image.getCanvas(width, height,
|
|
12324
|
+
const imageCanvas = image.getCanvas(width, height, opacity, undefined, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
|
|
12217
12325
|
const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
12218
12326
|
paint.style = pattern;
|
|
12219
12327
|
paint.patternId = id;
|
|
@@ -12234,15 +12342,15 @@ function getPatternFixScale(paint, imageScaleX, imageScaleY) {
|
|
|
12234
12342
|
}
|
|
12235
12343
|
|
|
12236
12344
|
function checkImage(paint, drawImage, ui, canvas, renderOptions) {
|
|
12237
|
-
const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions);
|
|
12345
|
+
const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
|
|
12238
12346
|
const {image: image, data: data, originPaint: originPaint} = paint, {exporting: exporting, snapshot: snapshot} = renderOptions;
|
|
12239
|
-
if (!data || paint.patternId ===
|
|
12347
|
+
if (!data || paint.patternId === id && !exporting || snapshot) {
|
|
12240
12348
|
return false;
|
|
12241
12349
|
} else {
|
|
12242
12350
|
if (drawImage) {
|
|
12243
12351
|
if (data.repeat) {
|
|
12244
12352
|
drawImage = false;
|
|
12245
|
-
} else if (!(originPaint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
|
|
12353
|
+
} else if (!(originPaint.changeful || paint.film || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
|
|
12246
12354
|
drawImage = Platform.image.isLarge(image, scaleX, scaleY) || image.width * scaleX > 8096 || image.height * scaleY > 8096;
|
|
12247
12355
|
}
|
|
12248
12356
|
}
|
|
@@ -12260,20 +12368,21 @@ function checkImage(paint, drawImage, ui, canvas, renderOptions) {
|
|
|
12260
12368
|
}
|
|
12261
12369
|
}
|
|
12262
12370
|
|
|
12263
|
-
function drawImage(paint,
|
|
12264
|
-
const {data: data, image: image
|
|
12265
|
-
let {width: width, height: height} = image
|
|
12266
|
-
if (
|
|
12371
|
+
function drawImage(paint, imageScaleX, imageScaleY, ui, canvas, _renderOptions) {
|
|
12372
|
+
const {data: data, image: image, complex: complex} = paint;
|
|
12373
|
+
let {width: width, height: height} = image;
|
|
12374
|
+
if (complex) {
|
|
12375
|
+
const {blendMode: blendMode, opacity: opacity} = paint.originPaint, {transform: transform} = data;
|
|
12267
12376
|
canvas.save();
|
|
12268
|
-
|
|
12377
|
+
complex === 2 && canvas.clipUI(ui);
|
|
12269
12378
|
blendMode && (canvas.blendMode = blendMode);
|
|
12270
12379
|
opacity && (canvas.opacity *= opacity);
|
|
12271
12380
|
transform && canvas.transform(transform);
|
|
12272
|
-
|
|
12381
|
+
image.render(canvas, 0, 0, width, height, ui, paint, imageScaleX, imageScaleY);
|
|
12273
12382
|
canvas.restore();
|
|
12274
12383
|
} else {
|
|
12275
12384
|
if (data.scaleX) width *= data.scaleX, height *= data.scaleY;
|
|
12276
|
-
|
|
12385
|
+
image.render(canvas, 0, 0, width, height, ui, paint, imageScaleX, imageScaleY);
|
|
12277
12386
|
}
|
|
12278
12387
|
}
|
|
12279
12388
|
|
|
@@ -12303,6 +12412,7 @@ function recycleImage(attrName, data) {
|
|
|
12303
12412
|
if (!recycleMap) recycleMap = {};
|
|
12304
12413
|
recycleMap[url] = true;
|
|
12305
12414
|
ImageManager.recyclePaint(paint);
|
|
12415
|
+
if (data.__willDestroy && image.parent) PaintImage.recycleFilter(image, data.__leaf);
|
|
12306
12416
|
if (image.loading) {
|
|
12307
12417
|
if (!input) {
|
|
12308
12418
|
input = data.__input && data.__input[attrName] || [];
|
|
@@ -13272,8 +13382,11 @@ function targetAttr(fn) {
|
|
|
13272
13382
|
});
|
|
13273
13383
|
if (isObject(check)) value = check; else if (check === false) return;
|
|
13274
13384
|
}
|
|
13275
|
-
t.
|
|
13276
|
-
|
|
13385
|
+
const {dimOthers: dimOthers, bright: bright} = t.editBox.mergedConfig || t.config;
|
|
13386
|
+
if (!isUndefined(dimOthers) || !isUndefined(bright)) {
|
|
13387
|
+
t.setDimOthers(false);
|
|
13388
|
+
t.setBright(false);
|
|
13389
|
+
}
|
|
13277
13390
|
if (isArray(value) && value.length > 1 && value[0].locked) value.splice(0, 1);
|
|
13278
13391
|
if (t.single) {
|
|
13279
13392
|
delete t.element.syncEventer;
|
|
@@ -13298,7 +13411,8 @@ function mergeConfigAttr() {
|
|
|
13298
13411
|
return (target, key) => {
|
|
13299
13412
|
defineKey(target, key, {
|
|
13300
13413
|
get() {
|
|
13301
|
-
const {config: config, element: element, dragPoint: dragPoint, editBox: editBox, app: app} = this, mergeConfig = Object.assign({}, config);
|
|
13414
|
+
const {config: config, element: element, dragPoint: dragPoint, editBox: editBox, editTool: editTool, innerEditor: innerEditor, app: app} = this, mergeConfig = Object.assign({}, config);
|
|
13415
|
+
if (innerEditor) innerEditor.editConfig && Object.assign(mergeConfig, innerEditor.editConfig); else if (editTool) editTool.editConfig && Object.assign(mergeConfig, editTool.editConfig);
|
|
13302
13416
|
if (element && element.editConfig) {
|
|
13303
13417
|
let {editConfig: editConfig} = element;
|
|
13304
13418
|
if (editConfig.hover || editConfig.hoverStyle) {
|
|
@@ -13564,6 +13678,7 @@ class EditSelect extends Group {
|
|
|
13564
13678
|
} else {
|
|
13565
13679
|
editor.target = find;
|
|
13566
13680
|
}
|
|
13681
|
+
e.path.needUpdate = true;
|
|
13567
13682
|
} else if (this.allow(e.target)) {
|
|
13568
13683
|
if (!this.isHoldMultipleSelectKey(e) && !this.editor.mergedConfig.selectKeep) editor.target = null;
|
|
13569
13684
|
}
|
|
@@ -14200,8 +14315,10 @@ class EditBox extends Group {
|
|
|
14200
14315
|
const {editMask: editMask} = editor;
|
|
14201
14316
|
const {middlePoint: middlePoint, resizeable: resizeable, rotateable: rotateable, hideOnSmall: hideOnSmall, editBox: editBox, mask: mask, dimOthers: dimOthers, bright: bright, spread: spread, hideRotatePoints: hideRotatePoints, hideResizeLines: hideResizeLines} = mergeConfig;
|
|
14202
14317
|
editMask.visible = mask ? true : 0;
|
|
14203
|
-
|
|
14204
|
-
|
|
14318
|
+
if (!isUndefined(dimOthers) || !isUndefined(bright)) {
|
|
14319
|
+
editor.setDimOthers(dimOthers);
|
|
14320
|
+
editor.setBright(!!dimOthers || bright);
|
|
14321
|
+
}
|
|
14205
14322
|
if (spread) BoundsHelper.spread(bounds, spread);
|
|
14206
14323
|
if (this.view.worldOpacity) {
|
|
14207
14324
|
const {width: width, height: height} = bounds;
|
|
@@ -14220,7 +14337,8 @@ class EditBox extends Group {
|
|
|
14220
14337
|
resizeL = resizeLines[(i - 1) / 2];
|
|
14221
14338
|
resizeL.set(point);
|
|
14222
14339
|
resizeL.visible = resizeP.visible && !hideResizeLines;
|
|
14223
|
-
resizeP.visible
|
|
14340
|
+
if (resizeP.visible) resizeP.visible = !!middlePoint;
|
|
14341
|
+
if (rotateP.visible) rotateP.visible = !!middlePoint;
|
|
14224
14342
|
if ((i + 1) / 2 % 2) {
|
|
14225
14343
|
resizeL.width = width + resizeL.height;
|
|
14226
14344
|
if (hideOnSmall && resizeP.width * 2 > width) resizeP.visible = false;
|
|
@@ -14782,6 +14900,7 @@ class SimulateElement extends Rect {
|
|
|
14782
14900
|
this.checkChange = true;
|
|
14783
14901
|
this.canChange = true;
|
|
14784
14902
|
this.visible = this.hittable = false;
|
|
14903
|
+
this.skipJSON = true;
|
|
14785
14904
|
this.on(PropertyEvent.CHANGE, event => {
|
|
14786
14905
|
if (this.checkChange && checkMap[event.attrName]) {
|
|
14787
14906
|
const {attrName: attrName, newValue: newValue, oldValue: oldValue} = event;
|
|
@@ -15984,9 +16103,14 @@ function addViewport(leafer, mergeConfig, custom) {
|
|
|
15984
16103
|
}), leafer.on_(MoveEvent.END, e => {
|
|
15985
16104
|
LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY));
|
|
15986
16105
|
}), leafer.on_(ZoomEvent.BEFORE_ZOOM, e => {
|
|
15987
|
-
const {zoomLayer: zoomLayer} = leafer;
|
|
16106
|
+
const {zoomLayer: zoomLayer, layouter: layouter} = leafer;
|
|
15988
16107
|
const changeScale = leafer.getValidScale(e.scale);
|
|
15989
|
-
if (changeScale !== 1)
|
|
16108
|
+
if (changeScale !== 1) {
|
|
16109
|
+
layouter.stop();
|
|
16110
|
+
LeafHelper.updateMatrix(leafer);
|
|
16111
|
+
zoomLayer.scaleOfWorld(e, changeScale);
|
|
16112
|
+
layouter.start();
|
|
16113
|
+
}
|
|
15990
16114
|
}));
|
|
15991
16115
|
}
|
|
15992
16116
|
|
|
@@ -16773,7 +16897,7 @@ Arrow = __decorate([ registerUI() ], Arrow);
|
|
|
16773
16897
|
|
|
16774
16898
|
const {M: M$2, L: L$2, C: C$2, Q: Q$1, O: O$1} = PathCommandMap;
|
|
16775
16899
|
|
|
16776
|
-
const {rotate: rotate$1, copyFrom: copyFrom$1, scale: scale} = PointHelper;
|
|
16900
|
+
const {rotate: rotate$1, copyFrom: copyFrom$1, scale: scale$1} = PointHelper;
|
|
16777
16901
|
|
|
16778
16902
|
const point$1 = {};
|
|
16779
16903
|
|
|
@@ -16820,7 +16944,7 @@ const PathMatrixHelper = {
|
|
|
16820
16944
|
function setPoint$2(data, startIndex, x, y, scaleX, scaleY, rotation, origin) {
|
|
16821
16945
|
copyFrom$1(point$1, data[startIndex], data[startIndex + 1]);
|
|
16822
16946
|
if (rotation) rotate$1(point$1, rotation, origin);
|
|
16823
|
-
if (scaleX) scale(point$1, scaleX, scaleY);
|
|
16947
|
+
if (scaleX) scale$1(point$1, scaleX, scaleY);
|
|
16824
16948
|
data[startIndex] = x + point$1.x;
|
|
16825
16949
|
data[startIndex + 1] = y + point$1.y;
|
|
16826
16950
|
}
|
|
@@ -16829,12 +16953,14 @@ const {layout: layout$2, rotate: rotate} = PathMatrixHelper;
|
|
|
16829
16953
|
|
|
16830
16954
|
const {getAngle: getAngle} = PointHelper;
|
|
16831
16955
|
|
|
16832
|
-
const
|
|
16956
|
+
const zero = {
|
|
16957
|
+
x: 0
|
|
16958
|
+
}, half = {
|
|
16833
16959
|
x: -.5
|
|
16834
16960
|
};
|
|
16835
16961
|
|
|
16836
16962
|
const angle = {
|
|
16837
|
-
connect:
|
|
16963
|
+
connect: zero,
|
|
16838
16964
|
offset: {
|
|
16839
16965
|
x: -.71,
|
|
16840
16966
|
bevelJoin: .36,
|
|
@@ -16855,73 +16981,110 @@ const angleSide = {
|
|
|
16855
16981
|
|
|
16856
16982
|
const triangleLinePath = [ 1, -3, 0, 2, -3, -2, 2, 0, 0, 2, -3, 2, 2, -3, 0 ];
|
|
16857
16983
|
|
|
16858
|
-
const
|
|
16859
|
-
connect:
|
|
16984
|
+
const triangleFill = {
|
|
16985
|
+
connect: zero,
|
|
16860
16986
|
offset: {
|
|
16861
16987
|
x: -.9,
|
|
16862
16988
|
bevelJoin: .624,
|
|
16863
16989
|
roundJoin: .4
|
|
16864
16990
|
},
|
|
16865
|
-
path: [ ...triangleLinePath
|
|
16866
|
-
dashPath: [ 1, -2, 0, 2, -.5, 0 ]
|
|
16991
|
+
path: [ ...triangleLinePath ]
|
|
16867
16992
|
};
|
|
16868
16993
|
|
|
16869
|
-
const
|
|
16994
|
+
const triangle = DataHelper.clone(triangleFill);
|
|
16870
16995
|
|
|
16871
|
-
|
|
16872
|
-
|
|
16873
|
-
|
|
16874
|
-
|
|
16875
|
-
|
|
16876
|
-
|
|
16877
|
-
|
|
16878
|
-
path: [ ...
|
|
16879
|
-
dashPath: [ 1, -3, 0, 2, -.5, 0 ]
|
|
16996
|
+
triangle.path = [ ...triangleLinePath, 1, -2.05, 1.1, 2, -2.05, -1.1 ];
|
|
16997
|
+
|
|
16998
|
+
triangle.dashPath = [ 1, -2, 0, 2, -.5, 0 ];
|
|
16999
|
+
|
|
17000
|
+
const triangleFlipFill = {
|
|
17001
|
+
connect: zero,
|
|
17002
|
+
offset: half,
|
|
17003
|
+
path: [ ...triangleFill.path ]
|
|
16880
17004
|
};
|
|
16881
17005
|
|
|
16882
17006
|
const triangleFlip = {
|
|
17007
|
+
connect: zero,
|
|
16883
17008
|
offset: half,
|
|
16884
17009
|
path: [ ...triangle.path ],
|
|
16885
17010
|
dashPath: [ 1, -2.5, 0, 2, -1, 0 ]
|
|
16886
17011
|
};
|
|
16887
17012
|
|
|
17013
|
+
rotate(triangleFlipFill.path, 180, {
|
|
17014
|
+
x: -1.5,
|
|
17015
|
+
y: 0
|
|
17016
|
+
});
|
|
17017
|
+
|
|
16888
17018
|
rotate(triangleFlip.path, 180, {
|
|
16889
17019
|
x: -1.5,
|
|
16890
17020
|
y: 0
|
|
16891
17021
|
});
|
|
16892
17022
|
|
|
17023
|
+
const arrowLinePath = [ 1, -3, 0, 2, -3.5, -1.8, 2, 0, 0, 2, -3.5, 1.8, 2, -3, 0 ];
|
|
17024
|
+
|
|
17025
|
+
const arrowFill = {
|
|
17026
|
+
connect: zero,
|
|
17027
|
+
offset: {
|
|
17028
|
+
x: -1.1,
|
|
17029
|
+
bevelJoin: .872,
|
|
17030
|
+
roundJoin: .6
|
|
17031
|
+
},
|
|
17032
|
+
path: [ ...arrowLinePath ]
|
|
17033
|
+
};
|
|
17034
|
+
|
|
17035
|
+
const arrow = DataHelper.clone(arrowFill);
|
|
17036
|
+
|
|
17037
|
+
arrow.path = [ ...arrowLinePath, 1, -2.25, .95, 2, -2.25, -.95 ];
|
|
17038
|
+
|
|
17039
|
+
arrow.dashPath = [ 1, -3, 0, 2, -.5, 0 ];
|
|
17040
|
+
|
|
16893
17041
|
const circleLine = {
|
|
16894
17042
|
connect: {
|
|
16895
|
-
x: -1.
|
|
17043
|
+
x: -1.8
|
|
16896
17044
|
},
|
|
16897
17045
|
path: [ 1, 1.8, -.1, 2, 1.8, 0, 26, 0, 0, 1.8, 0, 359, 0 ]
|
|
16898
17046
|
};
|
|
16899
17047
|
|
|
16900
|
-
const
|
|
17048
|
+
const circleFill = {
|
|
16901
17049
|
connect: {
|
|
16902
17050
|
x: .5
|
|
16903
17051
|
},
|
|
16904
|
-
path: [ ...circleLine.path
|
|
16905
|
-
dashPath: [ 1, -.5, 0, 2, .5, 0 ]
|
|
17052
|
+
path: [ ...circleLine.path ]
|
|
16906
17053
|
};
|
|
16907
17054
|
|
|
17055
|
+
const circle = DataHelper.clone(circleFill);
|
|
17056
|
+
|
|
17057
|
+
circle.path = [ ...circleLine.path, 1, 0, 0, 26, 0, 0, 1, 0, 360, 0 ];
|
|
17058
|
+
|
|
17059
|
+
circle.dashPath = [ 1, -.5, 0, 2, .5, 0 ];
|
|
17060
|
+
|
|
16908
17061
|
const squareLine = {
|
|
16909
17062
|
connect: {
|
|
16910
|
-
x: -1.
|
|
17063
|
+
x: -1.4
|
|
16911
17064
|
},
|
|
16912
17065
|
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 ]
|
|
16913
17066
|
};
|
|
16914
17067
|
|
|
17068
|
+
const squareFill = {
|
|
17069
|
+
path: [ ...squareLine.path ]
|
|
17070
|
+
};
|
|
17071
|
+
|
|
16915
17072
|
const square = {
|
|
16916
17073
|
path: [ ...squareLine.path, 2, -1.4, -.49, 2, 1, -.49, 1, -1.4, .49, 2, 1, .49 ]
|
|
16917
17074
|
};
|
|
16918
17075
|
|
|
16919
17076
|
const diamondLine = DataHelper.clone(squareLine);
|
|
16920
17077
|
|
|
17078
|
+
diamondLine.connect.x = -1.9;
|
|
17079
|
+
|
|
17080
|
+
const diamondFill = DataHelper.clone(squareFill);
|
|
17081
|
+
|
|
16921
17082
|
const diamond = DataHelper.clone(square);
|
|
16922
17083
|
|
|
16923
17084
|
rotate(diamondLine.path, 45);
|
|
16924
17085
|
|
|
17086
|
+
rotate(diamondFill.path, 45);
|
|
17087
|
+
|
|
16925
17088
|
rotate(diamond.path, 45);
|
|
16926
17089
|
|
|
16927
17090
|
const mark = {
|
|
@@ -16944,19 +17107,34 @@ const arrows = {
|
|
|
16944
17107
|
mark: mark
|
|
16945
17108
|
};
|
|
16946
17109
|
|
|
17110
|
+
const fillArrows = {
|
|
17111
|
+
triangle: triangleFill,
|
|
17112
|
+
"triangle-flip": triangleFlipFill,
|
|
17113
|
+
arrow: arrowFill,
|
|
17114
|
+
circle: circleFill,
|
|
17115
|
+
square: squareFill,
|
|
17116
|
+
diamond: diamondFill
|
|
17117
|
+
};
|
|
17118
|
+
|
|
16947
17119
|
function getArrowPath(ui, arrow, from, to, size, connectOffset, hasDashPattern) {
|
|
16948
|
-
let pathData, scale;
|
|
17120
|
+
let pathData, scale = 1, rotation = 0, fill;
|
|
16949
17121
|
const {strokeCap: strokeCap, strokeJoin: strokeJoin} = ui.__;
|
|
16950
17122
|
if (isObject(arrow)) {
|
|
16951
17123
|
if (arrow.type) {
|
|
16952
|
-
scale = arrow.scale;
|
|
17124
|
+
scale = arrow.scale || 1;
|
|
17125
|
+
rotation = arrow.rotation || 0;
|
|
16953
17126
|
pathData = arrows[arrow.type];
|
|
17127
|
+
if (scale > 1) {
|
|
17128
|
+
const fillData = fillArrows[arrow.type];
|
|
17129
|
+
if (fillData) pathData = fillData, fill = true;
|
|
17130
|
+
}
|
|
16954
17131
|
} else pathData = arrow;
|
|
16955
17132
|
} else {
|
|
16956
17133
|
pathData = arrows[arrow];
|
|
16957
17134
|
}
|
|
17135
|
+
if (!fill) fill = pathData.fill;
|
|
16958
17136
|
const {offset: offset, connect: connect, path: path, dashPath: dashPath} = pathData;
|
|
16959
|
-
let connectX = connect ? connect.x : 0;
|
|
17137
|
+
let connectX = connect ? connect.x * scale : 0;
|
|
16960
17138
|
let offsetX = offset ? offset.x : 0;
|
|
16961
17139
|
const data = [ ...path ];
|
|
16962
17140
|
if (hasDashPattern && dashPath) data.push(...dashPath);
|
|
@@ -16964,28 +17142,38 @@ function getArrowPath(ui, arrow, from, to, size, connectOffset, hasDashPattern)
|
|
|
16964
17142
|
if (offset) {
|
|
16965
17143
|
if (strokeJoin === "round" && offset.roundJoin) offsetX += offset.roundJoin; else if (strokeJoin === "bevel" && offset.bevelJoin) offsetX += offset.bevelJoin;
|
|
16966
17144
|
}
|
|
16967
|
-
if (scale) layout$2(data, 0, 0, scale, scale);
|
|
17145
|
+
if (scale !== 1) layout$2(data, 0, 0, scale, scale);
|
|
16968
17146
|
if (offsetX) layout$2(data, offsetX, 0);
|
|
16969
|
-
layout$2(data, to.x, to.y, size, size, getAngle(from, to));
|
|
17147
|
+
layout$2(data, to.x, to.y, size, size, getAngle(from, to) + rotation);
|
|
16970
17148
|
connectOffset.x = (connectX + offsetX) * size;
|
|
16971
|
-
|
|
17149
|
+
const arrowData = {
|
|
17150
|
+
data: data
|
|
17151
|
+
};
|
|
17152
|
+
if (fill) arrowData.fill = fill;
|
|
17153
|
+
return arrowData;
|
|
16972
17154
|
}
|
|
16973
17155
|
|
|
16974
17156
|
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;
|
|
16975
17157
|
|
|
16976
|
-
const {copy: copy, copyFrom: copyFrom, getDistancePoint: getDistancePoint} = PointHelper;
|
|
17158
|
+
const {copy: copy, copyFrom: copyFrom, getDistancePoint: getDistancePoint, isSame: isSame} = PointHelper;
|
|
17159
|
+
|
|
17160
|
+
const {stintSet: stintSet$1} = DataHelper;
|
|
16977
17161
|
|
|
16978
17162
|
const connectPoint = {};
|
|
16979
17163
|
|
|
16980
17164
|
const first = {}, second = {};
|
|
16981
17165
|
|
|
16982
|
-
const last = {}, now = {};
|
|
17166
|
+
const old = {}, last = {}, now = {};
|
|
16983
17167
|
|
|
16984
17168
|
const PathArrowModule = {
|
|
16985
17169
|
list: arrows,
|
|
16986
|
-
|
|
16987
|
-
|
|
17170
|
+
fillList: fillArrows,
|
|
17171
|
+
addArrows(ui, updateCache) {
|
|
17172
|
+
const uData = ui.__;
|
|
17173
|
+
const {startArrow: startArrow, endArrow: endArrow, __strokeWidth: strokeWidth, dashPattern: dashPattern, __pathForRender: data, cornerRadius: cornerRadius} = uData;
|
|
16988
17174
|
const clonePathForArrow = !cornerRadius;
|
|
17175
|
+
if (!updateCache) uData.__strokeWidthCache = strokeWidth;
|
|
17176
|
+
let startArrowPath, singleStartArrow, endArrowPath, singleEndArrow;
|
|
16989
17177
|
let command, i = 0, len = data.length, count = 0, useStartArrow = startArrow && startArrow !== "none";
|
|
16990
17178
|
while (i < len) {
|
|
16991
17179
|
command = data[i];
|
|
@@ -16993,6 +17181,7 @@ const PathArrowModule = {
|
|
|
16993
17181
|
case M$1:
|
|
16994
17182
|
case L$1:
|
|
16995
17183
|
if (count < 2 || i + 6 >= len) {
|
|
17184
|
+
copy(old, now);
|
|
16996
17185
|
copyFrom(now, data[i + 1], data[i + 2]);
|
|
16997
17186
|
if (!count && useStartArrow) copy(first, now);
|
|
16998
17187
|
}
|
|
@@ -17000,12 +17189,18 @@ const PathArrowModule = {
|
|
|
17000
17189
|
break;
|
|
17001
17190
|
|
|
17002
17191
|
case C$1:
|
|
17003
|
-
if (count === 1 || i + 7 >= len - 3)
|
|
17192
|
+
if (count === 1 || i + 7 >= len - 3) {
|
|
17193
|
+
copyPoints(data, last, now, i + 3);
|
|
17194
|
+
old.x = data[i + 1], old.y = data[i + 2];
|
|
17195
|
+
}
|
|
17004
17196
|
i += 7;
|
|
17005
17197
|
break;
|
|
17006
17198
|
|
|
17007
17199
|
case Q:
|
|
17008
|
-
if (count === 1 || i + 5 >= len - 3)
|
|
17200
|
+
if (count === 1 || i + 5 >= len - 3) {
|
|
17201
|
+
copyPoints(data, last, now, i + 1);
|
|
17202
|
+
copy(old, last);
|
|
17203
|
+
}
|
|
17009
17204
|
i += 5;
|
|
17010
17205
|
break;
|
|
17011
17206
|
|
|
@@ -17043,6 +17238,7 @@ const PathArrowModule = {
|
|
|
17043
17238
|
case U:
|
|
17044
17239
|
if (count === 1 || i + 6 >= len - 3) {
|
|
17045
17240
|
copyPoints(data, last, now, i + 1);
|
|
17241
|
+
copy(old, last);
|
|
17046
17242
|
if (i + 6 !== len) {
|
|
17047
17243
|
now.x -= (now.x - last.x) / 10;
|
|
17048
17244
|
now.y -= (now.y - last.y) / 10;
|
|
@@ -17053,13 +17249,13 @@ const PathArrowModule = {
|
|
|
17053
17249
|
}
|
|
17054
17250
|
count++;
|
|
17055
17251
|
if (count === 1 && command !== M$1) return;
|
|
17056
|
-
if (count === 2 && useStartArrow) copy(second, command === L$1 ? now : last);
|
|
17252
|
+
if (count === 2 && useStartArrow) copy(second, command === L$1 ? now : isSame(old, first) ? last : old);
|
|
17057
17253
|
if (i === len) {
|
|
17058
|
-
const path =
|
|
17059
|
-
const pathForArrow = ui.__.__pathForArrow = [];
|
|
17254
|
+
const path = uData.__pathForRender = clonePathForArrow ? [ ...data ] : data;
|
|
17060
17255
|
if (useStartArrow) {
|
|
17061
|
-
|
|
17062
|
-
|
|
17256
|
+
startArrowPath = getArrowPath(ui, startArrow, second, first, strokeWidth, connectPoint, !!dashPattern);
|
|
17257
|
+
singleStartArrow = startArrowPath.fill || dashPattern;
|
|
17258
|
+
if (!singleStartArrow) path.push(...startArrowPath.data);
|
|
17063
17259
|
if (connectPoint.x) {
|
|
17064
17260
|
getDistancePoint(first, second, -connectPoint.x, true);
|
|
17065
17261
|
path[1] = second.x;
|
|
@@ -17067,8 +17263,10 @@ const PathArrowModule = {
|
|
|
17067
17263
|
}
|
|
17068
17264
|
}
|
|
17069
17265
|
if (endArrow && endArrow !== "none") {
|
|
17070
|
-
|
|
17071
|
-
|
|
17266
|
+
if (isSame(last, now)) copy(last, old);
|
|
17267
|
+
endArrowPath = getArrowPath(ui, endArrow, last, now, strokeWidth, connectPoint, !!dashPattern);
|
|
17268
|
+
singleEndArrow = endArrowPath.fill || dashPattern;
|
|
17269
|
+
if (!singleEndArrow) path.push(...endArrowPath.data);
|
|
17072
17270
|
if (connectPoint.x) {
|
|
17073
17271
|
getDistancePoint(now, last, -connectPoint.x, true);
|
|
17074
17272
|
let index;
|
|
@@ -17095,10 +17293,21 @@ const PathArrowModule = {
|
|
|
17095
17293
|
} else {
|
|
17096
17294
|
copy(last, now);
|
|
17097
17295
|
}
|
|
17296
|
+
stintSet$1(uData, "__startArrowPath", singleStartArrow && startArrowPath);
|
|
17297
|
+
stintSet$1(uData, "__endArrowPath", singleEndArrow && endArrowPath);
|
|
17098
17298
|
}
|
|
17099
17299
|
},
|
|
17100
|
-
|
|
17300
|
+
updateArrow(ui) {
|
|
17301
|
+
const data = ui.__;
|
|
17302
|
+
if (data.strokeScaleFixed) {
|
|
17303
|
+
if (data.__strokeWidthCache !== data.__strokeWidth) {
|
|
17304
|
+
ui.__updateRenderPath(true);
|
|
17305
|
+
}
|
|
17306
|
+
}
|
|
17307
|
+
},
|
|
17308
|
+
register(name, data, fillData) {
|
|
17101
17309
|
this.list[name] = data;
|
|
17310
|
+
if (fillData) this.fillList[name] = data;
|
|
17102
17311
|
},
|
|
17103
17312
|
get(name) {
|
|
17104
17313
|
return this.list[name];
|
|
@@ -17124,12 +17333,26 @@ UI.addAttr("endArrow", "none", arrowType);
|
|
|
17124
17333
|
Object.assign(PathArrow, PathArrowModule);
|
|
17125
17334
|
|
|
17126
17335
|
Object.assign(Paint, {
|
|
17127
|
-
strokeArrow(
|
|
17128
|
-
|
|
17336
|
+
strokeArrow(stroke, ui, canvas, _renderOptions) {
|
|
17337
|
+
const {__startArrowPath: __startArrowPath, __endArrowPath: __endArrowPath, dashPattern: dashPattern} = ui.__;
|
|
17338
|
+
if (dashPattern) canvas.dashPattern = null;
|
|
17339
|
+
if (__startArrowPath) {
|
|
17129
17340
|
canvas.beginPath();
|
|
17130
|
-
ui.__drawPathByData(canvas,
|
|
17131
|
-
canvas.dashPattern = null;
|
|
17341
|
+
ui.__drawPathByData(canvas, __startArrowPath.data);
|
|
17132
17342
|
canvas.stroke();
|
|
17343
|
+
if (__startArrowPath.fill) {
|
|
17344
|
+
canvas.fillStyle = stroke;
|
|
17345
|
+
canvas.fill();
|
|
17346
|
+
}
|
|
17347
|
+
}
|
|
17348
|
+
if (__endArrowPath) {
|
|
17349
|
+
canvas.beginPath();
|
|
17350
|
+
ui.__drawPathByData(canvas, __endArrowPath.data);
|
|
17351
|
+
canvas.stroke();
|
|
17352
|
+
if (__endArrowPath.fill) {
|
|
17353
|
+
canvas.fillStyle = stroke;
|
|
17354
|
+
canvas.fill();
|
|
17355
|
+
}
|
|
17133
17356
|
}
|
|
17134
17357
|
}
|
|
17135
17358
|
});
|
|
@@ -17591,7 +17814,7 @@ UI.addAttr("autoHeight", undefined, autoBoundsType);
|
|
|
17591
17814
|
|
|
17592
17815
|
UI.addAttr("autoBox", undefined, boundsType);
|
|
17593
17816
|
|
|
17594
|
-
const {copyAndSpread: copyAndSpread} = BoundsHelper;
|
|
17817
|
+
const {copyAndSpread: copyAndSpread$1} = BoundsHelper;
|
|
17595
17818
|
|
|
17596
17819
|
box$1.__updateFlowLayout = function() {
|
|
17597
17820
|
const {leaferIsCreated: leaferIsCreated, flow: flow} = this;
|
|
@@ -17623,7 +17846,7 @@ box$1.__updateContentBounds = function() {
|
|
|
17623
17846
|
const same = layout.contentBounds === layout.boxBounds;
|
|
17624
17847
|
if (padding) {
|
|
17625
17848
|
if (same) layout.shrinkContent();
|
|
17626
|
-
copyAndSpread(layout.contentBounds, layout.boxBounds, padding, true);
|
|
17849
|
+
copyAndSpread$1(layout.contentBounds, layout.boxBounds, padding, true);
|
|
17627
17850
|
} else {
|
|
17628
17851
|
if (!same) layout.shrinkContentCancel();
|
|
17629
17852
|
}
|
|
@@ -17645,7 +17868,7 @@ box$1.__updateBoxBounds = function(secondLayout) {
|
|
|
17645
17868
|
boxBounds.width = data.width, boxBounds.x = 0;
|
|
17646
17869
|
}
|
|
17647
17870
|
}
|
|
17648
|
-
flow && secondLayout && data.padding && copyAndSpread(boxBounds, boxBounds, data.padding, false, data.__autoSize ? null : data.__autoWidth ? "width" : "height");
|
|
17871
|
+
flow && secondLayout && data.padding && copyAndSpread$1(boxBounds, boxBounds, data.padding, false, data.__autoSize ? null : data.__autoWidth ? "width" : "height");
|
|
17649
17872
|
this.__updateNaturalSize();
|
|
17650
17873
|
} else {
|
|
17651
17874
|
this.__updateRectBoxBounds();
|
|
@@ -19502,6 +19725,9 @@ let Robot = class Robot extends UI {
|
|
|
19502
19725
|
constructor(data) {
|
|
19503
19726
|
super(data);
|
|
19504
19727
|
}
|
|
19728
|
+
togglePlay() {
|
|
19729
|
+
this.running ? this.pause() : this.play();
|
|
19730
|
+
}
|
|
19505
19731
|
play() {
|
|
19506
19732
|
this.running = true;
|
|
19507
19733
|
}
|
|
@@ -19626,9 +19852,7 @@ const {Yes: Yes, NoAndSkip: NoAndSkip, YesAndSkip: YesAndSkip} = Answer;
|
|
|
19626
19852
|
const idCondition = {}, classNameCondition = {}, tagCondition = {};
|
|
19627
19853
|
|
|
19628
19854
|
class Finder {
|
|
19629
|
-
constructor(target) {
|
|
19630
|
-
this.innerIdMap = {};
|
|
19631
|
-
this.idMap = {};
|
|
19855
|
+
constructor(target, _config) {
|
|
19632
19856
|
this.methods = {
|
|
19633
19857
|
id: (leaf, name) => leaf.id === name ? (this.target && (this.idMap[name] = leaf),
|
|
19634
19858
|
1) : 0,
|
|
@@ -19638,6 +19862,13 @@ class Finder {
|
|
|
19638
19862
|
tag: (leaf, name) => leaf.__tag === name ? 1 : 0,
|
|
19639
19863
|
tags: (leaf, nameMap) => nameMap[leaf.__tag] ? 1 : 0
|
|
19640
19864
|
};
|
|
19865
|
+
this.idMap = {};
|
|
19866
|
+
this.innerIdMap = {};
|
|
19867
|
+
const app = target && target.app;
|
|
19868
|
+
if (app) {
|
|
19869
|
+
app.idMap ? this.idMap = app.idMap : app.idMap = this.idMap;
|
|
19870
|
+
app.innerIdMap ? this.innerIdMap = app.innerIdMap : app.innerIdMap = this.innerIdMap;
|
|
19871
|
+
}
|
|
19641
19872
|
if (this.target = target) this.__listenEvents();
|
|
19642
19873
|
}
|
|
19643
19874
|
getBy(condition, branch, one, options) {
|
|
@@ -19764,8 +19995,14 @@ ui.findOne = function(condition, options) {
|
|
|
19764
19995
|
|
|
19765
19996
|
Plugin.add("find");
|
|
19766
19997
|
|
|
19767
|
-
Creator.finder = function(target) {
|
|
19768
|
-
return new Finder(target);
|
|
19998
|
+
Creator.finder = function(target, config) {
|
|
19999
|
+
return new Finder(target, config);
|
|
20000
|
+
};
|
|
20001
|
+
|
|
20002
|
+
LeafHelper.cacheId = function(t) {
|
|
20003
|
+
const {leafer: leafer, id: id} = t;
|
|
20004
|
+
if (id) leafer.app.idMap[id] = t;
|
|
20005
|
+
if (leafer.cacheInnerId) leafer.app.innerIdMap[t.innerId] = t;
|
|
19769
20006
|
};
|
|
19770
20007
|
|
|
19771
20008
|
const {setPoint: setPoint, addPoint: addPoint, toBounds: toBounds} = TwoPointBoundsHelper;
|
|
@@ -20058,7 +20295,7 @@ const config = {
|
|
|
20058
20295
|
style: {
|
|
20059
20296
|
dragBoundsType: "outer",
|
|
20060
20297
|
strokeAlign: "center",
|
|
20061
|
-
|
|
20298
|
+
strokeScaleFixed: "zoom-in",
|
|
20062
20299
|
width: 6,
|
|
20063
20300
|
height: 6,
|
|
20064
20301
|
opacity: .5,
|
|
@@ -20307,4 +20544,48 @@ Scroller.registerTheme("dark", {
|
|
|
20307
20544
|
}
|
|
20308
20545
|
});
|
|
20309
20546
|
|
|
20310
|
-
|
|
20547
|
+
const {stintSet: stintSet} = DataHelper;
|
|
20548
|
+
|
|
20549
|
+
function scaleFixedType(defaultValue) {
|
|
20550
|
+
return decorateLeafAttr(defaultValue, key => attr({
|
|
20551
|
+
set(value) {
|
|
20552
|
+
if (this.__setAttr(key, value)) {
|
|
20553
|
+
const layout = this.__layout;
|
|
20554
|
+
doBoundsType(this);
|
|
20555
|
+
if (!isNumber(value)) value = value ? 1 : 0;
|
|
20556
|
+
stintSet(layout, "scaleFixed", value);
|
|
20557
|
+
stintSet(layout, "outerScale", value ? 1 / value : 0);
|
|
20558
|
+
if (!layout.outerScale && layout.localOuterBounds) layout.localOuterBounds = undefined;
|
|
20559
|
+
}
|
|
20560
|
+
}
|
|
20561
|
+
}));
|
|
20562
|
+
}
|
|
20563
|
+
|
|
20564
|
+
const {scale: scale} = MatrixHelper;
|
|
20565
|
+
|
|
20566
|
+
const {copyAndSpread: copyAndSpread} = BoundsHelper;
|
|
20567
|
+
|
|
20568
|
+
const {getScaleFixedData: getScaleFixedData} = MathHelper;
|
|
20569
|
+
|
|
20570
|
+
LeafHelper.updateScaleFixedWorld = function(t) {
|
|
20571
|
+
const {__world: __world, __: __} = t, {scaleX: scaleX, scaleY: scaleY} = getScaleFixedData(__world, __.scaleFixed);
|
|
20572
|
+
if (scaleX !== 1) {
|
|
20573
|
+
scale(__world, scaleX, scaleY);
|
|
20574
|
+
__world.scaleX *= scaleX, __world.scaleY *= scaleY;
|
|
20575
|
+
}
|
|
20576
|
+
};
|
|
20577
|
+
|
|
20578
|
+
LeafHelper.updateOuterBounds = function(t) {
|
|
20579
|
+
const layout = t.__layout, {localRenderBounds: localRenderBounds} = layout;
|
|
20580
|
+
const localOuterBounds = layout.localOuterBounds || (layout.localOuterBounds = {});
|
|
20581
|
+
const {width: width, height: height} = localRenderBounds;
|
|
20582
|
+
const scale = layout.outerScale - 1;
|
|
20583
|
+
copyAndSpread(localOuterBounds, localRenderBounds, [ height * scale, width * scale ]);
|
|
20584
|
+
if (t.parent) t.parent.__layout.renderChange();
|
|
20585
|
+
};
|
|
20586
|
+
|
|
20587
|
+
Plugin.add("scale-fixed");
|
|
20588
|
+
|
|
20589
|
+
UI.addAttr("scaleFixed", undefined, scaleFixedType);
|
|
20590
|
+
|
|
20591
|
+
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, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, Interaction, 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, 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 };
|