@leafer-draw/miniapp 1.5.3 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/miniapp.cjs +68 -71
- package/dist/miniapp.cjs.map +1 -1
- package/dist/miniapp.esm.js +68 -71
- package/dist/miniapp.esm.js.map +1 -1
- 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 +260 -165
- package/dist/miniapp.module.js.map +1 -1
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +9 -8
- package/src/core.ts +143 -0
- package/src/index.ts +2 -2
- package/types/index.d.ts +8 -1
package/dist/miniapp.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.0";
|
|
6075
6129
|
|
|
6076
6130
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6077
6131
|
get allowBackgroundColor() { return false; }
|
|
@@ -6450,7 +6504,6 @@ function updateChange(updateList) {
|
|
|
6450
6504
|
}
|
|
6451
6505
|
|
|
6452
6506
|
const { worldBounds } = LeafBoundsHelper;
|
|
6453
|
-
const bigBounds = { x: 0, y: 0, width: 100000, height: 100000 };
|
|
6454
6507
|
class LayoutBlockData {
|
|
6455
6508
|
constructor(list) {
|
|
6456
6509
|
this.updatedBounds = new Bounds();
|
|
@@ -6464,13 +6517,7 @@ class LayoutBlockData {
|
|
|
6464
6517
|
this.beforeBounds.setListWithFn(this.updatedList.list, worldBounds);
|
|
6465
6518
|
}
|
|
6466
6519
|
setAfter() {
|
|
6467
|
-
|
|
6468
|
-
if (list.some(leaf => leaf.noBounds)) {
|
|
6469
|
-
this.afterBounds.set(bigBounds);
|
|
6470
|
-
}
|
|
6471
|
-
else {
|
|
6472
|
-
this.afterBounds.setListWithFn(list, worldBounds);
|
|
6473
|
-
}
|
|
6520
|
+
this.afterBounds.setListWithFn(this.updatedList.list, worldBounds);
|
|
6474
6521
|
this.updatedBounds.setList([this.beforeBounds, this.afterBounds]);
|
|
6475
6522
|
}
|
|
6476
6523
|
merge(data) {
|
|
@@ -6672,6 +6719,13 @@ class Renderer {
|
|
|
6672
6719
|
requestLayout() {
|
|
6673
6720
|
this.target.emit(LayoutEvent.REQUEST);
|
|
6674
6721
|
}
|
|
6722
|
+
checkRender() {
|
|
6723
|
+
if (this.running) {
|
|
6724
|
+
if (this.changed && this.canvas.view)
|
|
6725
|
+
this.render();
|
|
6726
|
+
this.target.emit(RenderEvent.NEXT);
|
|
6727
|
+
}
|
|
6728
|
+
}
|
|
6675
6729
|
render(callback) {
|
|
6676
6730
|
if (!(this.running && this.canvas.view))
|
|
6677
6731
|
return this.update();
|
|
@@ -6680,8 +6734,6 @@ class Renderer {
|
|
|
6680
6734
|
this.totalBounds = new Bounds();
|
|
6681
6735
|
debug$2.log(target.innerName, '--->');
|
|
6682
6736
|
try {
|
|
6683
|
-
if (!target.isApp)
|
|
6684
|
-
target.app.emit(RenderEvent.CHILD_START, target);
|
|
6685
6737
|
this.emitRender(RenderEvent.START);
|
|
6686
6738
|
this.renderOnce(callback);
|
|
6687
6739
|
this.emitRender(RenderEvent.END, this.totalBounds);
|
|
@@ -6749,20 +6801,12 @@ class Renderer {
|
|
|
6749
6801
|
}
|
|
6750
6802
|
clipRender(block) {
|
|
6751
6803
|
const t = Run.start('PartRender');
|
|
6752
|
-
const { canvas } = this;
|
|
6753
|
-
const bounds = block.getIntersect(canvas.bounds);
|
|
6754
|
-
const includes = block.includes(this.target.__world);
|
|
6755
|
-
const realBounds = new Bounds(bounds);
|
|
6804
|
+
const { canvas } = this, bounds = block.getIntersect(canvas.bounds), realBounds = new Bounds(bounds);
|
|
6756
6805
|
canvas.save();
|
|
6757
|
-
|
|
6758
|
-
|
|
6759
|
-
|
|
6760
|
-
|
|
6761
|
-
bounds.spread(10 + 1 / this.canvas.pixelRatio).ceil();
|
|
6762
|
-
canvas.clearWorld(bounds, true);
|
|
6763
|
-
canvas.clipWorld(bounds, true);
|
|
6764
|
-
}
|
|
6765
|
-
this.__render(bounds, includes, realBounds);
|
|
6806
|
+
bounds.spread(Renderer.clipSpread).ceil();
|
|
6807
|
+
canvas.clearWorld(bounds, true);
|
|
6808
|
+
canvas.clipWorld(bounds, true);
|
|
6809
|
+
this.__render(bounds, block.includes(this.target.__world), realBounds);
|
|
6766
6810
|
canvas.restore();
|
|
6767
6811
|
Run.end(t);
|
|
6768
6812
|
}
|
|
@@ -6776,23 +6820,17 @@ class Renderer {
|
|
|
6776
6820
|
Run.end(t);
|
|
6777
6821
|
}
|
|
6778
6822
|
__render(bounds, includes, realBounds) {
|
|
6779
|
-
const options =
|
|
6823
|
+
const { canvas } = this, options = includes ? { includes } : { bounds, includes };
|
|
6780
6824
|
if (this.needFill)
|
|
6781
|
-
|
|
6825
|
+
canvas.fillWorld(bounds, this.config.fill);
|
|
6782
6826
|
if (Debug.showRepaint)
|
|
6783
|
-
|
|
6784
|
-
this.target.__render(
|
|
6827
|
+
Debug.drawRepaint(canvas, bounds);
|
|
6828
|
+
this.target.__render(canvas, options);
|
|
6785
6829
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
6786
6830
|
this.renderOptions = options;
|
|
6787
6831
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
6788
|
-
|
|
6789
|
-
|
|
6790
|
-
if (Debug.showBoundsView)
|
|
6791
|
-
this.renderBoundsView(options);
|
|
6792
|
-
this.canvas.updateRender(realBounds);
|
|
6793
|
-
}
|
|
6794
|
-
renderHitView(_options) { }
|
|
6795
|
-
renderBoundsView(_options) { }
|
|
6832
|
+
canvas.updateRender(realBounds);
|
|
6833
|
+
}
|
|
6796
6834
|
addBlock(block) {
|
|
6797
6835
|
if (!this.updateBlocks)
|
|
6798
6836
|
this.updateBlocks = [];
|
|
@@ -6808,17 +6846,24 @@ class Renderer {
|
|
|
6808
6846
|
}
|
|
6809
6847
|
}
|
|
6810
6848
|
__requestRender() {
|
|
6849
|
+
const target = this.target;
|
|
6850
|
+
if (target.parentApp)
|
|
6851
|
+
return target.parentApp.renderer.update(false);
|
|
6811
6852
|
if (this.requestTime)
|
|
6812
6853
|
return;
|
|
6813
6854
|
const requestTime = this.requestTime = Date.now();
|
|
6814
6855
|
Platform.requestRender(() => {
|
|
6815
6856
|
this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - requestTime)));
|
|
6816
6857
|
this.requestTime = 0;
|
|
6817
|
-
if (
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6858
|
+
if (target.isApp) {
|
|
6859
|
+
target.emit(RenderEvent.CHILD_START, target);
|
|
6860
|
+
target.children.forEach(leafer => {
|
|
6861
|
+
leafer.renderer.FPS = this.FPS;
|
|
6862
|
+
leafer.renderer.checkRender();
|
|
6863
|
+
});
|
|
6864
|
+
target.emit(RenderEvent.CHILD_END, target);
|
|
6821
6865
|
}
|
|
6866
|
+
this.checkRender();
|
|
6822
6867
|
});
|
|
6823
6868
|
}
|
|
6824
6869
|
__onResize(e) {
|
|
@@ -6876,6 +6921,7 @@ class Renderer {
|
|
|
6876
6921
|
}
|
|
6877
6922
|
}
|
|
6878
6923
|
}
|
|
6924
|
+
Renderer.clipSpread = 10;
|
|
6879
6925
|
|
|
6880
6926
|
Object.assign(Creator, {
|
|
6881
6927
|
watcher: (target, options) => new Watcher(target, options),
|
|
@@ -6964,6 +7010,7 @@ class UIData extends LeafData {
|
|
|
6964
7010
|
return strokeWidth;
|
|
6965
7011
|
}
|
|
6966
7012
|
get __hasStroke() { return this.stroke && this.strokeWidth; }
|
|
7013
|
+
get __hasHalf() { const t = this; return (t.stroke && t.strokeAlign === 'center' && t.strokeWidth % 2) || undefined; }
|
|
6967
7014
|
get __hasMultiPaint() {
|
|
6968
7015
|
const t = this;
|
|
6969
7016
|
if ((t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect)
|
|
@@ -7008,14 +7055,14 @@ class UIData extends LeafData {
|
|
|
7008
7055
|
this.__removeInput('fill');
|
|
7009
7056
|
PaintImage.recycleImage('fill', this);
|
|
7010
7057
|
this.__isFills = false;
|
|
7011
|
-
|
|
7012
|
-
this.__pixelFill = false;
|
|
7058
|
+
this.__pixelFill && (this.__pixelFill = false);
|
|
7013
7059
|
}
|
|
7014
7060
|
this._fill = value;
|
|
7015
7061
|
}
|
|
7016
7062
|
else if (typeof value === 'object') {
|
|
7017
7063
|
this.__setInput('fill', value);
|
|
7018
|
-
|
|
7064
|
+
const layout = this.__leaf.__layout;
|
|
7065
|
+
layout.boxChanged || layout.boxChange();
|
|
7019
7066
|
this.__isFills = true;
|
|
7020
7067
|
this._fill || (this._fill = emptyPaint);
|
|
7021
7068
|
}
|
|
@@ -7026,14 +7073,14 @@ class UIData extends LeafData {
|
|
|
7026
7073
|
this.__removeInput('stroke');
|
|
7027
7074
|
PaintImage.recycleImage('stroke', this);
|
|
7028
7075
|
this.__isStrokes = false;
|
|
7029
|
-
|
|
7030
|
-
this.__pixelStroke = false;
|
|
7076
|
+
this.__pixelStroke && (this.__pixelStroke = false);
|
|
7031
7077
|
}
|
|
7032
7078
|
this._stroke = value;
|
|
7033
7079
|
}
|
|
7034
7080
|
else if (typeof value === 'object') {
|
|
7035
7081
|
this.__setInput('stroke', value);
|
|
7036
|
-
|
|
7082
|
+
const layout = this.__leaf.__layout;
|
|
7083
|
+
layout.boxChanged || layout.boxChange();
|
|
7037
7084
|
this.__isStrokes = true;
|
|
7038
7085
|
this._stroke || (this._stroke = emptyPaint);
|
|
7039
7086
|
}
|
|
@@ -7148,6 +7195,31 @@ class TextData extends UIData {
|
|
|
7148
7195
|
this._fontWeight = value;
|
|
7149
7196
|
}
|
|
7150
7197
|
}
|
|
7198
|
+
setBoxStyle(value) {
|
|
7199
|
+
let t = this.__leaf, box = t.__box;
|
|
7200
|
+
if (value) {
|
|
7201
|
+
const { boxStyle } = this;
|
|
7202
|
+
if (box)
|
|
7203
|
+
for (let key in boxStyle)
|
|
7204
|
+
box[key] = undefined;
|
|
7205
|
+
else
|
|
7206
|
+
box = t.__box = UICreator.get('Rect', 0);
|
|
7207
|
+
const layout = t.__layout, boxLayout = box.__layout;
|
|
7208
|
+
if (!boxStyle)
|
|
7209
|
+
box.parent = t, box.__world = t.__world, boxLayout.boxBounds = layout.boxBounds;
|
|
7210
|
+
box.set(value);
|
|
7211
|
+
if (boxLayout.strokeChanged)
|
|
7212
|
+
layout.strokeChange();
|
|
7213
|
+
if (boxLayout.renderChanged)
|
|
7214
|
+
layout.renderChange();
|
|
7215
|
+
box.__updateChange();
|
|
7216
|
+
}
|
|
7217
|
+
else if (box) {
|
|
7218
|
+
t.__box = box.parent = null;
|
|
7219
|
+
box.destroy();
|
|
7220
|
+
}
|
|
7221
|
+
this._boxStyle = value;
|
|
7222
|
+
}
|
|
7151
7223
|
}
|
|
7152
7224
|
|
|
7153
7225
|
class ImageData extends RectData {
|
|
@@ -7185,7 +7257,7 @@ class CanvasData extends RectData {
|
|
|
7185
7257
|
const UIBounds = {
|
|
7186
7258
|
__updateStrokeSpread() {
|
|
7187
7259
|
let width = 0, boxWidth = 0;
|
|
7188
|
-
const data = this.__, { strokeAlign, strokeWidth } = data;
|
|
7260
|
+
const data = this.__, { strokeAlign, strokeWidth } = data, box = this.__box;
|
|
7189
7261
|
if ((data.stroke || data.hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
|
|
7190
7262
|
boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth;
|
|
7191
7263
|
if (!data.__boxStroke) {
|
|
@@ -7196,6 +7268,10 @@ const UIBounds = {
|
|
|
7196
7268
|
}
|
|
7197
7269
|
if (data.__useArrow)
|
|
7198
7270
|
width += strokeWidth * 5;
|
|
7271
|
+
if (box) {
|
|
7272
|
+
width = Math.max(box.__layout.strokeSpread = box.__updateStrokeSpread(), width);
|
|
7273
|
+
boxWidth = box.__layout.strokeBoxSpread;
|
|
7274
|
+
}
|
|
7199
7275
|
this.__layout.strokeBoxSpread = boxWidth;
|
|
7200
7276
|
return width;
|
|
7201
7277
|
},
|
|
@@ -7214,25 +7290,26 @@ const UIBounds = {
|
|
|
7214
7290
|
if (backgroundBlur)
|
|
7215
7291
|
shapeWidth = Math.max(shapeWidth, backgroundBlur);
|
|
7216
7292
|
this.__layout.renderShapeSpread = shapeWidth;
|
|
7217
|
-
|
|
7293
|
+
width += this.__layout.strokeSpread || 0;
|
|
7294
|
+
return this.__box ? Math.max(this.__box.__updateRenderSpread(), width) : width;
|
|
7218
7295
|
}
|
|
7219
7296
|
};
|
|
7220
7297
|
|
|
7221
7298
|
const UIRender = {
|
|
7222
7299
|
__updateChange() {
|
|
7223
|
-
const data = this.__;
|
|
7300
|
+
const data = this.__, w = this.__world;
|
|
7224
7301
|
if (data.__useEffect) {
|
|
7225
7302
|
const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
|
|
7226
7303
|
data.__useEffect = !!(shadow || innerShadow || blur || backgroundBlur || filter);
|
|
7227
7304
|
}
|
|
7305
|
+
const half = data.__hasHalf;
|
|
7306
|
+
w.half !== half && (w.half = half);
|
|
7228
7307
|
data.__checkSingle();
|
|
7229
7308
|
const complex = data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect;
|
|
7230
|
-
if (complex)
|
|
7309
|
+
if (complex)
|
|
7231
7310
|
data.__complex = true;
|
|
7232
|
-
|
|
7233
|
-
else {
|
|
7311
|
+
else
|
|
7234
7312
|
data.__complex && (data.__complex = false);
|
|
7235
|
-
}
|
|
7236
7313
|
},
|
|
7237
7314
|
__drawFast(canvas, options) {
|
|
7238
7315
|
drawFast(this, canvas, options);
|
|
@@ -7319,10 +7396,11 @@ function drawFast(ui, canvas, options) {
|
|
|
7319
7396
|
|
|
7320
7397
|
const RectRender = {
|
|
7321
7398
|
__drawFast(canvas, options) {
|
|
7322
|
-
let {
|
|
7399
|
+
let { x, y, width, height } = this.__layout.boxBounds;
|
|
7400
|
+
const { fill, stroke, __drawAfterFill } = this.__;
|
|
7323
7401
|
if (fill) {
|
|
7324
7402
|
canvas.fillStyle = fill;
|
|
7325
|
-
canvas.fillRect(
|
|
7403
|
+
canvas.fillRect(x, y, width, height);
|
|
7326
7404
|
}
|
|
7327
7405
|
if (__drawAfterFill)
|
|
7328
7406
|
this.__drawAfterFill(canvas, options);
|
|
@@ -7341,14 +7419,14 @@ const RectRender = {
|
|
|
7341
7419
|
if (width < 0 || height < 0) {
|
|
7342
7420
|
canvas.save();
|
|
7343
7421
|
this.__clip(canvas, options);
|
|
7344
|
-
canvas.strokeRect(half, half, width, height);
|
|
7422
|
+
canvas.strokeRect(x + half, y + half, width, height);
|
|
7345
7423
|
canvas.restore();
|
|
7346
7424
|
}
|
|
7347
7425
|
else
|
|
7348
|
-
canvas.strokeRect(half, half, width, height);
|
|
7426
|
+
canvas.strokeRect(x + half, y + half, width, height);
|
|
7349
7427
|
break;
|
|
7350
7428
|
case 'outside':
|
|
7351
|
-
canvas.strokeRect(-half, -half, width + __strokeWidth, height + __strokeWidth);
|
|
7429
|
+
canvas.strokeRect(x - half, y - half, width + __strokeWidth, height + __strokeWidth);
|
|
7352
7430
|
break;
|
|
7353
7431
|
}
|
|
7354
7432
|
}
|
|
@@ -7504,6 +7582,12 @@ __decorate([
|
|
|
7504
7582
|
__decorate([
|
|
7505
7583
|
surfaceType(false)
|
|
7506
7584
|
], UI.prototype, "locked", void 0);
|
|
7585
|
+
__decorate([
|
|
7586
|
+
surfaceType(false)
|
|
7587
|
+
], UI.prototype, "dim", void 0);
|
|
7588
|
+
__decorate([
|
|
7589
|
+
surfaceType(false)
|
|
7590
|
+
], UI.prototype, "dimskip", void 0);
|
|
7507
7591
|
__decorate([
|
|
7508
7592
|
sortType(0)
|
|
7509
7593
|
], UI.prototype, "zIndex", void 0);
|
|
@@ -7765,7 +7849,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7765
7849
|
start: true,
|
|
7766
7850
|
hittable: true,
|
|
7767
7851
|
smooth: true,
|
|
7768
|
-
lazySpeard: 100
|
|
7852
|
+
lazySpeard: 100,
|
|
7769
7853
|
};
|
|
7770
7854
|
this.leafs = 0;
|
|
7771
7855
|
this.__eventIds = [];
|
|
@@ -8189,13 +8273,13 @@ let Box = class Box extends Group {
|
|
|
8189
8273
|
super.__updateRenderBounds();
|
|
8190
8274
|
copy$2(childrenRenderBounds, renderBounds);
|
|
8191
8275
|
this.__updateRectRenderBounds();
|
|
8192
|
-
isOverflow = !includes$1(renderBounds, childrenRenderBounds);
|
|
8276
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds) || undefined;
|
|
8193
8277
|
if (isOverflow && this.__.overflow !== 'hide')
|
|
8194
8278
|
add(renderBounds, childrenRenderBounds);
|
|
8195
8279
|
}
|
|
8196
8280
|
else
|
|
8197
8281
|
this.__updateRectRenderBounds();
|
|
8198
|
-
|
|
8282
|
+
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8199
8283
|
}
|
|
8200
8284
|
__updateRectRenderBounds() { }
|
|
8201
8285
|
__updateRectChange() { }
|
|
@@ -8603,33 +8687,13 @@ Canvas = __decorate([
|
|
|
8603
8687
|
registerUI()
|
|
8604
8688
|
], Canvas);
|
|
8605
8689
|
|
|
8606
|
-
const { copyAndSpread, includes,
|
|
8690
|
+
const { copyAndSpread, includes, spread, setList } = BoundsHelper;
|
|
8607
8691
|
let Text = class Text extends UI {
|
|
8608
8692
|
get __tag() { return 'Text'; }
|
|
8609
|
-
get textDrawData() {
|
|
8610
|
-
this.__layout.update();
|
|
8611
|
-
return this.__.__textDrawData;
|
|
8612
|
-
}
|
|
8693
|
+
get textDrawData() { this.updateLayout(); return this.__.__textDrawData; }
|
|
8613
8694
|
constructor(data) {
|
|
8614
8695
|
super(data);
|
|
8615
8696
|
}
|
|
8616
|
-
__drawHitPath(canvas) {
|
|
8617
|
-
const { __lineHeight, fontSize, __baseLine, __textDrawData: data } = this.__;
|
|
8618
|
-
canvas.beginPath();
|
|
8619
|
-
if (this.__.__letterSpacing < 0) {
|
|
8620
|
-
this.__drawPathByData(canvas);
|
|
8621
|
-
}
|
|
8622
|
-
else {
|
|
8623
|
-
data.rows.forEach(row => canvas.rect(row.x, row.y - __baseLine, row.width, __lineHeight < fontSize ? fontSize : __lineHeight));
|
|
8624
|
-
}
|
|
8625
|
-
}
|
|
8626
|
-
__drawPathByData(drawer, _data) {
|
|
8627
|
-
const { x, y, width, height } = this.__layout.boxBounds;
|
|
8628
|
-
drawer.rect(x, y, width, height);
|
|
8629
|
-
}
|
|
8630
|
-
__drawRenderPath(canvas) {
|
|
8631
|
-
canvas.font = this.__.__font;
|
|
8632
|
-
}
|
|
8633
8697
|
__updateTextDrawData() {
|
|
8634
8698
|
const data = this.__;
|
|
8635
8699
|
const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow, padding } = data;
|
|
@@ -8646,15 +8710,16 @@ let Text = class Text extends UI {
|
|
|
8646
8710
|
const layout = this.__layout;
|
|
8647
8711
|
const { fontSize, italic, padding, __autoWidth: autoWidth, __autoHeight: autoHeight } = data;
|
|
8648
8712
|
this.__updateTextDrawData();
|
|
8649
|
-
const { bounds } = data.__textDrawData;
|
|
8713
|
+
const { bounds: contentBounds } = data.__textDrawData;
|
|
8650
8714
|
const b = layout.boxBounds;
|
|
8715
|
+
layout.contentBounds = contentBounds;
|
|
8651
8716
|
if (data.__lineHeight < fontSize)
|
|
8652
|
-
spread(
|
|
8717
|
+
spread(contentBounds, fontSize / 2);
|
|
8653
8718
|
if (autoWidth || autoHeight) {
|
|
8654
|
-
b.x = autoWidth ?
|
|
8655
|
-
b.y = autoHeight ?
|
|
8656
|
-
b.width = autoWidth ?
|
|
8657
|
-
b.height = autoHeight ?
|
|
8719
|
+
b.x = autoWidth ? contentBounds.x : 0;
|
|
8720
|
+
b.y = autoHeight ? contentBounds.y : 0;
|
|
8721
|
+
b.width = autoWidth ? contentBounds.width : data.width;
|
|
8722
|
+
b.height = autoHeight ? contentBounds.height : data.height;
|
|
8658
8723
|
if (padding) {
|
|
8659
8724
|
const [top, right, bottom, left] = data.__padding;
|
|
8660
8725
|
if (autoWidth)
|
|
@@ -8668,23 +8733,45 @@ let Text = class Text extends UI {
|
|
|
8668
8733
|
super.__updateBoxBounds();
|
|
8669
8734
|
if (italic)
|
|
8670
8735
|
b.width += fontSize * 0.16;
|
|
8671
|
-
const
|
|
8672
|
-
if (
|
|
8673
|
-
|
|
8674
|
-
layout.renderChanged = true;
|
|
8675
|
-
setList(data.__textBoxBounds = {}, [b, bounds]);
|
|
8676
|
-
}
|
|
8736
|
+
const isOverflow = !includes(b, contentBounds) || undefined;
|
|
8737
|
+
if (isOverflow)
|
|
8738
|
+
setList(data.__textBoxBounds = {}, [b, contentBounds]), layout.renderChanged = true;
|
|
8677
8739
|
else
|
|
8678
|
-
data.__textBoxBounds =
|
|
8740
|
+
data.__textBoxBounds = b;
|
|
8741
|
+
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8742
|
+
}
|
|
8743
|
+
__onUpdateSize() {
|
|
8744
|
+
if (this.__box)
|
|
8745
|
+
this.__box.__onUpdateSize();
|
|
8746
|
+
super.__onUpdateSize();
|
|
8679
8747
|
}
|
|
8680
8748
|
__updateRenderSpread() {
|
|
8681
8749
|
let width = super.__updateRenderSpread();
|
|
8682
8750
|
if (!width)
|
|
8683
|
-
width = this.
|
|
8751
|
+
width = this.isOverflow ? 1 : 0;
|
|
8684
8752
|
return width;
|
|
8685
8753
|
}
|
|
8686
8754
|
__updateRenderBounds() {
|
|
8687
|
-
|
|
8755
|
+
const { renderBounds, renderSpread } = this.__layout;
|
|
8756
|
+
copyAndSpread(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
8757
|
+
if (this.__box)
|
|
8758
|
+
this.__box.__layout.renderBounds = renderBounds;
|
|
8759
|
+
}
|
|
8760
|
+
__drawRenderPath(canvas) {
|
|
8761
|
+
canvas.font = this.__.__font;
|
|
8762
|
+
}
|
|
8763
|
+
__draw(canvas, options, originCanvas) {
|
|
8764
|
+
const box = this.__box;
|
|
8765
|
+
if (box)
|
|
8766
|
+
box.__nowWorld = this.__nowWorld, box.__draw(canvas, options, originCanvas);
|
|
8767
|
+
if (this.textEditing && !Export.running)
|
|
8768
|
+
return;
|
|
8769
|
+
super.__draw(canvas, options, originCanvas);
|
|
8770
|
+
}
|
|
8771
|
+
destroy() {
|
|
8772
|
+
if (this.boxStyle)
|
|
8773
|
+
this.boxStyle = null;
|
|
8774
|
+
super.destroy();
|
|
8688
8775
|
}
|
|
8689
8776
|
};
|
|
8690
8777
|
__decorate([
|
|
@@ -8696,6 +8783,9 @@ __decorate([
|
|
|
8696
8783
|
__decorate([
|
|
8697
8784
|
boundsType(0)
|
|
8698
8785
|
], Text.prototype, "height", void 0);
|
|
8786
|
+
__decorate([
|
|
8787
|
+
surfaceType()
|
|
8788
|
+
], Text.prototype, "boxStyle", void 0);
|
|
8699
8789
|
__decorate([
|
|
8700
8790
|
dataType(false)
|
|
8701
8791
|
], Text.prototype, "resizeFontSize", void 0);
|
|
@@ -9181,9 +9271,11 @@ const tempBox = new Bounds();
|
|
|
9181
9271
|
const tempPoint = {};
|
|
9182
9272
|
const tempScaleData = {};
|
|
9183
9273
|
function createData(leafPaint, image, paint, box) {
|
|
9184
|
-
const { blendMode, sync } = paint;
|
|
9274
|
+
const { blendMode, changeful, sync } = paint;
|
|
9185
9275
|
if (blendMode)
|
|
9186
9276
|
leafPaint.blendMode = blendMode;
|
|
9277
|
+
if (changeful)
|
|
9278
|
+
leafPaint.changeful = changeful;
|
|
9187
9279
|
if (sync)
|
|
9188
9280
|
leafPaint.sync = sync;
|
|
9189
9281
|
leafPaint.data = getPatternData(paint, box, image);
|
|
@@ -9416,40 +9508,32 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
9416
9508
|
}
|
|
9417
9509
|
|
|
9418
9510
|
const { abs } = Math;
|
|
9419
|
-
function checkImage(ui, canvas, paint,
|
|
9511
|
+
function checkImage(ui, canvas, paint, allowDraw) {
|
|
9420
9512
|
const { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
|
|
9421
|
-
const { pixelRatio } = canvas;
|
|
9422
|
-
if (!
|
|
9513
|
+
const { pixelRatio } = canvas, { data } = paint;
|
|
9514
|
+
if (!data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !Export.running)) {
|
|
9423
9515
|
return false;
|
|
9424
9516
|
}
|
|
9425
9517
|
else {
|
|
9426
|
-
|
|
9427
|
-
|
|
9428
|
-
|
|
9429
|
-
let { width, height } = data;
|
|
9430
|
-
width *= abs(scaleX) * pixelRatio;
|
|
9431
|
-
height *= abs(scaleY) * pixelRatio;
|
|
9432
|
-
if (data.scaleX) {
|
|
9433
|
-
width *= data.scaleX;
|
|
9434
|
-
height *= data.scaleY;
|
|
9435
|
-
}
|
|
9436
|
-
allowPaint = (width * height > Platform.image.maxCacheSize) || Export.running;
|
|
9518
|
+
if (allowDraw) {
|
|
9519
|
+
if (data.repeat) {
|
|
9520
|
+
allowDraw = false;
|
|
9437
9521
|
}
|
|
9438
9522
|
else {
|
|
9439
|
-
|
|
9523
|
+
if (!(paint.changeful || ResizeEvent.isResizing(ui) || Export.running)) {
|
|
9524
|
+
let { width, height } = data;
|
|
9525
|
+
width *= abs(scaleX) * pixelRatio;
|
|
9526
|
+
height *= abs(scaleY) * pixelRatio;
|
|
9527
|
+
if (data.scaleX) {
|
|
9528
|
+
width *= data.scaleX;
|
|
9529
|
+
height *= data.scaleY;
|
|
9530
|
+
}
|
|
9531
|
+
allowDraw = (width * height > Platform.image.maxCacheSize);
|
|
9532
|
+
}
|
|
9440
9533
|
}
|
|
9441
9534
|
}
|
|
9442
|
-
if (
|
|
9443
|
-
canvas
|
|
9444
|
-
ui.windingRule ? canvas.clip(ui.windingRule) : canvas.clip();
|
|
9445
|
-
if (paint.blendMode)
|
|
9446
|
-
canvas.blendMode = paint.blendMode;
|
|
9447
|
-
if (data.opacity)
|
|
9448
|
-
canvas.opacity *= data.opacity;
|
|
9449
|
-
if (data.transform)
|
|
9450
|
-
canvas.transform(data.transform);
|
|
9451
|
-
canvas.drawImage(paint.image.getFull(data.filters), 0, 0, data.width, data.height);
|
|
9452
|
-
canvas.restore();
|
|
9535
|
+
if (allowDraw) {
|
|
9536
|
+
drawImage(ui, canvas, paint, data);
|
|
9453
9537
|
return true;
|
|
9454
9538
|
}
|
|
9455
9539
|
else {
|
|
@@ -9470,13 +9554,26 @@ function checkImage(ui, canvas, paint, allowPaint) {
|
|
|
9470
9554
|
}
|
|
9471
9555
|
}
|
|
9472
9556
|
}
|
|
9557
|
+
function drawImage(ui, canvas, paint, data) {
|
|
9558
|
+
canvas.save();
|
|
9559
|
+
ui.windingRule ? canvas.clip(ui.windingRule) : canvas.clip();
|
|
9560
|
+
if (paint.blendMode)
|
|
9561
|
+
canvas.blendMode = paint.blendMode;
|
|
9562
|
+
if (data.opacity)
|
|
9563
|
+
canvas.opacity *= data.opacity;
|
|
9564
|
+
if (data.transform)
|
|
9565
|
+
canvas.transform(data.transform);
|
|
9566
|
+
canvas.drawImage(paint.image.getFull(data.filters), 0, 0, data.width, data.height);
|
|
9567
|
+
canvas.restore();
|
|
9568
|
+
}
|
|
9473
9569
|
|
|
9474
9570
|
function recycleImage(attrName, data) {
|
|
9475
9571
|
const paints = data['_' + attrName];
|
|
9476
9572
|
if (paints instanceof Array) {
|
|
9477
|
-
let image, recycleMap, input, url;
|
|
9573
|
+
let paint, image, recycleMap, input, url;
|
|
9478
9574
|
for (let i = 0, len = paints.length; i < len; i++) {
|
|
9479
|
-
|
|
9575
|
+
paint = paints[i];
|
|
9576
|
+
image = paint.image;
|
|
9480
9577
|
url = image && image.url;
|
|
9481
9578
|
if (url) {
|
|
9482
9579
|
if (!recycleMap)
|
|
@@ -9491,8 +9588,6 @@ function recycleImage(attrName, data) {
|
|
|
9491
9588
|
}
|
|
9492
9589
|
image.unload(paints[i].loadId, !input.some((item) => item.url === url));
|
|
9493
9590
|
}
|
|
9494
|
-
else
|
|
9495
|
-
paints[i].style = null;
|
|
9496
9591
|
}
|
|
9497
9592
|
}
|
|
9498
9593
|
return recycleMap;
|
|
@@ -9671,7 +9766,7 @@ const { toOffsetOutBounds } = BoundsHelper;
|
|
|
9671
9766
|
const offsetOutBounds = {};
|
|
9672
9767
|
function innerShadow(ui, current, shape) {
|
|
9673
9768
|
let copyBounds, spreadScale;
|
|
9674
|
-
const { __nowWorld: nowWorld, __layout
|
|
9769
|
+
const { __nowWorld: nowWorld, __layout } = ui;
|
|
9675
9770
|
const { innerShadow } = ui.__;
|
|
9676
9771
|
const { worldCanvas, bounds, shapeBounds, scaleX, scaleY } = shape;
|
|
9677
9772
|
const other = current.getSameCanvas();
|