@leafer/core 1.9.0 → 1.9.2
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/lib/core.cjs +121 -67
- package/lib/core.esm.js +118 -68
- package/lib/core.esm.min.js +1 -1
- package/lib/core.esm.min.js.map +1 -1
- package/lib/core.min.cjs +1 -1
- package/lib/core.min.cjs.map +1 -1
- package/package.json +17 -17
- package/src/index.ts +1 -1
- package/types/index.d.ts +1 -1
package/lib/core.cjs
CHANGED
|
@@ -478,9 +478,8 @@ const MatrixHelper = {
|
|
|
478
478
|
t.e = child.e * a + child.f * c + e;
|
|
479
479
|
t.f = child.e * b + child.f * d + f;
|
|
480
480
|
},
|
|
481
|
-
multiplyParent(t, parent, to, abcdChanged, childScaleData
|
|
482
|
-
|
|
483
|
-
if (scrollData) e += scrollData.scrollX, f += scrollData.scrollY;
|
|
481
|
+
multiplyParent(t, parent, to, abcdChanged, childScaleData) {
|
|
482
|
+
const {e: e, f: f} = t;
|
|
484
483
|
to || (to = t);
|
|
485
484
|
if (isUndefined(abcdChanged)) abcdChanged = t.a !== 1 || t.b || t.c || t.d !== 1;
|
|
486
485
|
if (abcdChanged) {
|
|
@@ -1193,6 +1192,12 @@ const BoundsHelper = {
|
|
|
1193
1192
|
t.x += x;
|
|
1194
1193
|
t.y += y;
|
|
1195
1194
|
},
|
|
1195
|
+
scroll(t, data) {
|
|
1196
|
+
if (data.scrollY || data.scrollX) {
|
|
1197
|
+
t.x += data.scrollX;
|
|
1198
|
+
t.y += data.scrollY;
|
|
1199
|
+
}
|
|
1200
|
+
},
|
|
1196
1201
|
getByMove(t, x, y) {
|
|
1197
1202
|
t = Object.assign({}, t);
|
|
1198
1203
|
B.move(t, x, y);
|
|
@@ -2139,7 +2144,7 @@ __decorate([ contextMethod() ], Canvas.prototype, "measureText", null);
|
|
|
2139
2144
|
|
|
2140
2145
|
__decorate([ contextMethod() ], Canvas.prototype, "strokeText", null);
|
|
2141
2146
|
|
|
2142
|
-
const {copy: copy$5, multiplyParent: multiplyParent$3} = MatrixHelper, {round: round$1} = Math;
|
|
2147
|
+
const {copy: copy$5, multiplyParent: multiplyParent$3} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
2143
2148
|
|
|
2144
2149
|
const minSize = {
|
|
2145
2150
|
width: 1,
|
|
@@ -2183,7 +2188,7 @@ class LeaferCanvasBase extends Canvas {
|
|
|
2183
2188
|
this.innerId = IncrementId.create(IncrementId.CNAVAS);
|
|
2184
2189
|
const {width: width, height: height, pixelRatio: pixelRatio} = config;
|
|
2185
2190
|
this.autoLayout = !width || !height;
|
|
2186
|
-
this.size.pixelRatio = pixelRatio
|
|
2191
|
+
this.size.pixelRatio = pixelRatio || Platform.devicePixelRatio;
|
|
2187
2192
|
this.config = config;
|
|
2188
2193
|
this.init();
|
|
2189
2194
|
}
|
|
@@ -2304,44 +2309,44 @@ class LeaferCanvasBase extends Canvas {
|
|
|
2304
2309
|
const {pixelRatio: pixelRatio} = this;
|
|
2305
2310
|
this.filter = `blur(${blur * pixelRatio}px)`;
|
|
2306
2311
|
}
|
|
2307
|
-
copyWorld(canvas, from, to, blendMode) {
|
|
2312
|
+
copyWorld(canvas, from, to, blendMode, ceilPixel = true) {
|
|
2308
2313
|
if (blendMode) this.blendMode = blendMode;
|
|
2309
2314
|
if (from) {
|
|
2310
|
-
|
|
2311
|
-
if (!to) to =
|
|
2312
|
-
this.drawImage(canvas.view,
|
|
2315
|
+
this.setTempPixelBounds(from, ceilPixel);
|
|
2316
|
+
if (!to) to = tempPixelBounds; else this.setTempPixelBounds2(to, ceilPixel), to = tempPixelBounds2;
|
|
2317
|
+
this.drawImage(canvas.view, tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height, to.x, to.y, to.width, to.height);
|
|
2313
2318
|
} else {
|
|
2314
2319
|
this.drawImage(canvas.view, 0, 0);
|
|
2315
2320
|
}
|
|
2316
2321
|
if (blendMode) this.blendMode = "source-over";
|
|
2317
2322
|
}
|
|
2318
|
-
copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode) {
|
|
2319
|
-
if (blendMode) this.blendMode = blendMode;
|
|
2323
|
+
copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode, ceilPixel = true) {
|
|
2320
2324
|
if (fromWorld.b || fromWorld.c) {
|
|
2321
2325
|
this.save();
|
|
2322
2326
|
this.resetTransform();
|
|
2323
|
-
this.copyWorld(canvas, fromWorld, BoundsHelper.tempToOuterOf(toInnerBounds, fromWorld));
|
|
2327
|
+
this.copyWorld(canvas, fromWorld, BoundsHelper.tempToOuterOf(toInnerBounds, fromWorld), blendMode, ceilPixel);
|
|
2324
2328
|
this.restore();
|
|
2325
2329
|
} else {
|
|
2326
|
-
|
|
2327
|
-
this.
|
|
2330
|
+
if (blendMode) this.blendMode = blendMode;
|
|
2331
|
+
this.setTempPixelBounds(fromWorld, ceilPixel);
|
|
2332
|
+
this.drawImage(canvas.view, tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height, toInnerBounds.x, toInnerBounds.y, toInnerBounds.width, toInnerBounds.height);
|
|
2333
|
+
if (blendMode) this.blendMode = "source-over";
|
|
2328
2334
|
}
|
|
2329
|
-
if (blendMode) this.blendMode = "source-over";
|
|
2330
2335
|
}
|
|
2331
|
-
copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform) {
|
|
2336
|
+
copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform, ceilPixel = true) {
|
|
2332
2337
|
this.resetTransform();
|
|
2333
|
-
this.copyWorld(canvas, from, to, blendMode);
|
|
2338
|
+
this.copyWorld(canvas, from, to, blendMode, ceilPixel);
|
|
2334
2339
|
if (!onlyResetTransform) this.useWorldTransform();
|
|
2335
2340
|
}
|
|
2336
2341
|
useGrayscaleAlpha(bounds) {
|
|
2337
|
-
this.
|
|
2342
|
+
this.setTempPixelBounds(bounds, true, true);
|
|
2338
2343
|
let alpha, pixel;
|
|
2339
|
-
const {context: context} = this, imageData = context.getImageData(
|
|
2344
|
+
const {context: context} = this, imageData = context.getImageData(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height), {data: data} = imageData;
|
|
2340
2345
|
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
2341
2346
|
pixel = data[i] * .299 + data[i + 1] * .587 + data[i + 2] * .114;
|
|
2342
2347
|
if (alpha = data[i + 3]) data[i + 3] = alpha === 255 ? pixel : alpha * (pixel / 255);
|
|
2343
2348
|
}
|
|
2344
|
-
context.putImageData(imageData,
|
|
2349
|
+
context.putImageData(imageData, tempPixelBounds.x, tempPixelBounds.y);
|
|
2345
2350
|
}
|
|
2346
2351
|
useMask(maskCanvas, fromBounds, toBounds) {
|
|
2347
2352
|
this.copyWorld(maskCanvas, fromBounds, toBounds, "destination-in");
|
|
@@ -2349,42 +2354,48 @@ class LeaferCanvasBase extends Canvas {
|
|
|
2349
2354
|
useEraser(eraserCanvas, fromBounds, toBounds) {
|
|
2350
2355
|
this.copyWorld(eraserCanvas, fromBounds, toBounds, "destination-out");
|
|
2351
2356
|
}
|
|
2352
|
-
fillWorld(bounds, color, blendMode) {
|
|
2357
|
+
fillWorld(bounds, color, blendMode, ceilPixel) {
|
|
2353
2358
|
if (blendMode) this.blendMode = blendMode;
|
|
2354
2359
|
this.fillStyle = color;
|
|
2355
|
-
this.
|
|
2356
|
-
this.fillRect(
|
|
2360
|
+
this.setTempPixelBounds(bounds, ceilPixel);
|
|
2361
|
+
this.fillRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
|
|
2357
2362
|
if (blendMode) this.blendMode = "source-over";
|
|
2358
2363
|
}
|
|
2359
|
-
strokeWorld(bounds, color, blendMode) {
|
|
2364
|
+
strokeWorld(bounds, color, blendMode, ceilPixel) {
|
|
2360
2365
|
if (blendMode) this.blendMode = blendMode;
|
|
2361
2366
|
this.strokeStyle = color;
|
|
2362
|
-
this.
|
|
2363
|
-
this.strokeRect(
|
|
2367
|
+
this.setTempPixelBounds(bounds, ceilPixel);
|
|
2368
|
+
this.strokeRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
|
|
2364
2369
|
if (blendMode) this.blendMode = "source-over";
|
|
2365
2370
|
}
|
|
2366
|
-
clipWorld(bounds, ceilPixel) {
|
|
2371
|
+
clipWorld(bounds, ceilPixel = true) {
|
|
2367
2372
|
this.beginPath();
|
|
2368
|
-
this.
|
|
2369
|
-
this.rect(
|
|
2373
|
+
this.setTempPixelBounds(bounds, ceilPixel);
|
|
2374
|
+
this.rect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
|
|
2370
2375
|
this.clip();
|
|
2371
2376
|
}
|
|
2372
2377
|
clipUI(ruleData) {
|
|
2373
2378
|
ruleData.windingRule ? this.clip(ruleData.windingRule) : this.clip();
|
|
2374
2379
|
}
|
|
2375
|
-
clearWorld(bounds, ceilPixel) {
|
|
2376
|
-
this.
|
|
2377
|
-
this.clearRect(
|
|
2380
|
+
clearWorld(bounds, ceilPixel = true) {
|
|
2381
|
+
this.setTempPixelBounds(bounds, ceilPixel);
|
|
2382
|
+
this.clearRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
|
|
2378
2383
|
}
|
|
2379
2384
|
clear() {
|
|
2380
2385
|
const {pixelRatio: pixelRatio} = this;
|
|
2381
2386
|
this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2);
|
|
2382
2387
|
}
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
+
setTempPixelBounds(bounds, ceil, intersect) {
|
|
2389
|
+
this.copyToPixelBounds(tempPixelBounds, bounds, ceil, intersect);
|
|
2390
|
+
}
|
|
2391
|
+
setTempPixelBounds2(bounds, ceil, intersect) {
|
|
2392
|
+
this.copyToPixelBounds(tempPixelBounds2, bounds, ceil, intersect);
|
|
2393
|
+
}
|
|
2394
|
+
copyToPixelBounds(pixelBounds, bounds, ceil, intersect) {
|
|
2395
|
+
pixelBounds.set(bounds);
|
|
2396
|
+
if (intersect) pixelBounds.intersect(this.bounds);
|
|
2397
|
+
pixelBounds.scale(this.pixelRatio);
|
|
2398
|
+
if (ceil) pixelBounds.ceil();
|
|
2388
2399
|
}
|
|
2389
2400
|
isSameSize(size) {
|
|
2390
2401
|
return this.width === size.width && this.height === size.height && (!size.pixelRatio || this.pixelRatio === size.pixelRatio);
|
|
@@ -2400,7 +2411,7 @@ class LeaferCanvasBase extends Canvas {
|
|
|
2400
2411
|
recycle(clearBounds) {
|
|
2401
2412
|
if (!this.recycled) {
|
|
2402
2413
|
this.restore();
|
|
2403
|
-
clearBounds ? this.clearWorld(clearBounds
|
|
2414
|
+
clearBounds ? this.clearWorld(clearBounds) : this.clear();
|
|
2404
2415
|
this.manager ? this.manager.recycle(this) : this.destroy();
|
|
2405
2416
|
}
|
|
2406
2417
|
}
|
|
@@ -4140,6 +4151,17 @@ function positionType(defaultValue, checkFiniteNumber) {
|
|
|
4140
4151
|
}));
|
|
4141
4152
|
}
|
|
4142
4153
|
|
|
4154
|
+
function scrollType(defaultValue, checkFiniteNumber) {
|
|
4155
|
+
return decorateLeafAttr(defaultValue, key => attr({
|
|
4156
|
+
set(value) {
|
|
4157
|
+
if (this.__setAttr(key, value, checkFiniteNumber)) {
|
|
4158
|
+
this.__layout.matrixChanged || this.__layout.matrixChange();
|
|
4159
|
+
this.__scrollWorld || (this.__scrollWorld = {});
|
|
4160
|
+
}
|
|
4161
|
+
}
|
|
4162
|
+
}));
|
|
4163
|
+
}
|
|
4164
|
+
|
|
4143
4165
|
function autoLayoutType(defaultValue) {
|
|
4144
4166
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4145
4167
|
set(value) {
|
|
@@ -4554,7 +4576,7 @@ const LeafHelper = {
|
|
|
4554
4576
|
x: x,
|
|
4555
4577
|
y: y
|
|
4556
4578
|
};
|
|
4557
|
-
isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : t.parent && toInnerPoint$1(t.parent.
|
|
4579
|
+
isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : t.parent && toInnerPoint$1(t.parent.scrollWorldTransform, local, local, true);
|
|
4558
4580
|
L.moveLocal(t, local.x, local.y, transition);
|
|
4559
4581
|
},
|
|
4560
4582
|
moveLocal(t, x, y = 0, transition) {
|
|
@@ -4578,7 +4600,7 @@ const LeafHelper = {
|
|
|
4578
4600
|
}
|
|
4579
4601
|
copy$3(matrix, o);
|
|
4580
4602
|
scaleOfOuter(matrix, origin, scaleX, scaleY);
|
|
4581
|
-
if (
|
|
4603
|
+
if (L.hasHighPosition(t)) {
|
|
4582
4604
|
L.setTransform(t, matrix, resize, transition);
|
|
4583
4605
|
} else {
|
|
4584
4606
|
const x = t.x + matrix.e - o.e, y = t.y + matrix.f - o.f;
|
|
@@ -4597,7 +4619,7 @@ const LeafHelper = {
|
|
|
4597
4619
|
const o = t.__localMatrix;
|
|
4598
4620
|
copy$3(matrix, o);
|
|
4599
4621
|
rotateOfOuter(matrix, origin, angle);
|
|
4600
|
-
if (
|
|
4622
|
+
if (L.hasHighPosition(t)) L.setTransform(t, matrix, false, transition); else t.set({
|
|
4601
4623
|
x: t.x + matrix.e - o.e,
|
|
4602
4624
|
y: t.y + matrix.f - o.f,
|
|
4603
4625
|
rotation: MathHelper.formatRotation(t.rotation + angle)
|
|
@@ -4614,7 +4636,7 @@ const LeafHelper = {
|
|
|
4614
4636
|
transformWorld(t, transform, resize, transition) {
|
|
4615
4637
|
copy$3(matrix, t.worldTransform);
|
|
4616
4638
|
multiplyParent$2(matrix, transform);
|
|
4617
|
-
if (t.parent) divideParent(matrix, t.parent.
|
|
4639
|
+
if (t.parent) divideParent(matrix, t.parent.scrollWorldTransform);
|
|
4618
4640
|
L.setTransform(t, matrix, resize, transition);
|
|
4619
4641
|
},
|
|
4620
4642
|
transform(t, transform, resize, transition) {
|
|
@@ -4625,6 +4647,10 @@ const LeafHelper = {
|
|
|
4625
4647
|
setTransform(t, transform, resize, transition) {
|
|
4626
4648
|
const data = t.__, originPoint = data.origin && L.getInnerOrigin(t, data.origin);
|
|
4627
4649
|
const layout = getLayout(transform, originPoint, data.around && L.getInnerOrigin(t, data.around));
|
|
4650
|
+
if (L.hasOffset(t)) {
|
|
4651
|
+
layout.x -= data.offsetX;
|
|
4652
|
+
layout.y -= data.offsetY;
|
|
4653
|
+
}
|
|
4628
4654
|
if (resize) {
|
|
4629
4655
|
const scaleX = layout.scaleX / t.scaleX, scaleY = layout.scaleY / t.scaleY;
|
|
4630
4656
|
delete layout.scaleX, delete layout.scaleY;
|
|
@@ -4653,13 +4679,19 @@ const LeafHelper = {
|
|
|
4653
4679
|
},
|
|
4654
4680
|
getRelativeWorld(t, relative, temp) {
|
|
4655
4681
|
copy$3(matrix, t.worldTransform);
|
|
4656
|
-
divideParent(matrix, relative.
|
|
4682
|
+
divideParent(matrix, relative.scrollWorldTransform);
|
|
4657
4683
|
return temp ? matrix : Object.assign({}, matrix);
|
|
4658
4684
|
},
|
|
4659
4685
|
drop(t, parent, index, resize) {
|
|
4660
4686
|
t.setTransform(L.getRelativeWorld(t, parent, true), resize);
|
|
4661
4687
|
parent.add(t, index);
|
|
4662
4688
|
},
|
|
4689
|
+
hasHighPosition(t) {
|
|
4690
|
+
return t.origin || t.around || L.hasOffset(t);
|
|
4691
|
+
},
|
|
4692
|
+
hasOffset(t) {
|
|
4693
|
+
return t.offsetX || t.offsetY;
|
|
4694
|
+
},
|
|
4663
4695
|
hasParent(p, parent) {
|
|
4664
4696
|
if (!parent) return false;
|
|
4665
4697
|
while (p) {
|
|
@@ -4685,8 +4717,7 @@ const L = LeafHelper;
|
|
|
4685
4717
|
const {updateAllMatrix: updateAllMatrix$1, updateMatrix: updateMatrix$1, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange, updateChange: updateChange} = L;
|
|
4686
4718
|
|
|
4687
4719
|
function getTempLocal(t, world) {
|
|
4688
|
-
t.
|
|
4689
|
-
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
|
|
4720
|
+
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.scrollWorldTransform) : world;
|
|
4690
4721
|
}
|
|
4691
4722
|
|
|
4692
4723
|
const LeafBoundsHelper = {
|
|
@@ -5238,6 +5269,8 @@ ChildEvent.UNMOUNTED = "unmounted";
|
|
|
5238
5269
|
|
|
5239
5270
|
ChildEvent.DESTROY = "destroy";
|
|
5240
5271
|
|
|
5272
|
+
const SCROLL = "property.scroll";
|
|
5273
|
+
|
|
5241
5274
|
class PropertyEvent extends Event {
|
|
5242
5275
|
constructor(type, target, attrName, oldValue, newValue) {
|
|
5243
5276
|
super(type, target);
|
|
@@ -5251,6 +5284,13 @@ PropertyEvent.CHANGE = "property.change";
|
|
|
5251
5284
|
|
|
5252
5285
|
PropertyEvent.LEAFER_CHANGE = "property.leafer_change";
|
|
5253
5286
|
|
|
5287
|
+
PropertyEvent.SCROLL = SCROLL;
|
|
5288
|
+
|
|
5289
|
+
const extraPropertyEventMap = {
|
|
5290
|
+
scrollX: SCROLL,
|
|
5291
|
+
scrollY: SCROLL
|
|
5292
|
+
};
|
|
5293
|
+
|
|
5254
5294
|
class ImageEvent extends Event {
|
|
5255
5295
|
constructor(type, data) {
|
|
5256
5296
|
super(type);
|
|
@@ -5526,7 +5566,9 @@ class Eventer {
|
|
|
5526
5566
|
if (!id) return;
|
|
5527
5567
|
const list = isArray(id) ? id : [ id ];
|
|
5528
5568
|
list.forEach(item => {
|
|
5529
|
-
if (
|
|
5569
|
+
if (item) {
|
|
5570
|
+
if (!item.listener) isArray(item.type) && item.type.forEach(v => item.current.off(v[0], v[1], v[3])); else item.current.off(item.type, item.listener, item.options);
|
|
5571
|
+
}
|
|
5530
5572
|
});
|
|
5531
5573
|
list.length = 0;
|
|
5532
5574
|
}
|
|
@@ -5620,8 +5662,6 @@ const LeafDataProxy = {
|
|
|
5620
5662
|
}
|
|
5621
5663
|
if (isObject(newValue) || oldValue !== newValue) {
|
|
5622
5664
|
this.__realSetAttr(name, newValue);
|
|
5623
|
-
const {CHANGE: CHANGE} = PropertyEvent;
|
|
5624
|
-
const event = new PropertyEvent(CHANGE, this, name, oldValue, newValue);
|
|
5625
5665
|
if (this.isLeafer) {
|
|
5626
5666
|
this.emitEvent(new PropertyEvent(PropertyEvent.LEAFER_CHANGE, this, name, oldValue, newValue));
|
|
5627
5667
|
const transformEventName = leaferTransformAttrMap[name];
|
|
@@ -5629,10 +5669,10 @@ const LeafDataProxy = {
|
|
|
5629
5669
|
this.emitEvent(new LeaferEvent(transformEventName, this));
|
|
5630
5670
|
this.emitEvent(new LeaferEvent(LeaferEvent.TRANSFORM, this));
|
|
5631
5671
|
}
|
|
5632
|
-
} else {
|
|
5633
|
-
if (this.hasEvent(CHANGE)) this.emitEvent(event);
|
|
5634
5672
|
}
|
|
5635
|
-
this.
|
|
5673
|
+
this.emitPropertyEvent(PropertyEvent.CHANGE, name, oldValue, newValue);
|
|
5674
|
+
const extraPropertyEvent = extraPropertyEventMap[name];
|
|
5675
|
+
if (extraPropertyEvent) this.emitPropertyEvent(extraPropertyEvent, name, oldValue, newValue);
|
|
5636
5676
|
return true;
|
|
5637
5677
|
} else {
|
|
5638
5678
|
return false;
|
|
@@ -5642,6 +5682,11 @@ const LeafDataProxy = {
|
|
|
5642
5682
|
return true;
|
|
5643
5683
|
}
|
|
5644
5684
|
},
|
|
5685
|
+
emitPropertyEvent(type, name, oldValue, newValue) {
|
|
5686
|
+
const event = new PropertyEvent(type, this, name, oldValue, newValue);
|
|
5687
|
+
this.isLeafer || this.hasEvent(type) && this.emitEvent(event);
|
|
5688
|
+
this.leafer.emitEvent(event);
|
|
5689
|
+
},
|
|
5645
5690
|
__realSetAttr(name, newValue) {
|
|
5646
5691
|
const data = this.__;
|
|
5647
5692
|
data[name] = newValue;
|
|
@@ -5660,8 +5705,9 @@ const {toPoint: toPoint, tempPoint: tempPoint} = AroundHelper;
|
|
|
5660
5705
|
|
|
5661
5706
|
const LeafMatrix = {
|
|
5662
5707
|
__updateWorldMatrix() {
|
|
5663
|
-
const {parent: parent, __layout: __layout} = this;
|
|
5664
|
-
multiplyParent$1(this.__local || __layout, parent ? parent.__world : defaultWorld,
|
|
5708
|
+
const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
|
|
5709
|
+
multiplyParent$1(this.__local || __layout, parent ? parent.__scrollWorld || parent.__world : defaultWorld, __world, !!__layout.affectScaleOrRotation, __);
|
|
5710
|
+
if (__scrollWorld) translateInner(Object.assign(__scrollWorld, __world), __.scrollX, __.scrollY);
|
|
5665
5711
|
},
|
|
5666
5712
|
__updateLocalMatrix() {
|
|
5667
5713
|
if (this.__local) {
|
|
@@ -5758,7 +5804,7 @@ const LeafBounds = {
|
|
|
5758
5804
|
__updateLocalRenderBounds() {
|
|
5759
5805
|
toOuterOf$1(this.__layout.renderBounds, this.__localMatrix, this.__layout.localRenderBounds);
|
|
5760
5806
|
},
|
|
5761
|
-
__updateBoxBounds() {
|
|
5807
|
+
__updateBoxBounds(_secondLayout, _bounds) {
|
|
5762
5808
|
const b = this.__layout.boxBounds;
|
|
5763
5809
|
const data = this.__;
|
|
5764
5810
|
if (data.__pathInputed) {
|
|
@@ -5792,11 +5838,11 @@ const LeafBounds = {
|
|
|
5792
5838
|
data.__naturalWidth = layout.boxBounds.width;
|
|
5793
5839
|
data.__naturalHeight = layout.boxBounds.height;
|
|
5794
5840
|
},
|
|
5795
|
-
__updateStrokeBounds() {
|
|
5841
|
+
__updateStrokeBounds(_bounds) {
|
|
5796
5842
|
const layout = this.__layout;
|
|
5797
5843
|
copyAndSpread(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
|
|
5798
5844
|
},
|
|
5799
|
-
__updateRenderBounds() {
|
|
5845
|
+
__updateRenderBounds(_bounds) {
|
|
5800
5846
|
const layout = this.__layout;
|
|
5801
5847
|
layout.renderSpread > 0 ? copyAndSpread(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$1(layout.renderBounds, layout.strokeBounds);
|
|
5802
5848
|
}
|
|
@@ -5945,6 +5991,10 @@ exports.Leaf = class Leaf {
|
|
|
5945
5991
|
get localTransform() {
|
|
5946
5992
|
return this.__layout.getTransform("local");
|
|
5947
5993
|
}
|
|
5994
|
+
get scrollWorldTransform() {
|
|
5995
|
+
this.updateLayout();
|
|
5996
|
+
return this.__scrollWorld || this.__world;
|
|
5997
|
+
}
|
|
5948
5998
|
get boxBounds() {
|
|
5949
5999
|
return this.getBounds("box", "inner");
|
|
5950
6000
|
}
|
|
@@ -5961,7 +6011,7 @@ exports.Leaf = class Leaf {
|
|
|
5961
6011
|
return this.getBounds("render");
|
|
5962
6012
|
}
|
|
5963
6013
|
get worldOpacity() {
|
|
5964
|
-
this.
|
|
6014
|
+
this.updateLayout();
|
|
5965
6015
|
return this.__worldOpacity;
|
|
5966
6016
|
}
|
|
5967
6017
|
get __worldFlipped() {
|
|
@@ -6136,10 +6186,10 @@ exports.Leaf = class Leaf {
|
|
|
6136
6186
|
__updateLocalBoxBounds() {}
|
|
6137
6187
|
__updateLocalStrokeBounds() {}
|
|
6138
6188
|
__updateLocalRenderBounds() {}
|
|
6139
|
-
__updateBoxBounds() {}
|
|
6189
|
+
__updateBoxBounds(_secondLayout, _bounds) {}
|
|
6140
6190
|
__updateContentBounds() {}
|
|
6141
|
-
__updateStrokeBounds() {}
|
|
6142
|
-
__updateRenderBounds() {}
|
|
6191
|
+
__updateStrokeBounds(_bounds) {}
|
|
6192
|
+
__updateRenderBounds(_bounds) {}
|
|
6143
6193
|
__updateAutoLayout() {}
|
|
6144
6194
|
__updateFlowLayout() {}
|
|
6145
6195
|
__updateNaturalSize() {}
|
|
@@ -6439,14 +6489,14 @@ exports.Branch = class Branch extends exports.Leaf {
|
|
|
6439
6489
|
}
|
|
6440
6490
|
return 0;
|
|
6441
6491
|
}
|
|
6442
|
-
__updateBoxBounds() {
|
|
6443
|
-
setListWithFn(this.__layout.boxBounds, this.children, this.__hasMask ? maskLocalBoxBounds : localBoxBounds);
|
|
6492
|
+
__updateBoxBounds(_secondLayout, bounds) {
|
|
6493
|
+
setListWithFn(bounds || this.__layout.boxBounds, this.children, this.__hasMask ? maskLocalBoxBounds : localBoxBounds);
|
|
6444
6494
|
}
|
|
6445
|
-
__updateStrokeBounds() {
|
|
6446
|
-
setListWithFn(this.__layout.strokeBounds, this.children, this.__hasMask ? maskLocalStrokeBounds : localStrokeBounds);
|
|
6495
|
+
__updateStrokeBounds(bounds) {
|
|
6496
|
+
setListWithFn(bounds || this.__layout.strokeBounds, this.children, this.__hasMask ? maskLocalStrokeBounds : localStrokeBounds);
|
|
6447
6497
|
}
|
|
6448
|
-
__updateRenderBounds() {
|
|
6449
|
-
setListWithFn(this.__layout.renderBounds, this.children, this.__hasMask ? maskLocalRenderBounds : localRenderBounds);
|
|
6498
|
+
__updateRenderBounds(bounds) {
|
|
6499
|
+
setListWithFn(bounds || this.__layout.renderBounds, this.children, this.__hasMask ? maskLocalRenderBounds : localRenderBounds);
|
|
6450
6500
|
}
|
|
6451
6501
|
__updateSortChildren() {
|
|
6452
6502
|
let affectSort;
|
|
@@ -6693,7 +6743,7 @@ class LeafLevelList {
|
|
|
6693
6743
|
}
|
|
6694
6744
|
}
|
|
6695
6745
|
|
|
6696
|
-
const version = "1.9.
|
|
6746
|
+
const version = "1.9.2";
|
|
6697
6747
|
|
|
6698
6748
|
exports.AlignHelper = AlignHelper;
|
|
6699
6749
|
|
|
@@ -6875,6 +6925,8 @@ exports.emptyData = emptyData;
|
|
|
6875
6925
|
|
|
6876
6926
|
exports.eraserType = eraserType;
|
|
6877
6927
|
|
|
6928
|
+
exports.extraPropertyEventMap = extraPropertyEventMap;
|
|
6929
|
+
|
|
6878
6930
|
exports.getBoundsData = getBoundsData;
|
|
6879
6931
|
|
|
6880
6932
|
exports.getDescriptor = getDescriptor;
|
|
@@ -6933,6 +6985,8 @@ exports.rotationType = rotationType;
|
|
|
6933
6985
|
|
|
6934
6986
|
exports.scaleType = scaleType;
|
|
6935
6987
|
|
|
6988
|
+
exports.scrollType = scrollType;
|
|
6989
|
+
|
|
6936
6990
|
exports.sortType = sortType;
|
|
6937
6991
|
|
|
6938
6992
|
exports.strokeType = strokeType;
|