@leafer/miniapp 1.9.1 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/miniapp.module.js +267 -183
- 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,12 @@ const BoundsHelper = {
|
|
|
1191
1190
|
t.x += x;
|
|
1192
1191
|
t.y += y;
|
|
1193
1192
|
},
|
|
1193
|
+
scroll(t, data) {
|
|
1194
|
+
if (data.scrollY || data.scrollX) {
|
|
1195
|
+
t.x += data.scrollX;
|
|
1196
|
+
t.y += data.scrollY;
|
|
1197
|
+
}
|
|
1198
|
+
},
|
|
1194
1199
|
getByMove(t, x, y) {
|
|
1195
1200
|
t = Object.assign({}, t);
|
|
1196
1201
|
B.move(t, x, y);
|
|
@@ -1200,7 +1205,7 @@ const BoundsHelper = {
|
|
|
1200
1205
|
if (!to) {
|
|
1201
1206
|
to = t;
|
|
1202
1207
|
} else {
|
|
1203
|
-
copy$
|
|
1208
|
+
copy$c(to, t);
|
|
1204
1209
|
}
|
|
1205
1210
|
if (parent) {
|
|
1206
1211
|
to.offsetX = -(B.maxX(parent) - t.x);
|
|
@@ -1352,7 +1357,7 @@ const BoundsHelper = {
|
|
|
1352
1357
|
if (bounds && (bounds.width || bounds.height)) {
|
|
1353
1358
|
if (first) {
|
|
1354
1359
|
first = false;
|
|
1355
|
-
if (!addMode) copy$
|
|
1360
|
+
if (!addMode) copy$c(t, bounds);
|
|
1356
1361
|
} else {
|
|
1357
1362
|
add$1(t, bounds);
|
|
1358
1363
|
}
|
|
@@ -1439,7 +1444,7 @@ const BoundsHelper = {
|
|
|
1439
1444
|
|
|
1440
1445
|
const B = BoundsHelper;
|
|
1441
1446
|
|
|
1442
|
-
const {add: add$1, copy: copy$
|
|
1447
|
+
const {add: add$1, copy: copy$c} = B;
|
|
1443
1448
|
|
|
1444
1449
|
class Bounds {
|
|
1445
1450
|
get minX() {
|
|
@@ -1654,17 +1659,17 @@ class Debug {
|
|
|
1654
1659
|
showHit ? canvas.stroke() : canvas.strokeWorld(w, color);
|
|
1655
1660
|
}
|
|
1656
1661
|
log(...messages) {
|
|
1657
|
-
if (D$
|
|
1658
|
-
if (D$
|
|
1659
|
-
if (D$
|
|
1662
|
+
if (D$7.enable) {
|
|
1663
|
+
if (D$7.filterList.length && D$7.filterList.every(name => name !== this.name)) return;
|
|
1664
|
+
if (D$7.excludeList.length && D$7.excludeList.some(name => name === this.name)) return;
|
|
1660
1665
|
console.log("%c" + this.name, "color:#21ae62", ...messages);
|
|
1661
1666
|
}
|
|
1662
1667
|
}
|
|
1663
1668
|
tip(...messages) {
|
|
1664
|
-
if (D$
|
|
1669
|
+
if (D$7.enable) this.warn(...messages);
|
|
1665
1670
|
}
|
|
1666
1671
|
warn(...messages) {
|
|
1667
|
-
if (D$
|
|
1672
|
+
if (D$7.showWarn) console.warn(this.name, ...messages);
|
|
1668
1673
|
}
|
|
1669
1674
|
repeat(name, ...messages) {
|
|
1670
1675
|
if (!this.repeatMap[name]) {
|
|
@@ -1692,7 +1697,7 @@ function getNameList(name) {
|
|
|
1692
1697
|
return name;
|
|
1693
1698
|
}
|
|
1694
1699
|
|
|
1695
|
-
const D$
|
|
1700
|
+
const D$7 = Debug;
|
|
1696
1701
|
|
|
1697
1702
|
const debug$i = Debug.get("RunTime");
|
|
1698
1703
|
|
|
@@ -2137,7 +2142,7 @@ __decorate([ contextMethod() ], Canvas$1.prototype, "measureText", null);
|
|
|
2137
2142
|
|
|
2138
2143
|
__decorate([ contextMethod() ], Canvas$1.prototype, "strokeText", null);
|
|
2139
2144
|
|
|
2140
|
-
const {copy: copy$
|
|
2145
|
+
const {copy: copy$b, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$4} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
2141
2146
|
|
|
2142
2147
|
const minSize = {
|
|
2143
2148
|
width: 1,
|
|
@@ -2302,44 +2307,44 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2302
2307
|
const {pixelRatio: pixelRatio} = this;
|
|
2303
2308
|
this.filter = `blur(${blur * pixelRatio}px)`;
|
|
2304
2309
|
}
|
|
2305
|
-
copyWorld(canvas, from, to, blendMode) {
|
|
2310
|
+
copyWorld(canvas, from, to, blendMode, ceilPixel = true) {
|
|
2306
2311
|
if (blendMode) this.blendMode = blendMode;
|
|
2307
2312
|
if (from) {
|
|
2308
|
-
|
|
2309
|
-
if (!to) to =
|
|
2310
|
-
this.drawImage(canvas.view,
|
|
2313
|
+
this.setTempPixelBounds(from, ceilPixel);
|
|
2314
|
+
if (!to) to = tempPixelBounds; else this.setTempPixelBounds2(to, ceilPixel), to = tempPixelBounds2;
|
|
2315
|
+
this.drawImage(canvas.view, tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height, to.x, to.y, to.width, to.height);
|
|
2311
2316
|
} else {
|
|
2312
2317
|
this.drawImage(canvas.view, 0, 0);
|
|
2313
2318
|
}
|
|
2314
2319
|
if (blendMode) this.blendMode = "source-over";
|
|
2315
2320
|
}
|
|
2316
|
-
copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode) {
|
|
2317
|
-
if (blendMode) this.blendMode = blendMode;
|
|
2321
|
+
copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode, ceilPixel = true) {
|
|
2318
2322
|
if (fromWorld.b || fromWorld.c) {
|
|
2319
2323
|
this.save();
|
|
2320
2324
|
this.resetTransform();
|
|
2321
|
-
this.copyWorld(canvas, fromWorld, BoundsHelper.tempToOuterOf(toInnerBounds, fromWorld));
|
|
2325
|
+
this.copyWorld(canvas, fromWorld, BoundsHelper.tempToOuterOf(toInnerBounds, fromWorld), blendMode, ceilPixel);
|
|
2322
2326
|
this.restore();
|
|
2323
2327
|
} else {
|
|
2324
|
-
|
|
2325
|
-
this.
|
|
2328
|
+
if (blendMode) this.blendMode = blendMode;
|
|
2329
|
+
this.setTempPixelBounds(fromWorld, ceilPixel);
|
|
2330
|
+
this.drawImage(canvas.view, tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height, toInnerBounds.x, toInnerBounds.y, toInnerBounds.width, toInnerBounds.height);
|
|
2331
|
+
if (blendMode) this.blendMode = "source-over";
|
|
2326
2332
|
}
|
|
2327
|
-
if (blendMode) this.blendMode = "source-over";
|
|
2328
2333
|
}
|
|
2329
|
-
copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform) {
|
|
2334
|
+
copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform, ceilPixel = true) {
|
|
2330
2335
|
this.resetTransform();
|
|
2331
|
-
this.copyWorld(canvas, from, to, blendMode);
|
|
2336
|
+
this.copyWorld(canvas, from, to, blendMode, ceilPixel);
|
|
2332
2337
|
if (!onlyResetTransform) this.useWorldTransform();
|
|
2333
2338
|
}
|
|
2334
2339
|
useGrayscaleAlpha(bounds) {
|
|
2335
|
-
this.
|
|
2340
|
+
this.setTempPixelBounds(bounds, true, true);
|
|
2336
2341
|
let alpha, pixel;
|
|
2337
|
-
const {context: context} = this, imageData = context.getImageData(
|
|
2342
|
+
const {context: context} = this, imageData = context.getImageData(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height), {data: data} = imageData;
|
|
2338
2343
|
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
2339
2344
|
pixel = data[i] * .299 + data[i + 1] * .587 + data[i + 2] * .114;
|
|
2340
2345
|
if (alpha = data[i + 3]) data[i + 3] = alpha === 255 ? pixel : alpha * (pixel / 255);
|
|
2341
2346
|
}
|
|
2342
|
-
context.putImageData(imageData,
|
|
2347
|
+
context.putImageData(imageData, tempPixelBounds.x, tempPixelBounds.y);
|
|
2343
2348
|
}
|
|
2344
2349
|
useMask(maskCanvas, fromBounds, toBounds) {
|
|
2345
2350
|
this.copyWorld(maskCanvas, fromBounds, toBounds, "destination-in");
|
|
@@ -2347,42 +2352,48 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2347
2352
|
useEraser(eraserCanvas, fromBounds, toBounds) {
|
|
2348
2353
|
this.copyWorld(eraserCanvas, fromBounds, toBounds, "destination-out");
|
|
2349
2354
|
}
|
|
2350
|
-
fillWorld(bounds, color, blendMode) {
|
|
2355
|
+
fillWorld(bounds, color, blendMode, ceilPixel) {
|
|
2351
2356
|
if (blendMode) this.blendMode = blendMode;
|
|
2352
2357
|
this.fillStyle = color;
|
|
2353
|
-
this.
|
|
2354
|
-
this.fillRect(
|
|
2358
|
+
this.setTempPixelBounds(bounds, ceilPixel);
|
|
2359
|
+
this.fillRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
|
|
2355
2360
|
if (blendMode) this.blendMode = "source-over";
|
|
2356
2361
|
}
|
|
2357
|
-
strokeWorld(bounds, color, blendMode) {
|
|
2362
|
+
strokeWorld(bounds, color, blendMode, ceilPixel) {
|
|
2358
2363
|
if (blendMode) this.blendMode = blendMode;
|
|
2359
2364
|
this.strokeStyle = color;
|
|
2360
|
-
this.
|
|
2361
|
-
this.strokeRect(
|
|
2365
|
+
this.setTempPixelBounds(bounds, ceilPixel);
|
|
2366
|
+
this.strokeRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
|
|
2362
2367
|
if (blendMode) this.blendMode = "source-over";
|
|
2363
2368
|
}
|
|
2364
|
-
clipWorld(bounds, ceilPixel) {
|
|
2369
|
+
clipWorld(bounds, ceilPixel = true) {
|
|
2365
2370
|
this.beginPath();
|
|
2366
|
-
this.
|
|
2367
|
-
this.rect(
|
|
2371
|
+
this.setTempPixelBounds(bounds, ceilPixel);
|
|
2372
|
+
this.rect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
|
|
2368
2373
|
this.clip();
|
|
2369
2374
|
}
|
|
2370
2375
|
clipUI(ruleData) {
|
|
2371
2376
|
ruleData.windingRule ? this.clip(ruleData.windingRule) : this.clip();
|
|
2372
2377
|
}
|
|
2373
|
-
clearWorld(bounds, ceilPixel) {
|
|
2374
|
-
this.
|
|
2375
|
-
this.clearRect(
|
|
2378
|
+
clearWorld(bounds, ceilPixel = true) {
|
|
2379
|
+
this.setTempPixelBounds(bounds, ceilPixel);
|
|
2380
|
+
this.clearRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
|
|
2376
2381
|
}
|
|
2377
2382
|
clear() {
|
|
2378
2383
|
const {pixelRatio: pixelRatio} = this;
|
|
2379
2384
|
this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2);
|
|
2380
2385
|
}
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
+
setTempPixelBounds(bounds, ceil, intersect) {
|
|
2387
|
+
this.copyToPixelBounds(tempPixelBounds, bounds, ceil, intersect);
|
|
2388
|
+
}
|
|
2389
|
+
setTempPixelBounds2(bounds, ceil, intersect) {
|
|
2390
|
+
this.copyToPixelBounds(tempPixelBounds2, bounds, ceil, intersect);
|
|
2391
|
+
}
|
|
2392
|
+
copyToPixelBounds(pixelBounds, bounds, ceil, intersect) {
|
|
2393
|
+
pixelBounds.set(bounds);
|
|
2394
|
+
if (intersect) pixelBounds.intersect(this.bounds);
|
|
2395
|
+
pixelBounds.scale(this.pixelRatio);
|
|
2396
|
+
if (ceil) pixelBounds.ceil();
|
|
2386
2397
|
}
|
|
2387
2398
|
isSameSize(size) {
|
|
2388
2399
|
return this.width === size.width && this.height === size.height && (!size.pixelRatio || this.pixelRatio === size.pixelRatio);
|
|
@@ -2390,7 +2401,7 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2390
2401
|
getSameCanvas(useSameWorldTransform, useSameSmooth) {
|
|
2391
2402
|
const {size: size, pixelSnap: pixelSnap} = this, canvas = this.manager ? this.manager.get(size) : Creator.canvas(Object.assign({}, size));
|
|
2392
2403
|
canvas.save();
|
|
2393
|
-
if (useSameWorldTransform) copy$
|
|
2404
|
+
if (useSameWorldTransform) copy$b(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
|
|
2394
2405
|
if (useSameSmooth) canvas.smooth = this.smooth;
|
|
2395
2406
|
canvas.pixelSnap !== pixelSnap && (canvas.pixelSnap = pixelSnap);
|
|
2396
2407
|
return canvas;
|
|
@@ -2398,7 +2409,7 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2398
2409
|
recycle(clearBounds) {
|
|
2399
2410
|
if (!this.recycled) {
|
|
2400
2411
|
this.restore();
|
|
2401
|
-
clearBounds ? this.clearWorld(clearBounds
|
|
2412
|
+
clearBounds ? this.clearWorld(clearBounds) : this.clear();
|
|
2402
2413
|
this.manager ? this.manager.recycle(this) : this.destroy();
|
|
2403
2414
|
}
|
|
2404
2415
|
}
|
|
@@ -2779,7 +2790,7 @@ const EllipseHelper = {
|
|
|
2779
2790
|
}
|
|
2780
2791
|
};
|
|
2781
2792
|
|
|
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$
|
|
2793
|
+
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
2794
|
|
|
2784
2795
|
const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
|
|
2785
2796
|
|
|
@@ -2999,7 +3010,7 @@ const PathConvert = {
|
|
|
2999
3010
|
i += 5;
|
|
3000
3011
|
break;
|
|
3001
3012
|
|
|
3002
|
-
case D$
|
|
3013
|
+
case D$6:
|
|
3003
3014
|
x = old[i + 1];
|
|
3004
3015
|
y = old[i + 2];
|
|
3005
3016
|
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 +3111,7 @@ const PathConvert = {
|
|
|
3100
3111
|
|
|
3101
3112
|
const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
|
|
3102
3113
|
|
|
3103
|
-
const {M: M$7, L: L$8, C: C$6, Q: Q$5, Z: Z$6, N: N$4, D: D$
|
|
3114
|
+
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
3115
|
|
|
3105
3116
|
const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
|
|
3106
3117
|
|
|
@@ -3136,7 +3147,7 @@ const PathCommandDataHelper = {
|
|
|
3136
3147
|
} else {
|
|
3137
3148
|
const fourCorners = MathHelper.fourNumber(cornerRadius);
|
|
3138
3149
|
if (fourCorners) {
|
|
3139
|
-
data.push(D$
|
|
3150
|
+
data.push(D$5, x, y, width, height, ...fourCorners);
|
|
3140
3151
|
} else {
|
|
3141
3152
|
data.push(N$4, x, y, width, height);
|
|
3142
3153
|
}
|
|
@@ -3279,7 +3290,7 @@ class PathCreator {
|
|
|
3279
3290
|
paint() {}
|
|
3280
3291
|
}
|
|
3281
3292
|
|
|
3282
|
-
const {M: M$6, L: L$7, C: C$5, Q: Q$4, Z: Z$5, N: N$3, D: D$
|
|
3293
|
+
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
3294
|
|
|
3284
3295
|
const debug$e = Debug.get("PathDrawer");
|
|
3285
3296
|
|
|
@@ -3321,7 +3332,7 @@ const PathDrawer = {
|
|
|
3321
3332
|
i += 5;
|
|
3322
3333
|
break;
|
|
3323
3334
|
|
|
3324
|
-
case D$
|
|
3335
|
+
case D$4:
|
|
3325
3336
|
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
3337
|
i += 9;
|
|
3327
3338
|
break;
|
|
@@ -3364,11 +3375,11 @@ const PathDrawer = {
|
|
|
3364
3375
|
}
|
|
3365
3376
|
};
|
|
3366
3377
|
|
|
3367
|
-
const {M: M$5, L: L$6, C: C$4, Q: Q$3, Z: Z$4, N: N$2, D: D$
|
|
3378
|
+
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
3379
|
|
|
3369
3380
|
const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
|
|
3370
3381
|
|
|
3371
|
-
const {addPointBounds: addPointBounds, copy: copy$
|
|
3382
|
+
const {addPointBounds: addPointBounds, copy: copy$a, addPoint: addPoint$1, setPoint: setPoint$3, addBounds: addBounds, toBounds: toBounds$3} = TwoPointBoundsHelper;
|
|
3372
3383
|
|
|
3373
3384
|
const debug$d = Debug.get("PathBounds");
|
|
3374
3385
|
|
|
@@ -3440,17 +3451,17 @@ const PathBounds = {
|
|
|
3440
3451
|
i += 5;
|
|
3441
3452
|
break;
|
|
3442
3453
|
|
|
3443
|
-
case D$
|
|
3454
|
+
case D$3:
|
|
3444
3455
|
case X$2:
|
|
3445
3456
|
x = data[i + 1];
|
|
3446
3457
|
y = data[i + 2];
|
|
3447
3458
|
addBounds(setPointBounds, x, y, data[i + 3], data[i + 4]);
|
|
3448
|
-
i += command === D$
|
|
3459
|
+
i += command === D$3 ? 9 : 6;
|
|
3449
3460
|
break;
|
|
3450
3461
|
|
|
3451
3462
|
case G$2:
|
|
3452
3463
|
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$
|
|
3464
|
+
i === 0 ? copy$a(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3454
3465
|
x = setEndPoint.x;
|
|
3455
3466
|
y = setEndPoint.y;
|
|
3456
3467
|
i += 9;
|
|
@@ -3468,7 +3479,7 @@ const PathBounds = {
|
|
|
3468
3479
|
|
|
3469
3480
|
case O$3:
|
|
3470
3481
|
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$
|
|
3482
|
+
i === 0 ? copy$a(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3472
3483
|
x = setEndPoint.x;
|
|
3473
3484
|
y = setEndPoint.y;
|
|
3474
3485
|
i += 7;
|
|
@@ -3485,7 +3496,7 @@ const PathBounds = {
|
|
|
3485
3496
|
|
|
3486
3497
|
case U$2:
|
|
3487
3498
|
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$
|
|
3499
|
+
i === 0 ? copy$a(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3489
3500
|
x = setEndPoint.x;
|
|
3490
3501
|
y = setEndPoint.y;
|
|
3491
3502
|
i += 6;
|
|
@@ -4138,6 +4149,17 @@ function positionType(defaultValue, checkFiniteNumber) {
|
|
|
4138
4149
|
}));
|
|
4139
4150
|
}
|
|
4140
4151
|
|
|
4152
|
+
function scrollType(defaultValue, checkFiniteNumber) {
|
|
4153
|
+
return decorateLeafAttr(defaultValue, key => attr({
|
|
4154
|
+
set(value) {
|
|
4155
|
+
if (this.__setAttr(key, value, checkFiniteNumber)) {
|
|
4156
|
+
this.__layout.matrixChanged || this.__layout.matrixChange();
|
|
4157
|
+
this.__scrollWorld || (this.__scrollWorld = {});
|
|
4158
|
+
}
|
|
4159
|
+
}
|
|
4160
|
+
}));
|
|
4161
|
+
}
|
|
4162
|
+
|
|
4141
4163
|
function autoLayoutType(defaultValue) {
|
|
4142
4164
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4143
4165
|
set(value) {
|
|
@@ -4476,7 +4498,7 @@ function registerUIEvent() {
|
|
|
4476
4498
|
};
|
|
4477
4499
|
}
|
|
4478
4500
|
|
|
4479
|
-
const {copy: copy$
|
|
4501
|
+
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
4502
|
|
|
4481
4503
|
const matrix$3 = {}, {round: round$3} = Math;
|
|
4482
4504
|
|
|
@@ -4552,7 +4574,7 @@ const LeafHelper = {
|
|
|
4552
4574
|
x: x,
|
|
4553
4575
|
y: y
|
|
4554
4576
|
};
|
|
4555
|
-
isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : t.parent && toInnerPoint$1(t.parent.
|
|
4577
|
+
isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : t.parent && toInnerPoint$1(t.parent.scrollWorldTransform, local, local, true);
|
|
4556
4578
|
L$4.moveLocal(t, local.x, local.y, transition);
|
|
4557
4579
|
},
|
|
4558
4580
|
moveLocal(t, x, y = 0, transition) {
|
|
@@ -4574,9 +4596,9 @@ const LeafHelper = {
|
|
|
4574
4596
|
if (scaleY) transition = scaleY;
|
|
4575
4597
|
scaleY = scaleX;
|
|
4576
4598
|
}
|
|
4577
|
-
copy$
|
|
4599
|
+
copy$9(matrix$3, o);
|
|
4578
4600
|
scaleOfOuter$2(matrix$3, origin, scaleX, scaleY);
|
|
4579
|
-
if (
|
|
4601
|
+
if (L$4.hasHighPosition(t)) {
|
|
4580
4602
|
L$4.setTransform(t, matrix$3, resize, transition);
|
|
4581
4603
|
} else {
|
|
4582
4604
|
const x = t.x + matrix$3.e - o.e, y = t.y + matrix$3.f - o.f;
|
|
@@ -4593,9 +4615,9 @@ const LeafHelper = {
|
|
|
4593
4615
|
},
|
|
4594
4616
|
rotateOfLocal(t, origin, angle, transition) {
|
|
4595
4617
|
const o = t.__localMatrix;
|
|
4596
|
-
copy$
|
|
4618
|
+
copy$9(matrix$3, o);
|
|
4597
4619
|
rotateOfOuter$2(matrix$3, origin, angle);
|
|
4598
|
-
if (
|
|
4620
|
+
if (L$4.hasHighPosition(t)) L$4.setTransform(t, matrix$3, false, transition); else t.set({
|
|
4599
4621
|
x: t.x + matrix$3.e - o.e,
|
|
4600
4622
|
y: t.y + matrix$3.f - o.f,
|
|
4601
4623
|
rotation: MathHelper.formatRotation(t.rotation + angle)
|
|
@@ -4605,24 +4627,28 @@ const LeafHelper = {
|
|
|
4605
4627
|
L$4.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
|
|
4606
4628
|
},
|
|
4607
4629
|
skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
|
|
4608
|
-
copy$
|
|
4630
|
+
copy$9(matrix$3, t.__localMatrix);
|
|
4609
4631
|
skewOfOuter(matrix$3, origin, skewX, skewY);
|
|
4610
4632
|
L$4.setTransform(t, matrix$3, resize, transition);
|
|
4611
4633
|
},
|
|
4612
4634
|
transformWorld(t, transform, resize, transition) {
|
|
4613
|
-
copy$
|
|
4635
|
+
copy$9(matrix$3, t.worldTransform);
|
|
4614
4636
|
multiplyParent$3(matrix$3, transform);
|
|
4615
|
-
if (t.parent) divideParent(matrix$3, t.parent.
|
|
4637
|
+
if (t.parent) divideParent(matrix$3, t.parent.scrollWorldTransform);
|
|
4616
4638
|
L$4.setTransform(t, matrix$3, resize, transition);
|
|
4617
4639
|
},
|
|
4618
4640
|
transform(t, transform, resize, transition) {
|
|
4619
|
-
copy$
|
|
4641
|
+
copy$9(matrix$3, t.localTransform);
|
|
4620
4642
|
multiplyParent$3(matrix$3, transform);
|
|
4621
4643
|
L$4.setTransform(t, matrix$3, resize, transition);
|
|
4622
4644
|
},
|
|
4623
4645
|
setTransform(t, transform, resize, transition) {
|
|
4624
4646
|
const data = t.__, originPoint = data.origin && L$4.getInnerOrigin(t, data.origin);
|
|
4625
4647
|
const layout = getLayout(transform, originPoint, data.around && L$4.getInnerOrigin(t, data.around));
|
|
4648
|
+
if (L$4.hasOffset(t)) {
|
|
4649
|
+
layout.x -= data.offsetX;
|
|
4650
|
+
layout.y -= data.offsetY;
|
|
4651
|
+
}
|
|
4626
4652
|
if (resize) {
|
|
4627
4653
|
const scaleX = layout.scaleX / t.scaleX, scaleY = layout.scaleY / t.scaleY;
|
|
4628
4654
|
delete layout.scaleX, delete layout.scaleY;
|
|
@@ -4650,14 +4676,20 @@ const LeafHelper = {
|
|
|
4650
4676
|
return innerOrigin;
|
|
4651
4677
|
},
|
|
4652
4678
|
getRelativeWorld(t, relative, temp) {
|
|
4653
|
-
copy$
|
|
4654
|
-
divideParent(matrix$3, relative.
|
|
4679
|
+
copy$9(matrix$3, t.worldTransform);
|
|
4680
|
+
divideParent(matrix$3, relative.scrollWorldTransform);
|
|
4655
4681
|
return temp ? matrix$3 : Object.assign({}, matrix$3);
|
|
4656
4682
|
},
|
|
4657
4683
|
drop(t, parent, index, resize) {
|
|
4658
4684
|
t.setTransform(L$4.getRelativeWorld(t, parent, true), resize);
|
|
4659
4685
|
parent.add(t, index);
|
|
4660
4686
|
},
|
|
4687
|
+
hasHighPosition(t) {
|
|
4688
|
+
return t.origin || t.around || L$4.hasOffset(t);
|
|
4689
|
+
},
|
|
4690
|
+
hasOffset(t) {
|
|
4691
|
+
return t.offsetX || t.offsetY;
|
|
4692
|
+
},
|
|
4661
4693
|
hasParent(p, parent) {
|
|
4662
4694
|
if (!parent) return false;
|
|
4663
4695
|
while (p) {
|
|
@@ -4683,8 +4715,7 @@ const L$4 = LeafHelper;
|
|
|
4683
4715
|
const {updateAllMatrix: updateAllMatrix$4, updateMatrix: updateMatrix$4, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1} = L$4;
|
|
4684
4716
|
|
|
4685
4717
|
function getTempLocal(t, world) {
|
|
4686
|
-
t.
|
|
4687
|
-
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
|
|
4718
|
+
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.scrollWorldTransform) : world;
|
|
4688
4719
|
}
|
|
4689
4720
|
|
|
4690
4721
|
const LeafBoundsHelper = {
|
|
@@ -4809,7 +4840,7 @@ const WaitHelper = {
|
|
|
4809
4840
|
|
|
4810
4841
|
const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$3} = LeafHelper;
|
|
4811
4842
|
|
|
4812
|
-
const {toOuterOf: toOuterOf$2, getPoints: getPoints, copy: copy$
|
|
4843
|
+
const {toOuterOf: toOuterOf$2, getPoints: getPoints, copy: copy$8} = BoundsHelper;
|
|
4813
4844
|
|
|
4814
4845
|
const localContent = "_localContentBounds";
|
|
4815
4846
|
|
|
@@ -5048,7 +5079,7 @@ class LeafLayout {
|
|
|
5048
5079
|
matrix = getRelativeWorld$1(leaf, relative, true);
|
|
5049
5080
|
}
|
|
5050
5081
|
if (!layoutBounds) layoutBounds = MatrixHelper.getLayout(matrix);
|
|
5051
|
-
copy$
|
|
5082
|
+
copy$8(layoutBounds, bounds);
|
|
5052
5083
|
PointHelper.copy(layoutBounds, point);
|
|
5053
5084
|
if (unscale) {
|
|
5054
5085
|
const {scaleX: scaleX, scaleY: scaleY} = layoutBounds;
|
|
@@ -5236,6 +5267,8 @@ ChildEvent.UNMOUNTED = "unmounted";
|
|
|
5236
5267
|
|
|
5237
5268
|
ChildEvent.DESTROY = "destroy";
|
|
5238
5269
|
|
|
5270
|
+
const SCROLL = "property.scroll";
|
|
5271
|
+
|
|
5239
5272
|
class PropertyEvent extends Event {
|
|
5240
5273
|
constructor(type, target, attrName, oldValue, newValue) {
|
|
5241
5274
|
super(type, target);
|
|
@@ -5249,6 +5282,13 @@ PropertyEvent.CHANGE = "property.change";
|
|
|
5249
5282
|
|
|
5250
5283
|
PropertyEvent.LEAFER_CHANGE = "property.leafer_change";
|
|
5251
5284
|
|
|
5285
|
+
PropertyEvent.SCROLL = SCROLL;
|
|
5286
|
+
|
|
5287
|
+
const extraPropertyEventMap = {
|
|
5288
|
+
scrollX: SCROLL,
|
|
5289
|
+
scrollY: SCROLL
|
|
5290
|
+
};
|
|
5291
|
+
|
|
5252
5292
|
class ImageEvent extends Event {
|
|
5253
5293
|
constructor(type, data) {
|
|
5254
5294
|
super(type);
|
|
@@ -5524,7 +5564,9 @@ class Eventer {
|
|
|
5524
5564
|
if (!id) return;
|
|
5525
5565
|
const list = isArray(id) ? id : [ id ];
|
|
5526
5566
|
list.forEach(item => {
|
|
5527
|
-
if (
|
|
5567
|
+
if (item) {
|
|
5568
|
+
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);
|
|
5569
|
+
}
|
|
5528
5570
|
});
|
|
5529
5571
|
list.length = 0;
|
|
5530
5572
|
}
|
|
@@ -5618,8 +5660,6 @@ const LeafDataProxy = {
|
|
|
5618
5660
|
}
|
|
5619
5661
|
if (isObject(newValue) || oldValue !== newValue) {
|
|
5620
5662
|
this.__realSetAttr(name, newValue);
|
|
5621
|
-
const {CHANGE: CHANGE} = PropertyEvent;
|
|
5622
|
-
const event = new PropertyEvent(CHANGE, this, name, oldValue, newValue);
|
|
5623
5663
|
if (this.isLeafer) {
|
|
5624
5664
|
this.emitEvent(new PropertyEvent(PropertyEvent.LEAFER_CHANGE, this, name, oldValue, newValue));
|
|
5625
5665
|
const transformEventName = leaferTransformAttrMap[name];
|
|
@@ -5627,10 +5667,10 @@ const LeafDataProxy = {
|
|
|
5627
5667
|
this.emitEvent(new LeaferEvent(transformEventName, this));
|
|
5628
5668
|
this.emitEvent(new LeaferEvent(LeaferEvent.TRANSFORM, this));
|
|
5629
5669
|
}
|
|
5630
|
-
} else {
|
|
5631
|
-
if (this.hasEvent(CHANGE)) this.emitEvent(event);
|
|
5632
5670
|
}
|
|
5633
|
-
this.
|
|
5671
|
+
this.emitPropertyEvent(PropertyEvent.CHANGE, name, oldValue, newValue);
|
|
5672
|
+
const extraPropertyEvent = extraPropertyEventMap[name];
|
|
5673
|
+
if (extraPropertyEvent) this.emitPropertyEvent(extraPropertyEvent, name, oldValue, newValue);
|
|
5634
5674
|
return true;
|
|
5635
5675
|
} else {
|
|
5636
5676
|
return false;
|
|
@@ -5640,6 +5680,11 @@ const LeafDataProxy = {
|
|
|
5640
5680
|
return true;
|
|
5641
5681
|
}
|
|
5642
5682
|
},
|
|
5683
|
+
emitPropertyEvent(type, name, oldValue, newValue) {
|
|
5684
|
+
const event = new PropertyEvent(type, this, name, oldValue, newValue);
|
|
5685
|
+
this.isLeafer || this.hasEvent(type) && this.emitEvent(event);
|
|
5686
|
+
this.leafer.emitEvent(event);
|
|
5687
|
+
},
|
|
5643
5688
|
__realSetAttr(name, newValue) {
|
|
5644
5689
|
const data = this.__;
|
|
5645
5690
|
data[name] = newValue;
|
|
@@ -5658,8 +5703,9 @@ const {toPoint: toPoint$4, tempPoint: tempPoint$1} = AroundHelper;
|
|
|
5658
5703
|
|
|
5659
5704
|
const LeafMatrix = {
|
|
5660
5705
|
__updateWorldMatrix() {
|
|
5661
|
-
const {parent: parent, __layout: __layout} = this;
|
|
5662
|
-
multiplyParent$2(this.__local || __layout, parent ? parent.__world : defaultWorld,
|
|
5706
|
+
const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
|
|
5707
|
+
multiplyParent$2(this.__local || __layout, parent ? parent.__scrollWorld || parent.__world : defaultWorld, __world, !!__layout.affectScaleOrRotation, __);
|
|
5708
|
+
if (__scrollWorld) translateInner(Object.assign(__scrollWorld, __world), __.scrollX, __.scrollY);
|
|
5663
5709
|
},
|
|
5664
5710
|
__updateLocalMatrix() {
|
|
5665
5711
|
if (this.__local) {
|
|
@@ -5685,7 +5731,7 @@ const {updateMatrix: updateMatrix$3, updateAllMatrix: updateAllMatrix$3} = LeafH
|
|
|
5685
5731
|
|
|
5686
5732
|
const {updateBounds: updateBounds$2} = BranchHelper;
|
|
5687
5733
|
|
|
5688
|
-
const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$2, copy: copy$
|
|
5734
|
+
const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$2, copy: copy$7} = BoundsHelper;
|
|
5689
5735
|
|
|
5690
5736
|
const {toBounds: toBounds$2} = PathBounds;
|
|
5691
5737
|
|
|
@@ -5756,7 +5802,7 @@ const LeafBounds = {
|
|
|
5756
5802
|
__updateLocalRenderBounds() {
|
|
5757
5803
|
toOuterOf$1(this.__layout.renderBounds, this.__localMatrix, this.__layout.localRenderBounds);
|
|
5758
5804
|
},
|
|
5759
|
-
__updateBoxBounds() {
|
|
5805
|
+
__updateBoxBounds(_secondLayout, _bounds) {
|
|
5760
5806
|
const b = this.__layout.boxBounds;
|
|
5761
5807
|
const data = this.__;
|
|
5762
5808
|
if (data.__pathInputed) {
|
|
@@ -5790,13 +5836,13 @@ const LeafBounds = {
|
|
|
5790
5836
|
data.__naturalWidth = layout.boxBounds.width;
|
|
5791
5837
|
data.__naturalHeight = layout.boxBounds.height;
|
|
5792
5838
|
},
|
|
5793
|
-
__updateStrokeBounds() {
|
|
5839
|
+
__updateStrokeBounds(_bounds) {
|
|
5794
5840
|
const layout = this.__layout;
|
|
5795
5841
|
copyAndSpread$2(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
|
|
5796
5842
|
},
|
|
5797
|
-
__updateRenderBounds() {
|
|
5843
|
+
__updateRenderBounds(_bounds) {
|
|
5798
5844
|
const layout = this.__layout;
|
|
5799
|
-
layout.renderSpread > 0 ? copyAndSpread$2(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$
|
|
5845
|
+
layout.renderSpread > 0 ? copyAndSpread$2(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$7(layout.renderBounds, layout.strokeBounds);
|
|
5800
5846
|
}
|
|
5801
5847
|
};
|
|
5802
5848
|
|
|
@@ -5895,7 +5941,7 @@ const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: m
|
|
|
5895
5941
|
|
|
5896
5942
|
const {toOuterOf: toOuterOf} = BoundsHelper;
|
|
5897
5943
|
|
|
5898
|
-
const {copy: copy$
|
|
5944
|
+
const {copy: copy$6, move: move$6} = PointHelper;
|
|
5899
5945
|
|
|
5900
5946
|
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
5947
|
|
|
@@ -5943,6 +5989,10 @@ let Leaf = class Leaf {
|
|
|
5943
5989
|
get localTransform() {
|
|
5944
5990
|
return this.__layout.getTransform("local");
|
|
5945
5991
|
}
|
|
5992
|
+
get scrollWorldTransform() {
|
|
5993
|
+
this.updateLayout();
|
|
5994
|
+
return this.__scrollWorld || this.__world;
|
|
5995
|
+
}
|
|
5946
5996
|
get boxBounds() {
|
|
5947
5997
|
return this.getBounds("box", "inner");
|
|
5948
5998
|
}
|
|
@@ -5959,7 +6009,7 @@ let Leaf = class Leaf {
|
|
|
5959
6009
|
return this.getBounds("render");
|
|
5960
6010
|
}
|
|
5961
6011
|
get worldOpacity() {
|
|
5962
|
-
this.
|
|
6012
|
+
this.updateLayout();
|
|
5963
6013
|
return this.__worldOpacity;
|
|
5964
6014
|
}
|
|
5965
6015
|
get __worldFlipped() {
|
|
@@ -6134,10 +6184,10 @@ let Leaf = class Leaf {
|
|
|
6134
6184
|
__updateLocalBoxBounds() {}
|
|
6135
6185
|
__updateLocalStrokeBounds() {}
|
|
6136
6186
|
__updateLocalRenderBounds() {}
|
|
6137
|
-
__updateBoxBounds() {}
|
|
6187
|
+
__updateBoxBounds(_secondLayout, _bounds) {}
|
|
6138
6188
|
__updateContentBounds() {}
|
|
6139
|
-
__updateStrokeBounds() {}
|
|
6140
|
-
__updateRenderBounds() {}
|
|
6189
|
+
__updateStrokeBounds(_bounds) {}
|
|
6190
|
+
__updateRenderBounds(_bounds) {}
|
|
6141
6191
|
__updateAutoLayout() {}
|
|
6142
6192
|
__updateFlowLayout() {}
|
|
6143
6193
|
__updateNaturalSize() {}
|
|
@@ -6209,14 +6259,14 @@ let Leaf = class Leaf {
|
|
|
6209
6259
|
if (this.parent) {
|
|
6210
6260
|
this.parent.worldToInner(world, to, distance, relative);
|
|
6211
6261
|
} else {
|
|
6212
|
-
if (to) copy$
|
|
6262
|
+
if (to) copy$6(to, world);
|
|
6213
6263
|
}
|
|
6214
6264
|
}
|
|
6215
6265
|
localToWorld(local, to, distance, relative) {
|
|
6216
6266
|
if (this.parent) {
|
|
6217
6267
|
this.parent.innerToWorld(local, to, distance, relative);
|
|
6218
6268
|
} else {
|
|
6219
|
-
if (to) copy$
|
|
6269
|
+
if (to) copy$6(to, local);
|
|
6220
6270
|
}
|
|
6221
6271
|
}
|
|
6222
6272
|
worldToInner(world, to, distance, relative) {
|
|
@@ -6235,7 +6285,7 @@ let Leaf = class Leaf {
|
|
|
6235
6285
|
}
|
|
6236
6286
|
getBoxPointByInner(inner, _relative, _distance, change) {
|
|
6237
6287
|
const point = change ? inner : Object.assign({}, inner), {x: x, y: y} = this.boxBounds;
|
|
6238
|
-
move$
|
|
6288
|
+
move$6(point, -x, -y);
|
|
6239
6289
|
return point;
|
|
6240
6290
|
}
|
|
6241
6291
|
getInnerPoint(world, relative, distance, change) {
|
|
@@ -6245,7 +6295,7 @@ let Leaf = class Leaf {
|
|
|
6245
6295
|
}
|
|
6246
6296
|
getInnerPointByBox(box, _relative, _distance, change) {
|
|
6247
6297
|
const point = change ? box : Object.assign({}, box), {x: x, y: y} = this.boxBounds;
|
|
6248
|
-
move$
|
|
6298
|
+
move$6(point, x, y);
|
|
6249
6299
|
return point;
|
|
6250
6300
|
}
|
|
6251
6301
|
getInnerPointByLocal(local, _relative, distance, change) {
|
|
@@ -6437,14 +6487,14 @@ let Branch = class Branch extends Leaf {
|
|
|
6437
6487
|
}
|
|
6438
6488
|
return 0;
|
|
6439
6489
|
}
|
|
6440
|
-
__updateBoxBounds() {
|
|
6441
|
-
setListWithFn$1(this.__layout.boxBounds, this.children, this.__hasMask ? maskLocalBoxBounds : localBoxBounds);
|
|
6490
|
+
__updateBoxBounds(_secondLayout, bounds) {
|
|
6491
|
+
setListWithFn$1(bounds || this.__layout.boxBounds, this.children, this.__hasMask ? maskLocalBoxBounds : localBoxBounds);
|
|
6442
6492
|
}
|
|
6443
|
-
__updateStrokeBounds() {
|
|
6444
|
-
setListWithFn$1(this.__layout.strokeBounds, this.children, this.__hasMask ? maskLocalStrokeBounds : localStrokeBounds);
|
|
6493
|
+
__updateStrokeBounds(bounds) {
|
|
6494
|
+
setListWithFn$1(bounds || this.__layout.strokeBounds, this.children, this.__hasMask ? maskLocalStrokeBounds : localStrokeBounds);
|
|
6445
6495
|
}
|
|
6446
|
-
__updateRenderBounds() {
|
|
6447
|
-
setListWithFn$1(this.__layout.renderBounds, this.children, this.__hasMask ? maskLocalRenderBounds : localRenderBounds);
|
|
6496
|
+
__updateRenderBounds(bounds) {
|
|
6497
|
+
setListWithFn$1(bounds || this.__layout.renderBounds, this.children, this.__hasMask ? maskLocalRenderBounds : localRenderBounds);
|
|
6448
6498
|
}
|
|
6449
6499
|
__updateSortChildren() {
|
|
6450
6500
|
let affectSort;
|
|
@@ -6691,7 +6741,7 @@ class LeafLevelList {
|
|
|
6691
6741
|
}
|
|
6692
6742
|
}
|
|
6693
6743
|
|
|
6694
|
-
const version = "1.9.
|
|
6744
|
+
const version = "1.9.2";
|
|
6695
6745
|
|
|
6696
6746
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6697
6747
|
get allowBackgroundColor() {
|
|
@@ -7372,8 +7422,8 @@ class Renderer {
|
|
|
7372
7422
|
const {canvas: canvas} = this, bounds = block.getIntersect(canvas.bounds), realBounds = new Bounds(bounds);
|
|
7373
7423
|
canvas.save();
|
|
7374
7424
|
bounds.spread(Renderer.clipSpread).ceil();
|
|
7375
|
-
canvas.clearWorld(bounds
|
|
7376
|
-
canvas.clipWorld(bounds
|
|
7425
|
+
canvas.clearWorld(bounds);
|
|
7426
|
+
canvas.clipWorld(bounds);
|
|
7377
7427
|
this.__render(bounds, realBounds);
|
|
7378
7428
|
canvas.restore();
|
|
7379
7429
|
Run.end(t);
|
|
@@ -7596,6 +7646,7 @@ class Picker {
|
|
|
7596
7646
|
hit = child.__.hitRadius ? true : hitRadiusPoint$1(child.__world, point);
|
|
7597
7647
|
if (child.isBranch) {
|
|
7598
7648
|
if (hit || child.__ignoreHitWorld) {
|
|
7649
|
+
if (child.topChildren) this.eachFind(child.topChildren, false);
|
|
7599
7650
|
this.eachFind(child.children, child.__onlyHitMask);
|
|
7600
7651
|
if (child.isBranchLeaf) this.hitChild(child, point);
|
|
7601
7652
|
}
|
|
@@ -7943,7 +7994,7 @@ class BoxData extends GroupData {
|
|
|
7943
7994
|
}
|
|
7944
7995
|
get __clipAfterFill() {
|
|
7945
7996
|
const t = this;
|
|
7946
|
-
return t.overflow
|
|
7997
|
+
return t.overflow !== "show" && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill);
|
|
7947
7998
|
}
|
|
7948
7999
|
}
|
|
7949
8000
|
|
|
@@ -8099,6 +8150,41 @@ const UIBounds = {
|
|
|
8099
8150
|
}
|
|
8100
8151
|
};
|
|
8101
8152
|
|
|
8153
|
+
const DragBoundsHelper = {
|
|
8154
|
+
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
8155
|
+
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
8156
|
+
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
8157
|
+
if (!change) move = Object.assign({}, move);
|
|
8158
|
+
const isBiggerWidth = content.width > dragBounds.width;
|
|
8159
|
+
const isBiggerHeight = content.height > dragBounds.height;
|
|
8160
|
+
if (isBiggerWidth && dragBoundsType !== "outer") {
|
|
8161
|
+
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
8162
|
+
} else {
|
|
8163
|
+
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
8164
|
+
}
|
|
8165
|
+
if (isBiggerHeight && dragBoundsType !== "outer") {
|
|
8166
|
+
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
8167
|
+
} else {
|
|
8168
|
+
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
8169
|
+
}
|
|
8170
|
+
move.x = MathHelper.float(move.x);
|
|
8171
|
+
move.y = MathHelper.float(move.y);
|
|
8172
|
+
return move;
|
|
8173
|
+
},
|
|
8174
|
+
axisMove(leaf, move) {
|
|
8175
|
+
const {draggable: draggable} = leaf;
|
|
8176
|
+
if (draggable === "x") move.y = 0;
|
|
8177
|
+
if (draggable === "y") move.x = 0;
|
|
8178
|
+
},
|
|
8179
|
+
limitMove(leaf, move) {
|
|
8180
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
8181
|
+
if (dragBounds) D$2.getValidMove(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, dragBoundsType, move, true);
|
|
8182
|
+
D$2.axisMove(leaf, move);
|
|
8183
|
+
}
|
|
8184
|
+
};
|
|
8185
|
+
|
|
8186
|
+
const D$2 = DragBoundsHelper;
|
|
8187
|
+
|
|
8102
8188
|
const {stintSet: stintSet$1} = DataHelper;
|
|
8103
8189
|
|
|
8104
8190
|
const UIRender = {
|
|
@@ -8413,9 +8499,9 @@ __decorate([ positionType(0, true) ], UI.prototype, "offsetX", void 0);
|
|
|
8413
8499
|
|
|
8414
8500
|
__decorate([ positionType(0, true) ], UI.prototype, "offsetY", void 0);
|
|
8415
8501
|
|
|
8416
|
-
__decorate([
|
|
8502
|
+
__decorate([ scrollType(0, true) ], UI.prototype, "scrollX", void 0);
|
|
8417
8503
|
|
|
8418
|
-
__decorate([
|
|
8504
|
+
__decorate([ scrollType(0, true) ], UI.prototype, "scrollY", void 0);
|
|
8419
8505
|
|
|
8420
8506
|
__decorate([ autoLayoutType() ], UI.prototype, "origin", void 0);
|
|
8421
8507
|
|
|
@@ -8445,6 +8531,8 @@ __decorate([ dataType(false) ], UI.prototype, "draggable", void 0);
|
|
|
8445
8531
|
|
|
8446
8532
|
__decorate([ dataType() ], UI.prototype, "dragBounds", void 0);
|
|
8447
8533
|
|
|
8534
|
+
__decorate([ dataType("auto") ], UI.prototype, "dragBoundsType", void 0);
|
|
8535
|
+
|
|
8448
8536
|
__decorate([ dataType(false) ], UI.prototype, "editable", void 0);
|
|
8449
8537
|
|
|
8450
8538
|
__decorate([ hitType(true) ], UI.prototype, "hittable", void 0);
|
|
@@ -8867,7 +8955,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8867
8955
|
zoom(_zoomType, _optionsOrPadding, _scroll, _transition) {
|
|
8868
8956
|
return Plugin.need("view");
|
|
8869
8957
|
}
|
|
8870
|
-
getValidMove(moveX, moveY) {
|
|
8958
|
+
getValidMove(moveX, moveY, _checkLimit) {
|
|
8871
8959
|
return {
|
|
8872
8960
|
x: moveX,
|
|
8873
8961
|
y: moveY
|
|
@@ -8956,12 +9044,10 @@ __decorate([ dataProcessor(RectData) ], Rect.prototype, "__", void 0);
|
|
|
8956
9044
|
|
|
8957
9045
|
Rect = __decorate([ useModule(RectRender), rewriteAble(), registerUI() ], Rect);
|
|
8958
9046
|
|
|
8959
|
-
const {
|
|
9047
|
+
const {add: add, includes: includes$1, scroll: scroll} = BoundsHelper;
|
|
8960
9048
|
|
|
8961
9049
|
const rect$1 = Rect.prototype, group = Group.prototype;
|
|
8962
9050
|
|
|
8963
|
-
const childrenRenderBounds = {};
|
|
8964
|
-
|
|
8965
9051
|
let Box = class Box extends Group {
|
|
8966
9052
|
get __tag() {
|
|
8967
9053
|
return "Box";
|
|
@@ -9007,22 +9093,24 @@ let Box = class Box extends Group {
|
|
|
9007
9093
|
__updateRenderBounds() {
|
|
9008
9094
|
let isOverflow;
|
|
9009
9095
|
if (this.children.length) {
|
|
9010
|
-
const data = this.__, {renderBounds: renderBounds, boxBounds: boxBounds} =
|
|
9011
|
-
|
|
9012
|
-
|
|
9096
|
+
const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
|
|
9097
|
+
const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
|
|
9098
|
+
super.__updateRenderBounds(childrenRenderBounds);
|
|
9099
|
+
scroll(childrenRenderBounds, data);
|
|
9013
9100
|
this.__updateRectRenderBounds();
|
|
9014
|
-
if (data.scrollY || data.scrollX) {
|
|
9015
|
-
childrenRenderBounds.x += data.scrollX;
|
|
9016
|
-
childrenRenderBounds.y += data.scrollY;
|
|
9017
|
-
}
|
|
9018
9101
|
isOverflow = !includes$1(boxBounds, childrenRenderBounds);
|
|
9019
|
-
if (isOverflow && data.overflow
|
|
9102
|
+
if (isOverflow && data.overflow === "show") add(renderBounds, childrenRenderBounds);
|
|
9020
9103
|
} else this.__updateRectRenderBounds();
|
|
9021
9104
|
DataHelper.stintSet(this, "isOverflow", isOverflow);
|
|
9022
|
-
this.
|
|
9105
|
+
this.__checkScroll();
|
|
9023
9106
|
}
|
|
9024
9107
|
__updateRectRenderBounds() {}
|
|
9025
|
-
|
|
9108
|
+
__updateWorldBounds() {
|
|
9109
|
+
if (this.hasScroller) this.__updateScroll();
|
|
9110
|
+
super.__updateWorldBounds();
|
|
9111
|
+
}
|
|
9112
|
+
__checkScroll() {}
|
|
9113
|
+
__updateScroll() {}
|
|
9026
9114
|
__updateRectChange() {}
|
|
9027
9115
|
__updateChange() {
|
|
9028
9116
|
super.__updateChange();
|
|
@@ -9037,7 +9125,7 @@ let Box = class Box extends Group {
|
|
|
9037
9125
|
this.__renderRect(canvas, options);
|
|
9038
9126
|
if (this.children.length) this.__renderGroup(canvas, options);
|
|
9039
9127
|
}
|
|
9040
|
-
if (this.
|
|
9128
|
+
if (this.hasScroller) this.scroller.__render(canvas, options);
|
|
9041
9129
|
}
|
|
9042
9130
|
__drawContent(canvas, options) {
|
|
9043
9131
|
this.__renderGroup(canvas, options);
|
|
@@ -9710,7 +9798,7 @@ let App = class App extends Leafer {
|
|
|
9710
9798
|
if (this.viewReady) this.renderer.update();
|
|
9711
9799
|
}
|
|
9712
9800
|
__render(canvas, options) {
|
|
9713
|
-
if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options
|
|
9801
|
+
if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options.bounds));
|
|
9714
9802
|
}
|
|
9715
9803
|
__onResize(event) {
|
|
9716
9804
|
this.forEach(leafer => leafer.resize(event));
|
|
@@ -9878,26 +9966,11 @@ let DragEvent = class DragEvent extends PointerEvent {
|
|
|
9878
9966
|
const move = leaf.getLocalPoint(total, null, true);
|
|
9879
9967
|
PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
|
|
9880
9968
|
if (checkLimit) this.limitMove(leaf, move);
|
|
9969
|
+
DragBoundsHelper.axisMove(leaf, move);
|
|
9881
9970
|
return move;
|
|
9882
9971
|
}
|
|
9883
9972
|
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;
|
|
9973
|
+
DragBoundsHelper.limitMove(leaf, move);
|
|
9901
9974
|
}
|
|
9902
9975
|
getPageMove(total) {
|
|
9903
9976
|
this.assignMove(total);
|
|
@@ -10182,11 +10255,12 @@ class Dragger {
|
|
|
10182
10255
|
const checkLimitMove = !dragLimitAnimate || !!isDragEnd;
|
|
10183
10256
|
list.forEach(leaf => {
|
|
10184
10257
|
if (leaf.draggable) {
|
|
10258
|
+
const axisDrag = isString(leaf.draggable);
|
|
10185
10259
|
const move = DragEvent.getValidMove(leaf, this.dragStartPoints[leaf.innerId], {
|
|
10186
10260
|
x: totalX,
|
|
10187
10261
|
y: totalY
|
|
10188
|
-
}, checkLimitMove);
|
|
10189
|
-
if (dragLimitAnimate && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else leaf.move(move);
|
|
10262
|
+
}, checkLimitMove || axisDrag);
|
|
10263
|
+
if (dragLimitAnimate && !axisDrag && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else leaf.move(move);
|
|
10190
10264
|
}
|
|
10191
10265
|
});
|
|
10192
10266
|
}
|
|
@@ -12057,7 +12131,7 @@ function shadow$1(ui, current, shape) {
|
|
|
12057
12131
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
12058
12132
|
}
|
|
12059
12133
|
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
12060
|
-
if (end && index < end) other.clearWorld(copyBounds
|
|
12134
|
+
if (end && index < end) other.clearWorld(copyBounds);
|
|
12061
12135
|
});
|
|
12062
12136
|
other.recycle(copyBounds);
|
|
12063
12137
|
}
|
|
@@ -12121,7 +12195,7 @@ function innerShadow(ui, current, shape) {
|
|
|
12121
12195
|
}
|
|
12122
12196
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), "source-in");
|
|
12123
12197
|
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
12124
|
-
if (end && index < end) other.clearWorld(copyBounds
|
|
12198
|
+
if (end && index < end) other.clearWorld(copyBounds);
|
|
12125
12199
|
});
|
|
12126
12200
|
other.recycle(copyBounds);
|
|
12127
12201
|
}
|
|
@@ -12220,7 +12294,7 @@ function copyContent(leaf, canvas, content, maskOpacity, blendMode, recycle) {
|
|
|
12220
12294
|
canvas.resetTransform();
|
|
12221
12295
|
canvas.opacity = maskOpacity;
|
|
12222
12296
|
canvas.copyWorld(content, realBounds, undefined, blendMode);
|
|
12223
|
-
recycle ? content.recycle(realBounds) : content.clearWorld(realBounds
|
|
12297
|
+
recycle ? content.recycle(realBounds) : content.clearWorld(realBounds);
|
|
12224
12298
|
}
|
|
12225
12299
|
|
|
12226
12300
|
const money = "¥¥$€££¢¢";
|
|
@@ -13833,7 +13907,7 @@ class EditBox extends Group {
|
|
|
13833
13907
|
if (pointType && pointType.includes("resize")) ResizeEvent.resizingKeys = editor.leafList.keys;
|
|
13834
13908
|
}
|
|
13835
13909
|
onDragEnd(e) {
|
|
13836
|
-
if (this.
|
|
13910
|
+
if (this.moving) this.transformTool.onMove(e);
|
|
13837
13911
|
this.dragPoint = null;
|
|
13838
13912
|
this.resetDoing();
|
|
13839
13913
|
const {name: name, pointType: pointType} = e.current;
|
|
@@ -13866,6 +13940,10 @@ class EditBox extends Group {
|
|
|
13866
13940
|
}
|
|
13867
13941
|
}
|
|
13868
13942
|
}
|
|
13943
|
+
onMoveEnd(e) {
|
|
13944
|
+
if (this.moving) this.transformTool.onMove(e);
|
|
13945
|
+
this.resetDoing();
|
|
13946
|
+
}
|
|
13869
13947
|
onScale(e) {
|
|
13870
13948
|
if (this.canGesture) {
|
|
13871
13949
|
e.stop();
|
|
@@ -13956,7 +14034,7 @@ class EditBox extends Group {
|
|
|
13956
14034
|
const {rect: rect, editor: editor, __eventIds: events} = this;
|
|
13957
14035
|
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
14036
|
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.
|
|
14037
|
+
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
14038
|
});
|
|
13961
14039
|
}
|
|
13962
14040
|
__removeListenEvents() {
|
|
@@ -14129,7 +14207,7 @@ const EditorHelper = {
|
|
|
14129
14207
|
parent.addAt(group, parent.children.indexOf(list[0]));
|
|
14130
14208
|
list.sort(order);
|
|
14131
14209
|
const matrx = new Matrix(element.worldTransform);
|
|
14132
|
-
matrx.divideParent(parent.
|
|
14210
|
+
matrx.divideParent(parent.scrollWorldTransform);
|
|
14133
14211
|
group.setTransform(matrx);
|
|
14134
14212
|
group.editable = true;
|
|
14135
14213
|
group.hitChildren = false;
|
|
@@ -14352,8 +14430,9 @@ class TransformTool {
|
|
|
14352
14430
|
const {target: target, mergeConfig: mergeConfig, dragStartData: dragStartData, app: app} = this.editBox;
|
|
14353
14431
|
let move, {dragLimitAnimate: dragLimitAnimate} = mergeConfig;
|
|
14354
14432
|
if (isUndefined(dragLimitAnimate)) dragLimitAnimate = app && app.config.pointer.dragLimitAnimate;
|
|
14355
|
-
const isMoveEnd = e.type ===
|
|
14356
|
-
const
|
|
14433
|
+
const isMoveEnd = e.type === MoveEvent.END || e.type === DragEvent.END;
|
|
14434
|
+
const axisDrag = isString(target.draggable);
|
|
14435
|
+
const checkLimitMove = !dragLimitAnimate || isMoveEnd || axisDrag;
|
|
14357
14436
|
if (e instanceof MoveEvent) {
|
|
14358
14437
|
move = e.getLocalMove(target);
|
|
14359
14438
|
if (checkLimitMove) DragEvent.limitMove(target, move);
|
|
@@ -14367,7 +14446,9 @@ class TransformTool {
|
|
|
14367
14446
|
}
|
|
14368
14447
|
move = DragEvent.getValidMove(target, dragStartData.point, total, checkLimitMove);
|
|
14369
14448
|
}
|
|
14370
|
-
if (
|
|
14449
|
+
if (move.x || move.y) {
|
|
14450
|
+
if (dragLimitAnimate && !axisDrag && isMoveEnd) LeafHelper.animateMove(this, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else this.move(move);
|
|
14451
|
+
}
|
|
14371
14452
|
}
|
|
14372
14453
|
onScale(e) {
|
|
14373
14454
|
const {target: target, mergeConfig: mergeConfig, single: single, dragStartData: dragStartData} = this.editBox;
|
|
@@ -14642,6 +14723,10 @@ let Editor = class Editor extends Group {
|
|
|
14642
14723
|
get buttons() {
|
|
14643
14724
|
return this.editBox.buttons;
|
|
14644
14725
|
}
|
|
14726
|
+
get targetLeafer() {
|
|
14727
|
+
const first = this.list[0];
|
|
14728
|
+
return first && first.leafer;
|
|
14729
|
+
}
|
|
14645
14730
|
constructor(userConfig, data) {
|
|
14646
14731
|
super(data);
|
|
14647
14732
|
this.leafList = new LeafList;
|
|
@@ -14798,7 +14883,6 @@ let Editor = class Editor extends Group {
|
|
|
14798
14883
|
this.emitInnerEvent(InnerEditorEvent.BEFORE_OPEN);
|
|
14799
14884
|
this.innerEditor.load();
|
|
14800
14885
|
this.emitInnerEvent(InnerEditorEvent.OPEN);
|
|
14801
|
-
console.log("hello");
|
|
14802
14886
|
}
|
|
14803
14887
|
}
|
|
14804
14888
|
}
|
|
@@ -14847,10 +14931,13 @@ let Editor = class Editor extends Group {
|
|
|
14847
14931
|
onRenderStart() {
|
|
14848
14932
|
if (this.targetChanged) this.update();
|
|
14849
14933
|
}
|
|
14934
|
+
onChildScroll() {
|
|
14935
|
+
if (this.multiple) this.updateEditBox();
|
|
14936
|
+
}
|
|
14850
14937
|
listenTargetEvents() {
|
|
14851
14938
|
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) ];
|
|
14939
|
+
const {app: app, leafer: leafer, targetLeafer: targetLeafer, editMask: editMask} = this;
|
|
14940
|
+
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
14941
|
if (editMask.visible) editMask.forceRender();
|
|
14855
14942
|
}
|
|
14856
14943
|
}
|
|
@@ -14999,7 +15086,7 @@ EditTool = __decorate([ registerEditTool() ], EditTool);
|
|
|
14999
15086
|
|
|
15000
15087
|
const {left: left$1, right: right$1} = Direction9;
|
|
15001
15088
|
|
|
15002
|
-
const {move: move$
|
|
15089
|
+
const {move: move$5, copy: copy$1, toNumberPoints: toNumberPoints} = PointHelper;
|
|
15003
15090
|
|
|
15004
15091
|
let LineEditTool = class LineEditTool extends EditTool {
|
|
15005
15092
|
constructor() {
|
|
@@ -15073,11 +15160,11 @@ let LineEditTool = class LineEditTool extends EditTool {
|
|
|
15073
15160
|
dragPoint(fromPoint, toPoint, isDragFrom, around, movePoint) {
|
|
15074
15161
|
const {x: x, y: y} = movePoint;
|
|
15075
15162
|
if (isDragFrom) {
|
|
15076
|
-
move$
|
|
15077
|
-
if (around) move$
|
|
15163
|
+
move$5(fromPoint, x, y);
|
|
15164
|
+
if (around) move$5(toPoint, -x, -y);
|
|
15078
15165
|
} else {
|
|
15079
|
-
if (around) move$
|
|
15080
|
-
move$
|
|
15166
|
+
if (around) move$5(fromPoint, -x, -y);
|
|
15167
|
+
move$5(toPoint, x, y);
|
|
15081
15168
|
}
|
|
15082
15169
|
}
|
|
15083
15170
|
onSkew(_e) {}
|
|
@@ -15377,7 +15464,9 @@ function addViewport(leafer, mergeConfig, custom) {
|
|
|
15377
15464
|
addViewportConfig(leafer.parentApp ? leafer.parentApp : leafer, mergeConfig);
|
|
15378
15465
|
if (leafer.isApp || custom) return;
|
|
15379
15466
|
leafer.__eventIds.push(leafer.on_(MoveEvent.BEFORE_MOVE, e => {
|
|
15380
|
-
leafer.zoomLayer.move(leafer.getValidMove(e.moveX, e.moveY));
|
|
15467
|
+
leafer.zoomLayer.move(leafer.getValidMove(e.moveX, e.moveY, false));
|
|
15468
|
+
}), leafer.on_(MoveEvent.END, e => {
|
|
15469
|
+
LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY));
|
|
15381
15470
|
}), leafer.on_(ZoomEvent.BEFORE_ZOOM, e => {
|
|
15382
15471
|
const {zoomLayer: zoomLayer} = leafer;
|
|
15383
15472
|
const changeScale = leafer.getValidScale(e.scale);
|
|
@@ -15592,32 +15681,27 @@ class Transformer {
|
|
|
15592
15681
|
|
|
15593
15682
|
const leafer = Leafer.prototype;
|
|
15594
15683
|
|
|
15595
|
-
const bounds = new Bounds;
|
|
15684
|
+
const bounds = new Bounds, move$4 = new Point;
|
|
15596
15685
|
|
|
15597
15686
|
leafer.initType = function(type) {
|
|
15598
15687
|
LeaferTypeCreator.run(type, this);
|
|
15599
15688
|
};
|
|
15600
15689
|
|
|
15601
|
-
leafer.getValidMove = function(moveX, moveY) {
|
|
15690
|
+
leafer.getValidMove = function(moveX, moveY, checkLimit = true) {
|
|
15602
15691
|
const {scroll: scroll, disabled: disabled} = this.app.config.move;
|
|
15692
|
+
move$4.set(moveX, moveY);
|
|
15603
15693
|
if (scroll) {
|
|
15604
15694
|
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;
|
|
15695
|
+
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;
|
|
15696
|
+
if (checkLimit && type.includes("limit")) {
|
|
15697
|
+
bounds.set(this.__world).addPoint(this.zoomLayer);
|
|
15698
|
+
DragBoundsHelper.getValidMove(bounds, this.canvas.bounds, "inner", move$4, true);
|
|
15699
|
+
if (type.includes("x")) move$4.y = 0; else if (type.includes("y")) move$4.x = 0;
|
|
15616
15700
|
}
|
|
15617
15701
|
}
|
|
15618
15702
|
return {
|
|
15619
|
-
x: disabled ? 0 :
|
|
15620
|
-
y: disabled ? 0 :
|
|
15703
|
+
x: disabled ? 0 : move$4.x,
|
|
15704
|
+
y: disabled ? 0 : move$4.y
|
|
15621
15705
|
};
|
|
15622
15706
|
};
|
|
15623
15707
|
|
|
@@ -19210,4 +19294,4 @@ Object.assign(Filter, {
|
|
|
19210
19294
|
}
|
|
19211
19295
|
});
|
|
19212
19296
|
|
|
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 };
|
|
19297
|
+
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 };
|