@leafer/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.module.js +296 -192
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +20 -20
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$7;
|
|
712
|
-
copy$
|
|
711
|
+
copy$d(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$7;
|
|
718
|
-
copy$
|
|
717
|
+
copy$d(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$7;
|
|
724
|
-
copy$
|
|
723
|
+
copy$d(temp, t);
|
|
725
724
|
P$7.toInnerRadiusPointOf(t, matrix, temp);
|
|
726
725
|
return temp;
|
|
727
726
|
},
|
|
@@ -797,7 +796,7 @@ const PointHelper = {
|
|
|
797
796
|
|
|
798
797
|
const P$7 = PointHelper;
|
|
799
798
|
|
|
800
|
-
const {getDistanceFrom: getDistanceFrom, copy: copy$
|
|
799
|
+
const {getDistanceFrom: getDistanceFrom, copy: copy$d, getAtan2: getAtan2} = P$7;
|
|
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$c(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$c(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$c} = 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$7.enable) {
|
|
1661
|
+
if (D$7.filterList.length && D$7.filterList.every(name => name !== this.name)) return;
|
|
1662
|
+
if (D$7.excludeList.length && D$7.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$7.enable) this.warn(...messages);
|
|
1665
1668
|
}
|
|
1666
1669
|
warn(...messages) {
|
|
1667
|
-
if (D$
|
|
1670
|
+
if (D$7.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$7 = Debug;
|
|
1696
1699
|
|
|
1697
1700
|
const debug$i = 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$b, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$4} = 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$b(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$8, m: m, L: L$9, l: l, H: H, h: h, V: V, v: v, C: C$7, c: c, S: S, s: s, Q: Q$6, q: q, T: T, t: t, A: A, a: a, Z: Z$7, z: z, N: N$5, D: D$
|
|
2791
|
+
const {M: M$8, m: m, L: L$9, l: l, H: H, h: h, V: V, v: v, C: C$7, c: c, S: S, s: s, Q: Q$6, q: q, T: T, t: t, A: A, a: a, Z: Z$7, z: z, N: N$5, D: D$6, X: X$5, G: G$5, F: F$6, O: O$6, P: P$5, U: U$5} = PathCommandMap;
|
|
2783
2792
|
|
|
2784
2793
|
const {rect: rect$3, 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$6:
|
|
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$7, L: L$8, C: C$6, Q: Q$5, Z: Z$6, N: N$4, D: D$
|
|
3112
|
+
const {M: M$7, L: L$8, C: C$6, Q: Q$5, Z: Z$6, N: N$4, D: D$5, X: X$4, G: G$4, F: F$5, O: O$5, P: P$4, U: U$4} = 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$5, x, y, width, height, ...fourCorners);
|
|
3140
3149
|
} else {
|
|
3141
3150
|
data.push(N$4, x, y, width, height);
|
|
3142
3151
|
}
|
|
@@ -3279,7 +3288,7 @@ class PathCreator {
|
|
|
3279
3288
|
paint() {}
|
|
3280
3289
|
}
|
|
3281
3290
|
|
|
3282
|
-
const {M: M$6, L: L$7, C: C$5, Q: Q$4, Z: Z$5, N: N$3, D: D$
|
|
3291
|
+
const {M: M$6, L: L$7, C: C$5, Q: Q$4, Z: Z$5, N: N$3, D: D$4, X: X$3, G: G$3, F: F$4, O: O$4, P: P$3, U: U$3} = PathCommandMap;
|
|
3283
3292
|
|
|
3284
3293
|
const debug$e = 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$4:
|
|
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$5, L: L$6, C: C$4, Q: Q$3, Z: Z$4, N: N$2, D: D$
|
|
3376
|
+
const {M: M$5, L: L$6, C: C$4, Q: Q$3, Z: Z$4, N: N$2, D: D$3, X: X$2, G: G$2, F: F$3, O: O$3, P: P$2, U: U$2} = 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$a, addPoint: addPoint$1, setPoint: setPoint$3, addBounds: addBounds, toBounds: toBounds$3} = TwoPointBoundsHelper;
|
|
3372
3381
|
|
|
3373
3382
|
const debug$d = 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$3:
|
|
3444
3453
|
case X$2:
|
|
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$
|
|
3457
|
+
i += command === D$3 ? 9 : 6;
|
|
3449
3458
|
break;
|
|
3450
3459
|
|
|
3451
3460
|
case G$2:
|
|
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$a(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$3:
|
|
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$a(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$2:
|
|
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$a(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$9, 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$3 = {}, {round: round$3} = 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$4.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$9(matrix$3, o);
|
|
4578
4598
|
scaleOfOuter$2(matrix$3, origin, scaleX, scaleY);
|
|
4579
|
-
if (
|
|
4599
|
+
if (L$4.hasHighPosition(t)) {
|
|
4580
4600
|
L$4.setTransform(t, matrix$3, resize, transition);
|
|
4581
4601
|
} else {
|
|
4582
4602
|
const x = t.x + matrix$3.e - o.e, y = t.y + matrix$3.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$9(matrix$3, o);
|
|
4597
4617
|
rotateOfOuter$2(matrix$3, origin, angle);
|
|
4598
|
-
if (
|
|
4618
|
+
if (L$4.hasHighPosition(t)) L$4.setTransform(t, matrix$3, false, transition); else t.set({
|
|
4599
4619
|
x: t.x + matrix$3.e - o.e,
|
|
4600
4620
|
y: t.y + matrix$3.f - o.f,
|
|
4601
4621
|
rotation: MathHelper.formatRotation(t.rotation + angle)
|
|
@@ -4605,24 +4625,28 @@ const LeafHelper = {
|
|
|
4605
4625
|
L$4.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$9(matrix$3, t.__localMatrix);
|
|
4609
4629
|
skewOfOuter(matrix$3, origin, skewX, skewY);
|
|
4610
4630
|
L$4.setTransform(t, matrix$3, resize, transition);
|
|
4611
4631
|
},
|
|
4612
4632
|
transformWorld(t, transform, resize, transition) {
|
|
4613
|
-
copy$
|
|
4633
|
+
copy$9(matrix$3, t.worldTransform);
|
|
4614
4634
|
multiplyParent$3(matrix$3, transform);
|
|
4615
|
-
if (t.parent) divideParent(matrix$3, t.parent.
|
|
4635
|
+
if (t.parent) divideParent(matrix$3, t.parent.scrollWorldTransform);
|
|
4616
4636
|
L$4.setTransform(t, matrix$3, resize, transition);
|
|
4617
4637
|
},
|
|
4618
4638
|
transform(t, transform, resize, transition) {
|
|
4619
|
-
copy$
|
|
4639
|
+
copy$9(matrix$3, t.localTransform);
|
|
4620
4640
|
multiplyParent$3(matrix$3, transform);
|
|
4621
4641
|
L$4.setTransform(t, matrix$3, resize, transition);
|
|
4622
4642
|
},
|
|
4623
4643
|
setTransform(t, transform, resize, transition) {
|
|
4624
4644
|
const data = t.__, originPoint = data.origin && L$4.getInnerOrigin(t, data.origin);
|
|
4625
4645
|
const layout = getLayout(transform, originPoint, data.around && L$4.getInnerOrigin(t, data.around));
|
|
4646
|
+
if (L$4.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$3, relative.
|
|
4677
|
+
copy$9(matrix$3, t.worldTransform);
|
|
4678
|
+
divideParent(matrix$3, relative.scrollWorldTransform);
|
|
4655
4679
|
return temp ? matrix$3 : Object.assign({}, matrix$3);
|
|
4656
4680
|
},
|
|
4657
4681
|
drop(t, parent, index, resize) {
|
|
4658
4682
|
t.setTransform(L$4.getRelativeWorld(t, parent, true), resize);
|
|
4659
4683
|
parent.add(t, index);
|
|
4660
4684
|
},
|
|
4685
|
+
hasHighPosition(t) {
|
|
4686
|
+
return t.origin || t.around || L$4.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$4 = LeafHelper;
|
|
|
4683
4713
|
const {updateAllMatrix: updateAllMatrix$4, updateMatrix: updateMatrix$4, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1} = L$4;
|
|
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$3} = LeafHelper;
|
|
4811
4840
|
|
|
4812
|
-
const {toOuterOf: toOuterOf$2, getPoints: getPoints, copy: copy$
|
|
4841
|
+
const {toOuterOf: toOuterOf$2, getPoints: getPoints, copy: copy$8} = 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$8(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$4, tempPoint: tempPoint$1} = 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$3, updateAllMatrix: updateAllMatrix$3} = LeafH
|
|
|
5685
5729
|
|
|
5686
5730
|
const {updateBounds: updateBounds$2} = BranchHelper;
|
|
5687
5731
|
|
|
5688
|
-
const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$2, copy: copy$
|
|
5732
|
+
const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$2, copy: copy$7} = BoundsHelper;
|
|
5689
5733
|
|
|
5690
5734
|
const {toBounds: toBounds$2} = 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$2(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
|
|
5796
5840
|
},
|
|
5797
|
-
__updateRenderBounds() {
|
|
5841
|
+
__updateRenderBounds(_bounds) {
|
|
5798
5842
|
const layout = this.__layout;
|
|
5799
|
-
layout.renderSpread > 0 ? copyAndSpread$2(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$
|
|
5843
|
+
layout.renderSpread > 0 ? copyAndSpread$2(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$7(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$6, move: move$6} = 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$6(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$6(to, local);
|
|
6220
6268
|
}
|
|
6221
6269
|
}
|
|
6222
6270
|
worldToInner(world, to, distance, relative) {
|
|
@@ -6235,7 +6283,7 @@ let Leaf = class Leaf {
|
|
|
6235
6283
|
}
|
|
6236
6284
|
getBoxPointByInner(inner, _relative, _distance, change) {
|
|
6237
6285
|
const point = change ? inner : Object.assign({}, inner), {x: x, y: y} = this.boxBounds;
|
|
6238
|
-
move$
|
|
6286
|
+
move$6(point, -x, -y);
|
|
6239
6287
|
return point;
|
|
6240
6288
|
}
|
|
6241
6289
|
getInnerPoint(world, relative, distance, change) {
|
|
@@ -6245,7 +6293,7 @@ let Leaf = class Leaf {
|
|
|
6245
6293
|
}
|
|
6246
6294
|
getInnerPointByBox(box, _relative, _distance, change) {
|
|
6247
6295
|
const point = change ? box : Object.assign({}, box), {x: x, y: y} = this.boxBounds;
|
|
6248
|
-
move$
|
|
6296
|
+
move$6(point, x, y);
|
|
6249
6297
|
return point;
|
|
6250
6298
|
}
|
|
6251
6299
|
getInnerPointByLocal(local, _relative, distance, change) {
|
|
@@ -6437,14 +6485,14 @@ let Branch = class Branch extends Leaf {
|
|
|
6437
6485
|
}
|
|
6438
6486
|
return 0;
|
|
6439
6487
|
}
|
|
6440
|
-
__updateBoxBounds() {
|
|
6441
|
-
setListWithFn$1(this.__layout.boxBounds, this.children, this.__hasMask ? maskLocalBoxBounds : localBoxBounds);
|
|
6488
|
+
__updateBoxBounds(_secondLayout, bounds) {
|
|
6489
|
+
setListWithFn$1(bounds || this.__layout.boxBounds, this.children, this.__hasMask ? maskLocalBoxBounds : localBoxBounds);
|
|
6442
6490
|
}
|
|
6443
|
-
__updateStrokeBounds() {
|
|
6444
|
-
setListWithFn$1(this.__layout.strokeBounds, this.children, this.__hasMask ? maskLocalStrokeBounds : localStrokeBounds);
|
|
6491
|
+
__updateStrokeBounds(bounds) {
|
|
6492
|
+
setListWithFn$1(bounds || this.__layout.strokeBounds, this.children, this.__hasMask ? maskLocalStrokeBounds : localStrokeBounds);
|
|
6445
6493
|
}
|
|
6446
|
-
__updateRenderBounds() {
|
|
6447
|
-
setListWithFn$1(this.__layout.renderBounds, this.children, this.__hasMask ? maskLocalRenderBounds : localRenderBounds);
|
|
6494
|
+
__updateRenderBounds(bounds) {
|
|
6495
|
+
setListWithFn$1(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);
|
|
@@ -7596,6 +7644,7 @@ class Picker {
|
|
|
7596
7644
|
hit = child.__.hitRadius ? true : hitRadiusPoint$1(child.__world, point);
|
|
7597
7645
|
if (child.isBranch) {
|
|
7598
7646
|
if (hit || child.__ignoreHitWorld) {
|
|
7647
|
+
if (child.topChildren) this.eachFind(child.topChildren, false);
|
|
7599
7648
|
this.eachFind(child.children, child.__onlyHitMask);
|
|
7600
7649
|
if (child.isBranchLeaf) this.hitChild(child, point);
|
|
7601
7650
|
}
|
|
@@ -7943,7 +7992,7 @@ class BoxData extends GroupData {
|
|
|
7943
7992
|
}
|
|
7944
7993
|
get __clipAfterFill() {
|
|
7945
7994
|
const t = this;
|
|
7946
|
-
return t.overflow
|
|
7995
|
+
return t.overflow !== "show" && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill);
|
|
7947
7996
|
}
|
|
7948
7997
|
}
|
|
7949
7998
|
|
|
@@ -8099,6 +8148,41 @@ const UIBounds = {
|
|
|
8099
8148
|
}
|
|
8100
8149
|
};
|
|
8101
8150
|
|
|
8151
|
+
const DragBoundsHelper = {
|
|
8152
|
+
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
8153
|
+
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
8154
|
+
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
8155
|
+
if (!change) move = Object.assign({}, move);
|
|
8156
|
+
const isBiggerWidth = content.width > dragBounds.width;
|
|
8157
|
+
const isBiggerHeight = content.height > dragBounds.height;
|
|
8158
|
+
if (isBiggerWidth && dragBoundsType !== "outer") {
|
|
8159
|
+
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
8160
|
+
} else {
|
|
8161
|
+
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
8162
|
+
}
|
|
8163
|
+
if (isBiggerHeight && dragBoundsType !== "outer") {
|
|
8164
|
+
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
8165
|
+
} else {
|
|
8166
|
+
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
8167
|
+
}
|
|
8168
|
+
move.x = MathHelper.float(move.x);
|
|
8169
|
+
move.y = MathHelper.float(move.y);
|
|
8170
|
+
return move;
|
|
8171
|
+
},
|
|
8172
|
+
axisMove(leaf, move) {
|
|
8173
|
+
const {draggable: draggable} = leaf;
|
|
8174
|
+
if (draggable === "x") move.y = 0;
|
|
8175
|
+
if (draggable === "y") move.x = 0;
|
|
8176
|
+
},
|
|
8177
|
+
limitMove(leaf, move) {
|
|
8178
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
8179
|
+
if (dragBounds) D$2.getValidMove(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, dragBoundsType, move, true);
|
|
8180
|
+
D$2.axisMove(leaf, move);
|
|
8181
|
+
}
|
|
8182
|
+
};
|
|
8183
|
+
|
|
8184
|
+
const D$2 = DragBoundsHelper;
|
|
8185
|
+
|
|
8102
8186
|
const {stintSet: stintSet$1} = DataHelper;
|
|
8103
8187
|
|
|
8104
8188
|
const UIRender = {
|
|
@@ -8413,9 +8497,9 @@ __decorate([ positionType(0, true) ], UI.prototype, "offsetX", void 0);
|
|
|
8413
8497
|
|
|
8414
8498
|
__decorate([ positionType(0, true) ], UI.prototype, "offsetY", void 0);
|
|
8415
8499
|
|
|
8416
|
-
__decorate([
|
|
8500
|
+
__decorate([ scrollType(0, true) ], UI.prototype, "scrollX", void 0);
|
|
8417
8501
|
|
|
8418
|
-
__decorate([
|
|
8502
|
+
__decorate([ scrollType(0, true) ], UI.prototype, "scrollY", void 0);
|
|
8419
8503
|
|
|
8420
8504
|
__decorate([ autoLayoutType() ], UI.prototype, "origin", void 0);
|
|
8421
8505
|
|
|
@@ -8445,6 +8529,8 @@ __decorate([ dataType(false) ], UI.prototype, "draggable", void 0);
|
|
|
8445
8529
|
|
|
8446
8530
|
__decorate([ dataType() ], UI.prototype, "dragBounds", void 0);
|
|
8447
8531
|
|
|
8532
|
+
__decorate([ dataType("auto") ], UI.prototype, "dragBoundsType", void 0);
|
|
8533
|
+
|
|
8448
8534
|
__decorate([ dataType(false) ], UI.prototype, "editable", void 0);
|
|
8449
8535
|
|
|
8450
8536
|
__decorate([ hitType(true) ], UI.prototype, "hittable", void 0);
|
|
@@ -8867,7 +8953,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8867
8953
|
zoom(_zoomType, _optionsOrPadding, _scroll, _transition) {
|
|
8868
8954
|
return Plugin.need("view");
|
|
8869
8955
|
}
|
|
8870
|
-
getValidMove(moveX, moveY) {
|
|
8956
|
+
getValidMove(moveX, moveY, _checkLimit) {
|
|
8871
8957
|
return {
|
|
8872
8958
|
x: moveX,
|
|
8873
8959
|
y: moveY
|
|
@@ -8956,12 +9042,10 @@ __decorate([ dataProcessor(RectData) ], Rect.prototype, "__", void 0);
|
|
|
8956
9042
|
|
|
8957
9043
|
Rect = __decorate([ useModule(RectRender), rewriteAble(), registerUI() ], Rect);
|
|
8958
9044
|
|
|
8959
|
-
const {
|
|
9045
|
+
const {add: add, includes: includes$1, scroll: scroll} = BoundsHelper;
|
|
8960
9046
|
|
|
8961
9047
|
const rect$1 = Rect.prototype, group = Group.prototype;
|
|
8962
9048
|
|
|
8963
|
-
const childrenRenderBounds = {};
|
|
8964
|
-
|
|
8965
9049
|
let Box = class Box extends Group {
|
|
8966
9050
|
get __tag() {
|
|
8967
9051
|
return "Box";
|
|
@@ -9007,22 +9091,27 @@ let Box = class Box extends Group {
|
|
|
9007
9091
|
__updateRenderBounds() {
|
|
9008
9092
|
let isOverflow;
|
|
9009
9093
|
if (this.children.length) {
|
|
9010
|
-
const data = this.__, {renderBounds: renderBounds, boxBounds: boxBounds} =
|
|
9011
|
-
|
|
9012
|
-
|
|
9013
|
-
|
|
9014
|
-
|
|
9015
|
-
childrenRenderBounds
|
|
9016
|
-
childrenRenderBounds.y += data.scrollY;
|
|
9094
|
+
const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
|
|
9095
|
+
const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
|
|
9096
|
+
super.__updateRenderBounds(childrenRenderBounds);
|
|
9097
|
+
if (data.overflow.includes("scroll")) {
|
|
9098
|
+
add(childrenRenderBounds, boxBounds);
|
|
9099
|
+
scroll(childrenRenderBounds, data);
|
|
9017
9100
|
}
|
|
9101
|
+
this.__updateRectRenderBounds();
|
|
9018
9102
|
isOverflow = !includes$1(boxBounds, childrenRenderBounds);
|
|
9019
|
-
if (isOverflow && data.overflow
|
|
9103
|
+
if (isOverflow && data.overflow === "show") add(renderBounds, childrenRenderBounds);
|
|
9020
9104
|
} else this.__updateRectRenderBounds();
|
|
9021
9105
|
DataHelper.stintSet(this, "isOverflow", isOverflow);
|
|
9022
|
-
this.
|
|
9106
|
+
this.__checkScroll();
|
|
9023
9107
|
}
|
|
9024
9108
|
__updateRectRenderBounds() {}
|
|
9025
|
-
|
|
9109
|
+
__updateWorldBounds() {
|
|
9110
|
+
if (this.hasScroller) this.__updateScroll();
|
|
9111
|
+
super.__updateWorldBounds();
|
|
9112
|
+
}
|
|
9113
|
+
__checkScroll() {}
|
|
9114
|
+
__updateScroll() {}
|
|
9026
9115
|
__updateRectChange() {}
|
|
9027
9116
|
__updateChange() {
|
|
9028
9117
|
super.__updateChange();
|
|
@@ -9037,7 +9126,7 @@ let Box = class Box extends Group {
|
|
|
9037
9126
|
this.__renderRect(canvas, options);
|
|
9038
9127
|
if (this.children.length) this.__renderGroup(canvas, options);
|
|
9039
9128
|
}
|
|
9040
|
-
if (this.
|
|
9129
|
+
if (this.hasScroller) this.scroller.__render(canvas, options);
|
|
9041
9130
|
}
|
|
9042
9131
|
__drawContent(canvas, options) {
|
|
9043
9132
|
this.__renderGroup(canvas, options);
|
|
@@ -9710,7 +9799,7 @@ let App = class App extends Leafer {
|
|
|
9710
9799
|
if (this.viewReady) this.renderer.update();
|
|
9711
9800
|
}
|
|
9712
9801
|
__render(canvas, options) {
|
|
9713
|
-
if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options
|
|
9802
|
+
if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options.bounds));
|
|
9714
9803
|
}
|
|
9715
9804
|
__onResize(event) {
|
|
9716
9805
|
this.forEach(leafer => leafer.resize(event));
|
|
@@ -9878,26 +9967,11 @@ let DragEvent = class DragEvent extends PointerEvent {
|
|
|
9878
9967
|
const move = leaf.getLocalPoint(total, null, true);
|
|
9879
9968
|
PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
|
|
9880
9969
|
if (checkLimit) this.limitMove(leaf, move);
|
|
9970
|
+
DragBoundsHelper.axisMove(leaf, move);
|
|
9881
9971
|
return move;
|
|
9882
9972
|
}
|
|
9883
9973
|
static limitMove(leaf, move) {
|
|
9884
|
-
|
|
9885
|
-
if (dragBounds) this.getMoveInDragBounds(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, move, true);
|
|
9886
|
-
if (draggable === "x") move.y = 0;
|
|
9887
|
-
if (draggable === "y") move.x = 0;
|
|
9888
|
-
}
|
|
9889
|
-
static getMoveInDragBounds(childBox, dragBounds, move, change) {
|
|
9890
|
-
const x = childBox.x + move.x, y = childBox.y + move.y, right = x + childBox.width, bottom = y + childBox.height;
|
|
9891
|
-
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
9892
|
-
if (!change) move = Object.assign({}, move);
|
|
9893
|
-
if (BoundsHelper.includes(childBox, dragBounds)) {
|
|
9894
|
-
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
9895
|
-
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
9896
|
-
} else {
|
|
9897
|
-
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
9898
|
-
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
9899
|
-
}
|
|
9900
|
-
return move;
|
|
9974
|
+
DragBoundsHelper.limitMove(leaf, move);
|
|
9901
9975
|
}
|
|
9902
9976
|
getPageMove(total) {
|
|
9903
9977
|
this.assignMove(total);
|
|
@@ -10182,11 +10256,12 @@ class Dragger {
|
|
|
10182
10256
|
const checkLimitMove = !dragLimitAnimate || !!isDragEnd;
|
|
10183
10257
|
list.forEach(leaf => {
|
|
10184
10258
|
if (leaf.draggable) {
|
|
10259
|
+
const axisDrag = isString(leaf.draggable);
|
|
10185
10260
|
const move = DragEvent.getValidMove(leaf, this.dragStartPoints[leaf.innerId], {
|
|
10186
10261
|
x: totalX,
|
|
10187
10262
|
y: totalY
|
|
10188
|
-
}, checkLimitMove);
|
|
10189
|
-
if (dragLimitAnimate && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else leaf.move(move);
|
|
10263
|
+
}, checkLimitMove || axisDrag);
|
|
10264
|
+
if (dragLimitAnimate && !axisDrag && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else leaf.move(move);
|
|
10190
10265
|
}
|
|
10191
10266
|
});
|
|
10192
10267
|
}
|
|
@@ -12057,7 +12132,7 @@ function shadow$1(ui, current, shape) {
|
|
|
12057
12132
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
12058
12133
|
}
|
|
12059
12134
|
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
12060
|
-
if (end && index < end) other.clearWorld(copyBounds
|
|
12135
|
+
if (end && index < end) other.clearWorld(copyBounds);
|
|
12061
12136
|
});
|
|
12062
12137
|
other.recycle(copyBounds);
|
|
12063
12138
|
}
|
|
@@ -12121,7 +12196,7 @@ function innerShadow(ui, current, shape) {
|
|
|
12121
12196
|
}
|
|
12122
12197
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), "source-in");
|
|
12123
12198
|
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
12124
|
-
if (end && index < end) other.clearWorld(copyBounds
|
|
12199
|
+
if (end && index < end) other.clearWorld(copyBounds);
|
|
12125
12200
|
});
|
|
12126
12201
|
other.recycle(copyBounds);
|
|
12127
12202
|
}
|
|
@@ -12220,7 +12295,7 @@ function copyContent(leaf, canvas, content, maskOpacity, blendMode, recycle) {
|
|
|
12220
12295
|
canvas.resetTransform();
|
|
12221
12296
|
canvas.opacity = maskOpacity;
|
|
12222
12297
|
canvas.copyWorld(content, realBounds, undefined, blendMode);
|
|
12223
|
-
recycle ? content.recycle(realBounds) : content.clearWorld(realBounds
|
|
12298
|
+
recycle ? content.recycle(realBounds) : content.clearWorld(realBounds);
|
|
12224
12299
|
}
|
|
12225
12300
|
|
|
12226
12301
|
const money = "¥¥$€££¢¢";
|
|
@@ -13833,7 +13908,7 @@ class EditBox extends Group {
|
|
|
13833
13908
|
if (pointType && pointType.includes("resize")) ResizeEvent.resizingKeys = editor.leafList.keys;
|
|
13834
13909
|
}
|
|
13835
13910
|
onDragEnd(e) {
|
|
13836
|
-
if (this.
|
|
13911
|
+
if (this.moving) this.transformTool.onMove(e);
|
|
13837
13912
|
this.dragPoint = null;
|
|
13838
13913
|
this.resetDoing();
|
|
13839
13914
|
const {name: name, pointType: pointType} = e.current;
|
|
@@ -13866,6 +13941,10 @@ class EditBox extends Group {
|
|
|
13866
13941
|
}
|
|
13867
13942
|
}
|
|
13868
13943
|
}
|
|
13944
|
+
onMoveEnd(e) {
|
|
13945
|
+
if (this.moving) this.transformTool.onMove(e);
|
|
13946
|
+
this.resetDoing();
|
|
13947
|
+
}
|
|
13869
13948
|
onScale(e) {
|
|
13870
13949
|
if (this.canGesture) {
|
|
13871
13950
|
e.stop();
|
|
@@ -13956,7 +14035,7 @@ class EditBox extends Group {
|
|
|
13956
14035
|
const {rect: rect, editor: editor, __eventIds: events} = this;
|
|
13957
14036
|
events.push(rect.on_([ [ DragEvent.START, this.onDragStart, this ], [ DragEvent.DRAG, this.onDrag, this ], [ DragEvent.END, this.onDragEnd, this ], [ PointerEvent.ENTER, () => updateMoveCursor(this) ], [ PointerEvent.DOUBLE_TAP, this.onDoubleTap, this ], [ PointerEvent.LONG_PRESS, this.onLongPress, this ] ]));
|
|
13958
14037
|
this.waitLeafer(() => {
|
|
13959
|
-
events.push(editor.app.on_([ [ [ KeyEvent.HOLD, KeyEvent.UP ], this.onKey, this ], [ KeyEvent.DOWN, this.onArrow, this ], [ MoveEvent.BEFORE_MOVE, this.onMove, this, true ], [ ZoomEvent.BEFORE_ZOOM, this.onScale, this, true ], [ RotateEvent.BEFORE_ROTATE, this.onRotate, this, true ], [ MoveEvent.END, this.
|
|
14038
|
+
events.push(editor.app.on_([ [ [ KeyEvent.HOLD, KeyEvent.UP ], this.onKey, this ], [ KeyEvent.DOWN, this.onArrow, this ], [ MoveEvent.BEFORE_MOVE, this.onMove, this, true ], [ ZoomEvent.BEFORE_ZOOM, this.onScale, this, true ], [ RotateEvent.BEFORE_ROTATE, this.onRotate, this, true ], [ MoveEvent.END, this.onMoveEnd, this ], [ ZoomEvent.END, this.resetDoing, this ], [ RotateEvent.END, this.resetDoing, this ] ]));
|
|
13960
14039
|
});
|
|
13961
14040
|
}
|
|
13962
14041
|
__removeListenEvents() {
|
|
@@ -14129,7 +14208,7 @@ const EditorHelper = {
|
|
|
14129
14208
|
parent.addAt(group, parent.children.indexOf(list[0]));
|
|
14130
14209
|
list.sort(order);
|
|
14131
14210
|
const matrx = new Matrix(element.worldTransform);
|
|
14132
|
-
matrx.divideParent(parent.
|
|
14211
|
+
matrx.divideParent(parent.scrollWorldTransform);
|
|
14133
14212
|
group.setTransform(matrx);
|
|
14134
14213
|
group.editable = true;
|
|
14135
14214
|
group.hitChildren = false;
|
|
@@ -14352,8 +14431,9 @@ class TransformTool {
|
|
|
14352
14431
|
const {target: target, mergeConfig: mergeConfig, dragStartData: dragStartData, app: app} = this.editBox;
|
|
14353
14432
|
let move, {dragLimitAnimate: dragLimitAnimate} = mergeConfig;
|
|
14354
14433
|
if (isUndefined(dragLimitAnimate)) dragLimitAnimate = app && app.config.pointer.dragLimitAnimate;
|
|
14355
|
-
const isMoveEnd = e.type ===
|
|
14356
|
-
const
|
|
14434
|
+
const isMoveEnd = e.type === MoveEvent.END || e.type === DragEvent.END;
|
|
14435
|
+
const axisDrag = isString(target.draggable);
|
|
14436
|
+
const checkLimitMove = !dragLimitAnimate || isMoveEnd || axisDrag;
|
|
14357
14437
|
if (e instanceof MoveEvent) {
|
|
14358
14438
|
move = e.getLocalMove(target);
|
|
14359
14439
|
if (checkLimitMove) DragEvent.limitMove(target, move);
|
|
@@ -14367,7 +14447,9 @@ class TransformTool {
|
|
|
14367
14447
|
}
|
|
14368
14448
|
move = DragEvent.getValidMove(target, dragStartData.point, total, checkLimitMove);
|
|
14369
14449
|
}
|
|
14370
|
-
if (
|
|
14450
|
+
if (move.x || move.y) {
|
|
14451
|
+
if (dragLimitAnimate && !axisDrag && isMoveEnd) LeafHelper.animateMove(this, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else this.move(move);
|
|
14452
|
+
}
|
|
14371
14453
|
}
|
|
14372
14454
|
onScale(e) {
|
|
14373
14455
|
const {target: target, mergeConfig: mergeConfig, single: single, dragStartData: dragStartData} = this.editBox;
|
|
@@ -14642,6 +14724,10 @@ let Editor = class Editor extends Group {
|
|
|
14642
14724
|
get buttons() {
|
|
14643
14725
|
return this.editBox.buttons;
|
|
14644
14726
|
}
|
|
14727
|
+
get targetLeafer() {
|
|
14728
|
+
const first = this.list[0];
|
|
14729
|
+
return first && first.leafer;
|
|
14730
|
+
}
|
|
14645
14731
|
constructor(userConfig, data) {
|
|
14646
14732
|
super(data);
|
|
14647
14733
|
this.leafList = new LeafList;
|
|
@@ -14691,11 +14777,22 @@ let Editor = class Editor extends Group {
|
|
|
14691
14777
|
updateEditTool() {
|
|
14692
14778
|
this.unloadEditTool();
|
|
14693
14779
|
if (this.editing) {
|
|
14694
|
-
const
|
|
14695
|
-
|
|
14696
|
-
this.
|
|
14697
|
-
|
|
14698
|
-
|
|
14780
|
+
const target = this.element;
|
|
14781
|
+
let name = target.editOuter || "EditTool";
|
|
14782
|
+
const {beforeEditOuter: beforeEditOuter} = this.mergeConfig;
|
|
14783
|
+
if (beforeEditOuter) {
|
|
14784
|
+
const check = beforeEditOuter({
|
|
14785
|
+
target: target,
|
|
14786
|
+
name: name
|
|
14787
|
+
});
|
|
14788
|
+
if (isString(check)) name = check; else if (check === false) return;
|
|
14789
|
+
}
|
|
14790
|
+
if (EditToolCreator.list[name]) {
|
|
14791
|
+
const tool = this.editTool = this.editToolList[name] = this.editToolList[name] || EditToolCreator.get(name, this);
|
|
14792
|
+
this.editBox.load();
|
|
14793
|
+
tool.load();
|
|
14794
|
+
this.update();
|
|
14795
|
+
}
|
|
14699
14796
|
}
|
|
14700
14797
|
}
|
|
14701
14798
|
unloadEditTool() {
|
|
@@ -14788,17 +14885,24 @@ let Editor = class Editor extends Group {
|
|
|
14788
14885
|
if (isString(nameOrSelect)) name = nameOrSelect; else if (!select) select = nameOrSelect;
|
|
14789
14886
|
if (target && select) this.target = target;
|
|
14790
14887
|
if (this.single) {
|
|
14791
|
-
|
|
14792
|
-
|
|
14793
|
-
|
|
14888
|
+
if (!target) target = this.element;
|
|
14889
|
+
if (!name) name = target.editInner;
|
|
14890
|
+
const {beforeEditInner: beforeEditInner} = this.mergeConfig;
|
|
14891
|
+
if (beforeEditInner) {
|
|
14892
|
+
const check = beforeEditInner({
|
|
14893
|
+
target: target,
|
|
14894
|
+
name: name
|
|
14895
|
+
});
|
|
14896
|
+
if (isString(check)) name = check; else if (check === false) return;
|
|
14897
|
+
}
|
|
14898
|
+
if (EditToolCreator.list[name]) {
|
|
14794
14899
|
this.editTool.unload();
|
|
14795
14900
|
this.innerEditing = true;
|
|
14796
14901
|
this.innerEditor = this.editToolList[name] = this.editToolList[name] || EditToolCreator.get(name, this);
|
|
14797
|
-
this.innerEditor.editTarget =
|
|
14902
|
+
this.innerEditor.editTarget = target;
|
|
14798
14903
|
this.emitInnerEvent(InnerEditorEvent.BEFORE_OPEN);
|
|
14799
14904
|
this.innerEditor.load();
|
|
14800
14905
|
this.emitInnerEvent(InnerEditorEvent.OPEN);
|
|
14801
|
-
console.log("hello");
|
|
14802
14906
|
}
|
|
14803
14907
|
}
|
|
14804
14908
|
}
|
|
@@ -14847,10 +14951,13 @@ let Editor = class Editor extends Group {
|
|
|
14847
14951
|
onRenderStart() {
|
|
14848
14952
|
if (this.targetChanged) this.update();
|
|
14849
14953
|
}
|
|
14954
|
+
onChildScroll() {
|
|
14955
|
+
if (this.multiple) this.updateEditBox();
|
|
14956
|
+
}
|
|
14850
14957
|
listenTargetEvents() {
|
|
14851
14958
|
if (!this.targetEventIds.length) {
|
|
14852
|
-
const {app: app, leafer: leafer, editMask: editMask} = this;
|
|
14853
|
-
this.targetEventIds = [ leafer.on_(RenderEvent.START, this.onRenderStart, this), app.on_(RenderEvent.CHILD_START, this.onAppRenderStart, this) ];
|
|
14959
|
+
const {app: app, leafer: leafer, targetLeafer: targetLeafer, editMask: editMask} = this;
|
|
14960
|
+
this.targetEventIds = [ leafer.on_(RenderEvent.START, this.onRenderStart, this), targetLeafer && targetLeafer.on_(PropertyEvent.SCROLL, this.onChildScroll, this), app.on_(RenderEvent.CHILD_START, this.onAppRenderStart, this) ];
|
|
14854
14961
|
if (editMask.visible) editMask.forceRender();
|
|
14855
14962
|
}
|
|
14856
14963
|
}
|
|
@@ -14999,7 +15106,7 @@ EditTool = __decorate([ registerEditTool() ], EditTool);
|
|
|
14999
15106
|
|
|
15000
15107
|
const {left: left$1, right: right$1} = Direction9;
|
|
15001
15108
|
|
|
15002
|
-
const {move: move$
|
|
15109
|
+
const {move: move$5, copy: copy$1, toNumberPoints: toNumberPoints} = PointHelper;
|
|
15003
15110
|
|
|
15004
15111
|
let LineEditTool = class LineEditTool extends EditTool {
|
|
15005
15112
|
constructor() {
|
|
@@ -15073,11 +15180,11 @@ let LineEditTool = class LineEditTool extends EditTool {
|
|
|
15073
15180
|
dragPoint(fromPoint, toPoint, isDragFrom, around, movePoint) {
|
|
15074
15181
|
const {x: x, y: y} = movePoint;
|
|
15075
15182
|
if (isDragFrom) {
|
|
15076
|
-
move$
|
|
15077
|
-
if (around) move$
|
|
15183
|
+
move$5(fromPoint, x, y);
|
|
15184
|
+
if (around) move$5(toPoint, -x, -y);
|
|
15078
15185
|
} else {
|
|
15079
|
-
if (around) move$
|
|
15080
|
-
move$
|
|
15186
|
+
if (around) move$5(fromPoint, -x, -y);
|
|
15187
|
+
move$5(toPoint, x, y);
|
|
15081
15188
|
}
|
|
15082
15189
|
}
|
|
15083
15190
|
onSkew(_e) {}
|
|
@@ -15377,7 +15484,9 @@ function addViewport(leafer, mergeConfig, custom) {
|
|
|
15377
15484
|
addViewportConfig(leafer.parentApp ? leafer.parentApp : leafer, mergeConfig);
|
|
15378
15485
|
if (leafer.isApp || custom) return;
|
|
15379
15486
|
leafer.__eventIds.push(leafer.on_(MoveEvent.BEFORE_MOVE, e => {
|
|
15380
|
-
leafer.zoomLayer.move(leafer.getValidMove(e.moveX, e.moveY));
|
|
15487
|
+
leafer.zoomLayer.move(leafer.getValidMove(e.moveX, e.moveY, false));
|
|
15488
|
+
}), leafer.on_(MoveEvent.END, e => {
|
|
15489
|
+
LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY));
|
|
15381
15490
|
}), leafer.on_(ZoomEvent.BEFORE_ZOOM, e => {
|
|
15382
15491
|
const {zoomLayer: zoomLayer} = leafer;
|
|
15383
15492
|
const changeScale = leafer.getValidScale(e.scale);
|
|
@@ -15592,32 +15701,27 @@ class Transformer {
|
|
|
15592
15701
|
|
|
15593
15702
|
const leafer = Leafer.prototype;
|
|
15594
15703
|
|
|
15595
|
-
const bounds = new Bounds;
|
|
15704
|
+
const bounds = new Bounds, move$4 = new Point;
|
|
15596
15705
|
|
|
15597
15706
|
leafer.initType = function(type) {
|
|
15598
15707
|
LeaferTypeCreator.run(type, this);
|
|
15599
15708
|
};
|
|
15600
15709
|
|
|
15601
|
-
leafer.getValidMove = function(moveX, moveY) {
|
|
15710
|
+
leafer.getValidMove = function(moveX, moveY, checkLimit = true) {
|
|
15602
15711
|
const {scroll: scroll, disabled: disabled} = this.app.config.move;
|
|
15712
|
+
move$4.set(moveX, moveY);
|
|
15603
15713
|
if (scroll) {
|
|
15604
15714
|
const type = scroll === true ? "" : scroll;
|
|
15605
|
-
if (type.includes("x"))
|
|
15606
|
-
|
|
15607
|
-
|
|
15608
|
-
|
|
15609
|
-
|
|
15610
|
-
if (x >= 0 && right <= 0) moveX = 0; else if (moveX > 0) {
|
|
15611
|
-
if (x + moveX > 0) moveX = -x;
|
|
15612
|
-
} else if (moveX < 0 && right + moveX < 0) moveX = -right;
|
|
15613
|
-
if (y >= 0 && bottom <= 0) moveY = 0; else if (moveY > 0) {
|
|
15614
|
-
if (y + moveY > 0) moveY = -y;
|
|
15615
|
-
} else if (moveY < 0 && bottom + moveY < 0) moveY = -bottom;
|
|
15715
|
+
if (type.includes("x")) move$4.y = 0; else if (type.includes("y")) move$4.x = 0; else Math.abs(move$4.x) > Math.abs(move$4.y) ? move$4.y = 0 : move$4.x = 0;
|
|
15716
|
+
if (checkLimit && type.includes("limit")) {
|
|
15717
|
+
bounds.set(this.__world).addPoint(this.zoomLayer);
|
|
15718
|
+
DragBoundsHelper.getValidMove(bounds, this.canvas.bounds, "inner", move$4, true);
|
|
15719
|
+
if (type.includes("x")) move$4.y = 0; else if (type.includes("y")) move$4.x = 0;
|
|
15616
15720
|
}
|
|
15617
15721
|
}
|
|
15618
15722
|
return {
|
|
15619
|
-
x: disabled ? 0 :
|
|
15620
|
-
y: disabled ? 0 :
|
|
15723
|
+
x: disabled ? 0 : move$4.x,
|
|
15724
|
+
y: disabled ? 0 : move$4.y
|
|
15621
15725
|
};
|
|
15622
15726
|
};
|
|
15623
15727
|
|
|
@@ -19210,4 +19314,4 @@ Object.assign(Filter, {
|
|
|
19210
19314
|
}
|
|
19211
19315
|
});
|
|
19212
19316
|
|
|
19213
|
-
export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, SelectArea, Selector, Star, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TransformTool, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, 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, motionPathType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$3 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|
|
19317
|
+
export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, SelectArea, Selector, Star, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TransformTool, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, 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, motionPathType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$3 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|