leafer-draw 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/web.cjs +68 -71
- package/dist/web.cjs.map +1 -1
- package/dist/web.esm.js +68 -71
- package/dist/web.esm.js.map +1 -1
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +260 -165
- package/dist/web.js.map +1 -1
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +260 -165
- package/dist/web.module.js.map +1 -1
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +2 -2
package/dist/web.js
CHANGED
|
@@ -48,7 +48,7 @@ var LeaferUI = (function (exports) {
|
|
|
48
48
|
};
|
|
49
49
|
const I$1 = IncrementId;
|
|
50
50
|
|
|
51
|
-
const { round, pow: pow$1, PI: PI$4 } = Math;
|
|
51
|
+
const { round: round$3, pow: pow$1, PI: PI$4 } = Math;
|
|
52
52
|
const MathHelper = {
|
|
53
53
|
within(value, min, max) {
|
|
54
54
|
if (typeof min === 'object')
|
|
@@ -112,7 +112,7 @@ var LeaferUI = (function (exports) {
|
|
|
112
112
|
},
|
|
113
113
|
float(num, maxLength) {
|
|
114
114
|
const a = maxLength !== undefined ? pow$1(10, maxLength) : 1000000000000;
|
|
115
|
-
num = round(num * a) / a;
|
|
115
|
+
num = round$3(num * a) / a;
|
|
116
116
|
return num === -0 ? 0 : num;
|
|
117
117
|
},
|
|
118
118
|
getScaleData(scale, size, originSize, scaleData) {
|
|
@@ -135,8 +135,15 @@ var LeaferUI = (function (exports) {
|
|
|
135
135
|
scaleData.scaleX = scale.x;
|
|
136
136
|
scaleData.scaleY = scale.y;
|
|
137
137
|
}
|
|
138
|
+
},
|
|
139
|
+
randInt,
|
|
140
|
+
randColor(opacity) {
|
|
141
|
+
return `rgba(${randInt(255)},${randInt(255)},${randInt(255)},${opacity || 1})`;
|
|
138
142
|
}
|
|
139
143
|
};
|
|
144
|
+
function randInt(num) {
|
|
145
|
+
return Math.round(Math.random() * num);
|
|
146
|
+
}
|
|
140
147
|
const OneRadian = PI$4 / 180;
|
|
141
148
|
const PI2 = PI$4 * 2;
|
|
142
149
|
const PI_2 = PI$4 / 2;
|
|
@@ -434,7 +441,7 @@ var LeaferUI = (function (exports) {
|
|
|
434
441
|
const M$6 = MatrixHelper;
|
|
435
442
|
|
|
436
443
|
const { toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3 } = MatrixHelper;
|
|
437
|
-
const { sin: sin$4, cos: cos$4, abs: abs$4, sqrt: sqrt$2, atan2: atan2$2, min: min$1, PI: PI$3 } = Math;
|
|
444
|
+
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;
|
|
438
445
|
const PointHelper = {
|
|
439
446
|
defaultPoint: getPointData(),
|
|
440
447
|
tempPoint: {},
|
|
@@ -455,6 +462,10 @@ var LeaferUI = (function (exports) {
|
|
|
455
462
|
t.x = x;
|
|
456
463
|
t.y = y;
|
|
457
464
|
},
|
|
465
|
+
round(t, halfPixel) {
|
|
466
|
+
t.x = halfPixel ? round$2(t.x - 0.5) + 0.5 : round$2(t.x);
|
|
467
|
+
t.y = halfPixel ? round$2(t.y - 0.5) + 0.5 : round$2(t.y);
|
|
468
|
+
},
|
|
458
469
|
move(t, x, y) {
|
|
459
470
|
t.x += x;
|
|
460
471
|
t.y += y;
|
|
@@ -1320,6 +1331,7 @@ var LeaferUI = (function (exports) {
|
|
|
1320
1331
|
'E': 1
|
|
1321
1332
|
};
|
|
1322
1333
|
|
|
1334
|
+
const { randColor } = MathHelper;
|
|
1323
1335
|
class Debug {
|
|
1324
1336
|
constructor(name) {
|
|
1325
1337
|
this.repeatMap = {};
|
|
@@ -1334,6 +1346,19 @@ var LeaferUI = (function (exports) {
|
|
|
1334
1346
|
static set exclude(name) {
|
|
1335
1347
|
this.excludeList = getNameList(name);
|
|
1336
1348
|
}
|
|
1349
|
+
static drawRepaint(canvas, bounds) {
|
|
1350
|
+
const color = randColor();
|
|
1351
|
+
canvas.fillWorld(bounds, color.replace('1)', '.1)'));
|
|
1352
|
+
canvas.strokeWorld(bounds, color);
|
|
1353
|
+
}
|
|
1354
|
+
static drawBounds(leaf, canvas, _options) {
|
|
1355
|
+
const showHit = Debug.showBounds === 'hit', w = leaf.__nowWorld, color = randColor();
|
|
1356
|
+
if (showHit)
|
|
1357
|
+
canvas.setWorld(w), leaf.__drawHitPath(canvas), canvas.fillStyle = color.replace('1)', '.2)'), canvas.fill();
|
|
1358
|
+
canvas.resetTransform();
|
|
1359
|
+
canvas.setStroke(color, 2);
|
|
1360
|
+
showHit ? canvas.stroke() : canvas.strokeWorld(w, color);
|
|
1361
|
+
}
|
|
1337
1362
|
log(...messages) {
|
|
1338
1363
|
if (D$4.enable) {
|
|
1339
1364
|
if (D$4.filterList.length && D$4.filterList.every(name => name !== this.name))
|
|
@@ -1420,7 +1445,7 @@ var LeaferUI = (function (exports) {
|
|
|
1420
1445
|
return rs;
|
|
1421
1446
|
},
|
|
1422
1447
|
need(name) {
|
|
1423
|
-
console.error('
|
|
1448
|
+
console.error('please install plugin: ' + (name.includes('-x') ? '' : '@leafer-in/') + name);
|
|
1424
1449
|
}
|
|
1425
1450
|
};
|
|
1426
1451
|
setTimeout(() => check.forEach(name => Plugin.has(name, true)));
|
|
@@ -2020,7 +2045,7 @@ var LeaferUI = (function (exports) {
|
|
|
2020
2045
|
contextMethod()
|
|
2021
2046
|
], Canvas.prototype, "strokeText", null);
|
|
2022
2047
|
|
|
2023
|
-
const { copy: copy$8 } = MatrixHelper;
|
|
2048
|
+
const { copy: copy$8, multiplyParent: multiplyParent$3 } = MatrixHelper, { round: round$1 } = Math;
|
|
2024
2049
|
const minSize = { width: 1, height: 1, pixelRatio: 1 };
|
|
2025
2050
|
const canvasSizeAttrs = ['width', 'height', 'pixelRatio'];
|
|
2026
2051
|
class LeaferCanvasBase extends Canvas {
|
|
@@ -2029,6 +2054,8 @@ var LeaferUI = (function (exports) {
|
|
|
2029
2054
|
get pixelRatio() { return this.size.pixelRatio; }
|
|
2030
2055
|
get pixelWidth() { return this.width * this.pixelRatio; }
|
|
2031
2056
|
get pixelHeight() { return this.height * this.pixelRatio; }
|
|
2057
|
+
get pixelSnap() { return this.config.pixelSnap; }
|
|
2058
|
+
set pixelSnap(value) { this.config.pixelSnap = value; }
|
|
2032
2059
|
get allowBackgroundColor() { return this.view && this.parentView; }
|
|
2033
2060
|
constructor(config, manager) {
|
|
2034
2061
|
super();
|
|
@@ -2089,15 +2116,22 @@ var LeaferUI = (function (exports) {
|
|
|
2089
2116
|
stopAutoLayout() { }
|
|
2090
2117
|
setCursor(_cursor) { }
|
|
2091
2118
|
setWorld(matrix, parentMatrix) {
|
|
2092
|
-
const { pixelRatio } = this;
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2119
|
+
const { pixelRatio, pixelSnap } = this, w = this.worldTransform;
|
|
2120
|
+
if (parentMatrix)
|
|
2121
|
+
multiplyParent$3(matrix, parentMatrix, w);
|
|
2122
|
+
w.a = matrix.a * pixelRatio;
|
|
2123
|
+
w.b = matrix.b * pixelRatio;
|
|
2124
|
+
w.c = matrix.c * pixelRatio;
|
|
2125
|
+
w.d = matrix.d * pixelRatio;
|
|
2126
|
+
w.e = matrix.e * pixelRatio;
|
|
2127
|
+
w.f = matrix.f * pixelRatio;
|
|
2128
|
+
if (pixelSnap) {
|
|
2129
|
+
if (matrix.half && (matrix.half * pixelRatio) % 2)
|
|
2130
|
+
w.e = round$1(w.e - 0.5) + 0.5, w.f = round$1(w.f - 0.5) + 0.5;
|
|
2131
|
+
else
|
|
2132
|
+
w.e = round$1(w.e), w.f = round$1(w.f);
|
|
2100
2133
|
}
|
|
2134
|
+
this.setTransform(w.a, w.b, w.c, w.d, w.e, w.f);
|
|
2101
2135
|
}
|
|
2102
2136
|
useWorldTransform(worldTransform) {
|
|
2103
2137
|
if (worldTransform)
|
|
@@ -2240,12 +2274,13 @@ var LeaferUI = (function (exports) {
|
|
|
2240
2274
|
return this.width === size.width && this.height === size.height && (!size.pixelRatio || this.pixelRatio === size.pixelRatio);
|
|
2241
2275
|
}
|
|
2242
2276
|
getSameCanvas(useSameWorldTransform, useSameSmooth) {
|
|
2243
|
-
const canvas = this.manager ? this.manager.get(
|
|
2277
|
+
const { size, pixelSnap } = this, canvas = this.manager ? this.manager.get(size) : Creator.canvas(Object.assign({}, size));
|
|
2244
2278
|
canvas.save();
|
|
2245
2279
|
if (useSameWorldTransform)
|
|
2246
2280
|
copy$8(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
|
|
2247
2281
|
if (useSameSmooth)
|
|
2248
2282
|
canvas.smooth = this.smooth;
|
|
2283
|
+
canvas.pixelSnap !== pixelSnap && (canvas.pixelSnap = pixelSnap);
|
|
2249
2284
|
return canvas;
|
|
2250
2285
|
}
|
|
2251
2286
|
recycle(clearBounds) {
|
|
@@ -3672,7 +3707,7 @@ var LeaferUI = (function (exports) {
|
|
|
3672
3707
|
const R = Resource;
|
|
3673
3708
|
|
|
3674
3709
|
const ImageManager = {
|
|
3675
|
-
maxRecycled:
|
|
3710
|
+
maxRecycled: 10,
|
|
3676
3711
|
recycledList: [],
|
|
3677
3712
|
patternTasker: new TaskProcessor(),
|
|
3678
3713
|
get(config) {
|
|
@@ -4025,9 +4060,8 @@ var LeaferUI = (function (exports) {
|
|
|
4025
4060
|
set(value) {
|
|
4026
4061
|
if (this.__setAttr(key, value)) {
|
|
4027
4062
|
this.__layout.hitCanvasChanged = true;
|
|
4028
|
-
if (Debug.
|
|
4063
|
+
if (Debug.showBounds === 'hit')
|
|
4029
4064
|
this.__layout.surfaceChanged || this.__layout.surfaceChange();
|
|
4030
|
-
}
|
|
4031
4065
|
if (this.leafer)
|
|
4032
4066
|
this.leafer.updateCursor();
|
|
4033
4067
|
}
|
|
@@ -4188,7 +4222,7 @@ var LeaferUI = (function (exports) {
|
|
|
4188
4222
|
}
|
|
4189
4223
|
|
|
4190
4224
|
const { copy: copy$6, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
|
|
4191
|
-
const matrix = {};
|
|
4225
|
+
const matrix = {}, { round } = Math;
|
|
4192
4226
|
const LeafHelper = {
|
|
4193
4227
|
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
4194
4228
|
if (checkAutoLayout && leaf.__hasAutoLayout && leaf.__layout.matrixChanged)
|
|
@@ -4262,6 +4296,8 @@ var LeaferUI = (function (exports) {
|
|
|
4262
4296
|
y = x.y, x = x.x;
|
|
4263
4297
|
x += t.x;
|
|
4264
4298
|
y += t.y;
|
|
4299
|
+
if (t.leafer && t.leafer.config.pointSnap)
|
|
4300
|
+
x = round(x), y = round(y);
|
|
4265
4301
|
transition ? t.animate({ x, y }, transition) : (t.x = x, t.y = y);
|
|
4266
4302
|
},
|
|
4267
4303
|
zoomOfWorld(t, origin, scaleX, scaleY, resize, transition) {
|
|
@@ -4500,6 +4536,7 @@ var LeaferUI = (function (exports) {
|
|
|
4500
4536
|
set contentBounds(bounds) { this._contentBounds = bounds; }
|
|
4501
4537
|
get strokeBounds() { return this._strokeBounds || this.boxBounds; }
|
|
4502
4538
|
get renderBounds() { return this._renderBounds || this.boxBounds; }
|
|
4539
|
+
set renderBounds(bounds) { this._renderBounds = bounds; }
|
|
4503
4540
|
get localContentBounds() { toOuterOf$2(this.contentBounds, this.leaf.__localMatrix, this[localContent] || (this[localContent] = {})); return this[localContent]; }
|
|
4504
4541
|
get localStrokeBounds() { return this._localStrokeBounds || this; }
|
|
4505
4542
|
get localRenderBounds() { return this._localRenderBounds || this; }
|
|
@@ -4518,11 +4555,13 @@ var LeaferUI = (function (exports) {
|
|
|
4518
4555
|
get height() { return this.boxBounds.height; }
|
|
4519
4556
|
constructor(leaf) {
|
|
4520
4557
|
this.leaf = leaf;
|
|
4521
|
-
this.boxBounds = { x: 0, y: 0, width: 0, height: 0 };
|
|
4522
4558
|
if (this.leaf.__local)
|
|
4523
4559
|
this._localRenderBounds = this._localStrokeBounds = this.leaf.__local;
|
|
4524
|
-
|
|
4525
|
-
|
|
4560
|
+
if (leaf.__world) {
|
|
4561
|
+
this.boxBounds = { x: 0, y: 0, width: 0, height: 0 };
|
|
4562
|
+
this.boxChange();
|
|
4563
|
+
this.matrixChange();
|
|
4564
|
+
}
|
|
4526
4565
|
}
|
|
4527
4566
|
createLocal() {
|
|
4528
4567
|
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 };
|
|
@@ -4854,6 +4893,9 @@ var LeaferUI = (function (exports) {
|
|
|
4854
4893
|
}
|
|
4855
4894
|
this.old = oldSize;
|
|
4856
4895
|
}
|
|
4896
|
+
static isResizing(leaf) {
|
|
4897
|
+
return this.resizingKeys && this.resizingKeys[leaf.innerId] !== undefined;
|
|
4898
|
+
}
|
|
4857
4899
|
}
|
|
4858
4900
|
ResizeEvent.RESIZE = 'resize';
|
|
4859
4901
|
|
|
@@ -4896,6 +4938,7 @@ var LeaferUI = (function (exports) {
|
|
|
4896
4938
|
}
|
|
4897
4939
|
RenderEvent.REQUEST = 'render.request';
|
|
4898
4940
|
RenderEvent.CHILD_START = 'render.child_start';
|
|
4941
|
+
RenderEvent.CHILD_END = 'render.child_end';
|
|
4899
4942
|
RenderEvent.START = 'render.start';
|
|
4900
4943
|
RenderEvent.BEFORE = 'render.before';
|
|
4901
4944
|
RenderEvent.RENDER = 'render';
|
|
@@ -5275,24 +5318,27 @@ var LeaferUI = (function (exports) {
|
|
|
5275
5318
|
const LeafRender = {
|
|
5276
5319
|
__render(canvas, options) {
|
|
5277
5320
|
if (this.__worldOpacity) {
|
|
5321
|
+
const data = this.__;
|
|
5278
5322
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5279
|
-
canvas.opacity =
|
|
5323
|
+
canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
|
|
5280
5324
|
if (this.__.__single) {
|
|
5281
|
-
if (
|
|
5325
|
+
if (data.eraser === 'path')
|
|
5282
5326
|
return this.__renderEraser(canvas, options);
|
|
5283
5327
|
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
5284
5328
|
this.__draw(tempCanvas, options, canvas);
|
|
5285
5329
|
if (this.__worldFlipped) {
|
|
5286
|
-
canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null,
|
|
5330
|
+
canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null, data.__blendMode, true);
|
|
5287
5331
|
}
|
|
5288
5332
|
else {
|
|
5289
|
-
canvas.copyWorldToInner(tempCanvas, this.__nowWorld, this.__layout.renderBounds,
|
|
5333
|
+
canvas.copyWorldToInner(tempCanvas, this.__nowWorld, this.__layout.renderBounds, data.__blendMode);
|
|
5290
5334
|
}
|
|
5291
5335
|
tempCanvas.recycle(this.__nowWorld);
|
|
5292
5336
|
}
|
|
5293
5337
|
else {
|
|
5294
5338
|
this.__draw(canvas, options);
|
|
5295
5339
|
}
|
|
5340
|
+
if (Debug.showBounds)
|
|
5341
|
+
Debug.drawBounds(this, canvas, options);
|
|
5296
5342
|
}
|
|
5297
5343
|
},
|
|
5298
5344
|
__clip(canvas, options) {
|
|
@@ -5322,14 +5368,19 @@ var LeaferUI = (function (exports) {
|
|
|
5322
5368
|
__render(canvas, options) {
|
|
5323
5369
|
this.__nowWorld = this.__getNowWorld(options);
|
|
5324
5370
|
if (this.__worldOpacity) {
|
|
5325
|
-
|
|
5326
|
-
|
|
5371
|
+
const data = this.__;
|
|
5372
|
+
if (data.dim)
|
|
5373
|
+
options.dimOpacity = data.dim === true ? 0.2 : data.dim;
|
|
5374
|
+
else if (data.dimskip)
|
|
5375
|
+
options.dimOpacity && (options.dimOpacity = 0);
|
|
5376
|
+
if (data.__single) {
|
|
5377
|
+
if (data.eraser === 'path')
|
|
5327
5378
|
return this.__renderEraser(canvas, options);
|
|
5328
5379
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
5329
5380
|
this.__renderBranch(tempCanvas, options);
|
|
5330
5381
|
const nowWorld = this.__nowWorld;
|
|
5331
|
-
canvas.opacity =
|
|
5332
|
-
canvas.copyWorldByReset(tempCanvas, nowWorld, nowWorld,
|
|
5382
|
+
canvas.opacity = options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
|
|
5383
|
+
canvas.copyWorldByReset(tempCanvas, nowWorld, nowWorld, data.__blendMode, true);
|
|
5333
5384
|
tempCanvas.recycle(nowWorld);
|
|
5334
5385
|
}
|
|
5335
5386
|
else {
|
|
@@ -5404,9 +5455,11 @@ var LeaferUI = (function (exports) {
|
|
|
5404
5455
|
reset(data) {
|
|
5405
5456
|
if (this.leafer)
|
|
5406
5457
|
this.leafer.forceRender(this.__world);
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5458
|
+
if (data !== 0) {
|
|
5459
|
+
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 };
|
|
5460
|
+
if (data !== null)
|
|
5461
|
+
this.__local = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, x: 0, y: 0, width: 0, height: 0 };
|
|
5462
|
+
}
|
|
5410
5463
|
this.__worldOpacity = 1;
|
|
5411
5464
|
this.__ = new this.__DataProcessor(this);
|
|
5412
5465
|
this.__layout = new this.__LayoutProcessor(this);
|
|
@@ -5542,9 +5595,10 @@ var LeaferUI = (function (exports) {
|
|
|
5542
5595
|
if (options.matrix) {
|
|
5543
5596
|
if (!this.__cameraWorld)
|
|
5544
5597
|
this.__cameraWorld = {};
|
|
5545
|
-
const cameraWorld = this.__cameraWorld;
|
|
5546
|
-
multiplyParent(
|
|
5598
|
+
const cameraWorld = this.__cameraWorld, world = this.__world;
|
|
5599
|
+
multiplyParent(world, options.matrix, cameraWorld, undefined, world);
|
|
5547
5600
|
toOuterOf(this.__layout.renderBounds, cameraWorld, cameraWorld);
|
|
5601
|
+
cameraWorld.half !== world.half && (cameraWorld.half = world.half);
|
|
5548
5602
|
return cameraWorld;
|
|
5549
5603
|
}
|
|
5550
5604
|
else {
|
|
@@ -5704,7 +5758,7 @@ var LeaferUI = (function (exports) {
|
|
|
5704
5758
|
__updateHitCanvas() { }
|
|
5705
5759
|
__render(_canvas, _options) { }
|
|
5706
5760
|
__drawFast(_canvas, _options) { }
|
|
5707
|
-
__draw(_canvas, _options) { }
|
|
5761
|
+
__draw(_canvas, _options, _originCanvas) { }
|
|
5708
5762
|
__clip(_canvas, _options) { }
|
|
5709
5763
|
__renderShape(_canvas, _options, _ignoreFill, _ignoreStroke) { }
|
|
5710
5764
|
__updateWorldOpacity() { }
|
|
@@ -6074,7 +6128,7 @@ var LeaferUI = (function (exports) {
|
|
|
6074
6128
|
}
|
|
6075
6129
|
}
|
|
6076
6130
|
|
|
6077
|
-
const version = "1.
|
|
6131
|
+
const version = "1.6.0";
|
|
6078
6132
|
|
|
6079
6133
|
const debug$4 = Debug.get('LeaferCanvas');
|
|
6080
6134
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -6495,7 +6549,6 @@ var LeaferUI = (function (exports) {
|
|
|
6495
6549
|
}
|
|
6496
6550
|
|
|
6497
6551
|
const { worldBounds } = LeafBoundsHelper;
|
|
6498
|
-
const bigBounds = { x: 0, y: 0, width: 100000, height: 100000 };
|
|
6499
6552
|
class LayoutBlockData {
|
|
6500
6553
|
constructor(list) {
|
|
6501
6554
|
this.updatedBounds = new Bounds();
|
|
@@ -6509,13 +6562,7 @@ var LeaferUI = (function (exports) {
|
|
|
6509
6562
|
this.beforeBounds.setListWithFn(this.updatedList.list, worldBounds);
|
|
6510
6563
|
}
|
|
6511
6564
|
setAfter() {
|
|
6512
|
-
|
|
6513
|
-
if (list.some(leaf => leaf.noBounds)) {
|
|
6514
|
-
this.afterBounds.set(bigBounds);
|
|
6515
|
-
}
|
|
6516
|
-
else {
|
|
6517
|
-
this.afterBounds.setListWithFn(list, worldBounds);
|
|
6518
|
-
}
|
|
6565
|
+
this.afterBounds.setListWithFn(this.updatedList.list, worldBounds);
|
|
6519
6566
|
this.updatedBounds.setList([this.beforeBounds, this.afterBounds]);
|
|
6520
6567
|
}
|
|
6521
6568
|
merge(data) {
|
|
@@ -6717,6 +6764,13 @@ var LeaferUI = (function (exports) {
|
|
|
6717
6764
|
requestLayout() {
|
|
6718
6765
|
this.target.emit(LayoutEvent.REQUEST);
|
|
6719
6766
|
}
|
|
6767
|
+
checkRender() {
|
|
6768
|
+
if (this.running) {
|
|
6769
|
+
if (this.changed && this.canvas.view)
|
|
6770
|
+
this.render();
|
|
6771
|
+
this.target.emit(RenderEvent.NEXT);
|
|
6772
|
+
}
|
|
6773
|
+
}
|
|
6720
6774
|
render(callback) {
|
|
6721
6775
|
if (!(this.running && this.canvas.view))
|
|
6722
6776
|
return this.update();
|
|
@@ -6725,8 +6779,6 @@ var LeaferUI = (function (exports) {
|
|
|
6725
6779
|
this.totalBounds = new Bounds();
|
|
6726
6780
|
debug$2.log(target.innerName, '--->');
|
|
6727
6781
|
try {
|
|
6728
|
-
if (!target.isApp)
|
|
6729
|
-
target.app.emit(RenderEvent.CHILD_START, target);
|
|
6730
6782
|
this.emitRender(RenderEvent.START);
|
|
6731
6783
|
this.renderOnce(callback);
|
|
6732
6784
|
this.emitRender(RenderEvent.END, this.totalBounds);
|
|
@@ -6794,20 +6846,12 @@ var LeaferUI = (function (exports) {
|
|
|
6794
6846
|
}
|
|
6795
6847
|
clipRender(block) {
|
|
6796
6848
|
const t = Run.start('PartRender');
|
|
6797
|
-
const { canvas } = this;
|
|
6798
|
-
const bounds = block.getIntersect(canvas.bounds);
|
|
6799
|
-
const includes = block.includes(this.target.__world);
|
|
6800
|
-
const realBounds = new Bounds(bounds);
|
|
6849
|
+
const { canvas } = this, bounds = block.getIntersect(canvas.bounds), realBounds = new Bounds(bounds);
|
|
6801
6850
|
canvas.save();
|
|
6802
|
-
|
|
6803
|
-
|
|
6804
|
-
|
|
6805
|
-
|
|
6806
|
-
bounds.spread(10 + 1 / this.canvas.pixelRatio).ceil();
|
|
6807
|
-
canvas.clearWorld(bounds, true);
|
|
6808
|
-
canvas.clipWorld(bounds, true);
|
|
6809
|
-
}
|
|
6810
|
-
this.__render(bounds, includes, realBounds);
|
|
6851
|
+
bounds.spread(Renderer.clipSpread).ceil();
|
|
6852
|
+
canvas.clearWorld(bounds, true);
|
|
6853
|
+
canvas.clipWorld(bounds, true);
|
|
6854
|
+
this.__render(bounds, block.includes(this.target.__world), realBounds);
|
|
6811
6855
|
canvas.restore();
|
|
6812
6856
|
Run.end(t);
|
|
6813
6857
|
}
|
|
@@ -6821,23 +6865,17 @@ var LeaferUI = (function (exports) {
|
|
|
6821
6865
|
Run.end(t);
|
|
6822
6866
|
}
|
|
6823
6867
|
__render(bounds, includes, realBounds) {
|
|
6824
|
-
const options =
|
|
6868
|
+
const { canvas } = this, options = includes ? { includes } : { bounds, includes };
|
|
6825
6869
|
if (this.needFill)
|
|
6826
|
-
|
|
6870
|
+
canvas.fillWorld(bounds, this.config.fill);
|
|
6827
6871
|
if (Debug.showRepaint)
|
|
6828
|
-
|
|
6829
|
-
this.target.__render(
|
|
6872
|
+
Debug.drawRepaint(canvas, bounds);
|
|
6873
|
+
this.target.__render(canvas, options);
|
|
6830
6874
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
6831
6875
|
this.renderOptions = options;
|
|
6832
6876
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
6833
|
-
|
|
6834
|
-
|
|
6835
|
-
if (Debug.showBoundsView)
|
|
6836
|
-
this.renderBoundsView(options);
|
|
6837
|
-
this.canvas.updateRender(realBounds);
|
|
6838
|
-
}
|
|
6839
|
-
renderHitView(_options) { }
|
|
6840
|
-
renderBoundsView(_options) { }
|
|
6877
|
+
canvas.updateRender(realBounds);
|
|
6878
|
+
}
|
|
6841
6879
|
addBlock(block) {
|
|
6842
6880
|
if (!this.updateBlocks)
|
|
6843
6881
|
this.updateBlocks = [];
|
|
@@ -6853,17 +6891,24 @@ var LeaferUI = (function (exports) {
|
|
|
6853
6891
|
}
|
|
6854
6892
|
}
|
|
6855
6893
|
__requestRender() {
|
|
6894
|
+
const target = this.target;
|
|
6895
|
+
if (target.parentApp)
|
|
6896
|
+
return target.parentApp.renderer.update(false);
|
|
6856
6897
|
if (this.requestTime)
|
|
6857
6898
|
return;
|
|
6858
6899
|
const requestTime = this.requestTime = Date.now();
|
|
6859
6900
|
Platform.requestRender(() => {
|
|
6860
6901
|
this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - requestTime)));
|
|
6861
6902
|
this.requestTime = 0;
|
|
6862
|
-
if (
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
6903
|
+
if (target.isApp) {
|
|
6904
|
+
target.emit(RenderEvent.CHILD_START, target);
|
|
6905
|
+
target.children.forEach(leafer => {
|
|
6906
|
+
leafer.renderer.FPS = this.FPS;
|
|
6907
|
+
leafer.renderer.checkRender();
|
|
6908
|
+
});
|
|
6909
|
+
target.emit(RenderEvent.CHILD_END, target);
|
|
6866
6910
|
}
|
|
6911
|
+
this.checkRender();
|
|
6867
6912
|
});
|
|
6868
6913
|
}
|
|
6869
6914
|
__onResize(e) {
|
|
@@ -6921,6 +6966,7 @@ var LeaferUI = (function (exports) {
|
|
|
6921
6966
|
}
|
|
6922
6967
|
}
|
|
6923
6968
|
}
|
|
6969
|
+
Renderer.clipSpread = 10;
|
|
6924
6970
|
|
|
6925
6971
|
Object.assign(Creator, {
|
|
6926
6972
|
watcher: (target, options) => new Watcher(target, options),
|
|
@@ -7009,6 +7055,7 @@ var LeaferUI = (function (exports) {
|
|
|
7009
7055
|
return strokeWidth;
|
|
7010
7056
|
}
|
|
7011
7057
|
get __hasStroke() { return this.stroke && this.strokeWidth; }
|
|
7058
|
+
get __hasHalf() { const t = this; return (t.stroke && t.strokeAlign === 'center' && t.strokeWidth % 2) || undefined; }
|
|
7012
7059
|
get __hasMultiPaint() {
|
|
7013
7060
|
const t = this;
|
|
7014
7061
|
if ((t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect)
|
|
@@ -7053,14 +7100,14 @@ var LeaferUI = (function (exports) {
|
|
|
7053
7100
|
this.__removeInput('fill');
|
|
7054
7101
|
PaintImage.recycleImage('fill', this);
|
|
7055
7102
|
this.__isFills = false;
|
|
7056
|
-
|
|
7057
|
-
this.__pixelFill = false;
|
|
7103
|
+
this.__pixelFill && (this.__pixelFill = false);
|
|
7058
7104
|
}
|
|
7059
7105
|
this._fill = value;
|
|
7060
7106
|
}
|
|
7061
7107
|
else if (typeof value === 'object') {
|
|
7062
7108
|
this.__setInput('fill', value);
|
|
7063
|
-
|
|
7109
|
+
const layout = this.__leaf.__layout;
|
|
7110
|
+
layout.boxChanged || layout.boxChange();
|
|
7064
7111
|
this.__isFills = true;
|
|
7065
7112
|
this._fill || (this._fill = emptyPaint);
|
|
7066
7113
|
}
|
|
@@ -7071,14 +7118,14 @@ var LeaferUI = (function (exports) {
|
|
|
7071
7118
|
this.__removeInput('stroke');
|
|
7072
7119
|
PaintImage.recycleImage('stroke', this);
|
|
7073
7120
|
this.__isStrokes = false;
|
|
7074
|
-
|
|
7075
|
-
this.__pixelStroke = false;
|
|
7121
|
+
this.__pixelStroke && (this.__pixelStroke = false);
|
|
7076
7122
|
}
|
|
7077
7123
|
this._stroke = value;
|
|
7078
7124
|
}
|
|
7079
7125
|
else if (typeof value === 'object') {
|
|
7080
7126
|
this.__setInput('stroke', value);
|
|
7081
|
-
|
|
7127
|
+
const layout = this.__leaf.__layout;
|
|
7128
|
+
layout.boxChanged || layout.boxChange();
|
|
7082
7129
|
this.__isStrokes = true;
|
|
7083
7130
|
this._stroke || (this._stroke = emptyPaint);
|
|
7084
7131
|
}
|
|
@@ -7193,6 +7240,31 @@ var LeaferUI = (function (exports) {
|
|
|
7193
7240
|
this._fontWeight = value;
|
|
7194
7241
|
}
|
|
7195
7242
|
}
|
|
7243
|
+
setBoxStyle(value) {
|
|
7244
|
+
let t = this.__leaf, box = t.__box;
|
|
7245
|
+
if (value) {
|
|
7246
|
+
const { boxStyle } = this;
|
|
7247
|
+
if (box)
|
|
7248
|
+
for (let key in boxStyle)
|
|
7249
|
+
box[key] = undefined;
|
|
7250
|
+
else
|
|
7251
|
+
box = t.__box = UICreator.get('Rect', 0);
|
|
7252
|
+
const layout = t.__layout, boxLayout = box.__layout;
|
|
7253
|
+
if (!boxStyle)
|
|
7254
|
+
box.parent = t, box.__world = t.__world, boxLayout.boxBounds = layout.boxBounds;
|
|
7255
|
+
box.set(value);
|
|
7256
|
+
if (boxLayout.strokeChanged)
|
|
7257
|
+
layout.strokeChange();
|
|
7258
|
+
if (boxLayout.renderChanged)
|
|
7259
|
+
layout.renderChange();
|
|
7260
|
+
box.__updateChange();
|
|
7261
|
+
}
|
|
7262
|
+
else if (box) {
|
|
7263
|
+
t.__box = box.parent = null;
|
|
7264
|
+
box.destroy();
|
|
7265
|
+
}
|
|
7266
|
+
this._boxStyle = value;
|
|
7267
|
+
}
|
|
7196
7268
|
}
|
|
7197
7269
|
|
|
7198
7270
|
class ImageData extends RectData {
|
|
@@ -7230,7 +7302,7 @@ var LeaferUI = (function (exports) {
|
|
|
7230
7302
|
const UIBounds = {
|
|
7231
7303
|
__updateStrokeSpread() {
|
|
7232
7304
|
let width = 0, boxWidth = 0;
|
|
7233
|
-
const data = this.__, { strokeAlign, strokeWidth } = data;
|
|
7305
|
+
const data = this.__, { strokeAlign, strokeWidth } = data, box = this.__box;
|
|
7234
7306
|
if ((data.stroke || data.hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
|
|
7235
7307
|
boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth;
|
|
7236
7308
|
if (!data.__boxStroke) {
|
|
@@ -7241,6 +7313,10 @@ var LeaferUI = (function (exports) {
|
|
|
7241
7313
|
}
|
|
7242
7314
|
if (data.__useArrow)
|
|
7243
7315
|
width += strokeWidth * 5;
|
|
7316
|
+
if (box) {
|
|
7317
|
+
width = Math.max(box.__layout.strokeSpread = box.__updateStrokeSpread(), width);
|
|
7318
|
+
boxWidth = box.__layout.strokeBoxSpread;
|
|
7319
|
+
}
|
|
7244
7320
|
this.__layout.strokeBoxSpread = boxWidth;
|
|
7245
7321
|
return width;
|
|
7246
7322
|
},
|
|
@@ -7259,25 +7335,26 @@ var LeaferUI = (function (exports) {
|
|
|
7259
7335
|
if (backgroundBlur)
|
|
7260
7336
|
shapeWidth = Math.max(shapeWidth, backgroundBlur);
|
|
7261
7337
|
this.__layout.renderShapeSpread = shapeWidth;
|
|
7262
|
-
|
|
7338
|
+
width += this.__layout.strokeSpread || 0;
|
|
7339
|
+
return this.__box ? Math.max(this.__box.__updateRenderSpread(), width) : width;
|
|
7263
7340
|
}
|
|
7264
7341
|
};
|
|
7265
7342
|
|
|
7266
7343
|
const UIRender = {
|
|
7267
7344
|
__updateChange() {
|
|
7268
|
-
const data = this.__;
|
|
7345
|
+
const data = this.__, w = this.__world;
|
|
7269
7346
|
if (data.__useEffect) {
|
|
7270
7347
|
const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
|
|
7271
7348
|
data.__useEffect = !!(shadow || innerShadow || blur || backgroundBlur || filter);
|
|
7272
7349
|
}
|
|
7350
|
+
const half = data.__hasHalf;
|
|
7351
|
+
w.half !== half && (w.half = half);
|
|
7273
7352
|
data.__checkSingle();
|
|
7274
7353
|
const complex = data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect;
|
|
7275
|
-
if (complex)
|
|
7354
|
+
if (complex)
|
|
7276
7355
|
data.__complex = true;
|
|
7277
|
-
|
|
7278
|
-
else {
|
|
7356
|
+
else
|
|
7279
7357
|
data.__complex && (data.__complex = false);
|
|
7280
|
-
}
|
|
7281
7358
|
},
|
|
7282
7359
|
__drawFast(canvas, options) {
|
|
7283
7360
|
drawFast(this, canvas, options);
|
|
@@ -7364,10 +7441,11 @@ var LeaferUI = (function (exports) {
|
|
|
7364
7441
|
|
|
7365
7442
|
const RectRender = {
|
|
7366
7443
|
__drawFast(canvas, options) {
|
|
7367
|
-
let {
|
|
7444
|
+
let { x, y, width, height } = this.__layout.boxBounds;
|
|
7445
|
+
const { fill, stroke, __drawAfterFill } = this.__;
|
|
7368
7446
|
if (fill) {
|
|
7369
7447
|
canvas.fillStyle = fill;
|
|
7370
|
-
canvas.fillRect(
|
|
7448
|
+
canvas.fillRect(x, y, width, height);
|
|
7371
7449
|
}
|
|
7372
7450
|
if (__drawAfterFill)
|
|
7373
7451
|
this.__drawAfterFill(canvas, options);
|
|
@@ -7386,14 +7464,14 @@ var LeaferUI = (function (exports) {
|
|
|
7386
7464
|
if (width < 0 || height < 0) {
|
|
7387
7465
|
canvas.save();
|
|
7388
7466
|
this.__clip(canvas, options);
|
|
7389
|
-
canvas.strokeRect(half, half, width, height);
|
|
7467
|
+
canvas.strokeRect(x + half, y + half, width, height);
|
|
7390
7468
|
canvas.restore();
|
|
7391
7469
|
}
|
|
7392
7470
|
else
|
|
7393
|
-
canvas.strokeRect(half, half, width, height);
|
|
7471
|
+
canvas.strokeRect(x + half, y + half, width, height);
|
|
7394
7472
|
break;
|
|
7395
7473
|
case 'outside':
|
|
7396
|
-
canvas.strokeRect(-half, -half, width + __strokeWidth, height + __strokeWidth);
|
|
7474
|
+
canvas.strokeRect(x - half, y - half, width + __strokeWidth, height + __strokeWidth);
|
|
7397
7475
|
break;
|
|
7398
7476
|
}
|
|
7399
7477
|
}
|
|
@@ -7549,6 +7627,12 @@ var LeaferUI = (function (exports) {
|
|
|
7549
7627
|
__decorate([
|
|
7550
7628
|
surfaceType(false)
|
|
7551
7629
|
], exports.UI.prototype, "locked", void 0);
|
|
7630
|
+
__decorate([
|
|
7631
|
+
surfaceType(false)
|
|
7632
|
+
], exports.UI.prototype, "dim", void 0);
|
|
7633
|
+
__decorate([
|
|
7634
|
+
surfaceType(false)
|
|
7635
|
+
], exports.UI.prototype, "dimskip", void 0);
|
|
7552
7636
|
__decorate([
|
|
7553
7637
|
sortType(0)
|
|
7554
7638
|
], exports.UI.prototype, "zIndex", void 0);
|
|
@@ -7810,7 +7894,7 @@ var LeaferUI = (function (exports) {
|
|
|
7810
7894
|
start: true,
|
|
7811
7895
|
hittable: true,
|
|
7812
7896
|
smooth: true,
|
|
7813
|
-
lazySpeard: 100
|
|
7897
|
+
lazySpeard: 100,
|
|
7814
7898
|
};
|
|
7815
7899
|
this.leafs = 0;
|
|
7816
7900
|
this.__eventIds = [];
|
|
@@ -8234,13 +8318,13 @@ var LeaferUI = (function (exports) {
|
|
|
8234
8318
|
super.__updateRenderBounds();
|
|
8235
8319
|
copy$2(childrenRenderBounds, renderBounds);
|
|
8236
8320
|
this.__updateRectRenderBounds();
|
|
8237
|
-
isOverflow = !includes$1(renderBounds, childrenRenderBounds);
|
|
8321
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds) || undefined;
|
|
8238
8322
|
if (isOverflow && this.__.overflow !== 'hide')
|
|
8239
8323
|
add(renderBounds, childrenRenderBounds);
|
|
8240
8324
|
}
|
|
8241
8325
|
else
|
|
8242
8326
|
this.__updateRectRenderBounds();
|
|
8243
|
-
|
|
8327
|
+
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8244
8328
|
}
|
|
8245
8329
|
__updateRectRenderBounds() { }
|
|
8246
8330
|
__updateRectChange() { }
|
|
@@ -8648,33 +8732,13 @@ var LeaferUI = (function (exports) {
|
|
|
8648
8732
|
registerUI()
|
|
8649
8733
|
], exports.Canvas);
|
|
8650
8734
|
|
|
8651
|
-
const { copyAndSpread, includes,
|
|
8735
|
+
const { copyAndSpread, includes, spread, setList } = BoundsHelper;
|
|
8652
8736
|
exports.Text = class Text extends exports.UI {
|
|
8653
8737
|
get __tag() { return 'Text'; }
|
|
8654
|
-
get textDrawData() {
|
|
8655
|
-
this.__layout.update();
|
|
8656
|
-
return this.__.__textDrawData;
|
|
8657
|
-
}
|
|
8738
|
+
get textDrawData() { this.updateLayout(); return this.__.__textDrawData; }
|
|
8658
8739
|
constructor(data) {
|
|
8659
8740
|
super(data);
|
|
8660
8741
|
}
|
|
8661
|
-
__drawHitPath(canvas) {
|
|
8662
|
-
const { __lineHeight, fontSize, __baseLine, __textDrawData: data } = this.__;
|
|
8663
|
-
canvas.beginPath();
|
|
8664
|
-
if (this.__.__letterSpacing < 0) {
|
|
8665
|
-
this.__drawPathByData(canvas);
|
|
8666
|
-
}
|
|
8667
|
-
else {
|
|
8668
|
-
data.rows.forEach(row => canvas.rect(row.x, row.y - __baseLine, row.width, __lineHeight < fontSize ? fontSize : __lineHeight));
|
|
8669
|
-
}
|
|
8670
|
-
}
|
|
8671
|
-
__drawPathByData(drawer, _data) {
|
|
8672
|
-
const { x, y, width, height } = this.__layout.boxBounds;
|
|
8673
|
-
drawer.rect(x, y, width, height);
|
|
8674
|
-
}
|
|
8675
|
-
__drawRenderPath(canvas) {
|
|
8676
|
-
canvas.font = this.__.__font;
|
|
8677
|
-
}
|
|
8678
8742
|
__updateTextDrawData() {
|
|
8679
8743
|
const data = this.__;
|
|
8680
8744
|
const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow, padding } = data;
|
|
@@ -8691,15 +8755,16 @@ var LeaferUI = (function (exports) {
|
|
|
8691
8755
|
const layout = this.__layout;
|
|
8692
8756
|
const { fontSize, italic, padding, __autoWidth: autoWidth, __autoHeight: autoHeight } = data;
|
|
8693
8757
|
this.__updateTextDrawData();
|
|
8694
|
-
const { bounds } = data.__textDrawData;
|
|
8758
|
+
const { bounds: contentBounds } = data.__textDrawData;
|
|
8695
8759
|
const b = layout.boxBounds;
|
|
8760
|
+
layout.contentBounds = contentBounds;
|
|
8696
8761
|
if (data.__lineHeight < fontSize)
|
|
8697
|
-
spread(
|
|
8762
|
+
spread(contentBounds, fontSize / 2);
|
|
8698
8763
|
if (autoWidth || autoHeight) {
|
|
8699
|
-
b.x = autoWidth ?
|
|
8700
|
-
b.y = autoHeight ?
|
|
8701
|
-
b.width = autoWidth ?
|
|
8702
|
-
b.height = autoHeight ?
|
|
8764
|
+
b.x = autoWidth ? contentBounds.x : 0;
|
|
8765
|
+
b.y = autoHeight ? contentBounds.y : 0;
|
|
8766
|
+
b.width = autoWidth ? contentBounds.width : data.width;
|
|
8767
|
+
b.height = autoHeight ? contentBounds.height : data.height;
|
|
8703
8768
|
if (padding) {
|
|
8704
8769
|
const [top, right, bottom, left] = data.__padding;
|
|
8705
8770
|
if (autoWidth)
|
|
@@ -8713,23 +8778,45 @@ var LeaferUI = (function (exports) {
|
|
|
8713
8778
|
super.__updateBoxBounds();
|
|
8714
8779
|
if (italic)
|
|
8715
8780
|
b.width += fontSize * 0.16;
|
|
8716
|
-
const
|
|
8717
|
-
if (
|
|
8718
|
-
|
|
8719
|
-
layout.renderChanged = true;
|
|
8720
|
-
setList(data.__textBoxBounds = {}, [b, bounds]);
|
|
8721
|
-
}
|
|
8781
|
+
const isOverflow = !includes(b, contentBounds) || undefined;
|
|
8782
|
+
if (isOverflow)
|
|
8783
|
+
setList(data.__textBoxBounds = {}, [b, contentBounds]), layout.renderChanged = true;
|
|
8722
8784
|
else
|
|
8723
|
-
data.__textBoxBounds =
|
|
8785
|
+
data.__textBoxBounds = b;
|
|
8786
|
+
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8787
|
+
}
|
|
8788
|
+
__onUpdateSize() {
|
|
8789
|
+
if (this.__box)
|
|
8790
|
+
this.__box.__onUpdateSize();
|
|
8791
|
+
super.__onUpdateSize();
|
|
8724
8792
|
}
|
|
8725
8793
|
__updateRenderSpread() {
|
|
8726
8794
|
let width = super.__updateRenderSpread();
|
|
8727
8795
|
if (!width)
|
|
8728
|
-
width = this.
|
|
8796
|
+
width = this.isOverflow ? 1 : 0;
|
|
8729
8797
|
return width;
|
|
8730
8798
|
}
|
|
8731
8799
|
__updateRenderBounds() {
|
|
8732
|
-
|
|
8800
|
+
const { renderBounds, renderSpread } = this.__layout;
|
|
8801
|
+
copyAndSpread(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
8802
|
+
if (this.__box)
|
|
8803
|
+
this.__box.__layout.renderBounds = renderBounds;
|
|
8804
|
+
}
|
|
8805
|
+
__drawRenderPath(canvas) {
|
|
8806
|
+
canvas.font = this.__.__font;
|
|
8807
|
+
}
|
|
8808
|
+
__draw(canvas, options, originCanvas) {
|
|
8809
|
+
const box = this.__box;
|
|
8810
|
+
if (box)
|
|
8811
|
+
box.__nowWorld = this.__nowWorld, box.__draw(canvas, options, originCanvas);
|
|
8812
|
+
if (this.textEditing && !Export.running)
|
|
8813
|
+
return;
|
|
8814
|
+
super.__draw(canvas, options, originCanvas);
|
|
8815
|
+
}
|
|
8816
|
+
destroy() {
|
|
8817
|
+
if (this.boxStyle)
|
|
8818
|
+
this.boxStyle = null;
|
|
8819
|
+
super.destroy();
|
|
8733
8820
|
}
|
|
8734
8821
|
};
|
|
8735
8822
|
__decorate([
|
|
@@ -8741,6 +8828,9 @@ var LeaferUI = (function (exports) {
|
|
|
8741
8828
|
__decorate([
|
|
8742
8829
|
boundsType(0)
|
|
8743
8830
|
], exports.Text.prototype, "height", void 0);
|
|
8831
|
+
__decorate([
|
|
8832
|
+
surfaceType()
|
|
8833
|
+
], exports.Text.prototype, "boxStyle", void 0);
|
|
8744
8834
|
__decorate([
|
|
8745
8835
|
dataType(false)
|
|
8746
8836
|
], exports.Text.prototype, "resizeFontSize", void 0);
|
|
@@ -9226,9 +9316,11 @@ var LeaferUI = (function (exports) {
|
|
|
9226
9316
|
const tempPoint = {};
|
|
9227
9317
|
const tempScaleData = {};
|
|
9228
9318
|
function createData(leafPaint, image, paint, box) {
|
|
9229
|
-
const { blendMode, sync } = paint;
|
|
9319
|
+
const { blendMode, changeful, sync } = paint;
|
|
9230
9320
|
if (blendMode)
|
|
9231
9321
|
leafPaint.blendMode = blendMode;
|
|
9322
|
+
if (changeful)
|
|
9323
|
+
leafPaint.changeful = changeful;
|
|
9232
9324
|
if (sync)
|
|
9233
9325
|
leafPaint.sync = sync;
|
|
9234
9326
|
leafPaint.data = getPatternData(paint, box, image);
|
|
@@ -9461,40 +9553,32 @@ var LeaferUI = (function (exports) {
|
|
|
9461
9553
|
}
|
|
9462
9554
|
|
|
9463
9555
|
const { abs } = Math;
|
|
9464
|
-
function checkImage(ui, canvas, paint,
|
|
9556
|
+
function checkImage(ui, canvas, paint, allowDraw) {
|
|
9465
9557
|
const { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
|
|
9466
|
-
const { pixelRatio } = canvas;
|
|
9467
|
-
if (!
|
|
9558
|
+
const { pixelRatio } = canvas, { data } = paint;
|
|
9559
|
+
if (!data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !Export.running)) {
|
|
9468
9560
|
return false;
|
|
9469
9561
|
}
|
|
9470
9562
|
else {
|
|
9471
|
-
|
|
9472
|
-
|
|
9473
|
-
|
|
9474
|
-
let { width, height } = data;
|
|
9475
|
-
width *= abs(scaleX) * pixelRatio;
|
|
9476
|
-
height *= abs(scaleY) * pixelRatio;
|
|
9477
|
-
if (data.scaleX) {
|
|
9478
|
-
width *= data.scaleX;
|
|
9479
|
-
height *= data.scaleY;
|
|
9480
|
-
}
|
|
9481
|
-
allowPaint = (width * height > Platform.image.maxCacheSize) || Export.running;
|
|
9563
|
+
if (allowDraw) {
|
|
9564
|
+
if (data.repeat) {
|
|
9565
|
+
allowDraw = false;
|
|
9482
9566
|
}
|
|
9483
9567
|
else {
|
|
9484
|
-
|
|
9568
|
+
if (!(paint.changeful || ResizeEvent.isResizing(ui) || Export.running)) {
|
|
9569
|
+
let { width, height } = data;
|
|
9570
|
+
width *= abs(scaleX) * pixelRatio;
|
|
9571
|
+
height *= abs(scaleY) * pixelRatio;
|
|
9572
|
+
if (data.scaleX) {
|
|
9573
|
+
width *= data.scaleX;
|
|
9574
|
+
height *= data.scaleY;
|
|
9575
|
+
}
|
|
9576
|
+
allowDraw = (width * height > Platform.image.maxCacheSize);
|
|
9577
|
+
}
|
|
9485
9578
|
}
|
|
9486
9579
|
}
|
|
9487
|
-
if (
|
|
9488
|
-
canvas
|
|
9489
|
-
ui.windingRule ? canvas.clip(ui.windingRule) : canvas.clip();
|
|
9490
|
-
if (paint.blendMode)
|
|
9491
|
-
canvas.blendMode = paint.blendMode;
|
|
9492
|
-
if (data.opacity)
|
|
9493
|
-
canvas.opacity *= data.opacity;
|
|
9494
|
-
if (data.transform)
|
|
9495
|
-
canvas.transform(data.transform);
|
|
9496
|
-
canvas.drawImage(paint.image.getFull(data.filters), 0, 0, data.width, data.height);
|
|
9497
|
-
canvas.restore();
|
|
9580
|
+
if (allowDraw) {
|
|
9581
|
+
drawImage(ui, canvas, paint, data);
|
|
9498
9582
|
return true;
|
|
9499
9583
|
}
|
|
9500
9584
|
else {
|
|
@@ -9515,13 +9599,26 @@ var LeaferUI = (function (exports) {
|
|
|
9515
9599
|
}
|
|
9516
9600
|
}
|
|
9517
9601
|
}
|
|
9602
|
+
function drawImage(ui, canvas, paint, data) {
|
|
9603
|
+
canvas.save();
|
|
9604
|
+
ui.windingRule ? canvas.clip(ui.windingRule) : canvas.clip();
|
|
9605
|
+
if (paint.blendMode)
|
|
9606
|
+
canvas.blendMode = paint.blendMode;
|
|
9607
|
+
if (data.opacity)
|
|
9608
|
+
canvas.opacity *= data.opacity;
|
|
9609
|
+
if (data.transform)
|
|
9610
|
+
canvas.transform(data.transform);
|
|
9611
|
+
canvas.drawImage(paint.image.getFull(data.filters), 0, 0, data.width, data.height);
|
|
9612
|
+
canvas.restore();
|
|
9613
|
+
}
|
|
9518
9614
|
|
|
9519
9615
|
function recycleImage(attrName, data) {
|
|
9520
9616
|
const paints = data['_' + attrName];
|
|
9521
9617
|
if (paints instanceof Array) {
|
|
9522
|
-
let image, recycleMap, input, url;
|
|
9618
|
+
let paint, image, recycleMap, input, url;
|
|
9523
9619
|
for (let i = 0, len = paints.length; i < len; i++) {
|
|
9524
|
-
|
|
9620
|
+
paint = paints[i];
|
|
9621
|
+
image = paint.image;
|
|
9525
9622
|
url = image && image.url;
|
|
9526
9623
|
if (url) {
|
|
9527
9624
|
if (!recycleMap)
|
|
@@ -9536,8 +9633,6 @@ var LeaferUI = (function (exports) {
|
|
|
9536
9633
|
}
|
|
9537
9634
|
image.unload(paints[i].loadId, !input.some((item) => item.url === url));
|
|
9538
9635
|
}
|
|
9539
|
-
else
|
|
9540
|
-
paints[i].style = null;
|
|
9541
9636
|
}
|
|
9542
9637
|
}
|
|
9543
9638
|
return recycleMap;
|
|
@@ -9716,7 +9811,7 @@ var LeaferUI = (function (exports) {
|
|
|
9716
9811
|
const offsetOutBounds = {};
|
|
9717
9812
|
function innerShadow(ui, current, shape) {
|
|
9718
9813
|
let copyBounds, spreadScale;
|
|
9719
|
-
const { __nowWorld: nowWorld, __layout
|
|
9814
|
+
const { __nowWorld: nowWorld, __layout } = ui;
|
|
9720
9815
|
const { innerShadow } = ui.__;
|
|
9721
9816
|
const { worldCanvas, bounds, shapeBounds, scaleX, scaleY } = shape;
|
|
9722
9817
|
const other = current.getSameCanvas();
|