@leafer/worker 1.9.0 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker.js +275 -190
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +280 -192
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +22 -22
package/dist/worker.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,
|
|
@@ -2181,7 +2186,7 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2181
2186
|
this.innerId = IncrementId.create(IncrementId.CNAVAS);
|
|
2182
2187
|
const {width: width, height: height, pixelRatio: pixelRatio} = config;
|
|
2183
2188
|
this.autoLayout = !width || !height;
|
|
2184
|
-
this.size.pixelRatio = pixelRatio
|
|
2189
|
+
this.size.pixelRatio = pixelRatio || Platform.devicePixelRatio;
|
|
2185
2190
|
this.config = config;
|
|
2186
2191
|
this.init();
|
|
2187
2192
|
}
|
|
@@ -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() {
|
|
@@ -7221,8 +7271,8 @@ class Renderer {
|
|
|
7221
7271
|
const {canvas: canvas} = this, bounds = block.getIntersect(canvas.bounds), realBounds = new Bounds(bounds);
|
|
7222
7272
|
canvas.save();
|
|
7223
7273
|
bounds.spread(Renderer.clipSpread).ceil();
|
|
7224
|
-
canvas.clearWorld(bounds
|
|
7225
|
-
canvas.clipWorld(bounds
|
|
7274
|
+
canvas.clearWorld(bounds);
|
|
7275
|
+
canvas.clipWorld(bounds);
|
|
7226
7276
|
this.__render(bounds, realBounds);
|
|
7227
7277
|
canvas.restore();
|
|
7228
7278
|
Run.end(t);
|
|
@@ -7445,6 +7495,7 @@ class Picker {
|
|
|
7445
7495
|
hit = child.__.hitRadius ? true : hitRadiusPoint$1(child.__world, point);
|
|
7446
7496
|
if (child.isBranch) {
|
|
7447
7497
|
if (hit || child.__ignoreHitWorld) {
|
|
7498
|
+
if (child.topChildren) this.eachFind(child.topChildren, false);
|
|
7448
7499
|
this.eachFind(child.children, child.__onlyHitMask);
|
|
7449
7500
|
if (child.isBranchLeaf) this.hitChild(child, point);
|
|
7450
7501
|
}
|
|
@@ -7792,7 +7843,7 @@ class BoxData extends GroupData {
|
|
|
7792
7843
|
}
|
|
7793
7844
|
get __clipAfterFill() {
|
|
7794
7845
|
const t = this;
|
|
7795
|
-
return t.overflow
|
|
7846
|
+
return t.overflow !== "show" && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill);
|
|
7796
7847
|
}
|
|
7797
7848
|
}
|
|
7798
7849
|
|
|
@@ -7948,6 +7999,41 @@ const UIBounds = {
|
|
|
7948
7999
|
}
|
|
7949
8000
|
};
|
|
7950
8001
|
|
|
8002
|
+
const DragBoundsHelper = {
|
|
8003
|
+
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
8004
|
+
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
8005
|
+
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
8006
|
+
if (!change) move = Object.assign({}, move);
|
|
8007
|
+
const isBiggerWidth = content.width > dragBounds.width;
|
|
8008
|
+
const isBiggerHeight = content.height > dragBounds.height;
|
|
8009
|
+
if (isBiggerWidth && dragBoundsType !== "outer") {
|
|
8010
|
+
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
8011
|
+
} else {
|
|
8012
|
+
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
8013
|
+
}
|
|
8014
|
+
if (isBiggerHeight && dragBoundsType !== "outer") {
|
|
8015
|
+
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
8016
|
+
} else {
|
|
8017
|
+
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
8018
|
+
}
|
|
8019
|
+
move.x = MathHelper.float(move.x);
|
|
8020
|
+
move.y = MathHelper.float(move.y);
|
|
8021
|
+
return move;
|
|
8022
|
+
},
|
|
8023
|
+
axisMove(leaf, move) {
|
|
8024
|
+
const {draggable: draggable} = leaf;
|
|
8025
|
+
if (draggable === "x") move.y = 0;
|
|
8026
|
+
if (draggable === "y") move.x = 0;
|
|
8027
|
+
},
|
|
8028
|
+
limitMove(leaf, move) {
|
|
8029
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
8030
|
+
if (dragBounds) D$2.getValidMove(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, dragBoundsType, move, true);
|
|
8031
|
+
D$2.axisMove(leaf, move);
|
|
8032
|
+
}
|
|
8033
|
+
};
|
|
8034
|
+
|
|
8035
|
+
const D$2 = DragBoundsHelper;
|
|
8036
|
+
|
|
7951
8037
|
const {stintSet: stintSet$1} = DataHelper;
|
|
7952
8038
|
|
|
7953
8039
|
const UIRender = {
|
|
@@ -8262,9 +8348,9 @@ __decorate([ positionType(0, true) ], UI.prototype, "offsetX", void 0);
|
|
|
8262
8348
|
|
|
8263
8349
|
__decorate([ positionType(0, true) ], UI.prototype, "offsetY", void 0);
|
|
8264
8350
|
|
|
8265
|
-
__decorate([
|
|
8351
|
+
__decorate([ scrollType(0, true) ], UI.prototype, "scrollX", void 0);
|
|
8266
8352
|
|
|
8267
|
-
__decorate([
|
|
8353
|
+
__decorate([ scrollType(0, true) ], UI.prototype, "scrollY", void 0);
|
|
8268
8354
|
|
|
8269
8355
|
__decorate([ autoLayoutType() ], UI.prototype, "origin", void 0);
|
|
8270
8356
|
|
|
@@ -8294,6 +8380,8 @@ __decorate([ dataType(false) ], UI.prototype, "draggable", void 0);
|
|
|
8294
8380
|
|
|
8295
8381
|
__decorate([ dataType() ], UI.prototype, "dragBounds", void 0);
|
|
8296
8382
|
|
|
8383
|
+
__decorate([ dataType("auto") ], UI.prototype, "dragBoundsType", void 0);
|
|
8384
|
+
|
|
8297
8385
|
__decorate([ dataType(false) ], UI.prototype, "editable", void 0);
|
|
8298
8386
|
|
|
8299
8387
|
__decorate([ hitType(true) ], UI.prototype, "hittable", void 0);
|
|
@@ -8716,7 +8804,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8716
8804
|
zoom(_zoomType, _optionsOrPadding, _scroll, _transition) {
|
|
8717
8805
|
return Plugin.need("view");
|
|
8718
8806
|
}
|
|
8719
|
-
getValidMove(moveX, moveY) {
|
|
8807
|
+
getValidMove(moveX, moveY, _checkLimit) {
|
|
8720
8808
|
return {
|
|
8721
8809
|
x: moveX,
|
|
8722
8810
|
y: moveY
|
|
@@ -8805,12 +8893,10 @@ __decorate([ dataProcessor(RectData) ], Rect.prototype, "__", void 0);
|
|
|
8805
8893
|
|
|
8806
8894
|
Rect = __decorate([ useModule(RectRender), rewriteAble(), registerUI() ], Rect);
|
|
8807
8895
|
|
|
8808
|
-
const {
|
|
8896
|
+
const {add: add, includes: includes$1, scroll: scroll} = BoundsHelper;
|
|
8809
8897
|
|
|
8810
8898
|
const rect$1 = Rect.prototype, group = Group.prototype;
|
|
8811
8899
|
|
|
8812
|
-
const childrenRenderBounds = {};
|
|
8813
|
-
|
|
8814
8900
|
let Box = class Box extends Group {
|
|
8815
8901
|
get __tag() {
|
|
8816
8902
|
return "Box";
|
|
@@ -8856,22 +8942,24 @@ let Box = class Box extends Group {
|
|
|
8856
8942
|
__updateRenderBounds() {
|
|
8857
8943
|
let isOverflow;
|
|
8858
8944
|
if (this.children.length) {
|
|
8859
|
-
const data = this.__, {renderBounds: renderBounds, boxBounds: boxBounds} =
|
|
8860
|
-
|
|
8861
|
-
|
|
8945
|
+
const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
|
|
8946
|
+
const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
|
|
8947
|
+
super.__updateRenderBounds(childrenRenderBounds);
|
|
8948
|
+
scroll(childrenRenderBounds, data);
|
|
8862
8949
|
this.__updateRectRenderBounds();
|
|
8863
|
-
if (data.scrollY || data.scrollX) {
|
|
8864
|
-
childrenRenderBounds.x += data.scrollX;
|
|
8865
|
-
childrenRenderBounds.y += data.scrollY;
|
|
8866
|
-
}
|
|
8867
8950
|
isOverflow = !includes$1(boxBounds, childrenRenderBounds);
|
|
8868
|
-
if (isOverflow && data.overflow
|
|
8951
|
+
if (isOverflow && data.overflow === "show") add(renderBounds, childrenRenderBounds);
|
|
8869
8952
|
} else this.__updateRectRenderBounds();
|
|
8870
8953
|
DataHelper.stintSet(this, "isOverflow", isOverflow);
|
|
8871
|
-
this.
|
|
8954
|
+
this.__checkScroll();
|
|
8872
8955
|
}
|
|
8873
8956
|
__updateRectRenderBounds() {}
|
|
8874
|
-
|
|
8957
|
+
__updateWorldBounds() {
|
|
8958
|
+
if (this.hasScroller) this.__updateScroll();
|
|
8959
|
+
super.__updateWorldBounds();
|
|
8960
|
+
}
|
|
8961
|
+
__checkScroll() {}
|
|
8962
|
+
__updateScroll() {}
|
|
8875
8963
|
__updateRectChange() {}
|
|
8876
8964
|
__updateChange() {
|
|
8877
8965
|
super.__updateChange();
|
|
@@ -8886,7 +8974,7 @@ let Box = class Box extends Group {
|
|
|
8886
8974
|
this.__renderRect(canvas, options);
|
|
8887
8975
|
if (this.children.length) this.__renderGroup(canvas, options);
|
|
8888
8976
|
}
|
|
8889
|
-
if (this.
|
|
8977
|
+
if (this.hasScroller) this.scroller.__render(canvas, options);
|
|
8890
8978
|
}
|
|
8891
8979
|
__drawContent(canvas, options) {
|
|
8892
8980
|
this.__renderGroup(canvas, options);
|
|
@@ -9256,7 +9344,7 @@ let Text = class Text extends UI {
|
|
|
9256
9344
|
data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
|
|
9257
9345
|
data.__padding = padding ? MathHelper.fourNumber(padding) : undefined;
|
|
9258
9346
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * .7) / 2;
|
|
9259
|
-
data.__font = `${italic ? "italic " : ""}${textCase === "small-caps" ? "small-caps " : ""}${fontWeight !== "normal" ? fontWeight + " " : ""}${fontSize}px ${fontFamily}`;
|
|
9347
|
+
data.__font = `${italic ? "italic " : ""}${textCase === "small-caps" ? "small-caps " : ""}${fontWeight !== "normal" ? fontWeight + " " : ""}${fontSize || 12}px ${fontFamily || "caption"}`;
|
|
9260
9348
|
data.__clipText = textOverflow !== "show" && !data.__autoSize;
|
|
9261
9349
|
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === "") ? data.placeholder : data.text, this.__);
|
|
9262
9350
|
}
|
|
@@ -9559,7 +9647,7 @@ let App = class App extends Leafer {
|
|
|
9559
9647
|
if (this.viewReady) this.renderer.update();
|
|
9560
9648
|
}
|
|
9561
9649
|
__render(canvas, options) {
|
|
9562
|
-
if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options
|
|
9650
|
+
if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options.bounds));
|
|
9563
9651
|
}
|
|
9564
9652
|
__onResize(event) {
|
|
9565
9653
|
this.forEach(leafer => leafer.resize(event));
|
|
@@ -9727,26 +9815,11 @@ let DragEvent = class DragEvent extends PointerEvent {
|
|
|
9727
9815
|
const move = leaf.getLocalPoint(total, null, true);
|
|
9728
9816
|
PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
|
|
9729
9817
|
if (checkLimit) this.limitMove(leaf, move);
|
|
9818
|
+
DragBoundsHelper.axisMove(leaf, move);
|
|
9730
9819
|
return move;
|
|
9731
9820
|
}
|
|
9732
9821
|
static limitMove(leaf, move) {
|
|
9733
|
-
|
|
9734
|
-
if (dragBounds) this.getMoveInDragBounds(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, move, true);
|
|
9735
|
-
if (draggable === "x") move.y = 0;
|
|
9736
|
-
if (draggable === "y") move.x = 0;
|
|
9737
|
-
}
|
|
9738
|
-
static getMoveInDragBounds(childBox, dragBounds, move, change) {
|
|
9739
|
-
const x = childBox.x + move.x, y = childBox.y + move.y, right = x + childBox.width, bottom = y + childBox.height;
|
|
9740
|
-
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
9741
|
-
if (!change) move = Object.assign({}, move);
|
|
9742
|
-
if (BoundsHelper.includes(childBox, dragBounds)) {
|
|
9743
|
-
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
9744
|
-
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
9745
|
-
} else {
|
|
9746
|
-
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
9747
|
-
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
9748
|
-
}
|
|
9749
|
-
return move;
|
|
9822
|
+
DragBoundsHelper.limitMove(leaf, move);
|
|
9750
9823
|
}
|
|
9751
9824
|
getPageMove(total) {
|
|
9752
9825
|
this.assignMove(total);
|
|
@@ -10031,11 +10104,12 @@ class Dragger {
|
|
|
10031
10104
|
const checkLimitMove = !dragLimitAnimate || !!isDragEnd;
|
|
10032
10105
|
list.forEach(leaf => {
|
|
10033
10106
|
if (leaf.draggable) {
|
|
10107
|
+
const axisDrag = isString(leaf.draggable);
|
|
10034
10108
|
const move = DragEvent.getValidMove(leaf, this.dragStartPoints[leaf.innerId], {
|
|
10035
10109
|
x: totalX,
|
|
10036
10110
|
y: totalY
|
|
10037
|
-
}, checkLimitMove);
|
|
10038
|
-
if (dragLimitAnimate && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else leaf.move(move);
|
|
10111
|
+
}, checkLimitMove || axisDrag);
|
|
10112
|
+
if (dragLimitAnimate && !axisDrag && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else leaf.move(move);
|
|
10039
10113
|
}
|
|
10040
10114
|
});
|
|
10041
10115
|
}
|
|
@@ -11072,18 +11146,22 @@ const {getSpread: getSpread, getOuterOf: getOuterOf, getByMove: getByMove, getIn
|
|
|
11072
11146
|
|
|
11073
11147
|
function shape(ui, current, options) {
|
|
11074
11148
|
const canvas = current.getSameCanvas();
|
|
11075
|
-
const nowWorld = ui.__nowWorld;
|
|
11149
|
+
const nowWorld = ui.__nowWorld, currentBounds = current.bounds;
|
|
11076
11150
|
let bounds, matrix, fitMatrix, shapeBounds, worldCanvas;
|
|
11077
|
-
let {scaleX: scaleX, scaleY: scaleY} =
|
|
11078
|
-
if (
|
|
11079
|
-
if (scaleY < 0) scaleY = -scaleY;
|
|
11080
|
-
if (current.bounds.includes(nowWorld)) {
|
|
11151
|
+
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
11152
|
+
if (currentBounds.includes(nowWorld)) {
|
|
11081
11153
|
worldCanvas = canvas;
|
|
11082
11154
|
bounds = shapeBounds = nowWorld;
|
|
11083
11155
|
} else {
|
|
11084
11156
|
const {renderShapeSpread: spread} = ui.__layout;
|
|
11085
|
-
|
|
11086
|
-
|
|
11157
|
+
let worldClipBounds;
|
|
11158
|
+
if (Platform.fullImageShadow) {
|
|
11159
|
+
worldClipBounds = nowWorld;
|
|
11160
|
+
} else {
|
|
11161
|
+
const spreadBounds = spread ? getSpread(currentBounds, scaleX === scaleY ? spread * scaleX : [ spread * scaleY, spread * scaleX ]) : currentBounds;
|
|
11162
|
+
worldClipBounds = getIntersectData(spreadBounds, nowWorld);
|
|
11163
|
+
}
|
|
11164
|
+
fitMatrix = currentBounds.getFitMatrix(worldClipBounds);
|
|
11087
11165
|
let {a: fitScaleX, d: fitScaleY} = fitMatrix;
|
|
11088
11166
|
if (fitMatrix.a < 1) {
|
|
11089
11167
|
worldCanvas = current.getSameCanvas();
|
|
@@ -11790,7 +11868,7 @@ function shadow$1(ui, current, shape) {
|
|
|
11790
11868
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
11791
11869
|
}
|
|
11792
11870
|
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
11793
|
-
if (end && index < end) other.clearWorld(copyBounds
|
|
11871
|
+
if (end && index < end) other.clearWorld(copyBounds);
|
|
11794
11872
|
});
|
|
11795
11873
|
other.recycle(copyBounds);
|
|
11796
11874
|
}
|
|
@@ -11854,7 +11932,7 @@ function innerShadow(ui, current, shape) {
|
|
|
11854
11932
|
}
|
|
11855
11933
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), "source-in");
|
|
11856
11934
|
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
11857
|
-
if (end && index < end) other.clearWorld(copyBounds
|
|
11935
|
+
if (end && index < end) other.clearWorld(copyBounds);
|
|
11858
11936
|
});
|
|
11859
11937
|
other.recycle(copyBounds);
|
|
11860
11938
|
}
|
|
@@ -11953,7 +12031,7 @@ function copyContent(leaf, canvas, content, maskOpacity, blendMode, recycle) {
|
|
|
11953
12031
|
canvas.resetTransform();
|
|
11954
12032
|
canvas.opacity = maskOpacity;
|
|
11955
12033
|
canvas.copyWorld(content, realBounds, undefined, blendMode);
|
|
11956
|
-
recycle ? content.recycle(realBounds) : content.clearWorld(realBounds
|
|
12034
|
+
recycle ? content.recycle(realBounds) : content.clearWorld(realBounds);
|
|
11957
12035
|
}
|
|
11958
12036
|
|
|
11959
12037
|
const money = "¥¥$€££¢¢";
|
|
@@ -13560,7 +13638,7 @@ class EditBox extends Group {
|
|
|
13560
13638
|
if (pointType && pointType.includes("resize")) ResizeEvent.resizingKeys = editor.leafList.keys;
|
|
13561
13639
|
}
|
|
13562
13640
|
onDragEnd(e) {
|
|
13563
|
-
if (this.
|
|
13641
|
+
if (this.moving) this.transformTool.onMove(e);
|
|
13564
13642
|
this.dragPoint = null;
|
|
13565
13643
|
this.resetDoing();
|
|
13566
13644
|
const {name: name, pointType: pointType} = e.current;
|
|
@@ -13593,6 +13671,10 @@ class EditBox extends Group {
|
|
|
13593
13671
|
}
|
|
13594
13672
|
}
|
|
13595
13673
|
}
|
|
13674
|
+
onMoveEnd(e) {
|
|
13675
|
+
if (this.moving) this.transformTool.onMove(e);
|
|
13676
|
+
this.resetDoing();
|
|
13677
|
+
}
|
|
13596
13678
|
onScale(e) {
|
|
13597
13679
|
if (this.canGesture) {
|
|
13598
13680
|
e.stop();
|
|
@@ -13683,7 +13765,7 @@ class EditBox extends Group {
|
|
|
13683
13765
|
const {rect: rect, editor: editor, __eventIds: events} = this;
|
|
13684
13766
|
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 ] ]));
|
|
13685
13767
|
this.waitLeafer(() => {
|
|
13686
|
-
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.
|
|
13768
|
+
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 ] ]));
|
|
13687
13769
|
});
|
|
13688
13770
|
}
|
|
13689
13771
|
__removeListenEvents() {
|
|
@@ -13856,7 +13938,7 @@ const EditorHelper = {
|
|
|
13856
13938
|
parent.addAt(group, parent.children.indexOf(list[0]));
|
|
13857
13939
|
list.sort(order);
|
|
13858
13940
|
const matrx = new Matrix(element.worldTransform);
|
|
13859
|
-
matrx.divideParent(parent.
|
|
13941
|
+
matrx.divideParent(parent.scrollWorldTransform);
|
|
13860
13942
|
group.setTransform(matrx);
|
|
13861
13943
|
group.editable = true;
|
|
13862
13944
|
group.hitChildren = false;
|
|
@@ -14079,8 +14161,9 @@ class TransformTool {
|
|
|
14079
14161
|
const {target: target, mergeConfig: mergeConfig, dragStartData: dragStartData, app: app} = this.editBox;
|
|
14080
14162
|
let move, {dragLimitAnimate: dragLimitAnimate} = mergeConfig;
|
|
14081
14163
|
if (isUndefined(dragLimitAnimate)) dragLimitAnimate = app && app.config.pointer.dragLimitAnimate;
|
|
14082
|
-
const isMoveEnd = e.type ===
|
|
14083
|
-
const
|
|
14164
|
+
const isMoveEnd = e.type === MoveEvent.END || e.type === DragEvent.END;
|
|
14165
|
+
const axisDrag = isString(target.draggable);
|
|
14166
|
+
const checkLimitMove = !dragLimitAnimate || isMoveEnd || axisDrag;
|
|
14084
14167
|
if (e instanceof MoveEvent) {
|
|
14085
14168
|
move = e.getLocalMove(target);
|
|
14086
14169
|
if (checkLimitMove) DragEvent.limitMove(target, move);
|
|
@@ -14094,7 +14177,9 @@ class TransformTool {
|
|
|
14094
14177
|
}
|
|
14095
14178
|
move = DragEvent.getValidMove(target, dragStartData.point, total, checkLimitMove);
|
|
14096
14179
|
}
|
|
14097
|
-
if (
|
|
14180
|
+
if (move.x || move.y) {
|
|
14181
|
+
if (dragLimitAnimate && !axisDrag && isMoveEnd) LeafHelper.animateMove(this, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else this.move(move);
|
|
14182
|
+
}
|
|
14098
14183
|
}
|
|
14099
14184
|
onScale(e) {
|
|
14100
14185
|
const {target: target, mergeConfig: mergeConfig, single: single, dragStartData: dragStartData} = this.editBox;
|
|
@@ -14369,6 +14454,10 @@ let Editor = class Editor extends Group {
|
|
|
14369
14454
|
get buttons() {
|
|
14370
14455
|
return this.editBox.buttons;
|
|
14371
14456
|
}
|
|
14457
|
+
get targetLeafer() {
|
|
14458
|
+
const first = this.list[0];
|
|
14459
|
+
return first && first.leafer;
|
|
14460
|
+
}
|
|
14372
14461
|
constructor(userConfig, data) {
|
|
14373
14462
|
super(data);
|
|
14374
14463
|
this.leafList = new LeafList;
|
|
@@ -14525,7 +14614,6 @@ let Editor = class Editor extends Group {
|
|
|
14525
14614
|
this.emitInnerEvent(InnerEditorEvent.BEFORE_OPEN);
|
|
14526
14615
|
this.innerEditor.load();
|
|
14527
14616
|
this.emitInnerEvent(InnerEditorEvent.OPEN);
|
|
14528
|
-
console.log("hello");
|
|
14529
14617
|
}
|
|
14530
14618
|
}
|
|
14531
14619
|
}
|
|
@@ -14574,10 +14662,13 @@ let Editor = class Editor extends Group {
|
|
|
14574
14662
|
onRenderStart() {
|
|
14575
14663
|
if (this.targetChanged) this.update();
|
|
14576
14664
|
}
|
|
14665
|
+
onChildScroll() {
|
|
14666
|
+
if (this.multiple) this.updateEditBox();
|
|
14667
|
+
}
|
|
14577
14668
|
listenTargetEvents() {
|
|
14578
14669
|
if (!this.targetEventIds.length) {
|
|
14579
|
-
const {app: app, leafer: leafer, editMask: editMask} = this;
|
|
14580
|
-
this.targetEventIds = [ leafer.on_(RenderEvent.START, this.onRenderStart, this), app.on_(RenderEvent.CHILD_START, this.onAppRenderStart, this) ];
|
|
14670
|
+
const {app: app, leafer: leafer, targetLeafer: targetLeafer, editMask: editMask} = this;
|
|
14671
|
+
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) ];
|
|
14581
14672
|
if (editMask.visible) editMask.forceRender();
|
|
14582
14673
|
}
|
|
14583
14674
|
}
|
|
@@ -14726,7 +14817,7 @@ EditTool = __decorate([ registerEditTool() ], EditTool);
|
|
|
14726
14817
|
|
|
14727
14818
|
const {left: left$1, right: right$1} = Direction9;
|
|
14728
14819
|
|
|
14729
|
-
const {move: move$
|
|
14820
|
+
const {move: move$5, copy: copy$1, toNumberPoints: toNumberPoints} = PointHelper;
|
|
14730
14821
|
|
|
14731
14822
|
let LineEditTool = class LineEditTool extends EditTool {
|
|
14732
14823
|
constructor() {
|
|
@@ -14800,11 +14891,11 @@ let LineEditTool = class LineEditTool extends EditTool {
|
|
|
14800
14891
|
dragPoint(fromPoint, toPoint, isDragFrom, around, movePoint) {
|
|
14801
14892
|
const {x: x, y: y} = movePoint;
|
|
14802
14893
|
if (isDragFrom) {
|
|
14803
|
-
move$
|
|
14804
|
-
if (around) move$
|
|
14894
|
+
move$5(fromPoint, x, y);
|
|
14895
|
+
if (around) move$5(toPoint, -x, -y);
|
|
14805
14896
|
} else {
|
|
14806
|
-
if (around) move$
|
|
14807
|
-
move$
|
|
14897
|
+
if (around) move$5(fromPoint, -x, -y);
|
|
14898
|
+
move$5(toPoint, x, y);
|
|
14808
14899
|
}
|
|
14809
14900
|
}
|
|
14810
14901
|
onSkew(_e) {}
|
|
@@ -15359,7 +15450,9 @@ function addViewport(leafer, mergeConfig, custom) {
|
|
|
15359
15450
|
addViewportConfig(leafer.parentApp ? leafer.parentApp : leafer, mergeConfig);
|
|
15360
15451
|
if (leafer.isApp || custom) return;
|
|
15361
15452
|
leafer.__eventIds.push(leafer.on_(MoveEvent.BEFORE_MOVE, e => {
|
|
15362
|
-
leafer.zoomLayer.move(leafer.getValidMove(e.moveX, e.moveY));
|
|
15453
|
+
leafer.zoomLayer.move(leafer.getValidMove(e.moveX, e.moveY, false));
|
|
15454
|
+
}), leafer.on_(MoveEvent.END, e => {
|
|
15455
|
+
LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY));
|
|
15363
15456
|
}), leafer.on_(ZoomEvent.BEFORE_ZOOM, e => {
|
|
15364
15457
|
const {zoomLayer: zoomLayer} = leafer;
|
|
15365
15458
|
const changeScale = leafer.getValidScale(e.scale);
|
|
@@ -15574,32 +15667,27 @@ class Transformer {
|
|
|
15574
15667
|
|
|
15575
15668
|
const leafer = Leafer.prototype;
|
|
15576
15669
|
|
|
15577
|
-
const bounds = new Bounds;
|
|
15670
|
+
const bounds = new Bounds, move$4 = new Point;
|
|
15578
15671
|
|
|
15579
15672
|
leafer.initType = function(type) {
|
|
15580
15673
|
LeaferTypeCreator.run(type, this);
|
|
15581
15674
|
};
|
|
15582
15675
|
|
|
15583
|
-
leafer.getValidMove = function(moveX, moveY) {
|
|
15676
|
+
leafer.getValidMove = function(moveX, moveY, checkLimit = true) {
|
|
15584
15677
|
const {scroll: scroll, disabled: disabled} = this.app.config.move;
|
|
15678
|
+
move$4.set(moveX, moveY);
|
|
15585
15679
|
if (scroll) {
|
|
15586
15680
|
const type = scroll === true ? "" : scroll;
|
|
15587
|
-
if (type.includes("x"))
|
|
15588
|
-
|
|
15589
|
-
|
|
15590
|
-
|
|
15591
|
-
|
|
15592
|
-
if (x >= 0 && right <= 0) moveX = 0; else if (moveX > 0) {
|
|
15593
|
-
if (x + moveX > 0) moveX = -x;
|
|
15594
|
-
} else if (moveX < 0 && right + moveX < 0) moveX = -right;
|
|
15595
|
-
if (y >= 0 && bottom <= 0) moveY = 0; else if (moveY > 0) {
|
|
15596
|
-
if (y + moveY > 0) moveY = -y;
|
|
15597
|
-
} else if (moveY < 0 && bottom + moveY < 0) moveY = -bottom;
|
|
15681
|
+
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;
|
|
15682
|
+
if (checkLimit && type.includes("limit")) {
|
|
15683
|
+
bounds.set(this.__world).addPoint(this.zoomLayer);
|
|
15684
|
+
DragBoundsHelper.getValidMove(bounds, this.canvas.bounds, "inner", move$4, true);
|
|
15685
|
+
if (type.includes("x")) move$4.y = 0; else if (type.includes("y")) move$4.x = 0;
|
|
15598
15686
|
}
|
|
15599
15687
|
}
|
|
15600
15688
|
return {
|
|
15601
|
-
x: disabled ? 0 :
|
|
15602
|
-
y: disabled ? 0 :
|
|
15689
|
+
x: disabled ? 0 : move$4.x,
|
|
15690
|
+
y: disabled ? 0 : move$4.y
|
|
15603
15691
|
};
|
|
15604
15692
|
};
|
|
15605
15693
|
|
|
@@ -19245,4 +19333,4 @@ Object.assign(Filter, {
|
|
|
19245
19333
|
}
|
|
19246
19334
|
});
|
|
19247
19335
|
|
|
19248
|
-
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, HTMLText, HTMLTextData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, 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, TextEditor, 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 };
|
|
19336
|
+
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, HTMLText, HTMLTextData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, 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, TextEditor, 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 };
|