@leafer-draw/worker 1.5.3 → 1.6.1
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 +73 -75
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.esm.js +73 -75
- package/dist/worker.esm.js.map +1 -1
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +265 -169
- package/dist/worker.js.map +1 -1
- 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 +265 -169
- package/dist/worker.module.js.map +1 -1
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +9 -7
- package/src/core.ts +86 -0
- package/src/index.ts +2 -2
- package/types/index.d.ts +8 -1
package/dist/worker.module.js
CHANGED
|
@@ -45,7 +45,7 @@ const IncrementId = {
|
|
|
45
45
|
};
|
|
46
46
|
const I$1 = IncrementId;
|
|
47
47
|
|
|
48
|
-
const { round, pow: pow$1, PI: PI$4 } = Math;
|
|
48
|
+
const { round: round$3, pow: pow$1, PI: PI$4 } = Math;
|
|
49
49
|
const MathHelper = {
|
|
50
50
|
within(value, min, max) {
|
|
51
51
|
if (typeof min === 'object')
|
|
@@ -109,7 +109,7 @@ const MathHelper = {
|
|
|
109
109
|
},
|
|
110
110
|
float(num, maxLength) {
|
|
111
111
|
const a = maxLength !== undefined ? pow$1(10, maxLength) : 1000000000000;
|
|
112
|
-
num = round(num * a) / a;
|
|
112
|
+
num = round$3(num * a) / a;
|
|
113
113
|
return num === -0 ? 0 : num;
|
|
114
114
|
},
|
|
115
115
|
getScaleData(scale, size, originSize, scaleData) {
|
|
@@ -132,8 +132,15 @@ const MathHelper = {
|
|
|
132
132
|
scaleData.scaleX = scale.x;
|
|
133
133
|
scaleData.scaleY = scale.y;
|
|
134
134
|
}
|
|
135
|
+
},
|
|
136
|
+
randInt,
|
|
137
|
+
randColor(opacity) {
|
|
138
|
+
return `rgba(${randInt(255)},${randInt(255)},${randInt(255)},${opacity || 1})`;
|
|
135
139
|
}
|
|
136
140
|
};
|
|
141
|
+
function randInt(num) {
|
|
142
|
+
return Math.round(Math.random() * num);
|
|
143
|
+
}
|
|
137
144
|
const OneRadian = PI$4 / 180;
|
|
138
145
|
const PI2 = PI$4 * 2;
|
|
139
146
|
const PI_2 = PI$4 / 2;
|
|
@@ -431,7 +438,7 @@ const MatrixHelper = {
|
|
|
431
438
|
const M$6 = MatrixHelper;
|
|
432
439
|
|
|
433
440
|
const { toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3 } = MatrixHelper;
|
|
434
|
-
const { sin: sin$4, cos: cos$4, abs: abs$4, sqrt: sqrt$2, atan2: atan2$2, min: min$1, PI: PI$3 } = Math;
|
|
441
|
+
const { sin: sin$4, cos: cos$4, abs: abs$4, sqrt: sqrt$2, atan2: atan2$2, min: min$1, round: round$2, PI: PI$3 } = Math;
|
|
435
442
|
const PointHelper = {
|
|
436
443
|
defaultPoint: getPointData(),
|
|
437
444
|
tempPoint: {},
|
|
@@ -452,6 +459,10 @@ const PointHelper = {
|
|
|
452
459
|
t.x = x;
|
|
453
460
|
t.y = y;
|
|
454
461
|
},
|
|
462
|
+
round(t, halfPixel) {
|
|
463
|
+
t.x = halfPixel ? round$2(t.x - 0.5) + 0.5 : round$2(t.x);
|
|
464
|
+
t.y = halfPixel ? round$2(t.y - 0.5) + 0.5 : round$2(t.y);
|
|
465
|
+
},
|
|
455
466
|
move(t, x, y) {
|
|
456
467
|
t.x += x;
|
|
457
468
|
t.y += y;
|
|
@@ -1317,6 +1328,7 @@ const StringNumberMap = {
|
|
|
1317
1328
|
'E': 1
|
|
1318
1329
|
};
|
|
1319
1330
|
|
|
1331
|
+
const { randColor } = MathHelper;
|
|
1320
1332
|
class Debug {
|
|
1321
1333
|
constructor(name) {
|
|
1322
1334
|
this.repeatMap = {};
|
|
@@ -1331,6 +1343,19 @@ class Debug {
|
|
|
1331
1343
|
static set exclude(name) {
|
|
1332
1344
|
this.excludeList = getNameList(name);
|
|
1333
1345
|
}
|
|
1346
|
+
static drawRepaint(canvas, bounds) {
|
|
1347
|
+
const color = randColor();
|
|
1348
|
+
canvas.fillWorld(bounds, color.replace('1)', '.1)'));
|
|
1349
|
+
canvas.strokeWorld(bounds, color);
|
|
1350
|
+
}
|
|
1351
|
+
static drawBounds(leaf, canvas, _options) {
|
|
1352
|
+
const showHit = Debug.showBounds === 'hit', w = leaf.__nowWorld, color = randColor();
|
|
1353
|
+
if (showHit)
|
|
1354
|
+
canvas.setWorld(w), leaf.__drawHitPath(canvas), canvas.fillStyle = color.replace('1)', '.2)'), canvas.fill();
|
|
1355
|
+
canvas.resetTransform();
|
|
1356
|
+
canvas.setStroke(color, 2);
|
|
1357
|
+
showHit ? canvas.stroke() : canvas.strokeWorld(w, color);
|
|
1358
|
+
}
|
|
1334
1359
|
log(...messages) {
|
|
1335
1360
|
if (D$4.enable) {
|
|
1336
1361
|
if (D$4.filterList.length && D$4.filterList.every(name => name !== this.name))
|
|
@@ -1417,7 +1442,7 @@ const Plugin = {
|
|
|
1417
1442
|
return rs;
|
|
1418
1443
|
},
|
|
1419
1444
|
need(name) {
|
|
1420
|
-
console.error('
|
|
1445
|
+
console.error('please install plugin: ' + (name.includes('-x') ? '' : '@leafer-in/') + name);
|
|
1421
1446
|
}
|
|
1422
1447
|
};
|
|
1423
1448
|
setTimeout(() => check.forEach(name => Plugin.has(name, true)));
|
|
@@ -2017,7 +2042,7 @@ __decorate([
|
|
|
2017
2042
|
contextMethod()
|
|
2018
2043
|
], Canvas$1.prototype, "strokeText", null);
|
|
2019
2044
|
|
|
2020
|
-
const { copy: copy$8 } = MatrixHelper;
|
|
2045
|
+
const { copy: copy$8, multiplyParent: multiplyParent$3 } = MatrixHelper, { round: round$1 } = Math;
|
|
2021
2046
|
const minSize = { width: 1, height: 1, pixelRatio: 1 };
|
|
2022
2047
|
const canvasSizeAttrs = ['width', 'height', 'pixelRatio'];
|
|
2023
2048
|
class LeaferCanvasBase extends Canvas$1 {
|
|
@@ -2026,6 +2051,8 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2026
2051
|
get pixelRatio() { return this.size.pixelRatio; }
|
|
2027
2052
|
get pixelWidth() { return this.width * this.pixelRatio; }
|
|
2028
2053
|
get pixelHeight() { return this.height * this.pixelRatio; }
|
|
2054
|
+
get pixelSnap() { return this.config.pixelSnap; }
|
|
2055
|
+
set pixelSnap(value) { this.config.pixelSnap = value; }
|
|
2029
2056
|
get allowBackgroundColor() { return this.view && this.parentView; }
|
|
2030
2057
|
constructor(config, manager) {
|
|
2031
2058
|
super();
|
|
@@ -2086,15 +2113,22 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2086
2113
|
stopAutoLayout() { }
|
|
2087
2114
|
setCursor(_cursor) { }
|
|
2088
2115
|
setWorld(matrix, parentMatrix) {
|
|
2089
|
-
const { pixelRatio } = this;
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2116
|
+
const { pixelRatio, pixelSnap } = this, w = this.worldTransform;
|
|
2117
|
+
if (parentMatrix)
|
|
2118
|
+
multiplyParent$3(matrix, parentMatrix, w);
|
|
2119
|
+
w.a = matrix.a * pixelRatio;
|
|
2120
|
+
w.b = matrix.b * pixelRatio;
|
|
2121
|
+
w.c = matrix.c * pixelRatio;
|
|
2122
|
+
w.d = matrix.d * pixelRatio;
|
|
2123
|
+
w.e = matrix.e * pixelRatio;
|
|
2124
|
+
w.f = matrix.f * pixelRatio;
|
|
2125
|
+
if (pixelSnap) {
|
|
2126
|
+
if (matrix.half && (matrix.half * pixelRatio) % 2)
|
|
2127
|
+
w.e = round$1(w.e - 0.5) + 0.5, w.f = round$1(w.f - 0.5) + 0.5;
|
|
2128
|
+
else
|
|
2129
|
+
w.e = round$1(w.e), w.f = round$1(w.f);
|
|
2097
2130
|
}
|
|
2131
|
+
this.setTransform(w.a, w.b, w.c, w.d, w.e, w.f);
|
|
2098
2132
|
}
|
|
2099
2133
|
useWorldTransform(worldTransform) {
|
|
2100
2134
|
if (worldTransform)
|
|
@@ -2237,12 +2271,13 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2237
2271
|
return this.width === size.width && this.height === size.height && (!size.pixelRatio || this.pixelRatio === size.pixelRatio);
|
|
2238
2272
|
}
|
|
2239
2273
|
getSameCanvas(useSameWorldTransform, useSameSmooth) {
|
|
2240
|
-
const canvas = this.manager ? this.manager.get(
|
|
2274
|
+
const { size, pixelSnap } = this, canvas = this.manager ? this.manager.get(size) : Creator.canvas(Object.assign({}, size));
|
|
2241
2275
|
canvas.save();
|
|
2242
2276
|
if (useSameWorldTransform)
|
|
2243
2277
|
copy$8(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
|
|
2244
2278
|
if (useSameSmooth)
|
|
2245
2279
|
canvas.smooth = this.smooth;
|
|
2280
|
+
canvas.pixelSnap !== pixelSnap && (canvas.pixelSnap = pixelSnap);
|
|
2246
2281
|
return canvas;
|
|
2247
2282
|
}
|
|
2248
2283
|
recycle(clearBounds) {
|
|
@@ -3669,7 +3704,7 @@ const Resource = {
|
|
|
3669
3704
|
const R = Resource;
|
|
3670
3705
|
|
|
3671
3706
|
const ImageManager = {
|
|
3672
|
-
maxRecycled:
|
|
3707
|
+
maxRecycled: 10,
|
|
3673
3708
|
recycledList: [],
|
|
3674
3709
|
patternTasker: new TaskProcessor(),
|
|
3675
3710
|
get(config) {
|
|
@@ -4022,9 +4057,8 @@ function hitType(defaultValue) {
|
|
|
4022
4057
|
set(value) {
|
|
4023
4058
|
if (this.__setAttr(key, value)) {
|
|
4024
4059
|
this.__layout.hitCanvasChanged = true;
|
|
4025
|
-
if (Debug.
|
|
4060
|
+
if (Debug.showBounds === 'hit')
|
|
4026
4061
|
this.__layout.surfaceChanged || this.__layout.surfaceChange();
|
|
4027
|
-
}
|
|
4028
4062
|
if (this.leafer)
|
|
4029
4063
|
this.leafer.updateCursor();
|
|
4030
4064
|
}
|
|
@@ -4185,7 +4219,7 @@ function registerUIEvent() {
|
|
|
4185
4219
|
}
|
|
4186
4220
|
|
|
4187
4221
|
const { copy: copy$6, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
|
|
4188
|
-
const matrix = {};
|
|
4222
|
+
const matrix = {}, { round } = Math;
|
|
4189
4223
|
const LeafHelper = {
|
|
4190
4224
|
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
4191
4225
|
if (checkAutoLayout && leaf.__hasAutoLayout && leaf.__layout.matrixChanged)
|
|
@@ -4259,6 +4293,8 @@ const LeafHelper = {
|
|
|
4259
4293
|
y = x.y, x = x.x;
|
|
4260
4294
|
x += t.x;
|
|
4261
4295
|
y += t.y;
|
|
4296
|
+
if (t.leafer && t.leafer.config.pointSnap)
|
|
4297
|
+
x = round(x), y = round(y);
|
|
4262
4298
|
transition ? t.animate({ x, y }, transition) : (t.x = x, t.y = y);
|
|
4263
4299
|
},
|
|
4264
4300
|
zoomOfWorld(t, origin, scaleX, scaleY, resize, transition) {
|
|
@@ -4497,6 +4533,7 @@ class LeafLayout {
|
|
|
4497
4533
|
set contentBounds(bounds) { this._contentBounds = bounds; }
|
|
4498
4534
|
get strokeBounds() { return this._strokeBounds || this.boxBounds; }
|
|
4499
4535
|
get renderBounds() { return this._renderBounds || this.boxBounds; }
|
|
4536
|
+
set renderBounds(bounds) { this._renderBounds = bounds; }
|
|
4500
4537
|
get localContentBounds() { toOuterOf$2(this.contentBounds, this.leaf.__localMatrix, this[localContent] || (this[localContent] = {})); return this[localContent]; }
|
|
4501
4538
|
get localStrokeBounds() { return this._localStrokeBounds || this; }
|
|
4502
4539
|
get localRenderBounds() { return this._localRenderBounds || this; }
|
|
@@ -4515,11 +4552,13 @@ class LeafLayout {
|
|
|
4515
4552
|
get height() { return this.boxBounds.height; }
|
|
4516
4553
|
constructor(leaf) {
|
|
4517
4554
|
this.leaf = leaf;
|
|
4518
|
-
this.boxBounds = { x: 0, y: 0, width: 0, height: 0 };
|
|
4519
4555
|
if (this.leaf.__local)
|
|
4520
4556
|
this._localRenderBounds = this._localStrokeBounds = this.leaf.__local;
|
|
4521
|
-
|
|
4522
|
-
|
|
4557
|
+
if (leaf.__world) {
|
|
4558
|
+
this.boxBounds = { x: 0, y: 0, width: 0, height: 0 };
|
|
4559
|
+
this.boxChange();
|
|
4560
|
+
this.matrixChange();
|
|
4561
|
+
}
|
|
4523
4562
|
}
|
|
4524
4563
|
createLocal() {
|
|
4525
4564
|
const local = this.leaf.__local = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, x: 0, y: 0, width: 0, height: 0 };
|
|
@@ -4851,6 +4890,9 @@ class ResizeEvent extends Event {
|
|
|
4851
4890
|
}
|
|
4852
4891
|
this.old = oldSize;
|
|
4853
4892
|
}
|
|
4893
|
+
static isResizing(leaf) {
|
|
4894
|
+
return this.resizingKeys && this.resizingKeys[leaf.innerId] !== undefined;
|
|
4895
|
+
}
|
|
4854
4896
|
}
|
|
4855
4897
|
ResizeEvent.RESIZE = 'resize';
|
|
4856
4898
|
|
|
@@ -4893,6 +4935,7 @@ class RenderEvent extends Event {
|
|
|
4893
4935
|
}
|
|
4894
4936
|
RenderEvent.REQUEST = 'render.request';
|
|
4895
4937
|
RenderEvent.CHILD_START = 'render.child_start';
|
|
4938
|
+
RenderEvent.CHILD_END = 'render.child_end';
|
|
4896
4939
|
RenderEvent.START = 'render.start';
|
|
4897
4940
|
RenderEvent.BEFORE = 'render.before';
|
|
4898
4941
|
RenderEvent.RENDER = 'render';
|
|
@@ -5272,24 +5315,27 @@ const LeafBounds = {
|
|
|
5272
5315
|
const LeafRender = {
|
|
5273
5316
|
__render(canvas, options) {
|
|
5274
5317
|
if (this.__worldOpacity) {
|
|
5318
|
+
const data = this.__;
|
|
5275
5319
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5276
|
-
canvas.opacity =
|
|
5320
|
+
canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
|
|
5277
5321
|
if (this.__.__single) {
|
|
5278
|
-
if (
|
|
5322
|
+
if (data.eraser === 'path')
|
|
5279
5323
|
return this.__renderEraser(canvas, options);
|
|
5280
5324
|
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
5281
5325
|
this.__draw(tempCanvas, options, canvas);
|
|
5282
5326
|
if (this.__worldFlipped) {
|
|
5283
|
-
canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null,
|
|
5327
|
+
canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null, data.__blendMode, true);
|
|
5284
5328
|
}
|
|
5285
5329
|
else {
|
|
5286
|
-
canvas.copyWorldToInner(tempCanvas, this.__nowWorld, this.__layout.renderBounds,
|
|
5330
|
+
canvas.copyWorldToInner(tempCanvas, this.__nowWorld, this.__layout.renderBounds, data.__blendMode);
|
|
5287
5331
|
}
|
|
5288
5332
|
tempCanvas.recycle(this.__nowWorld);
|
|
5289
5333
|
}
|
|
5290
5334
|
else {
|
|
5291
5335
|
this.__draw(canvas, options);
|
|
5292
5336
|
}
|
|
5337
|
+
if (Debug.showBounds)
|
|
5338
|
+
Debug.drawBounds(this, canvas, options);
|
|
5293
5339
|
}
|
|
5294
5340
|
},
|
|
5295
5341
|
__clip(canvas, options) {
|
|
@@ -5319,14 +5365,19 @@ const BranchRender = {
|
|
|
5319
5365
|
__render(canvas, options) {
|
|
5320
5366
|
this.__nowWorld = this.__getNowWorld(options);
|
|
5321
5367
|
if (this.__worldOpacity) {
|
|
5322
|
-
|
|
5323
|
-
|
|
5368
|
+
const data = this.__;
|
|
5369
|
+
if (data.dim)
|
|
5370
|
+
options.dimOpacity = data.dim === true ? 0.2 : data.dim;
|
|
5371
|
+
else if (data.dimskip)
|
|
5372
|
+
options.dimOpacity && (options.dimOpacity = 0);
|
|
5373
|
+
if (data.__single) {
|
|
5374
|
+
if (data.eraser === 'path')
|
|
5324
5375
|
return this.__renderEraser(canvas, options);
|
|
5325
5376
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
5326
5377
|
this.__renderBranch(tempCanvas, options);
|
|
5327
5378
|
const nowWorld = this.__nowWorld;
|
|
5328
|
-
canvas.opacity =
|
|
5329
|
-
canvas.copyWorldByReset(tempCanvas, nowWorld, nowWorld,
|
|
5379
|
+
canvas.opacity = options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
|
|
5380
|
+
canvas.copyWorldByReset(tempCanvas, nowWorld, nowWorld, data.__blendMode, true);
|
|
5330
5381
|
tempCanvas.recycle(nowWorld);
|
|
5331
5382
|
}
|
|
5332
5383
|
else {
|
|
@@ -5401,9 +5452,11 @@ let Leaf = class Leaf {
|
|
|
5401
5452
|
reset(data) {
|
|
5402
5453
|
if (this.leafer)
|
|
5403
5454
|
this.leafer.forceRender(this.__world);
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
|
|
5455
|
+
if (data !== 0) {
|
|
5456
|
+
this.__world = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, x: 0, y: 0, width: 0, height: 0, scaleX: 1, scaleY: 1 };
|
|
5457
|
+
if (data !== null)
|
|
5458
|
+
this.__local = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, x: 0, y: 0, width: 0, height: 0 };
|
|
5459
|
+
}
|
|
5407
5460
|
this.__worldOpacity = 1;
|
|
5408
5461
|
this.__ = new this.__DataProcessor(this);
|
|
5409
5462
|
this.__layout = new this.__LayoutProcessor(this);
|
|
@@ -5539,9 +5592,10 @@ let Leaf = class Leaf {
|
|
|
5539
5592
|
if (options.matrix) {
|
|
5540
5593
|
if (!this.__cameraWorld)
|
|
5541
5594
|
this.__cameraWorld = {};
|
|
5542
|
-
const cameraWorld = this.__cameraWorld;
|
|
5543
|
-
multiplyParent(
|
|
5595
|
+
const cameraWorld = this.__cameraWorld, world = this.__world;
|
|
5596
|
+
multiplyParent(world, options.matrix, cameraWorld, undefined, world);
|
|
5544
5597
|
toOuterOf(this.__layout.renderBounds, cameraWorld, cameraWorld);
|
|
5598
|
+
cameraWorld.half !== world.half && (cameraWorld.half = world.half);
|
|
5545
5599
|
return cameraWorld;
|
|
5546
5600
|
}
|
|
5547
5601
|
else {
|
|
@@ -5701,7 +5755,7 @@ let Leaf = class Leaf {
|
|
|
5701
5755
|
__updateHitCanvas() { }
|
|
5702
5756
|
__render(_canvas, _options) { }
|
|
5703
5757
|
__drawFast(_canvas, _options) { }
|
|
5704
|
-
__draw(_canvas, _options) { }
|
|
5758
|
+
__draw(_canvas, _options, _originCanvas) { }
|
|
5705
5759
|
__clip(_canvas, _options) { }
|
|
5706
5760
|
__renderShape(_canvas, _options, _ignoreFill, _ignoreStroke) { }
|
|
5707
5761
|
__updateWorldOpacity() { }
|
|
@@ -6071,7 +6125,7 @@ class LeafLevelList {
|
|
|
6071
6125
|
}
|
|
6072
6126
|
}
|
|
6073
6127
|
|
|
6074
|
-
const version = "1.
|
|
6128
|
+
const version = "1.6.1";
|
|
6075
6129
|
|
|
6076
6130
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6077
6131
|
get allowBackgroundColor() { return true; }
|
|
@@ -6311,7 +6365,6 @@ function updateChange(updateList) {
|
|
|
6311
6365
|
}
|
|
6312
6366
|
|
|
6313
6367
|
const { worldBounds } = LeafBoundsHelper;
|
|
6314
|
-
const bigBounds = { x: 0, y: 0, width: 100000, height: 100000 };
|
|
6315
6368
|
class LayoutBlockData {
|
|
6316
6369
|
constructor(list) {
|
|
6317
6370
|
this.updatedBounds = new Bounds();
|
|
@@ -6325,13 +6378,7 @@ class LayoutBlockData {
|
|
|
6325
6378
|
this.beforeBounds.setListWithFn(this.updatedList.list, worldBounds);
|
|
6326
6379
|
}
|
|
6327
6380
|
setAfter() {
|
|
6328
|
-
|
|
6329
|
-
if (list.some(leaf => leaf.noBounds)) {
|
|
6330
|
-
this.afterBounds.set(bigBounds);
|
|
6331
|
-
}
|
|
6332
|
-
else {
|
|
6333
|
-
this.afterBounds.setListWithFn(list, worldBounds);
|
|
6334
|
-
}
|
|
6381
|
+
this.afterBounds.setListWithFn(this.updatedList.list, worldBounds);
|
|
6335
6382
|
this.updatedBounds.setList([this.beforeBounds, this.afterBounds]);
|
|
6336
6383
|
}
|
|
6337
6384
|
merge(data) {
|
|
@@ -6533,6 +6580,22 @@ class Renderer {
|
|
|
6533
6580
|
requestLayout() {
|
|
6534
6581
|
this.target.emit(LayoutEvent.REQUEST);
|
|
6535
6582
|
}
|
|
6583
|
+
checkRender() {
|
|
6584
|
+
if (this.running) {
|
|
6585
|
+
const { target } = this;
|
|
6586
|
+
if (target.isApp) {
|
|
6587
|
+
target.emit(RenderEvent.CHILD_START, target);
|
|
6588
|
+
target.children.forEach(leafer => {
|
|
6589
|
+
leafer.renderer.FPS = this.FPS;
|
|
6590
|
+
leafer.renderer.checkRender();
|
|
6591
|
+
});
|
|
6592
|
+
target.emit(RenderEvent.CHILD_END, target);
|
|
6593
|
+
}
|
|
6594
|
+
if (this.changed && this.canvas.view)
|
|
6595
|
+
this.render();
|
|
6596
|
+
this.target.emit(RenderEvent.NEXT);
|
|
6597
|
+
}
|
|
6598
|
+
}
|
|
6536
6599
|
render(callback) {
|
|
6537
6600
|
if (!(this.running && this.canvas.view))
|
|
6538
6601
|
return this.update();
|
|
@@ -6541,8 +6604,6 @@ class Renderer {
|
|
|
6541
6604
|
this.totalBounds = new Bounds();
|
|
6542
6605
|
debug$2.log(target.innerName, '--->');
|
|
6543
6606
|
try {
|
|
6544
|
-
if (!target.isApp)
|
|
6545
|
-
target.app.emit(RenderEvent.CHILD_START, target);
|
|
6546
6607
|
this.emitRender(RenderEvent.START);
|
|
6547
6608
|
this.renderOnce(callback);
|
|
6548
6609
|
this.emitRender(RenderEvent.END, this.totalBounds);
|
|
@@ -6610,20 +6671,12 @@ class Renderer {
|
|
|
6610
6671
|
}
|
|
6611
6672
|
clipRender(block) {
|
|
6612
6673
|
const t = Run.start('PartRender');
|
|
6613
|
-
const { canvas } = this;
|
|
6614
|
-
const bounds = block.getIntersect(canvas.bounds);
|
|
6615
|
-
const includes = block.includes(this.target.__world);
|
|
6616
|
-
const realBounds = new Bounds(bounds);
|
|
6674
|
+
const { canvas } = this, bounds = block.getIntersect(canvas.bounds), realBounds = new Bounds(bounds);
|
|
6617
6675
|
canvas.save();
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
bounds.spread(10 + 1 / this.canvas.pixelRatio).ceil();
|
|
6623
|
-
canvas.clearWorld(bounds, true);
|
|
6624
|
-
canvas.clipWorld(bounds, true);
|
|
6625
|
-
}
|
|
6626
|
-
this.__render(bounds, includes, realBounds);
|
|
6676
|
+
bounds.spread(Renderer.clipSpread).ceil();
|
|
6677
|
+
canvas.clearWorld(bounds, true);
|
|
6678
|
+
canvas.clipWorld(bounds, true);
|
|
6679
|
+
this.__render(bounds, realBounds);
|
|
6627
6680
|
canvas.restore();
|
|
6628
6681
|
Run.end(t);
|
|
6629
6682
|
}
|
|
@@ -6632,28 +6685,22 @@ class Renderer {
|
|
|
6632
6685
|
const { canvas } = this;
|
|
6633
6686
|
canvas.save();
|
|
6634
6687
|
canvas.clear();
|
|
6635
|
-
this.__render(canvas.bounds
|
|
6688
|
+
this.__render(canvas.bounds);
|
|
6636
6689
|
canvas.restore();
|
|
6637
6690
|
Run.end(t);
|
|
6638
6691
|
}
|
|
6639
|
-
__render(bounds,
|
|
6640
|
-
const
|
|
6692
|
+
__render(bounds, realBounds) {
|
|
6693
|
+
const { canvas } = this, includes = bounds.includes(this.target.__world), options = includes ? { includes } : { bounds, includes };
|
|
6641
6694
|
if (this.needFill)
|
|
6642
|
-
|
|
6695
|
+
canvas.fillWorld(bounds, this.config.fill);
|
|
6643
6696
|
if (Debug.showRepaint)
|
|
6644
|
-
|
|
6645
|
-
this.target.__render(
|
|
6697
|
+
Debug.drawRepaint(canvas, bounds);
|
|
6698
|
+
this.target.__render(canvas, options);
|
|
6646
6699
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
6647
6700
|
this.renderOptions = options;
|
|
6648
6701
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
if (Debug.showBoundsView)
|
|
6652
|
-
this.renderBoundsView(options);
|
|
6653
|
-
this.canvas.updateRender(realBounds);
|
|
6654
|
-
}
|
|
6655
|
-
renderHitView(_options) { }
|
|
6656
|
-
renderBoundsView(_options) { }
|
|
6702
|
+
canvas.updateRender(realBounds);
|
|
6703
|
+
}
|
|
6657
6704
|
addBlock(block) {
|
|
6658
6705
|
if (!this.updateBlocks)
|
|
6659
6706
|
this.updateBlocks = [];
|
|
@@ -6669,17 +6716,16 @@ class Renderer {
|
|
|
6669
6716
|
}
|
|
6670
6717
|
}
|
|
6671
6718
|
__requestRender() {
|
|
6672
|
-
|
|
6719
|
+
const target = this.target;
|
|
6720
|
+
if (this.requestTime || !target)
|
|
6673
6721
|
return;
|
|
6722
|
+
if (target.parentApp)
|
|
6723
|
+
return target.parentApp.requestRender(false);
|
|
6674
6724
|
const requestTime = this.requestTime = Date.now();
|
|
6675
6725
|
Platform.requestRender(() => {
|
|
6676
6726
|
this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - requestTime)));
|
|
6677
6727
|
this.requestTime = 0;
|
|
6678
|
-
|
|
6679
|
-
if (this.changed && this.canvas.view)
|
|
6680
|
-
this.render();
|
|
6681
|
-
this.target.emit(RenderEvent.NEXT);
|
|
6682
|
-
}
|
|
6728
|
+
this.checkRender();
|
|
6683
6729
|
});
|
|
6684
6730
|
}
|
|
6685
6731
|
__onResize(e) {
|
|
@@ -6737,6 +6783,7 @@ class Renderer {
|
|
|
6737
6783
|
}
|
|
6738
6784
|
}
|
|
6739
6785
|
}
|
|
6786
|
+
Renderer.clipSpread = 10;
|
|
6740
6787
|
|
|
6741
6788
|
Object.assign(Creator, {
|
|
6742
6789
|
watcher: (target, options) => new Watcher(target, options),
|
|
@@ -6825,6 +6872,7 @@ class UIData extends LeafData {
|
|
|
6825
6872
|
return strokeWidth;
|
|
6826
6873
|
}
|
|
6827
6874
|
get __hasStroke() { return this.stroke && this.strokeWidth; }
|
|
6875
|
+
get __hasHalf() { const t = this; return (t.stroke && t.strokeAlign === 'center' && t.strokeWidth % 2) || undefined; }
|
|
6828
6876
|
get __hasMultiPaint() {
|
|
6829
6877
|
const t = this;
|
|
6830
6878
|
if ((t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect)
|
|
@@ -6869,14 +6917,14 @@ class UIData extends LeafData {
|
|
|
6869
6917
|
this.__removeInput('fill');
|
|
6870
6918
|
PaintImage.recycleImage('fill', this);
|
|
6871
6919
|
this.__isFills = false;
|
|
6872
|
-
|
|
6873
|
-
this.__pixelFill = false;
|
|
6920
|
+
this.__pixelFill && (this.__pixelFill = false);
|
|
6874
6921
|
}
|
|
6875
6922
|
this._fill = value;
|
|
6876
6923
|
}
|
|
6877
6924
|
else if (typeof value === 'object') {
|
|
6878
6925
|
this.__setInput('fill', value);
|
|
6879
|
-
|
|
6926
|
+
const layout = this.__leaf.__layout;
|
|
6927
|
+
layout.boxChanged || layout.boxChange();
|
|
6880
6928
|
this.__isFills = true;
|
|
6881
6929
|
this._fill || (this._fill = emptyPaint);
|
|
6882
6930
|
}
|
|
@@ -6887,14 +6935,14 @@ class UIData extends LeafData {
|
|
|
6887
6935
|
this.__removeInput('stroke');
|
|
6888
6936
|
PaintImage.recycleImage('stroke', this);
|
|
6889
6937
|
this.__isStrokes = false;
|
|
6890
|
-
|
|
6891
|
-
this.__pixelStroke = false;
|
|
6938
|
+
this.__pixelStroke && (this.__pixelStroke = false);
|
|
6892
6939
|
}
|
|
6893
6940
|
this._stroke = value;
|
|
6894
6941
|
}
|
|
6895
6942
|
else if (typeof value === 'object') {
|
|
6896
6943
|
this.__setInput('stroke', value);
|
|
6897
|
-
|
|
6944
|
+
const layout = this.__leaf.__layout;
|
|
6945
|
+
layout.boxChanged || layout.boxChange();
|
|
6898
6946
|
this.__isStrokes = true;
|
|
6899
6947
|
this._stroke || (this._stroke = emptyPaint);
|
|
6900
6948
|
}
|
|
@@ -7009,6 +7057,31 @@ class TextData extends UIData {
|
|
|
7009
7057
|
this._fontWeight = value;
|
|
7010
7058
|
}
|
|
7011
7059
|
}
|
|
7060
|
+
setBoxStyle(value) {
|
|
7061
|
+
let t = this.__leaf, box = t.__box;
|
|
7062
|
+
if (value) {
|
|
7063
|
+
const { boxStyle } = this;
|
|
7064
|
+
if (box)
|
|
7065
|
+
for (let key in boxStyle)
|
|
7066
|
+
box[key] = undefined;
|
|
7067
|
+
else
|
|
7068
|
+
box = t.__box = UICreator.get('Rect', 0);
|
|
7069
|
+
const layout = t.__layout, boxLayout = box.__layout;
|
|
7070
|
+
if (!boxStyle)
|
|
7071
|
+
box.parent = t, box.__world = t.__world, boxLayout.boxBounds = layout.boxBounds;
|
|
7072
|
+
box.set(value);
|
|
7073
|
+
if (boxLayout.strokeChanged)
|
|
7074
|
+
layout.strokeChange();
|
|
7075
|
+
if (boxLayout.renderChanged)
|
|
7076
|
+
layout.renderChange();
|
|
7077
|
+
box.__updateChange();
|
|
7078
|
+
}
|
|
7079
|
+
else if (box) {
|
|
7080
|
+
t.__box = box.parent = null;
|
|
7081
|
+
box.destroy();
|
|
7082
|
+
}
|
|
7083
|
+
this._boxStyle = value;
|
|
7084
|
+
}
|
|
7012
7085
|
}
|
|
7013
7086
|
|
|
7014
7087
|
class ImageData extends RectData {
|
|
@@ -7046,7 +7119,7 @@ class CanvasData extends RectData {
|
|
|
7046
7119
|
const UIBounds = {
|
|
7047
7120
|
__updateStrokeSpread() {
|
|
7048
7121
|
let width = 0, boxWidth = 0;
|
|
7049
|
-
const data = this.__, { strokeAlign, strokeWidth } = data;
|
|
7122
|
+
const data = this.__, { strokeAlign, strokeWidth } = data, box = this.__box;
|
|
7050
7123
|
if ((data.stroke || data.hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
|
|
7051
7124
|
boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth;
|
|
7052
7125
|
if (!data.__boxStroke) {
|
|
@@ -7057,6 +7130,10 @@ const UIBounds = {
|
|
|
7057
7130
|
}
|
|
7058
7131
|
if (data.__useArrow)
|
|
7059
7132
|
width += strokeWidth * 5;
|
|
7133
|
+
if (box) {
|
|
7134
|
+
width = Math.max(box.__layout.strokeSpread = box.__updateStrokeSpread(), width);
|
|
7135
|
+
boxWidth = box.__layout.strokeBoxSpread;
|
|
7136
|
+
}
|
|
7060
7137
|
this.__layout.strokeBoxSpread = boxWidth;
|
|
7061
7138
|
return width;
|
|
7062
7139
|
},
|
|
@@ -7075,25 +7152,26 @@ const UIBounds = {
|
|
|
7075
7152
|
if (backgroundBlur)
|
|
7076
7153
|
shapeWidth = Math.max(shapeWidth, backgroundBlur);
|
|
7077
7154
|
this.__layout.renderShapeSpread = shapeWidth;
|
|
7078
|
-
|
|
7155
|
+
width += this.__layout.strokeSpread || 0;
|
|
7156
|
+
return this.__box ? Math.max(this.__box.__updateRenderSpread(), width) : width;
|
|
7079
7157
|
}
|
|
7080
7158
|
};
|
|
7081
7159
|
|
|
7082
7160
|
const UIRender = {
|
|
7083
7161
|
__updateChange() {
|
|
7084
|
-
const data = this.__;
|
|
7162
|
+
const data = this.__, w = this.__world;
|
|
7085
7163
|
if (data.__useEffect) {
|
|
7086
7164
|
const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
|
|
7087
7165
|
data.__useEffect = !!(shadow || innerShadow || blur || backgroundBlur || filter);
|
|
7088
7166
|
}
|
|
7167
|
+
const half = data.__hasHalf;
|
|
7168
|
+
w.half !== half && (w.half = half);
|
|
7089
7169
|
data.__checkSingle();
|
|
7090
7170
|
const complex = data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect;
|
|
7091
|
-
if (complex)
|
|
7171
|
+
if (complex)
|
|
7092
7172
|
data.__complex = true;
|
|
7093
|
-
|
|
7094
|
-
else {
|
|
7173
|
+
else
|
|
7095
7174
|
data.__complex && (data.__complex = false);
|
|
7096
|
-
}
|
|
7097
7175
|
},
|
|
7098
7176
|
__drawFast(canvas, options) {
|
|
7099
7177
|
drawFast(this, canvas, options);
|
|
@@ -7180,10 +7258,11 @@ function drawFast(ui, canvas, options) {
|
|
|
7180
7258
|
|
|
7181
7259
|
const RectRender = {
|
|
7182
7260
|
__drawFast(canvas, options) {
|
|
7183
|
-
let {
|
|
7261
|
+
let { x, y, width, height } = this.__layout.boxBounds;
|
|
7262
|
+
const { fill, stroke, __drawAfterFill } = this.__;
|
|
7184
7263
|
if (fill) {
|
|
7185
7264
|
canvas.fillStyle = fill;
|
|
7186
|
-
canvas.fillRect(
|
|
7265
|
+
canvas.fillRect(x, y, width, height);
|
|
7187
7266
|
}
|
|
7188
7267
|
if (__drawAfterFill)
|
|
7189
7268
|
this.__drawAfterFill(canvas, options);
|
|
@@ -7202,14 +7281,14 @@ const RectRender = {
|
|
|
7202
7281
|
if (width < 0 || height < 0) {
|
|
7203
7282
|
canvas.save();
|
|
7204
7283
|
this.__clip(canvas, options);
|
|
7205
|
-
canvas.strokeRect(half, half, width, height);
|
|
7284
|
+
canvas.strokeRect(x + half, y + half, width, height);
|
|
7206
7285
|
canvas.restore();
|
|
7207
7286
|
}
|
|
7208
7287
|
else
|
|
7209
|
-
canvas.strokeRect(half, half, width, height);
|
|
7288
|
+
canvas.strokeRect(x + half, y + half, width, height);
|
|
7210
7289
|
break;
|
|
7211
7290
|
case 'outside':
|
|
7212
|
-
canvas.strokeRect(-half, -half, width + __strokeWidth, height + __strokeWidth);
|
|
7291
|
+
canvas.strokeRect(x - half, y - half, width + __strokeWidth, height + __strokeWidth);
|
|
7213
7292
|
break;
|
|
7214
7293
|
}
|
|
7215
7294
|
}
|
|
@@ -7365,6 +7444,12 @@ __decorate([
|
|
|
7365
7444
|
__decorate([
|
|
7366
7445
|
surfaceType(false)
|
|
7367
7446
|
], UI.prototype, "locked", void 0);
|
|
7447
|
+
__decorate([
|
|
7448
|
+
surfaceType(false)
|
|
7449
|
+
], UI.prototype, "dim", void 0);
|
|
7450
|
+
__decorate([
|
|
7451
|
+
surfaceType(false)
|
|
7452
|
+
], UI.prototype, "dimskip", void 0);
|
|
7368
7453
|
__decorate([
|
|
7369
7454
|
sortType(0)
|
|
7370
7455
|
], UI.prototype, "zIndex", void 0);
|
|
@@ -7626,7 +7711,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7626
7711
|
start: true,
|
|
7627
7712
|
hittable: true,
|
|
7628
7713
|
smooth: true,
|
|
7629
|
-
lazySpeard: 100
|
|
7714
|
+
lazySpeard: 100,
|
|
7630
7715
|
};
|
|
7631
7716
|
this.leafs = 0;
|
|
7632
7717
|
this.__eventIds = [];
|
|
@@ -8050,13 +8135,13 @@ let Box = class Box extends Group {
|
|
|
8050
8135
|
super.__updateRenderBounds();
|
|
8051
8136
|
copy$2(childrenRenderBounds, renderBounds);
|
|
8052
8137
|
this.__updateRectRenderBounds();
|
|
8053
|
-
isOverflow = !includes$1(renderBounds, childrenRenderBounds);
|
|
8138
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds) || undefined;
|
|
8054
8139
|
if (isOverflow && this.__.overflow !== 'hide')
|
|
8055
8140
|
add(renderBounds, childrenRenderBounds);
|
|
8056
8141
|
}
|
|
8057
8142
|
else
|
|
8058
8143
|
this.__updateRectRenderBounds();
|
|
8059
|
-
|
|
8144
|
+
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8060
8145
|
}
|
|
8061
8146
|
__updateRectRenderBounds() { }
|
|
8062
8147
|
__updateRectChange() { }
|
|
@@ -8464,33 +8549,13 @@ Canvas = __decorate([
|
|
|
8464
8549
|
registerUI()
|
|
8465
8550
|
], Canvas);
|
|
8466
8551
|
|
|
8467
|
-
const { copyAndSpread, includes,
|
|
8552
|
+
const { copyAndSpread, includes, spread, setList } = BoundsHelper;
|
|
8468
8553
|
let Text = class Text extends UI {
|
|
8469
8554
|
get __tag() { return 'Text'; }
|
|
8470
|
-
get textDrawData() {
|
|
8471
|
-
this.__layout.update();
|
|
8472
|
-
return this.__.__textDrawData;
|
|
8473
|
-
}
|
|
8555
|
+
get textDrawData() { this.updateLayout(); return this.__.__textDrawData; }
|
|
8474
8556
|
constructor(data) {
|
|
8475
8557
|
super(data);
|
|
8476
8558
|
}
|
|
8477
|
-
__drawHitPath(canvas) {
|
|
8478
|
-
const { __lineHeight, fontSize, __baseLine, __textDrawData: data } = this.__;
|
|
8479
|
-
canvas.beginPath();
|
|
8480
|
-
if (this.__.__letterSpacing < 0) {
|
|
8481
|
-
this.__drawPathByData(canvas);
|
|
8482
|
-
}
|
|
8483
|
-
else {
|
|
8484
|
-
data.rows.forEach(row => canvas.rect(row.x, row.y - __baseLine, row.width, __lineHeight < fontSize ? fontSize : __lineHeight));
|
|
8485
|
-
}
|
|
8486
|
-
}
|
|
8487
|
-
__drawPathByData(drawer, _data) {
|
|
8488
|
-
const { x, y, width, height } = this.__layout.boxBounds;
|
|
8489
|
-
drawer.rect(x, y, width, height);
|
|
8490
|
-
}
|
|
8491
|
-
__drawRenderPath(canvas) {
|
|
8492
|
-
canvas.font = this.__.__font;
|
|
8493
|
-
}
|
|
8494
8559
|
__updateTextDrawData() {
|
|
8495
8560
|
const data = this.__;
|
|
8496
8561
|
const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow, padding } = data;
|
|
@@ -8507,15 +8572,16 @@ let Text = class Text extends UI {
|
|
|
8507
8572
|
const layout = this.__layout;
|
|
8508
8573
|
const { fontSize, italic, padding, __autoWidth: autoWidth, __autoHeight: autoHeight } = data;
|
|
8509
8574
|
this.__updateTextDrawData();
|
|
8510
|
-
const { bounds } = data.__textDrawData;
|
|
8575
|
+
const { bounds: contentBounds } = data.__textDrawData;
|
|
8511
8576
|
const b = layout.boxBounds;
|
|
8577
|
+
layout.contentBounds = contentBounds;
|
|
8512
8578
|
if (data.__lineHeight < fontSize)
|
|
8513
|
-
spread(
|
|
8579
|
+
spread(contentBounds, fontSize / 2);
|
|
8514
8580
|
if (autoWidth || autoHeight) {
|
|
8515
|
-
b.x = autoWidth ?
|
|
8516
|
-
b.y = autoHeight ?
|
|
8517
|
-
b.width = autoWidth ?
|
|
8518
|
-
b.height = autoHeight ?
|
|
8581
|
+
b.x = autoWidth ? contentBounds.x : 0;
|
|
8582
|
+
b.y = autoHeight ? contentBounds.y : 0;
|
|
8583
|
+
b.width = autoWidth ? contentBounds.width : data.width;
|
|
8584
|
+
b.height = autoHeight ? contentBounds.height : data.height;
|
|
8519
8585
|
if (padding) {
|
|
8520
8586
|
const [top, right, bottom, left] = data.__padding;
|
|
8521
8587
|
if (autoWidth)
|
|
@@ -8529,23 +8595,45 @@ let Text = class Text extends UI {
|
|
|
8529
8595
|
super.__updateBoxBounds();
|
|
8530
8596
|
if (italic)
|
|
8531
8597
|
b.width += fontSize * 0.16;
|
|
8532
|
-
const
|
|
8533
|
-
if (
|
|
8534
|
-
|
|
8535
|
-
layout.renderChanged = true;
|
|
8536
|
-
setList(data.__textBoxBounds = {}, [b, bounds]);
|
|
8537
|
-
}
|
|
8598
|
+
const isOverflow = !includes(b, contentBounds) || undefined;
|
|
8599
|
+
if (isOverflow)
|
|
8600
|
+
setList(data.__textBoxBounds = {}, [b, contentBounds]), layout.renderChanged = true;
|
|
8538
8601
|
else
|
|
8539
|
-
data.__textBoxBounds =
|
|
8602
|
+
data.__textBoxBounds = b;
|
|
8603
|
+
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8604
|
+
}
|
|
8605
|
+
__onUpdateSize() {
|
|
8606
|
+
if (this.__box)
|
|
8607
|
+
this.__box.__onUpdateSize();
|
|
8608
|
+
super.__onUpdateSize();
|
|
8540
8609
|
}
|
|
8541
8610
|
__updateRenderSpread() {
|
|
8542
8611
|
let width = super.__updateRenderSpread();
|
|
8543
8612
|
if (!width)
|
|
8544
|
-
width = this.
|
|
8613
|
+
width = this.isOverflow ? 1 : 0;
|
|
8545
8614
|
return width;
|
|
8546
8615
|
}
|
|
8547
8616
|
__updateRenderBounds() {
|
|
8548
|
-
|
|
8617
|
+
const { renderBounds, renderSpread } = this.__layout;
|
|
8618
|
+
copyAndSpread(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
8619
|
+
if (this.__box)
|
|
8620
|
+
this.__box.__layout.renderBounds = renderBounds;
|
|
8621
|
+
}
|
|
8622
|
+
__drawRenderPath(canvas) {
|
|
8623
|
+
canvas.font = this.__.__font;
|
|
8624
|
+
}
|
|
8625
|
+
__draw(canvas, options, originCanvas) {
|
|
8626
|
+
const box = this.__box;
|
|
8627
|
+
if (box)
|
|
8628
|
+
box.__nowWorld = this.__nowWorld, box.__draw(canvas, options, originCanvas);
|
|
8629
|
+
if (this.textEditing && !Export.running)
|
|
8630
|
+
return;
|
|
8631
|
+
super.__draw(canvas, options, originCanvas);
|
|
8632
|
+
}
|
|
8633
|
+
destroy() {
|
|
8634
|
+
if (this.boxStyle)
|
|
8635
|
+
this.boxStyle = null;
|
|
8636
|
+
super.destroy();
|
|
8549
8637
|
}
|
|
8550
8638
|
};
|
|
8551
8639
|
__decorate([
|
|
@@ -8557,6 +8645,9 @@ __decorate([
|
|
|
8557
8645
|
__decorate([
|
|
8558
8646
|
boundsType(0)
|
|
8559
8647
|
], Text.prototype, "height", void 0);
|
|
8648
|
+
__decorate([
|
|
8649
|
+
surfaceType()
|
|
8650
|
+
], Text.prototype, "boxStyle", void 0);
|
|
8560
8651
|
__decorate([
|
|
8561
8652
|
dataType(false)
|
|
8562
8653
|
], Text.prototype, "resizeFontSize", void 0);
|
|
@@ -9042,9 +9133,11 @@ const tempBox = new Bounds();
|
|
|
9042
9133
|
const tempPoint = {};
|
|
9043
9134
|
const tempScaleData = {};
|
|
9044
9135
|
function createData(leafPaint, image, paint, box) {
|
|
9045
|
-
const { blendMode, sync } = paint;
|
|
9136
|
+
const { blendMode, changeful, sync } = paint;
|
|
9046
9137
|
if (blendMode)
|
|
9047
9138
|
leafPaint.blendMode = blendMode;
|
|
9139
|
+
if (changeful)
|
|
9140
|
+
leafPaint.changeful = changeful;
|
|
9048
9141
|
if (sync)
|
|
9049
9142
|
leafPaint.sync = sync;
|
|
9050
9143
|
leafPaint.data = getPatternData(paint, box, image);
|
|
@@ -9277,40 +9370,32 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
9277
9370
|
}
|
|
9278
9371
|
|
|
9279
9372
|
const { abs } = Math;
|
|
9280
|
-
function checkImage(ui, canvas, paint,
|
|
9373
|
+
function checkImage(ui, canvas, paint, allowDraw) {
|
|
9281
9374
|
const { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
|
|
9282
|
-
const { pixelRatio } = canvas;
|
|
9283
|
-
if (!
|
|
9375
|
+
const { pixelRatio } = canvas, { data } = paint;
|
|
9376
|
+
if (!data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !Export.running)) {
|
|
9284
9377
|
return false;
|
|
9285
9378
|
}
|
|
9286
9379
|
else {
|
|
9287
|
-
|
|
9288
|
-
|
|
9289
|
-
|
|
9290
|
-
let { width, height } = data;
|
|
9291
|
-
width *= abs(scaleX) * pixelRatio;
|
|
9292
|
-
height *= abs(scaleY) * pixelRatio;
|
|
9293
|
-
if (data.scaleX) {
|
|
9294
|
-
width *= data.scaleX;
|
|
9295
|
-
height *= data.scaleY;
|
|
9296
|
-
}
|
|
9297
|
-
allowPaint = (width * height > Platform.image.maxCacheSize) || Export.running;
|
|
9380
|
+
if (allowDraw) {
|
|
9381
|
+
if (data.repeat) {
|
|
9382
|
+
allowDraw = false;
|
|
9298
9383
|
}
|
|
9299
9384
|
else {
|
|
9300
|
-
|
|
9385
|
+
if (!(paint.changeful || ResizeEvent.isResizing(ui) || Export.running)) {
|
|
9386
|
+
let { width, height } = data;
|
|
9387
|
+
width *= abs(scaleX) * pixelRatio;
|
|
9388
|
+
height *= abs(scaleY) * pixelRatio;
|
|
9389
|
+
if (data.scaleX) {
|
|
9390
|
+
width *= data.scaleX;
|
|
9391
|
+
height *= data.scaleY;
|
|
9392
|
+
}
|
|
9393
|
+
allowDraw = (width * height > Platform.image.maxCacheSize);
|
|
9394
|
+
}
|
|
9301
9395
|
}
|
|
9302
9396
|
}
|
|
9303
|
-
if (
|
|
9304
|
-
canvas
|
|
9305
|
-
ui.windingRule ? canvas.clip(ui.windingRule) : canvas.clip();
|
|
9306
|
-
if (paint.blendMode)
|
|
9307
|
-
canvas.blendMode = paint.blendMode;
|
|
9308
|
-
if (data.opacity)
|
|
9309
|
-
canvas.opacity *= data.opacity;
|
|
9310
|
-
if (data.transform)
|
|
9311
|
-
canvas.transform(data.transform);
|
|
9312
|
-
canvas.drawImage(paint.image.getFull(data.filters), 0, 0, data.width, data.height);
|
|
9313
|
-
canvas.restore();
|
|
9397
|
+
if (allowDraw) {
|
|
9398
|
+
drawImage(ui, canvas, paint, data);
|
|
9314
9399
|
return true;
|
|
9315
9400
|
}
|
|
9316
9401
|
else {
|
|
@@ -9331,13 +9416,26 @@ function checkImage(ui, canvas, paint, allowPaint) {
|
|
|
9331
9416
|
}
|
|
9332
9417
|
}
|
|
9333
9418
|
}
|
|
9419
|
+
function drawImage(ui, canvas, paint, data) {
|
|
9420
|
+
canvas.save();
|
|
9421
|
+
ui.windingRule ? canvas.clip(ui.windingRule) : canvas.clip();
|
|
9422
|
+
if (paint.blendMode)
|
|
9423
|
+
canvas.blendMode = paint.blendMode;
|
|
9424
|
+
if (data.opacity)
|
|
9425
|
+
canvas.opacity *= data.opacity;
|
|
9426
|
+
if (data.transform)
|
|
9427
|
+
canvas.transform(data.transform);
|
|
9428
|
+
canvas.drawImage(paint.image.getFull(data.filters), 0, 0, data.width, data.height);
|
|
9429
|
+
canvas.restore();
|
|
9430
|
+
}
|
|
9334
9431
|
|
|
9335
9432
|
function recycleImage(attrName, data) {
|
|
9336
9433
|
const paints = data['_' + attrName];
|
|
9337
9434
|
if (paints instanceof Array) {
|
|
9338
|
-
let image, recycleMap, input, url;
|
|
9435
|
+
let paint, image, recycleMap, input, url;
|
|
9339
9436
|
for (let i = 0, len = paints.length; i < len; i++) {
|
|
9340
|
-
|
|
9437
|
+
paint = paints[i];
|
|
9438
|
+
image = paint.image;
|
|
9341
9439
|
url = image && image.url;
|
|
9342
9440
|
if (url) {
|
|
9343
9441
|
if (!recycleMap)
|
|
@@ -9352,8 +9450,6 @@ function recycleImage(attrName, data) {
|
|
|
9352
9450
|
}
|
|
9353
9451
|
image.unload(paints[i].loadId, !input.some((item) => item.url === url));
|
|
9354
9452
|
}
|
|
9355
|
-
else
|
|
9356
|
-
paints[i].style = null;
|
|
9357
9453
|
}
|
|
9358
9454
|
}
|
|
9359
9455
|
return recycleMap;
|
|
@@ -9532,7 +9628,7 @@ const { toOffsetOutBounds } = BoundsHelper;
|
|
|
9532
9628
|
const offsetOutBounds = {};
|
|
9533
9629
|
function innerShadow(ui, current, shape) {
|
|
9534
9630
|
let copyBounds, spreadScale;
|
|
9535
|
-
const { __nowWorld: nowWorld, __layout
|
|
9631
|
+
const { __nowWorld: nowWorld, __layout } = ui;
|
|
9536
9632
|
const { innerShadow } = ui.__;
|
|
9537
9633
|
const { worldCanvas, bounds, shapeBounds, scaleX, scaleY } = shape;
|
|
9538
9634
|
const other = current.getSameCanvas();
|