@leafer-draw/miniapp 1.9.1 → 1.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/miniapp.cjs +5 -5
- package/dist/miniapp.esm.js +5 -5
- 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 +219 -131
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +9 -9
package/dist/miniapp.module.js
CHANGED
|
@@ -476,9 +476,8 @@ const MatrixHelper = {
|
|
|
476
476
|
t.e = child.e * a + child.f * c + e;
|
|
477
477
|
t.f = child.e * b + child.f * d + f;
|
|
478
478
|
},
|
|
479
|
-
multiplyParent(t, parent, to, abcdChanged, childScaleData
|
|
480
|
-
|
|
481
|
-
if (scrollData) e += scrollData.scrollX, f += scrollData.scrollY;
|
|
479
|
+
multiplyParent(t, parent, to, abcdChanged, childScaleData) {
|
|
480
|
+
const {e: e, f: f} = t;
|
|
482
481
|
to || (to = t);
|
|
483
482
|
if (isUndefined(abcdChanged)) abcdChanged = t.a !== 1 || t.b || t.c || t.d !== 1;
|
|
484
483
|
if (abcdChanged) {
|
|
@@ -709,19 +708,19 @@ const PointHelper = {
|
|
|
709
708
|
},
|
|
710
709
|
tempToInnerOf(t, matrix) {
|
|
711
710
|
const {tempPoint: temp} = P$5;
|
|
712
|
-
copy$
|
|
711
|
+
copy$9(temp, t);
|
|
713
712
|
toInnerPoint$2(matrix, temp, temp);
|
|
714
713
|
return temp;
|
|
715
714
|
},
|
|
716
715
|
tempToOuterOf(t, matrix) {
|
|
717
716
|
const {tempPoint: temp} = P$5;
|
|
718
|
-
copy$
|
|
717
|
+
copy$9(temp, t);
|
|
719
718
|
toOuterPoint$3(matrix, temp, temp);
|
|
720
719
|
return temp;
|
|
721
720
|
},
|
|
722
721
|
tempToInnerRadiusPointOf(t, matrix) {
|
|
723
722
|
const {tempRadiusPoint: temp} = P$5;
|
|
724
|
-
copy$
|
|
723
|
+
copy$9(temp, t);
|
|
725
724
|
P$5.toInnerRadiusPointOf(t, matrix, temp);
|
|
726
725
|
return temp;
|
|
727
726
|
},
|
|
@@ -797,7 +796,7 @@ const PointHelper = {
|
|
|
797
796
|
|
|
798
797
|
const P$5 = PointHelper;
|
|
799
798
|
|
|
800
|
-
const {getDistanceFrom: getDistanceFrom, copy: copy$
|
|
799
|
+
const {getDistanceFrom: getDistanceFrom, copy: copy$9, getAtan2: getAtan2} = P$5;
|
|
801
800
|
|
|
802
801
|
class Point {
|
|
803
802
|
constructor(x, y) {
|
|
@@ -1191,6 +1190,10 @@ const BoundsHelper = {
|
|
|
1191
1190
|
t.x += x;
|
|
1192
1191
|
t.y += y;
|
|
1193
1192
|
},
|
|
1193
|
+
scroll(t, data) {
|
|
1194
|
+
t.x += data.scrollX;
|
|
1195
|
+
t.y += data.scrollY;
|
|
1196
|
+
},
|
|
1194
1197
|
getByMove(t, x, y) {
|
|
1195
1198
|
t = Object.assign({}, t);
|
|
1196
1199
|
B.move(t, x, y);
|
|
@@ -1200,7 +1203,7 @@ const BoundsHelper = {
|
|
|
1200
1203
|
if (!to) {
|
|
1201
1204
|
to = t;
|
|
1202
1205
|
} else {
|
|
1203
|
-
copy$
|
|
1206
|
+
copy$8(to, t);
|
|
1204
1207
|
}
|
|
1205
1208
|
if (parent) {
|
|
1206
1209
|
to.offsetX = -(B.maxX(parent) - t.x);
|
|
@@ -1352,7 +1355,7 @@ const BoundsHelper = {
|
|
|
1352
1355
|
if (bounds && (bounds.width || bounds.height)) {
|
|
1353
1356
|
if (first) {
|
|
1354
1357
|
first = false;
|
|
1355
|
-
if (!addMode) copy$
|
|
1358
|
+
if (!addMode) copy$8(t, bounds);
|
|
1356
1359
|
} else {
|
|
1357
1360
|
add$1(t, bounds);
|
|
1358
1361
|
}
|
|
@@ -1439,7 +1442,7 @@ const BoundsHelper = {
|
|
|
1439
1442
|
|
|
1440
1443
|
const B = BoundsHelper;
|
|
1441
1444
|
|
|
1442
|
-
const {add: add$1, copy: copy$
|
|
1445
|
+
const {add: add$1, copy: copy$8} = B;
|
|
1443
1446
|
|
|
1444
1447
|
class Bounds {
|
|
1445
1448
|
get minX() {
|
|
@@ -1654,17 +1657,17 @@ class Debug {
|
|
|
1654
1657
|
showHit ? canvas.stroke() : canvas.strokeWorld(w, color);
|
|
1655
1658
|
}
|
|
1656
1659
|
log(...messages) {
|
|
1657
|
-
if (D$
|
|
1658
|
-
if (D$
|
|
1659
|
-
if (D$
|
|
1660
|
+
if (D$5.enable) {
|
|
1661
|
+
if (D$5.filterList.length && D$5.filterList.every(name => name !== this.name)) return;
|
|
1662
|
+
if (D$5.excludeList.length && D$5.excludeList.some(name => name === this.name)) return;
|
|
1660
1663
|
console.log("%c" + this.name, "color:#21ae62", ...messages);
|
|
1661
1664
|
}
|
|
1662
1665
|
}
|
|
1663
1666
|
tip(...messages) {
|
|
1664
|
-
if (D$
|
|
1667
|
+
if (D$5.enable) this.warn(...messages);
|
|
1665
1668
|
}
|
|
1666
1669
|
warn(...messages) {
|
|
1667
|
-
if (D$
|
|
1670
|
+
if (D$5.showWarn) console.warn(this.name, ...messages);
|
|
1668
1671
|
}
|
|
1669
1672
|
repeat(name, ...messages) {
|
|
1670
1673
|
if (!this.repeatMap[name]) {
|
|
@@ -1692,7 +1695,7 @@ function getNameList(name) {
|
|
|
1692
1695
|
return name;
|
|
1693
1696
|
}
|
|
1694
1697
|
|
|
1695
|
-
const D$
|
|
1698
|
+
const D$5 = Debug;
|
|
1696
1699
|
|
|
1697
1700
|
const debug$e = Debug.get("RunTime");
|
|
1698
1701
|
|
|
@@ -2137,7 +2140,7 @@ __decorate([ contextMethod() ], Canvas$1.prototype, "measureText", null);
|
|
|
2137
2140
|
|
|
2138
2141
|
__decorate([ contextMethod() ], Canvas$1.prototype, "strokeText", null);
|
|
2139
2142
|
|
|
2140
|
-
const {copy: copy$
|
|
2143
|
+
const {copy: copy$7, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
2141
2144
|
|
|
2142
2145
|
const minSize = {
|
|
2143
2146
|
width: 1,
|
|
@@ -2302,44 +2305,44 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2302
2305
|
const {pixelRatio: pixelRatio} = this;
|
|
2303
2306
|
this.filter = `blur(${blur * pixelRatio}px)`;
|
|
2304
2307
|
}
|
|
2305
|
-
copyWorld(canvas, from, to, blendMode) {
|
|
2308
|
+
copyWorld(canvas, from, to, blendMode, ceilPixel = true) {
|
|
2306
2309
|
if (blendMode) this.blendMode = blendMode;
|
|
2307
2310
|
if (from) {
|
|
2308
|
-
|
|
2309
|
-
if (!to) to =
|
|
2310
|
-
this.drawImage(canvas.view,
|
|
2311
|
+
this.setTempPixelBounds(from, ceilPixel);
|
|
2312
|
+
if (!to) to = tempPixelBounds; else this.setTempPixelBounds2(to, ceilPixel), to = tempPixelBounds2;
|
|
2313
|
+
this.drawImage(canvas.view, tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height, to.x, to.y, to.width, to.height);
|
|
2311
2314
|
} else {
|
|
2312
2315
|
this.drawImage(canvas.view, 0, 0);
|
|
2313
2316
|
}
|
|
2314
2317
|
if (blendMode) this.blendMode = "source-over";
|
|
2315
2318
|
}
|
|
2316
|
-
copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode) {
|
|
2317
|
-
if (blendMode) this.blendMode = blendMode;
|
|
2319
|
+
copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode, ceilPixel = true) {
|
|
2318
2320
|
if (fromWorld.b || fromWorld.c) {
|
|
2319
2321
|
this.save();
|
|
2320
2322
|
this.resetTransform();
|
|
2321
|
-
this.copyWorld(canvas, fromWorld, BoundsHelper.tempToOuterOf(toInnerBounds, fromWorld));
|
|
2323
|
+
this.copyWorld(canvas, fromWorld, BoundsHelper.tempToOuterOf(toInnerBounds, fromWorld), blendMode, ceilPixel);
|
|
2322
2324
|
this.restore();
|
|
2323
2325
|
} else {
|
|
2324
|
-
|
|
2325
|
-
this.
|
|
2326
|
+
if (blendMode) this.blendMode = blendMode;
|
|
2327
|
+
this.setTempPixelBounds(fromWorld, ceilPixel);
|
|
2328
|
+
this.drawImage(canvas.view, tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height, toInnerBounds.x, toInnerBounds.y, toInnerBounds.width, toInnerBounds.height);
|
|
2329
|
+
if (blendMode) this.blendMode = "source-over";
|
|
2326
2330
|
}
|
|
2327
|
-
if (blendMode) this.blendMode = "source-over";
|
|
2328
2331
|
}
|
|
2329
|
-
copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform) {
|
|
2332
|
+
copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform, ceilPixel = true) {
|
|
2330
2333
|
this.resetTransform();
|
|
2331
|
-
this.copyWorld(canvas, from, to, blendMode);
|
|
2334
|
+
this.copyWorld(canvas, from, to, blendMode, ceilPixel);
|
|
2332
2335
|
if (!onlyResetTransform) this.useWorldTransform();
|
|
2333
2336
|
}
|
|
2334
2337
|
useGrayscaleAlpha(bounds) {
|
|
2335
|
-
this.
|
|
2338
|
+
this.setTempPixelBounds(bounds, true, true);
|
|
2336
2339
|
let alpha, pixel;
|
|
2337
|
-
const {context: context} = this, imageData = context.getImageData(
|
|
2340
|
+
const {context: context} = this, imageData = context.getImageData(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height), {data: data} = imageData;
|
|
2338
2341
|
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
2339
2342
|
pixel = data[i] * .299 + data[i + 1] * .587 + data[i + 2] * .114;
|
|
2340
2343
|
if (alpha = data[i + 3]) data[i + 3] = alpha === 255 ? pixel : alpha * (pixel / 255);
|
|
2341
2344
|
}
|
|
2342
|
-
context.putImageData(imageData,
|
|
2345
|
+
context.putImageData(imageData, tempPixelBounds.x, tempPixelBounds.y);
|
|
2343
2346
|
}
|
|
2344
2347
|
useMask(maskCanvas, fromBounds, toBounds) {
|
|
2345
2348
|
this.copyWorld(maskCanvas, fromBounds, toBounds, "destination-in");
|
|
@@ -2347,42 +2350,48 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2347
2350
|
useEraser(eraserCanvas, fromBounds, toBounds) {
|
|
2348
2351
|
this.copyWorld(eraserCanvas, fromBounds, toBounds, "destination-out");
|
|
2349
2352
|
}
|
|
2350
|
-
fillWorld(bounds, color, blendMode) {
|
|
2353
|
+
fillWorld(bounds, color, blendMode, ceilPixel) {
|
|
2351
2354
|
if (blendMode) this.blendMode = blendMode;
|
|
2352
2355
|
this.fillStyle = color;
|
|
2353
|
-
this.
|
|
2354
|
-
this.fillRect(
|
|
2356
|
+
this.setTempPixelBounds(bounds, ceilPixel);
|
|
2357
|
+
this.fillRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
|
|
2355
2358
|
if (blendMode) this.blendMode = "source-over";
|
|
2356
2359
|
}
|
|
2357
|
-
strokeWorld(bounds, color, blendMode) {
|
|
2360
|
+
strokeWorld(bounds, color, blendMode, ceilPixel) {
|
|
2358
2361
|
if (blendMode) this.blendMode = blendMode;
|
|
2359
2362
|
this.strokeStyle = color;
|
|
2360
|
-
this.
|
|
2361
|
-
this.strokeRect(
|
|
2363
|
+
this.setTempPixelBounds(bounds, ceilPixel);
|
|
2364
|
+
this.strokeRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
|
|
2362
2365
|
if (blendMode) this.blendMode = "source-over";
|
|
2363
2366
|
}
|
|
2364
|
-
clipWorld(bounds, ceilPixel) {
|
|
2367
|
+
clipWorld(bounds, ceilPixel = true) {
|
|
2365
2368
|
this.beginPath();
|
|
2366
|
-
this.
|
|
2367
|
-
this.rect(
|
|
2369
|
+
this.setTempPixelBounds(bounds, ceilPixel);
|
|
2370
|
+
this.rect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
|
|
2368
2371
|
this.clip();
|
|
2369
2372
|
}
|
|
2370
2373
|
clipUI(ruleData) {
|
|
2371
2374
|
ruleData.windingRule ? this.clip(ruleData.windingRule) : this.clip();
|
|
2372
2375
|
}
|
|
2373
|
-
clearWorld(bounds, ceilPixel) {
|
|
2374
|
-
this.
|
|
2375
|
-
this.clearRect(
|
|
2376
|
+
clearWorld(bounds, ceilPixel = true) {
|
|
2377
|
+
this.setTempPixelBounds(bounds, ceilPixel);
|
|
2378
|
+
this.clearRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
|
|
2376
2379
|
}
|
|
2377
2380
|
clear() {
|
|
2378
2381
|
const {pixelRatio: pixelRatio} = this;
|
|
2379
2382
|
this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2);
|
|
2380
2383
|
}
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2384
|
+
setTempPixelBounds(bounds, ceil, intersect) {
|
|
2385
|
+
this.copyToPixelBounds(tempPixelBounds, bounds, ceil, intersect);
|
|
2386
|
+
}
|
|
2387
|
+
setTempPixelBounds2(bounds, ceil, intersect) {
|
|
2388
|
+
this.copyToPixelBounds(tempPixelBounds2, bounds, ceil, intersect);
|
|
2389
|
+
}
|
|
2390
|
+
copyToPixelBounds(pixelBounds, bounds, ceil, intersect) {
|
|
2391
|
+
pixelBounds.set(bounds);
|
|
2392
|
+
if (intersect) pixelBounds.intersect(this.bounds);
|
|
2393
|
+
pixelBounds.scale(this.pixelRatio);
|
|
2394
|
+
if (ceil) pixelBounds.ceil();
|
|
2386
2395
|
}
|
|
2387
2396
|
isSameSize(size) {
|
|
2388
2397
|
return this.width === size.width && this.height === size.height && (!size.pixelRatio || this.pixelRatio === size.pixelRatio);
|
|
@@ -2390,7 +2399,7 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2390
2399
|
getSameCanvas(useSameWorldTransform, useSameSmooth) {
|
|
2391
2400
|
const {size: size, pixelSnap: pixelSnap} = this, canvas = this.manager ? this.manager.get(size) : Creator.canvas(Object.assign({}, size));
|
|
2392
2401
|
canvas.save();
|
|
2393
|
-
if (useSameWorldTransform) copy$
|
|
2402
|
+
if (useSameWorldTransform) copy$7(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
|
|
2394
2403
|
if (useSameSmooth) canvas.smooth = this.smooth;
|
|
2395
2404
|
canvas.pixelSnap !== pixelSnap && (canvas.pixelSnap = pixelSnap);
|
|
2396
2405
|
return canvas;
|
|
@@ -2398,7 +2407,7 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2398
2407
|
recycle(clearBounds) {
|
|
2399
2408
|
if (!this.recycled) {
|
|
2400
2409
|
this.restore();
|
|
2401
|
-
clearBounds ? this.clearWorld(clearBounds
|
|
2410
|
+
clearBounds ? this.clearWorld(clearBounds) : this.clear();
|
|
2402
2411
|
this.manager ? this.manager.recycle(this) : this.destroy();
|
|
2403
2412
|
}
|
|
2404
2413
|
}
|
|
@@ -2779,7 +2788,7 @@ const EllipseHelper = {
|
|
|
2779
2788
|
}
|
|
2780
2789
|
};
|
|
2781
2790
|
|
|
2782
|
-
const {M: M$4, m: m, L: L$5, l: l, H: H, h: h, V: V, v: v, C: C$3, c: c, S: S, s: s, Q: Q$3, q: q, T: T, t: t, A: A, a: a, Z: Z$4, z: z, N: N$3, D: D$
|
|
2791
|
+
const {M: M$4, m: m, L: L$5, l: l, H: H, h: h, V: V, v: v, C: C$3, c: c, S: S, s: s, Q: Q$3, q: q, T: T, t: t, A: A, a: a, Z: Z$4, z: z, N: N$3, D: D$4, X: X$3, G: G$3, F: F$4, O: O$3, P: P$3, U: U$3} = PathCommandMap;
|
|
2783
2792
|
|
|
2784
2793
|
const {rect: rect$2, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
|
|
2785
2794
|
|
|
@@ -2999,7 +3008,7 @@ const PathConvert = {
|
|
|
2999
3008
|
i += 5;
|
|
3000
3009
|
break;
|
|
3001
3010
|
|
|
3002
|
-
case D$
|
|
3011
|
+
case D$4:
|
|
3003
3012
|
x = old[i + 1];
|
|
3004
3013
|
y = old[i + 2];
|
|
3005
3014
|
curveMode ? roundRect$2(data, x, y, old[i + 3], old[i + 4], [ old[i + 5], old[i + 6], old[i + 7], old[i + 8] ]) : copyData(data, old, i, 9);
|
|
@@ -3100,7 +3109,7 @@ const PathConvert = {
|
|
|
3100
3109
|
|
|
3101
3110
|
const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
|
|
3102
3111
|
|
|
3103
|
-
const {M: M$3, L: L$4, C: C$2, Q: Q$2, Z: Z$3, N: N$2, D: D$
|
|
3112
|
+
const {M: M$3, L: L$4, C: C$2, Q: Q$2, Z: Z$3, N: N$2, D: D$3, X: X$2, G: G$2, F: F$3, O: O$2, P: P$2, U: U$2} = PathCommandMap;
|
|
3104
3113
|
|
|
3105
3114
|
const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
|
|
3106
3115
|
|
|
@@ -3136,7 +3145,7 @@ const PathCommandDataHelper = {
|
|
|
3136
3145
|
} else {
|
|
3137
3146
|
const fourCorners = MathHelper.fourNumber(cornerRadius);
|
|
3138
3147
|
if (fourCorners) {
|
|
3139
|
-
data.push(D$
|
|
3148
|
+
data.push(D$3, x, y, width, height, ...fourCorners);
|
|
3140
3149
|
} else {
|
|
3141
3150
|
data.push(N$2, x, y, width, height);
|
|
3142
3151
|
}
|
|
@@ -3279,7 +3288,7 @@ class PathCreator {
|
|
|
3279
3288
|
paint() {}
|
|
3280
3289
|
}
|
|
3281
3290
|
|
|
3282
|
-
const {M: M$2, L: L$3, C: C$1, Q: Q$1, Z: Z$2, N: N$1, D: D$
|
|
3291
|
+
const {M: M$2, L: L$3, C: C$1, Q: Q$1, Z: Z$2, N: N$1, D: D$2, X: X$1, G: G$1, F: F$2, O: O$1, P: P$1, U: U$1} = PathCommandMap;
|
|
3283
3292
|
|
|
3284
3293
|
const debug$a = Debug.get("PathDrawer");
|
|
3285
3294
|
|
|
@@ -3321,7 +3330,7 @@ const PathDrawer = {
|
|
|
3321
3330
|
i += 5;
|
|
3322
3331
|
break;
|
|
3323
3332
|
|
|
3324
|
-
case D$
|
|
3333
|
+
case D$2:
|
|
3325
3334
|
drawer.roundRect(data[i + 1], data[i + 2], data[i + 3], data[i + 4], [ data[i + 5], data[i + 6], data[i + 7], data[i + 8] ]);
|
|
3326
3335
|
i += 9;
|
|
3327
3336
|
break;
|
|
@@ -3364,11 +3373,11 @@ const PathDrawer = {
|
|
|
3364
3373
|
}
|
|
3365
3374
|
};
|
|
3366
3375
|
|
|
3367
|
-
const {M: M$1, L: L$2, C: C, Q: Q, Z: Z$1, N: N, D: D, X: X, G: G, F: F$1, O: O, P: P, U: U} = PathCommandMap;
|
|
3376
|
+
const {M: M$1, L: L$2, C: C, Q: Q, Z: Z$1, N: N, D: D$1, X: X, G: G, F: F$1, O: O, P: P, U: U} = PathCommandMap;
|
|
3368
3377
|
|
|
3369
3378
|
const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
|
|
3370
3379
|
|
|
3371
|
-
const {addPointBounds: addPointBounds, copy: copy$
|
|
3380
|
+
const {addPointBounds: addPointBounds, copy: copy$6, addPoint: addPoint, setPoint: setPoint, addBounds: addBounds, toBounds: toBounds$2} = TwoPointBoundsHelper;
|
|
3372
3381
|
|
|
3373
3382
|
const debug$9 = Debug.get("PathBounds");
|
|
3374
3383
|
|
|
@@ -3440,17 +3449,17 @@ const PathBounds = {
|
|
|
3440
3449
|
i += 5;
|
|
3441
3450
|
break;
|
|
3442
3451
|
|
|
3443
|
-
case D:
|
|
3452
|
+
case D$1:
|
|
3444
3453
|
case X:
|
|
3445
3454
|
x = data[i + 1];
|
|
3446
3455
|
y = data[i + 2];
|
|
3447
3456
|
addBounds(setPointBounds, x, y, data[i + 3], data[i + 4]);
|
|
3448
|
-
i += command === D ? 9 : 6;
|
|
3457
|
+
i += command === D$1 ? 9 : 6;
|
|
3449
3458
|
break;
|
|
3450
3459
|
|
|
3451
3460
|
case G:
|
|
3452
3461
|
ellipse$1(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], data[i + 7], data[i + 8], tempPointBounds, setEndPoint);
|
|
3453
|
-
i === 0 ? copy$
|
|
3462
|
+
i === 0 ? copy$6(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3454
3463
|
x = setEndPoint.x;
|
|
3455
3464
|
y = setEndPoint.y;
|
|
3456
3465
|
i += 9;
|
|
@@ -3468,7 +3477,7 @@ const PathBounds = {
|
|
|
3468
3477
|
|
|
3469
3478
|
case O:
|
|
3470
3479
|
arc(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], tempPointBounds, setEndPoint);
|
|
3471
|
-
i === 0 ? copy$
|
|
3480
|
+
i === 0 ? copy$6(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3472
3481
|
x = setEndPoint.x;
|
|
3473
3482
|
y = setEndPoint.y;
|
|
3474
3483
|
i += 7;
|
|
@@ -3485,7 +3494,7 @@ const PathBounds = {
|
|
|
3485
3494
|
|
|
3486
3495
|
case U:
|
|
3487
3496
|
arcTo$1(null, x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], tempPointBounds, setEndPoint);
|
|
3488
|
-
i === 0 ? copy$
|
|
3497
|
+
i === 0 ? copy$6(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3489
3498
|
x = setEndPoint.x;
|
|
3490
3499
|
y = setEndPoint.y;
|
|
3491
3500
|
i += 6;
|
|
@@ -4138,6 +4147,17 @@ function positionType(defaultValue, checkFiniteNumber) {
|
|
|
4138
4147
|
}));
|
|
4139
4148
|
}
|
|
4140
4149
|
|
|
4150
|
+
function scrollType(defaultValue, checkFiniteNumber) {
|
|
4151
|
+
return decorateLeafAttr(defaultValue, key => attr({
|
|
4152
|
+
set(value) {
|
|
4153
|
+
if (this.__setAttr(key, value, checkFiniteNumber)) {
|
|
4154
|
+
this.__layout.matrixChanged || this.__layout.matrixChange();
|
|
4155
|
+
this.__scrollWorld || (this.__scrollWorld = {});
|
|
4156
|
+
}
|
|
4157
|
+
}
|
|
4158
|
+
}));
|
|
4159
|
+
}
|
|
4160
|
+
|
|
4141
4161
|
function autoLayoutType(defaultValue) {
|
|
4142
4162
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4143
4163
|
set(value) {
|
|
@@ -4476,7 +4496,7 @@ function registerUIEvent() {
|
|
|
4476
4496
|
};
|
|
4477
4497
|
}
|
|
4478
4498
|
|
|
4479
|
-
const {copy: copy$
|
|
4499
|
+
const {copy: copy$5, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter: skewOfOuter, multiplyParent: multiplyParent$3, divideParent: divideParent, getLayout: getLayout} = MatrixHelper;
|
|
4480
4500
|
|
|
4481
4501
|
const matrix = {}, {round: round} = Math;
|
|
4482
4502
|
|
|
@@ -4552,7 +4572,7 @@ const LeafHelper = {
|
|
|
4552
4572
|
x: x,
|
|
4553
4573
|
y: y
|
|
4554
4574
|
};
|
|
4555
|
-
isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : t.parent && toInnerPoint$1(t.parent.
|
|
4575
|
+
isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : t.parent && toInnerPoint$1(t.parent.scrollWorldTransform, local, local, true);
|
|
4556
4576
|
L.moveLocal(t, local.x, local.y, transition);
|
|
4557
4577
|
},
|
|
4558
4578
|
moveLocal(t, x, y = 0, transition) {
|
|
@@ -4574,9 +4594,9 @@ const LeafHelper = {
|
|
|
4574
4594
|
if (scaleY) transition = scaleY;
|
|
4575
4595
|
scaleY = scaleX;
|
|
4576
4596
|
}
|
|
4577
|
-
copy$
|
|
4597
|
+
copy$5(matrix, o);
|
|
4578
4598
|
scaleOfOuter$2(matrix, origin, scaleX, scaleY);
|
|
4579
|
-
if (
|
|
4599
|
+
if (L.hasHighPosition(t)) {
|
|
4580
4600
|
L.setTransform(t, matrix, resize, transition);
|
|
4581
4601
|
} else {
|
|
4582
4602
|
const x = t.x + matrix.e - o.e, y = t.y + matrix.f - o.f;
|
|
@@ -4593,9 +4613,9 @@ const LeafHelper = {
|
|
|
4593
4613
|
},
|
|
4594
4614
|
rotateOfLocal(t, origin, angle, transition) {
|
|
4595
4615
|
const o = t.__localMatrix;
|
|
4596
|
-
copy$
|
|
4616
|
+
copy$5(matrix, o);
|
|
4597
4617
|
rotateOfOuter$2(matrix, origin, angle);
|
|
4598
|
-
if (
|
|
4618
|
+
if (L.hasHighPosition(t)) L.setTransform(t, matrix, false, transition); else t.set({
|
|
4599
4619
|
x: t.x + matrix.e - o.e,
|
|
4600
4620
|
y: t.y + matrix.f - o.f,
|
|
4601
4621
|
rotation: MathHelper.formatRotation(t.rotation + angle)
|
|
@@ -4605,24 +4625,28 @@ const LeafHelper = {
|
|
|
4605
4625
|
L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
|
|
4606
4626
|
},
|
|
4607
4627
|
skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
|
|
4608
|
-
copy$
|
|
4628
|
+
copy$5(matrix, t.__localMatrix);
|
|
4609
4629
|
skewOfOuter(matrix, origin, skewX, skewY);
|
|
4610
4630
|
L.setTransform(t, matrix, resize, transition);
|
|
4611
4631
|
},
|
|
4612
4632
|
transformWorld(t, transform, resize, transition) {
|
|
4613
|
-
copy$
|
|
4633
|
+
copy$5(matrix, t.worldTransform);
|
|
4614
4634
|
multiplyParent$3(matrix, transform);
|
|
4615
|
-
if (t.parent) divideParent(matrix, t.parent.
|
|
4635
|
+
if (t.parent) divideParent(matrix, t.parent.scrollWorldTransform);
|
|
4616
4636
|
L.setTransform(t, matrix, resize, transition);
|
|
4617
4637
|
},
|
|
4618
4638
|
transform(t, transform, resize, transition) {
|
|
4619
|
-
copy$
|
|
4639
|
+
copy$5(matrix, t.localTransform);
|
|
4620
4640
|
multiplyParent$3(matrix, transform);
|
|
4621
4641
|
L.setTransform(t, matrix, resize, transition);
|
|
4622
4642
|
},
|
|
4623
4643
|
setTransform(t, transform, resize, transition) {
|
|
4624
4644
|
const data = t.__, originPoint = data.origin && L.getInnerOrigin(t, data.origin);
|
|
4625
4645
|
const layout = getLayout(transform, originPoint, data.around && L.getInnerOrigin(t, data.around));
|
|
4646
|
+
if (L.hasOffset(t)) {
|
|
4647
|
+
layout.x -= data.offsetX;
|
|
4648
|
+
layout.y -= data.offsetY;
|
|
4649
|
+
}
|
|
4626
4650
|
if (resize) {
|
|
4627
4651
|
const scaleX = layout.scaleX / t.scaleX, scaleY = layout.scaleY / t.scaleY;
|
|
4628
4652
|
delete layout.scaleX, delete layout.scaleY;
|
|
@@ -4650,14 +4674,20 @@ const LeafHelper = {
|
|
|
4650
4674
|
return innerOrigin;
|
|
4651
4675
|
},
|
|
4652
4676
|
getRelativeWorld(t, relative, temp) {
|
|
4653
|
-
copy$
|
|
4654
|
-
divideParent(matrix, relative.
|
|
4677
|
+
copy$5(matrix, t.worldTransform);
|
|
4678
|
+
divideParent(matrix, relative.scrollWorldTransform);
|
|
4655
4679
|
return temp ? matrix : Object.assign({}, matrix);
|
|
4656
4680
|
},
|
|
4657
4681
|
drop(t, parent, index, resize) {
|
|
4658
4682
|
t.setTransform(L.getRelativeWorld(t, parent, true), resize);
|
|
4659
4683
|
parent.add(t, index);
|
|
4660
4684
|
},
|
|
4685
|
+
hasHighPosition(t) {
|
|
4686
|
+
return t.origin || t.around || L.hasOffset(t);
|
|
4687
|
+
},
|
|
4688
|
+
hasOffset(t) {
|
|
4689
|
+
return t.offsetX || t.offsetY;
|
|
4690
|
+
},
|
|
4661
4691
|
hasParent(p, parent) {
|
|
4662
4692
|
if (!parent) return false;
|
|
4663
4693
|
while (p) {
|
|
@@ -4683,8 +4713,7 @@ const L = LeafHelper;
|
|
|
4683
4713
|
const {updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1} = L;
|
|
4684
4714
|
|
|
4685
4715
|
function getTempLocal(t, world) {
|
|
4686
|
-
t.
|
|
4687
|
-
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
|
|
4716
|
+
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.scrollWorldTransform) : world;
|
|
4688
4717
|
}
|
|
4689
4718
|
|
|
4690
4719
|
const LeafBoundsHelper = {
|
|
@@ -4809,7 +4838,7 @@ const WaitHelper = {
|
|
|
4809
4838
|
|
|
4810
4839
|
const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$2} = LeafHelper;
|
|
4811
4840
|
|
|
4812
|
-
const {toOuterOf: toOuterOf$2, getPoints: getPoints, copy: copy$
|
|
4841
|
+
const {toOuterOf: toOuterOf$2, getPoints: getPoints, copy: copy$4} = BoundsHelper;
|
|
4813
4842
|
|
|
4814
4843
|
const localContent = "_localContentBounds";
|
|
4815
4844
|
|
|
@@ -5048,7 +5077,7 @@ class LeafLayout {
|
|
|
5048
5077
|
matrix = getRelativeWorld$1(leaf, relative, true);
|
|
5049
5078
|
}
|
|
5050
5079
|
if (!layoutBounds) layoutBounds = MatrixHelper.getLayout(matrix);
|
|
5051
|
-
copy$
|
|
5080
|
+
copy$4(layoutBounds, bounds);
|
|
5052
5081
|
PointHelper.copy(layoutBounds, point);
|
|
5053
5082
|
if (unscale) {
|
|
5054
5083
|
const {scaleX: scaleX, scaleY: scaleY} = layoutBounds;
|
|
@@ -5236,6 +5265,8 @@ ChildEvent.UNMOUNTED = "unmounted";
|
|
|
5236
5265
|
|
|
5237
5266
|
ChildEvent.DESTROY = "destroy";
|
|
5238
5267
|
|
|
5268
|
+
const SCROLL = "property.scroll";
|
|
5269
|
+
|
|
5239
5270
|
class PropertyEvent extends Event {
|
|
5240
5271
|
constructor(type, target, attrName, oldValue, newValue) {
|
|
5241
5272
|
super(type, target);
|
|
@@ -5249,6 +5280,13 @@ PropertyEvent.CHANGE = "property.change";
|
|
|
5249
5280
|
|
|
5250
5281
|
PropertyEvent.LEAFER_CHANGE = "property.leafer_change";
|
|
5251
5282
|
|
|
5283
|
+
PropertyEvent.SCROLL = SCROLL;
|
|
5284
|
+
|
|
5285
|
+
const extraPropertyEventMap = {
|
|
5286
|
+
scrollX: SCROLL,
|
|
5287
|
+
scrollY: SCROLL
|
|
5288
|
+
};
|
|
5289
|
+
|
|
5252
5290
|
class ImageEvent extends Event {
|
|
5253
5291
|
constructor(type, data) {
|
|
5254
5292
|
super(type);
|
|
@@ -5524,7 +5562,9 @@ class Eventer {
|
|
|
5524
5562
|
if (!id) return;
|
|
5525
5563
|
const list = isArray(id) ? id : [ id ];
|
|
5526
5564
|
list.forEach(item => {
|
|
5527
|
-
if (
|
|
5565
|
+
if (item) {
|
|
5566
|
+
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);
|
|
5567
|
+
}
|
|
5528
5568
|
});
|
|
5529
5569
|
list.length = 0;
|
|
5530
5570
|
}
|
|
@@ -5618,8 +5658,6 @@ const LeafDataProxy = {
|
|
|
5618
5658
|
}
|
|
5619
5659
|
if (isObject(newValue) || oldValue !== newValue) {
|
|
5620
5660
|
this.__realSetAttr(name, newValue);
|
|
5621
|
-
const {CHANGE: CHANGE} = PropertyEvent;
|
|
5622
|
-
const event = new PropertyEvent(CHANGE, this, name, oldValue, newValue);
|
|
5623
5661
|
if (this.isLeafer) {
|
|
5624
5662
|
this.emitEvent(new PropertyEvent(PropertyEvent.LEAFER_CHANGE, this, name, oldValue, newValue));
|
|
5625
5663
|
const transformEventName = leaferTransformAttrMap[name];
|
|
@@ -5627,10 +5665,10 @@ const LeafDataProxy = {
|
|
|
5627
5665
|
this.emitEvent(new LeaferEvent(transformEventName, this));
|
|
5628
5666
|
this.emitEvent(new LeaferEvent(LeaferEvent.TRANSFORM, this));
|
|
5629
5667
|
}
|
|
5630
|
-
} else {
|
|
5631
|
-
if (this.hasEvent(CHANGE)) this.emitEvent(event);
|
|
5632
5668
|
}
|
|
5633
|
-
this.
|
|
5669
|
+
this.emitPropertyEvent(PropertyEvent.CHANGE, name, oldValue, newValue);
|
|
5670
|
+
const extraPropertyEvent = extraPropertyEventMap[name];
|
|
5671
|
+
if (extraPropertyEvent) this.emitPropertyEvent(extraPropertyEvent, name, oldValue, newValue);
|
|
5634
5672
|
return true;
|
|
5635
5673
|
} else {
|
|
5636
5674
|
return false;
|
|
@@ -5640,6 +5678,11 @@ const LeafDataProxy = {
|
|
|
5640
5678
|
return true;
|
|
5641
5679
|
}
|
|
5642
5680
|
},
|
|
5681
|
+
emitPropertyEvent(type, name, oldValue, newValue) {
|
|
5682
|
+
const event = new PropertyEvent(type, this, name, oldValue, newValue);
|
|
5683
|
+
this.isLeafer || this.hasEvent(type) && this.emitEvent(event);
|
|
5684
|
+
this.leafer.emitEvent(event);
|
|
5685
|
+
},
|
|
5643
5686
|
__realSetAttr(name, newValue) {
|
|
5644
5687
|
const data = this.__;
|
|
5645
5688
|
data[name] = newValue;
|
|
@@ -5658,8 +5701,9 @@ const {toPoint: toPoint$3, tempPoint: tempPoint} = AroundHelper;
|
|
|
5658
5701
|
|
|
5659
5702
|
const LeafMatrix = {
|
|
5660
5703
|
__updateWorldMatrix() {
|
|
5661
|
-
const {parent: parent, __layout: __layout} = this;
|
|
5662
|
-
multiplyParent$2(this.__local || __layout, parent ? parent.__world : defaultWorld,
|
|
5704
|
+
const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
|
|
5705
|
+
multiplyParent$2(this.__local || __layout, parent ? parent.__scrollWorld || parent.__world : defaultWorld, __world, !!__layout.affectScaleOrRotation, __);
|
|
5706
|
+
if (__scrollWorld) translateInner(Object.assign(__scrollWorld, __world), __.scrollX, __.scrollY);
|
|
5663
5707
|
},
|
|
5664
5708
|
__updateLocalMatrix() {
|
|
5665
5709
|
if (this.__local) {
|
|
@@ -5685,7 +5729,7 @@ const {updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2} = LeafH
|
|
|
5685
5729
|
|
|
5686
5730
|
const {updateBounds: updateBounds$1} = BranchHelper;
|
|
5687
5731
|
|
|
5688
|
-
const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$
|
|
5732
|
+
const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$3} = BoundsHelper;
|
|
5689
5733
|
|
|
5690
5734
|
const {toBounds: toBounds$1} = PathBounds;
|
|
5691
5735
|
|
|
@@ -5756,7 +5800,7 @@ const LeafBounds = {
|
|
|
5756
5800
|
__updateLocalRenderBounds() {
|
|
5757
5801
|
toOuterOf$1(this.__layout.renderBounds, this.__localMatrix, this.__layout.localRenderBounds);
|
|
5758
5802
|
},
|
|
5759
|
-
__updateBoxBounds() {
|
|
5803
|
+
__updateBoxBounds(_secondLayout, _bounds) {
|
|
5760
5804
|
const b = this.__layout.boxBounds;
|
|
5761
5805
|
const data = this.__;
|
|
5762
5806
|
if (data.__pathInputed) {
|
|
@@ -5790,13 +5834,13 @@ const LeafBounds = {
|
|
|
5790
5834
|
data.__naturalWidth = layout.boxBounds.width;
|
|
5791
5835
|
data.__naturalHeight = layout.boxBounds.height;
|
|
5792
5836
|
},
|
|
5793
|
-
__updateStrokeBounds() {
|
|
5837
|
+
__updateStrokeBounds(_bounds) {
|
|
5794
5838
|
const layout = this.__layout;
|
|
5795
5839
|
copyAndSpread$1(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
|
|
5796
5840
|
},
|
|
5797
|
-
__updateRenderBounds() {
|
|
5841
|
+
__updateRenderBounds(_bounds) {
|
|
5798
5842
|
const layout = this.__layout;
|
|
5799
|
-
layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$
|
|
5843
|
+
layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$3(layout.renderBounds, layout.strokeBounds);
|
|
5800
5844
|
}
|
|
5801
5845
|
};
|
|
5802
5846
|
|
|
@@ -5895,7 +5939,7 @@ const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: m
|
|
|
5895
5939
|
|
|
5896
5940
|
const {toOuterOf: toOuterOf} = BoundsHelper;
|
|
5897
5941
|
|
|
5898
|
-
const {copy: copy$
|
|
5942
|
+
const {copy: copy$2, move: move} = PointHelper;
|
|
5899
5943
|
|
|
5900
5944
|
const {moveLocal: moveLocal, zoomOfLocal: zoomOfLocal, rotateOfLocal: rotateOfLocal, skewOfLocal: skewOfLocal, moveWorld: moveWorld, zoomOfWorld: zoomOfWorld, rotateOfWorld: rotateOfWorld, skewOfWorld: skewOfWorld, transform: transform, transformWorld: transformWorld, setTransform: setTransform, getFlipTransform: getFlipTransform, getLocalOrigin: getLocalOrigin, getRelativeWorld: getRelativeWorld, drop: drop} = LeafHelper;
|
|
5901
5945
|
|
|
@@ -5943,6 +5987,10 @@ let Leaf = class Leaf {
|
|
|
5943
5987
|
get localTransform() {
|
|
5944
5988
|
return this.__layout.getTransform("local");
|
|
5945
5989
|
}
|
|
5990
|
+
get scrollWorldTransform() {
|
|
5991
|
+
this.updateLayout();
|
|
5992
|
+
return this.__scrollWorld || this.__world;
|
|
5993
|
+
}
|
|
5946
5994
|
get boxBounds() {
|
|
5947
5995
|
return this.getBounds("box", "inner");
|
|
5948
5996
|
}
|
|
@@ -5959,7 +6007,7 @@ let Leaf = class Leaf {
|
|
|
5959
6007
|
return this.getBounds("render");
|
|
5960
6008
|
}
|
|
5961
6009
|
get worldOpacity() {
|
|
5962
|
-
this.
|
|
6010
|
+
this.updateLayout();
|
|
5963
6011
|
return this.__worldOpacity;
|
|
5964
6012
|
}
|
|
5965
6013
|
get __worldFlipped() {
|
|
@@ -6134,10 +6182,10 @@ let Leaf = class Leaf {
|
|
|
6134
6182
|
__updateLocalBoxBounds() {}
|
|
6135
6183
|
__updateLocalStrokeBounds() {}
|
|
6136
6184
|
__updateLocalRenderBounds() {}
|
|
6137
|
-
__updateBoxBounds() {}
|
|
6185
|
+
__updateBoxBounds(_secondLayout, _bounds) {}
|
|
6138
6186
|
__updateContentBounds() {}
|
|
6139
|
-
__updateStrokeBounds() {}
|
|
6140
|
-
__updateRenderBounds() {}
|
|
6187
|
+
__updateStrokeBounds(_bounds) {}
|
|
6188
|
+
__updateRenderBounds(_bounds) {}
|
|
6141
6189
|
__updateAutoLayout() {}
|
|
6142
6190
|
__updateFlowLayout() {}
|
|
6143
6191
|
__updateNaturalSize() {}
|
|
@@ -6209,14 +6257,14 @@ let Leaf = class Leaf {
|
|
|
6209
6257
|
if (this.parent) {
|
|
6210
6258
|
this.parent.worldToInner(world, to, distance, relative);
|
|
6211
6259
|
} else {
|
|
6212
|
-
if (to) copy$
|
|
6260
|
+
if (to) copy$2(to, world);
|
|
6213
6261
|
}
|
|
6214
6262
|
}
|
|
6215
6263
|
localToWorld(local, to, distance, relative) {
|
|
6216
6264
|
if (this.parent) {
|
|
6217
6265
|
this.parent.innerToWorld(local, to, distance, relative);
|
|
6218
6266
|
} else {
|
|
6219
|
-
if (to) copy$
|
|
6267
|
+
if (to) copy$2(to, local);
|
|
6220
6268
|
}
|
|
6221
6269
|
}
|
|
6222
6270
|
worldToInner(world, to, distance, relative) {
|
|
@@ -6437,14 +6485,14 @@ let Branch = class Branch extends Leaf {
|
|
|
6437
6485
|
}
|
|
6438
6486
|
return 0;
|
|
6439
6487
|
}
|
|
6440
|
-
__updateBoxBounds() {
|
|
6441
|
-
setListWithFn(this.__layout.boxBounds, this.children, this.__hasMask ? maskLocalBoxBounds : localBoxBounds);
|
|
6488
|
+
__updateBoxBounds(_secondLayout, bounds) {
|
|
6489
|
+
setListWithFn(bounds || this.__layout.boxBounds, this.children, this.__hasMask ? maskLocalBoxBounds : localBoxBounds);
|
|
6442
6490
|
}
|
|
6443
|
-
__updateStrokeBounds() {
|
|
6444
|
-
setListWithFn(this.__layout.strokeBounds, this.children, this.__hasMask ? maskLocalStrokeBounds : localStrokeBounds);
|
|
6491
|
+
__updateStrokeBounds(bounds) {
|
|
6492
|
+
setListWithFn(bounds || this.__layout.strokeBounds, this.children, this.__hasMask ? maskLocalStrokeBounds : localStrokeBounds);
|
|
6445
6493
|
}
|
|
6446
|
-
__updateRenderBounds() {
|
|
6447
|
-
setListWithFn(this.__layout.renderBounds, this.children, this.__hasMask ? maskLocalRenderBounds : localRenderBounds);
|
|
6494
|
+
__updateRenderBounds(bounds) {
|
|
6495
|
+
setListWithFn(bounds || this.__layout.renderBounds, this.children, this.__hasMask ? maskLocalRenderBounds : localRenderBounds);
|
|
6448
6496
|
}
|
|
6449
6497
|
__updateSortChildren() {
|
|
6450
6498
|
let affectSort;
|
|
@@ -6691,7 +6739,7 @@ class LeafLevelList {
|
|
|
6691
6739
|
}
|
|
6692
6740
|
}
|
|
6693
6741
|
|
|
6694
|
-
const version = "1.9.
|
|
6742
|
+
const version = "1.9.3";
|
|
6695
6743
|
|
|
6696
6744
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6697
6745
|
get allowBackgroundColor() {
|
|
@@ -7372,8 +7420,8 @@ class Renderer {
|
|
|
7372
7420
|
const {canvas: canvas} = this, bounds = block.getIntersect(canvas.bounds), realBounds = new Bounds(bounds);
|
|
7373
7421
|
canvas.save();
|
|
7374
7422
|
bounds.spread(Renderer.clipSpread).ceil();
|
|
7375
|
-
canvas.clearWorld(bounds
|
|
7376
|
-
canvas.clipWorld(bounds
|
|
7423
|
+
canvas.clearWorld(bounds);
|
|
7424
|
+
canvas.clipWorld(bounds);
|
|
7377
7425
|
this.__render(bounds, realBounds);
|
|
7378
7426
|
canvas.restore();
|
|
7379
7427
|
Run.end(t);
|
|
@@ -7761,7 +7809,7 @@ class BoxData extends GroupData {
|
|
|
7761
7809
|
}
|
|
7762
7810
|
get __clipAfterFill() {
|
|
7763
7811
|
const t = this;
|
|
7764
|
-
return t.overflow
|
|
7812
|
+
return t.overflow !== "show" && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill);
|
|
7765
7813
|
}
|
|
7766
7814
|
}
|
|
7767
7815
|
|
|
@@ -7917,6 +7965,41 @@ const UIBounds = {
|
|
|
7917
7965
|
}
|
|
7918
7966
|
};
|
|
7919
7967
|
|
|
7968
|
+
const DragBoundsHelper = {
|
|
7969
|
+
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
7970
|
+
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
7971
|
+
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
7972
|
+
if (!change) move = Object.assign({}, move);
|
|
7973
|
+
const isBiggerWidth = content.width > dragBounds.width;
|
|
7974
|
+
const isBiggerHeight = content.height > dragBounds.height;
|
|
7975
|
+
if (isBiggerWidth && dragBoundsType !== "outer") {
|
|
7976
|
+
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
7977
|
+
} else {
|
|
7978
|
+
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
7979
|
+
}
|
|
7980
|
+
if (isBiggerHeight && dragBoundsType !== "outer") {
|
|
7981
|
+
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
7982
|
+
} else {
|
|
7983
|
+
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
7984
|
+
}
|
|
7985
|
+
move.x = MathHelper.float(move.x);
|
|
7986
|
+
move.y = MathHelper.float(move.y);
|
|
7987
|
+
return move;
|
|
7988
|
+
},
|
|
7989
|
+
axisMove(leaf, move) {
|
|
7990
|
+
const {draggable: draggable} = leaf;
|
|
7991
|
+
if (draggable === "x") move.y = 0;
|
|
7992
|
+
if (draggable === "y") move.x = 0;
|
|
7993
|
+
},
|
|
7994
|
+
limitMove(leaf, move) {
|
|
7995
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
7996
|
+
if (dragBounds) D.getValidMove(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, dragBoundsType, move, true);
|
|
7997
|
+
D.axisMove(leaf, move);
|
|
7998
|
+
}
|
|
7999
|
+
};
|
|
8000
|
+
|
|
8001
|
+
const D = DragBoundsHelper;
|
|
8002
|
+
|
|
7920
8003
|
const {stintSet: stintSet$1} = DataHelper;
|
|
7921
8004
|
|
|
7922
8005
|
const UIRender = {
|
|
@@ -8231,9 +8314,9 @@ __decorate([ positionType(0, true) ], UI.prototype, "offsetX", void 0);
|
|
|
8231
8314
|
|
|
8232
8315
|
__decorate([ positionType(0, true) ], UI.prototype, "offsetY", void 0);
|
|
8233
8316
|
|
|
8234
|
-
__decorate([
|
|
8317
|
+
__decorate([ scrollType(0, true) ], UI.prototype, "scrollX", void 0);
|
|
8235
8318
|
|
|
8236
|
-
__decorate([
|
|
8319
|
+
__decorate([ scrollType(0, true) ], UI.prototype, "scrollY", void 0);
|
|
8237
8320
|
|
|
8238
8321
|
__decorate([ autoLayoutType() ], UI.prototype, "origin", void 0);
|
|
8239
8322
|
|
|
@@ -8263,6 +8346,8 @@ __decorate([ dataType(false) ], UI.prototype, "draggable", void 0);
|
|
|
8263
8346
|
|
|
8264
8347
|
__decorate([ dataType() ], UI.prototype, "dragBounds", void 0);
|
|
8265
8348
|
|
|
8349
|
+
__decorate([ dataType("auto") ], UI.prototype, "dragBoundsType", void 0);
|
|
8350
|
+
|
|
8266
8351
|
__decorate([ dataType(false) ], UI.prototype, "editable", void 0);
|
|
8267
8352
|
|
|
8268
8353
|
__decorate([ hitType(true) ], UI.prototype, "hittable", void 0);
|
|
@@ -8685,7 +8770,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8685
8770
|
zoom(_zoomType, _optionsOrPadding, _scroll, _transition) {
|
|
8686
8771
|
return Plugin.need("view");
|
|
8687
8772
|
}
|
|
8688
|
-
getValidMove(moveX, moveY) {
|
|
8773
|
+
getValidMove(moveX, moveY, _checkLimit) {
|
|
8689
8774
|
return {
|
|
8690
8775
|
x: moveX,
|
|
8691
8776
|
y: moveY
|
|
@@ -8774,12 +8859,10 @@ __decorate([ dataProcessor(RectData) ], Rect.prototype, "__", void 0);
|
|
|
8774
8859
|
|
|
8775
8860
|
Rect = __decorate([ useModule(RectRender), rewriteAble(), registerUI() ], Rect);
|
|
8776
8861
|
|
|
8777
|
-
const {
|
|
8862
|
+
const {add: add, includes: includes$1, scroll: scroll} = BoundsHelper;
|
|
8778
8863
|
|
|
8779
8864
|
const rect = Rect.prototype, group = Group.prototype;
|
|
8780
8865
|
|
|
8781
|
-
const childrenRenderBounds = {};
|
|
8782
|
-
|
|
8783
8866
|
let Box = class Box extends Group {
|
|
8784
8867
|
get __tag() {
|
|
8785
8868
|
return "Box";
|
|
@@ -8825,22 +8908,27 @@ let Box = class Box extends Group {
|
|
|
8825
8908
|
__updateRenderBounds() {
|
|
8826
8909
|
let isOverflow;
|
|
8827
8910
|
if (this.children.length) {
|
|
8828
|
-
const data = this.__, {renderBounds: renderBounds, boxBounds: boxBounds} =
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8832
|
-
|
|
8833
|
-
childrenRenderBounds
|
|
8834
|
-
childrenRenderBounds.y += data.scrollY;
|
|
8911
|
+
const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
|
|
8912
|
+
const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
|
|
8913
|
+
super.__updateRenderBounds(childrenRenderBounds);
|
|
8914
|
+
if (data.overflow.includes("scroll")) {
|
|
8915
|
+
add(childrenRenderBounds, boxBounds);
|
|
8916
|
+
scroll(childrenRenderBounds, data);
|
|
8835
8917
|
}
|
|
8918
|
+
this.__updateRectRenderBounds();
|
|
8836
8919
|
isOverflow = !includes$1(boxBounds, childrenRenderBounds);
|
|
8837
|
-
if (isOverflow && data.overflow
|
|
8920
|
+
if (isOverflow && data.overflow === "show") add(renderBounds, childrenRenderBounds);
|
|
8838
8921
|
} else this.__updateRectRenderBounds();
|
|
8839
8922
|
DataHelper.stintSet(this, "isOverflow", isOverflow);
|
|
8840
|
-
this.
|
|
8923
|
+
this.__checkScroll();
|
|
8841
8924
|
}
|
|
8842
8925
|
__updateRectRenderBounds() {}
|
|
8843
|
-
|
|
8926
|
+
__updateWorldBounds() {
|
|
8927
|
+
if (this.hasScroller) this.__updateScroll();
|
|
8928
|
+
super.__updateWorldBounds();
|
|
8929
|
+
}
|
|
8930
|
+
__checkScroll() {}
|
|
8931
|
+
__updateScroll() {}
|
|
8844
8932
|
__updateRectChange() {}
|
|
8845
8933
|
__updateChange() {
|
|
8846
8934
|
super.__updateChange();
|
|
@@ -8855,7 +8943,7 @@ let Box = class Box extends Group {
|
|
|
8855
8943
|
this.__renderRect(canvas, options);
|
|
8856
8944
|
if (this.children.length) this.__renderGroup(canvas, options);
|
|
8857
8945
|
}
|
|
8858
|
-
if (this.
|
|
8946
|
+
if (this.hasScroller) this.scroller.__render(canvas, options);
|
|
8859
8947
|
}
|
|
8860
8948
|
__drawContent(canvas, options) {
|
|
8861
8949
|
this.__renderGroup(canvas, options);
|
|
@@ -10360,7 +10448,7 @@ function shadow(ui, current, shape) {
|
|
|
10360
10448
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
10361
10449
|
}
|
|
10362
10450
|
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
10363
|
-
if (end && index < end) other.clearWorld(copyBounds
|
|
10451
|
+
if (end && index < end) other.clearWorld(copyBounds);
|
|
10364
10452
|
});
|
|
10365
10453
|
other.recycle(copyBounds);
|
|
10366
10454
|
}
|
|
@@ -10424,7 +10512,7 @@ function innerShadow(ui, current, shape) {
|
|
|
10424
10512
|
}
|
|
10425
10513
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), "source-in");
|
|
10426
10514
|
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
10427
|
-
if (end && index < end) other.clearWorld(copyBounds
|
|
10515
|
+
if (end && index < end) other.clearWorld(copyBounds);
|
|
10428
10516
|
});
|
|
10429
10517
|
other.recycle(copyBounds);
|
|
10430
10518
|
}
|
|
@@ -10523,7 +10611,7 @@ function copyContent(leaf, canvas, content, maskOpacity, blendMode, recycle) {
|
|
|
10523
10611
|
canvas.resetTransform();
|
|
10524
10612
|
canvas.opacity = maskOpacity;
|
|
10525
10613
|
canvas.copyWorld(content, realBounds, undefined, blendMode);
|
|
10526
|
-
recycle ? content.recycle(realBounds) : content.clearWorld(realBounds
|
|
10614
|
+
recycle ? content.recycle(realBounds) : content.clearWorld(realBounds);
|
|
10527
10615
|
}
|
|
10528
10616
|
|
|
10529
10617
|
const money = "¥¥$€££¢¢";
|
|
@@ -11067,4 +11155,4 @@ try {
|
|
|
11067
11155
|
if (wx) useCanvas("miniapp", wx);
|
|
11068
11156
|
} catch (_a) {}
|
|
11069
11157
|
|
|
11070
|
-
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|
|
11158
|
+
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|