@leafer/worker 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/worker.js +262 -181
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +267 -183
- 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.js
CHANGED
|
@@ -445,9 +445,8 @@ var LeaferUI = function(exports) {
|
|
|
445
445
|
t.e = child.e * a + child.f * c + e;
|
|
446
446
|
t.f = child.e * b + child.f * d + f;
|
|
447
447
|
},
|
|
448
|
-
multiplyParent(t, parent, to, abcdChanged, childScaleData
|
|
449
|
-
|
|
450
|
-
if (scrollData) e += scrollData.scrollX, f += scrollData.scrollY;
|
|
448
|
+
multiplyParent(t, parent, to, abcdChanged, childScaleData) {
|
|
449
|
+
const {e: e, f: f} = t;
|
|
451
450
|
to || (to = t);
|
|
452
451
|
if (isUndefined(abcdChanged)) abcdChanged = t.a !== 1 || t.b || t.c || t.d !== 1;
|
|
453
452
|
if (abcdChanged) {
|
|
@@ -674,19 +673,19 @@ var LeaferUI = function(exports) {
|
|
|
674
673
|
},
|
|
675
674
|
tempToInnerOf(t, matrix) {
|
|
676
675
|
const {tempPoint: temp} = P$7;
|
|
677
|
-
copy$
|
|
676
|
+
copy$d(temp, t);
|
|
678
677
|
toInnerPoint$2(matrix, temp, temp);
|
|
679
678
|
return temp;
|
|
680
679
|
},
|
|
681
680
|
tempToOuterOf(t, matrix) {
|
|
682
681
|
const {tempPoint: temp} = P$7;
|
|
683
|
-
copy$
|
|
682
|
+
copy$d(temp, t);
|
|
684
683
|
toOuterPoint$3(matrix, temp, temp);
|
|
685
684
|
return temp;
|
|
686
685
|
},
|
|
687
686
|
tempToInnerRadiusPointOf(t, matrix) {
|
|
688
687
|
const {tempRadiusPoint: temp} = P$7;
|
|
689
|
-
copy$
|
|
688
|
+
copy$d(temp, t);
|
|
690
689
|
P$7.toInnerRadiusPointOf(t, matrix, temp);
|
|
691
690
|
return temp;
|
|
692
691
|
},
|
|
@@ -760,7 +759,7 @@ var LeaferUI = function(exports) {
|
|
|
760
759
|
}
|
|
761
760
|
};
|
|
762
761
|
const P$7 = PointHelper;
|
|
763
|
-
const {getDistanceFrom: getDistanceFrom, copy: copy$
|
|
762
|
+
const {getDistanceFrom: getDistanceFrom, copy: copy$d, getAtan2: getAtan2} = P$7;
|
|
764
763
|
class Point {
|
|
765
764
|
constructor(x, y) {
|
|
766
765
|
this.set(x, y);
|
|
@@ -1129,6 +1128,12 @@ var LeaferUI = function(exports) {
|
|
|
1129
1128
|
t.x += x;
|
|
1130
1129
|
t.y += y;
|
|
1131
1130
|
},
|
|
1131
|
+
scroll(t, data) {
|
|
1132
|
+
if (data.scrollY || data.scrollX) {
|
|
1133
|
+
t.x += data.scrollX;
|
|
1134
|
+
t.y += data.scrollY;
|
|
1135
|
+
}
|
|
1136
|
+
},
|
|
1132
1137
|
getByMove(t, x, y) {
|
|
1133
1138
|
t = Object.assign({}, t);
|
|
1134
1139
|
B.move(t, x, y);
|
|
@@ -1138,7 +1143,7 @@ var LeaferUI = function(exports) {
|
|
|
1138
1143
|
if (!to) {
|
|
1139
1144
|
to = t;
|
|
1140
1145
|
} else {
|
|
1141
|
-
copy$
|
|
1146
|
+
copy$c(to, t);
|
|
1142
1147
|
}
|
|
1143
1148
|
if (parent) {
|
|
1144
1149
|
to.offsetX = -(B.maxX(parent) - t.x);
|
|
@@ -1290,7 +1295,7 @@ var LeaferUI = function(exports) {
|
|
|
1290
1295
|
if (bounds && (bounds.width || bounds.height)) {
|
|
1291
1296
|
if (first) {
|
|
1292
1297
|
first = false;
|
|
1293
|
-
if (!addMode) copy$
|
|
1298
|
+
if (!addMode) copy$c(t, bounds);
|
|
1294
1299
|
} else {
|
|
1295
1300
|
add$1(t, bounds);
|
|
1296
1301
|
}
|
|
@@ -1375,7 +1380,7 @@ var LeaferUI = function(exports) {
|
|
|
1375
1380
|
}
|
|
1376
1381
|
};
|
|
1377
1382
|
const B = BoundsHelper;
|
|
1378
|
-
const {add: add$1, copy: copy$
|
|
1383
|
+
const {add: add$1, copy: copy$c} = B;
|
|
1379
1384
|
class Bounds {
|
|
1380
1385
|
get minX() {
|
|
1381
1386
|
return BoundsHelper.minX(this);
|
|
@@ -1584,17 +1589,17 @@ var LeaferUI = function(exports) {
|
|
|
1584
1589
|
showHit ? canvas.stroke() : canvas.strokeWorld(w, color);
|
|
1585
1590
|
}
|
|
1586
1591
|
log(...messages) {
|
|
1587
|
-
if (D$
|
|
1588
|
-
if (D$
|
|
1589
|
-
if (D$
|
|
1592
|
+
if (D$7.enable) {
|
|
1593
|
+
if (D$7.filterList.length && D$7.filterList.every(name => name !== this.name)) return;
|
|
1594
|
+
if (D$7.excludeList.length && D$7.excludeList.some(name => name === this.name)) return;
|
|
1590
1595
|
console.log("%c" + this.name, "color:#21ae62", ...messages);
|
|
1591
1596
|
}
|
|
1592
1597
|
}
|
|
1593
1598
|
tip(...messages) {
|
|
1594
|
-
if (D$
|
|
1599
|
+
if (D$7.enable) this.warn(...messages);
|
|
1595
1600
|
}
|
|
1596
1601
|
warn(...messages) {
|
|
1597
|
-
if (D$
|
|
1602
|
+
if (D$7.showWarn) console.warn(this.name, ...messages);
|
|
1598
1603
|
}
|
|
1599
1604
|
repeat(name, ...messages) {
|
|
1600
1605
|
if (!this.repeatMap[name]) {
|
|
@@ -1617,7 +1622,7 @@ var LeaferUI = function(exports) {
|
|
|
1617
1622
|
if (!name) name = []; else if (isString(name)) name = [ name ];
|
|
1618
1623
|
return name;
|
|
1619
1624
|
}
|
|
1620
|
-
const D$
|
|
1625
|
+
const D$7 = Debug;
|
|
1621
1626
|
const debug$i = Debug.get("RunTime");
|
|
1622
1627
|
const Run = {
|
|
1623
1628
|
currentId: 0,
|
|
@@ -1982,7 +1987,7 @@ var LeaferUI = function(exports) {
|
|
|
1982
1987
|
__decorate([ contextMethod() ], Canvas.prototype, "fillText", null);
|
|
1983
1988
|
__decorate([ contextMethod() ], Canvas.prototype, "measureText", null);
|
|
1984
1989
|
__decorate([ contextMethod() ], Canvas.prototype, "strokeText", null);
|
|
1985
|
-
const {copy: copy$
|
|
1990
|
+
const {copy: copy$b, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$4} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
1986
1991
|
const minSize = {
|
|
1987
1992
|
width: 1,
|
|
1988
1993
|
height: 1,
|
|
@@ -2144,44 +2149,44 @@ var LeaferUI = function(exports) {
|
|
|
2144
2149
|
const {pixelRatio: pixelRatio} = this;
|
|
2145
2150
|
this.filter = `blur(${blur * pixelRatio}px)`;
|
|
2146
2151
|
}
|
|
2147
|
-
copyWorld(canvas, from, to, blendMode) {
|
|
2152
|
+
copyWorld(canvas, from, to, blendMode, ceilPixel = true) {
|
|
2148
2153
|
if (blendMode) this.blendMode = blendMode;
|
|
2149
2154
|
if (from) {
|
|
2150
|
-
|
|
2151
|
-
if (!to) to =
|
|
2152
|
-
this.drawImage(canvas.view,
|
|
2155
|
+
this.setTempPixelBounds(from, ceilPixel);
|
|
2156
|
+
if (!to) to = tempPixelBounds; else this.setTempPixelBounds2(to, ceilPixel), to = tempPixelBounds2;
|
|
2157
|
+
this.drawImage(canvas.view, tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height, to.x, to.y, to.width, to.height);
|
|
2153
2158
|
} else {
|
|
2154
2159
|
this.drawImage(canvas.view, 0, 0);
|
|
2155
2160
|
}
|
|
2156
2161
|
if (blendMode) this.blendMode = "source-over";
|
|
2157
2162
|
}
|
|
2158
|
-
copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode) {
|
|
2159
|
-
if (blendMode) this.blendMode = blendMode;
|
|
2163
|
+
copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode, ceilPixel = true) {
|
|
2160
2164
|
if (fromWorld.b || fromWorld.c) {
|
|
2161
2165
|
this.save();
|
|
2162
2166
|
this.resetTransform();
|
|
2163
|
-
this.copyWorld(canvas, fromWorld, BoundsHelper.tempToOuterOf(toInnerBounds, fromWorld));
|
|
2167
|
+
this.copyWorld(canvas, fromWorld, BoundsHelper.tempToOuterOf(toInnerBounds, fromWorld), blendMode, ceilPixel);
|
|
2164
2168
|
this.restore();
|
|
2165
2169
|
} else {
|
|
2166
|
-
|
|
2167
|
-
this.
|
|
2170
|
+
if (blendMode) this.blendMode = blendMode;
|
|
2171
|
+
this.setTempPixelBounds(fromWorld, ceilPixel);
|
|
2172
|
+
this.drawImage(canvas.view, tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height, toInnerBounds.x, toInnerBounds.y, toInnerBounds.width, toInnerBounds.height);
|
|
2173
|
+
if (blendMode) this.blendMode = "source-over";
|
|
2168
2174
|
}
|
|
2169
|
-
if (blendMode) this.blendMode = "source-over";
|
|
2170
2175
|
}
|
|
2171
|
-
copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform) {
|
|
2176
|
+
copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform, ceilPixel = true) {
|
|
2172
2177
|
this.resetTransform();
|
|
2173
|
-
this.copyWorld(canvas, from, to, blendMode);
|
|
2178
|
+
this.copyWorld(canvas, from, to, blendMode, ceilPixel);
|
|
2174
2179
|
if (!onlyResetTransform) this.useWorldTransform();
|
|
2175
2180
|
}
|
|
2176
2181
|
useGrayscaleAlpha(bounds) {
|
|
2177
|
-
this.
|
|
2182
|
+
this.setTempPixelBounds(bounds, true, true);
|
|
2178
2183
|
let alpha, pixel;
|
|
2179
|
-
const {context: context} = this, imageData = context.getImageData(
|
|
2184
|
+
const {context: context} = this, imageData = context.getImageData(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height), {data: data} = imageData;
|
|
2180
2185
|
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
2181
2186
|
pixel = data[i] * .299 + data[i + 1] * .587 + data[i + 2] * .114;
|
|
2182
2187
|
if (alpha = data[i + 3]) data[i + 3] = alpha === 255 ? pixel : alpha * (pixel / 255);
|
|
2183
2188
|
}
|
|
2184
|
-
context.putImageData(imageData,
|
|
2189
|
+
context.putImageData(imageData, tempPixelBounds.x, tempPixelBounds.y);
|
|
2185
2190
|
}
|
|
2186
2191
|
useMask(maskCanvas, fromBounds, toBounds) {
|
|
2187
2192
|
this.copyWorld(maskCanvas, fromBounds, toBounds, "destination-in");
|
|
@@ -2189,42 +2194,48 @@ var LeaferUI = function(exports) {
|
|
|
2189
2194
|
useEraser(eraserCanvas, fromBounds, toBounds) {
|
|
2190
2195
|
this.copyWorld(eraserCanvas, fromBounds, toBounds, "destination-out");
|
|
2191
2196
|
}
|
|
2192
|
-
fillWorld(bounds, color, blendMode) {
|
|
2197
|
+
fillWorld(bounds, color, blendMode, ceilPixel) {
|
|
2193
2198
|
if (blendMode) this.blendMode = blendMode;
|
|
2194
2199
|
this.fillStyle = color;
|
|
2195
|
-
this.
|
|
2196
|
-
this.fillRect(
|
|
2200
|
+
this.setTempPixelBounds(bounds, ceilPixel);
|
|
2201
|
+
this.fillRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
|
|
2197
2202
|
if (blendMode) this.blendMode = "source-over";
|
|
2198
2203
|
}
|
|
2199
|
-
strokeWorld(bounds, color, blendMode) {
|
|
2204
|
+
strokeWorld(bounds, color, blendMode, ceilPixel) {
|
|
2200
2205
|
if (blendMode) this.blendMode = blendMode;
|
|
2201
2206
|
this.strokeStyle = color;
|
|
2202
|
-
this.
|
|
2203
|
-
this.strokeRect(
|
|
2207
|
+
this.setTempPixelBounds(bounds, ceilPixel);
|
|
2208
|
+
this.strokeRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
|
|
2204
2209
|
if (blendMode) this.blendMode = "source-over";
|
|
2205
2210
|
}
|
|
2206
|
-
clipWorld(bounds, ceilPixel) {
|
|
2211
|
+
clipWorld(bounds, ceilPixel = true) {
|
|
2207
2212
|
this.beginPath();
|
|
2208
|
-
this.
|
|
2209
|
-
this.rect(
|
|
2213
|
+
this.setTempPixelBounds(bounds, ceilPixel);
|
|
2214
|
+
this.rect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
|
|
2210
2215
|
this.clip();
|
|
2211
2216
|
}
|
|
2212
2217
|
clipUI(ruleData) {
|
|
2213
2218
|
ruleData.windingRule ? this.clip(ruleData.windingRule) : this.clip();
|
|
2214
2219
|
}
|
|
2215
|
-
clearWorld(bounds, ceilPixel) {
|
|
2216
|
-
this.
|
|
2217
|
-
this.clearRect(
|
|
2220
|
+
clearWorld(bounds, ceilPixel = true) {
|
|
2221
|
+
this.setTempPixelBounds(bounds, ceilPixel);
|
|
2222
|
+
this.clearRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
|
|
2218
2223
|
}
|
|
2219
2224
|
clear() {
|
|
2220
2225
|
const {pixelRatio: pixelRatio} = this;
|
|
2221
2226
|
this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2);
|
|
2222
2227
|
}
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
+
setTempPixelBounds(bounds, ceil, intersect) {
|
|
2229
|
+
this.copyToPixelBounds(tempPixelBounds, bounds, ceil, intersect);
|
|
2230
|
+
}
|
|
2231
|
+
setTempPixelBounds2(bounds, ceil, intersect) {
|
|
2232
|
+
this.copyToPixelBounds(tempPixelBounds2, bounds, ceil, intersect);
|
|
2233
|
+
}
|
|
2234
|
+
copyToPixelBounds(pixelBounds, bounds, ceil, intersect) {
|
|
2235
|
+
pixelBounds.set(bounds);
|
|
2236
|
+
if (intersect) pixelBounds.intersect(this.bounds);
|
|
2237
|
+
pixelBounds.scale(this.pixelRatio);
|
|
2238
|
+
if (ceil) pixelBounds.ceil();
|
|
2228
2239
|
}
|
|
2229
2240
|
isSameSize(size) {
|
|
2230
2241
|
return this.width === size.width && this.height === size.height && (!size.pixelRatio || this.pixelRatio === size.pixelRatio);
|
|
@@ -2232,7 +2243,7 @@ var LeaferUI = function(exports) {
|
|
|
2232
2243
|
getSameCanvas(useSameWorldTransform, useSameSmooth) {
|
|
2233
2244
|
const {size: size, pixelSnap: pixelSnap} = this, canvas = this.manager ? this.manager.get(size) : Creator.canvas(Object.assign({}, size));
|
|
2234
2245
|
canvas.save();
|
|
2235
|
-
if (useSameWorldTransform) copy$
|
|
2246
|
+
if (useSameWorldTransform) copy$b(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
|
|
2236
2247
|
if (useSameSmooth) canvas.smooth = this.smooth;
|
|
2237
2248
|
canvas.pixelSnap !== pixelSnap && (canvas.pixelSnap = pixelSnap);
|
|
2238
2249
|
return canvas;
|
|
@@ -2240,7 +2251,7 @@ var LeaferUI = function(exports) {
|
|
|
2240
2251
|
recycle(clearBounds) {
|
|
2241
2252
|
if (!this.recycled) {
|
|
2242
2253
|
this.restore();
|
|
2243
|
-
clearBounds ? this.clearWorld(clearBounds
|
|
2254
|
+
clearBounds ? this.clearWorld(clearBounds) : this.clear();
|
|
2244
2255
|
this.manager ? this.manager.recycle(this) : this.destroy();
|
|
2245
2256
|
}
|
|
2246
2257
|
}
|
|
@@ -2598,7 +2609,7 @@ var LeaferUI = function(exports) {
|
|
|
2598
2609
|
}
|
|
2599
2610
|
}
|
|
2600
2611
|
};
|
|
2601
|
-
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$
|
|
2612
|
+
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;
|
|
2602
2613
|
const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
|
|
2603
2614
|
const {ellipticalArc: ellipticalArc} = EllipseHelper;
|
|
2604
2615
|
const debug$f = Debug.get("PathConvert");
|
|
@@ -2813,7 +2824,7 @@ var LeaferUI = function(exports) {
|
|
|
2813
2824
|
i += 5;
|
|
2814
2825
|
break;
|
|
2815
2826
|
|
|
2816
|
-
case D$
|
|
2827
|
+
case D$6:
|
|
2817
2828
|
x = old[i + 1];
|
|
2818
2829
|
y = old[i + 2];
|
|
2819
2830
|
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);
|
|
@@ -2912,7 +2923,7 @@ var LeaferUI = function(exports) {
|
|
|
2912
2923
|
}
|
|
2913
2924
|
};
|
|
2914
2925
|
const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
|
|
2915
|
-
const {M: M$7, L: L$8, C: C$6, Q: Q$5, Z: Z$6, N: N$4, D: D$
|
|
2926
|
+
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;
|
|
2916
2927
|
const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
|
|
2917
2928
|
const {tan: tan, min: min, abs: abs$4} = Math;
|
|
2918
2929
|
const startPoint = {};
|
|
@@ -2944,7 +2955,7 @@ var LeaferUI = function(exports) {
|
|
|
2944
2955
|
} else {
|
|
2945
2956
|
const fourCorners = MathHelper.fourNumber(cornerRadius);
|
|
2946
2957
|
if (fourCorners) {
|
|
2947
|
-
data.push(D$
|
|
2958
|
+
data.push(D$5, x, y, width, height, ...fourCorners);
|
|
2948
2959
|
} else {
|
|
2949
2960
|
data.push(N$4, x, y, width, height);
|
|
2950
2961
|
}
|
|
@@ -3083,7 +3094,7 @@ var LeaferUI = function(exports) {
|
|
|
3083
3094
|
}
|
|
3084
3095
|
paint() {}
|
|
3085
3096
|
}
|
|
3086
|
-
const {M: M$6, L: L$7, C: C$5, Q: Q$4, Z: Z$5, N: N$3, D: D$
|
|
3097
|
+
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;
|
|
3087
3098
|
const debug$e = Debug.get("PathDrawer");
|
|
3088
3099
|
const PathDrawer = {
|
|
3089
3100
|
drawPathByData(drawer, data) {
|
|
@@ -3123,7 +3134,7 @@ var LeaferUI = function(exports) {
|
|
|
3123
3134
|
i += 5;
|
|
3124
3135
|
break;
|
|
3125
3136
|
|
|
3126
|
-
case D$
|
|
3137
|
+
case D$4:
|
|
3127
3138
|
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] ]);
|
|
3128
3139
|
i += 9;
|
|
3129
3140
|
break;
|
|
@@ -3165,9 +3176,9 @@ var LeaferUI = function(exports) {
|
|
|
3165
3176
|
}
|
|
3166
3177
|
}
|
|
3167
3178
|
};
|
|
3168
|
-
const {M: M$5, L: L$6, C: C$4, Q: Q$3, Z: Z$4, N: N$2, D: D$
|
|
3179
|
+
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;
|
|
3169
3180
|
const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
|
|
3170
|
-
const {addPointBounds: addPointBounds, copy: copy$
|
|
3181
|
+
const {addPointBounds: addPointBounds, copy: copy$a, addPoint: addPoint$1, setPoint: setPoint$3, addBounds: addBounds, toBounds: toBounds$3} = TwoPointBoundsHelper;
|
|
3171
3182
|
const debug$d = Debug.get("PathBounds");
|
|
3172
3183
|
let radius, radiusX, radiusY;
|
|
3173
3184
|
const tempPointBounds = {};
|
|
@@ -3233,17 +3244,17 @@ var LeaferUI = function(exports) {
|
|
|
3233
3244
|
i += 5;
|
|
3234
3245
|
break;
|
|
3235
3246
|
|
|
3236
|
-
case D$
|
|
3247
|
+
case D$3:
|
|
3237
3248
|
case X$2:
|
|
3238
3249
|
x = data[i + 1];
|
|
3239
3250
|
y = data[i + 2];
|
|
3240
3251
|
addBounds(setPointBounds, x, y, data[i + 3], data[i + 4]);
|
|
3241
|
-
i += command === D$
|
|
3252
|
+
i += command === D$3 ? 9 : 6;
|
|
3242
3253
|
break;
|
|
3243
3254
|
|
|
3244
3255
|
case G$2:
|
|
3245
3256
|
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);
|
|
3246
|
-
i === 0 ? copy$
|
|
3257
|
+
i === 0 ? copy$a(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3247
3258
|
x = setEndPoint.x;
|
|
3248
3259
|
y = setEndPoint.y;
|
|
3249
3260
|
i += 9;
|
|
@@ -3261,7 +3272,7 @@ var LeaferUI = function(exports) {
|
|
|
3261
3272
|
|
|
3262
3273
|
case O$3:
|
|
3263
3274
|
arc(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], tempPointBounds, setEndPoint);
|
|
3264
|
-
i === 0 ? copy$
|
|
3275
|
+
i === 0 ? copy$a(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3265
3276
|
x = setEndPoint.x;
|
|
3266
3277
|
y = setEndPoint.y;
|
|
3267
3278
|
i += 7;
|
|
@@ -3278,7 +3289,7 @@ var LeaferUI = function(exports) {
|
|
|
3278
3289
|
|
|
3279
3290
|
case U$2:
|
|
3280
3291
|
arcTo$1(null, x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], tempPointBounds, setEndPoint);
|
|
3281
|
-
i === 0 ? copy$
|
|
3292
|
+
i === 0 ? copy$a(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3282
3293
|
x = setEndPoint.x;
|
|
3283
3294
|
y = setEndPoint.y;
|
|
3284
3295
|
i += 6;
|
|
@@ -3896,6 +3907,16 @@ var LeaferUI = function(exports) {
|
|
|
3896
3907
|
}
|
|
3897
3908
|
}));
|
|
3898
3909
|
}
|
|
3910
|
+
function scrollType(defaultValue, checkFiniteNumber) {
|
|
3911
|
+
return decorateLeafAttr(defaultValue, key => attr({
|
|
3912
|
+
set(value) {
|
|
3913
|
+
if (this.__setAttr(key, value, checkFiniteNumber)) {
|
|
3914
|
+
this.__layout.matrixChanged || this.__layout.matrixChange();
|
|
3915
|
+
this.__scrollWorld || (this.__scrollWorld = {});
|
|
3916
|
+
}
|
|
3917
|
+
}
|
|
3918
|
+
}));
|
|
3919
|
+
}
|
|
3899
3920
|
function autoLayoutType(defaultValue) {
|
|
3900
3921
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
3901
3922
|
set(value) {
|
|
@@ -4198,7 +4219,7 @@ var LeaferUI = function(exports) {
|
|
|
4198
4219
|
EventCreator.register(target);
|
|
4199
4220
|
};
|
|
4200
4221
|
}
|
|
4201
|
-
const {copy: copy$
|
|
4222
|
+
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;
|
|
4202
4223
|
const matrix$3 = {}, {round: round$3} = Math;
|
|
4203
4224
|
const LeafHelper = {
|
|
4204
4225
|
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
@@ -4272,7 +4293,7 @@ var LeaferUI = function(exports) {
|
|
|
4272
4293
|
x: x,
|
|
4273
4294
|
y: y
|
|
4274
4295
|
};
|
|
4275
|
-
isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : t.parent && toInnerPoint$1(t.parent.
|
|
4296
|
+
isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : t.parent && toInnerPoint$1(t.parent.scrollWorldTransform, local, local, true);
|
|
4276
4297
|
L$4.moveLocal(t, local.x, local.y, transition);
|
|
4277
4298
|
},
|
|
4278
4299
|
moveLocal(t, x, y = 0, transition) {
|
|
@@ -4294,9 +4315,9 @@ var LeaferUI = function(exports) {
|
|
|
4294
4315
|
if (scaleY) transition = scaleY;
|
|
4295
4316
|
scaleY = scaleX;
|
|
4296
4317
|
}
|
|
4297
|
-
copy$
|
|
4318
|
+
copy$9(matrix$3, o);
|
|
4298
4319
|
scaleOfOuter$2(matrix$3, origin, scaleX, scaleY);
|
|
4299
|
-
if (
|
|
4320
|
+
if (L$4.hasHighPosition(t)) {
|
|
4300
4321
|
L$4.setTransform(t, matrix$3, resize, transition);
|
|
4301
4322
|
} else {
|
|
4302
4323
|
const x = t.x + matrix$3.e - o.e, y = t.y + matrix$3.f - o.f;
|
|
@@ -4313,9 +4334,9 @@ var LeaferUI = function(exports) {
|
|
|
4313
4334
|
},
|
|
4314
4335
|
rotateOfLocal(t, origin, angle, transition) {
|
|
4315
4336
|
const o = t.__localMatrix;
|
|
4316
|
-
copy$
|
|
4337
|
+
copy$9(matrix$3, o);
|
|
4317
4338
|
rotateOfOuter$2(matrix$3, origin, angle);
|
|
4318
|
-
if (
|
|
4339
|
+
if (L$4.hasHighPosition(t)) L$4.setTransform(t, matrix$3, false, transition); else t.set({
|
|
4319
4340
|
x: t.x + matrix$3.e - o.e,
|
|
4320
4341
|
y: t.y + matrix$3.f - o.f,
|
|
4321
4342
|
rotation: MathHelper.formatRotation(t.rotation + angle)
|
|
@@ -4325,24 +4346,28 @@ var LeaferUI = function(exports) {
|
|
|
4325
4346
|
L$4.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
|
|
4326
4347
|
},
|
|
4327
4348
|
skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
|
|
4328
|
-
copy$
|
|
4349
|
+
copy$9(matrix$3, t.__localMatrix);
|
|
4329
4350
|
skewOfOuter(matrix$3, origin, skewX, skewY);
|
|
4330
4351
|
L$4.setTransform(t, matrix$3, resize, transition);
|
|
4331
4352
|
},
|
|
4332
4353
|
transformWorld(t, transform, resize, transition) {
|
|
4333
|
-
copy$
|
|
4354
|
+
copy$9(matrix$3, t.worldTransform);
|
|
4334
4355
|
multiplyParent$3(matrix$3, transform);
|
|
4335
|
-
if (t.parent) divideParent(matrix$3, t.parent.
|
|
4356
|
+
if (t.parent) divideParent(matrix$3, t.parent.scrollWorldTransform);
|
|
4336
4357
|
L$4.setTransform(t, matrix$3, resize, transition);
|
|
4337
4358
|
},
|
|
4338
4359
|
transform(t, transform, resize, transition) {
|
|
4339
|
-
copy$
|
|
4360
|
+
copy$9(matrix$3, t.localTransform);
|
|
4340
4361
|
multiplyParent$3(matrix$3, transform);
|
|
4341
4362
|
L$4.setTransform(t, matrix$3, resize, transition);
|
|
4342
4363
|
},
|
|
4343
4364
|
setTransform(t, transform, resize, transition) {
|
|
4344
4365
|
const data = t.__, originPoint = data.origin && L$4.getInnerOrigin(t, data.origin);
|
|
4345
4366
|
const layout = getLayout(transform, originPoint, data.around && L$4.getInnerOrigin(t, data.around));
|
|
4367
|
+
if (L$4.hasOffset(t)) {
|
|
4368
|
+
layout.x -= data.offsetX;
|
|
4369
|
+
layout.y -= data.offsetY;
|
|
4370
|
+
}
|
|
4346
4371
|
if (resize) {
|
|
4347
4372
|
const scaleX = layout.scaleX / t.scaleX, scaleY = layout.scaleY / t.scaleY;
|
|
4348
4373
|
delete layout.scaleX, delete layout.scaleY;
|
|
@@ -4370,14 +4395,20 @@ var LeaferUI = function(exports) {
|
|
|
4370
4395
|
return innerOrigin;
|
|
4371
4396
|
},
|
|
4372
4397
|
getRelativeWorld(t, relative, temp) {
|
|
4373
|
-
copy$
|
|
4374
|
-
divideParent(matrix$3, relative.
|
|
4398
|
+
copy$9(matrix$3, t.worldTransform);
|
|
4399
|
+
divideParent(matrix$3, relative.scrollWorldTransform);
|
|
4375
4400
|
return temp ? matrix$3 : Object.assign({}, matrix$3);
|
|
4376
4401
|
},
|
|
4377
4402
|
drop(t, parent, index, resize) {
|
|
4378
4403
|
t.setTransform(L$4.getRelativeWorld(t, parent, true), resize);
|
|
4379
4404
|
parent.add(t, index);
|
|
4380
4405
|
},
|
|
4406
|
+
hasHighPosition(t) {
|
|
4407
|
+
return t.origin || t.around || L$4.hasOffset(t);
|
|
4408
|
+
},
|
|
4409
|
+
hasOffset(t) {
|
|
4410
|
+
return t.offsetX || t.offsetY;
|
|
4411
|
+
},
|
|
4381
4412
|
hasParent(p, parent) {
|
|
4382
4413
|
if (!parent) return false;
|
|
4383
4414
|
while (p) {
|
|
@@ -4400,8 +4431,7 @@ var LeaferUI = function(exports) {
|
|
|
4400
4431
|
const L$4 = LeafHelper;
|
|
4401
4432
|
const {updateAllMatrix: updateAllMatrix$4, updateMatrix: updateMatrix$4, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1} = L$4;
|
|
4402
4433
|
function getTempLocal(t, world) {
|
|
4403
|
-
t.
|
|
4404
|
-
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
|
|
4434
|
+
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.scrollWorldTransform) : world;
|
|
4405
4435
|
}
|
|
4406
4436
|
const LeafBoundsHelper = {
|
|
4407
4437
|
worldBounds(target) {
|
|
@@ -4517,7 +4547,7 @@ var LeaferUI = function(exports) {
|
|
|
4517
4547
|
}
|
|
4518
4548
|
};
|
|
4519
4549
|
const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$3} = LeafHelper;
|
|
4520
|
-
const {toOuterOf: toOuterOf$2, getPoints: getPoints, copy: copy$
|
|
4550
|
+
const {toOuterOf: toOuterOf$2, getPoints: getPoints, copy: copy$8} = BoundsHelper;
|
|
4521
4551
|
const localContent = "_localContentBounds";
|
|
4522
4552
|
const worldContent = "_worldContentBounds", worldBox = "_worldBoxBounds", worldStroke = "_worldStrokeBounds";
|
|
4523
4553
|
class LeafLayout {
|
|
@@ -4753,7 +4783,7 @@ var LeaferUI = function(exports) {
|
|
|
4753
4783
|
matrix = getRelativeWorld$1(leaf, relative, true);
|
|
4754
4784
|
}
|
|
4755
4785
|
if (!layoutBounds) layoutBounds = MatrixHelper.getLayout(matrix);
|
|
4756
|
-
copy$
|
|
4786
|
+
copy$8(layoutBounds, bounds);
|
|
4757
4787
|
PointHelper.copy(layoutBounds, point);
|
|
4758
4788
|
if (unscale) {
|
|
4759
4789
|
const {scaleX: scaleX, scaleY: scaleY} = layoutBounds;
|
|
@@ -4932,6 +4962,7 @@ var LeaferUI = function(exports) {
|
|
|
4932
4962
|
ChildEvent.MOUNTED = "mounted";
|
|
4933
4963
|
ChildEvent.UNMOUNTED = "unmounted";
|
|
4934
4964
|
ChildEvent.DESTROY = "destroy";
|
|
4965
|
+
const SCROLL = "property.scroll";
|
|
4935
4966
|
class PropertyEvent extends Event {
|
|
4936
4967
|
constructor(type, target, attrName, oldValue, newValue) {
|
|
4937
4968
|
super(type, target);
|
|
@@ -4942,6 +4973,11 @@ var LeaferUI = function(exports) {
|
|
|
4942
4973
|
}
|
|
4943
4974
|
PropertyEvent.CHANGE = "property.change";
|
|
4944
4975
|
PropertyEvent.LEAFER_CHANGE = "property.leafer_change";
|
|
4976
|
+
PropertyEvent.SCROLL = SCROLL;
|
|
4977
|
+
const extraPropertyEventMap = {
|
|
4978
|
+
scrollX: SCROLL,
|
|
4979
|
+
scrollY: SCROLL
|
|
4980
|
+
};
|
|
4945
4981
|
class ImageEvent extends Event {
|
|
4946
4982
|
constructor(type, data) {
|
|
4947
4983
|
super(type);
|
|
@@ -5163,7 +5199,9 @@ var LeaferUI = function(exports) {
|
|
|
5163
5199
|
if (!id) return;
|
|
5164
5200
|
const list = isArray(id) ? id : [ id ];
|
|
5165
5201
|
list.forEach(item => {
|
|
5166
|
-
if (
|
|
5202
|
+
if (item) {
|
|
5203
|
+
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);
|
|
5204
|
+
}
|
|
5167
5205
|
});
|
|
5168
5206
|
list.length = 0;
|
|
5169
5207
|
}
|
|
@@ -5252,8 +5290,6 @@ var LeaferUI = function(exports) {
|
|
|
5252
5290
|
}
|
|
5253
5291
|
if (isObject(newValue) || oldValue !== newValue) {
|
|
5254
5292
|
this.__realSetAttr(name, newValue);
|
|
5255
|
-
const {CHANGE: CHANGE} = PropertyEvent;
|
|
5256
|
-
const event = new PropertyEvent(CHANGE, this, name, oldValue, newValue);
|
|
5257
5293
|
if (this.isLeafer) {
|
|
5258
5294
|
this.emitEvent(new PropertyEvent(PropertyEvent.LEAFER_CHANGE, this, name, oldValue, newValue));
|
|
5259
5295
|
const transformEventName = leaferTransformAttrMap[name];
|
|
@@ -5261,10 +5297,10 @@ var LeaferUI = function(exports) {
|
|
|
5261
5297
|
this.emitEvent(new LeaferEvent(transformEventName, this));
|
|
5262
5298
|
this.emitEvent(new LeaferEvent(LeaferEvent.TRANSFORM, this));
|
|
5263
5299
|
}
|
|
5264
|
-
} else {
|
|
5265
|
-
if (this.hasEvent(CHANGE)) this.emitEvent(event);
|
|
5266
5300
|
}
|
|
5267
|
-
this.
|
|
5301
|
+
this.emitPropertyEvent(PropertyEvent.CHANGE, name, oldValue, newValue);
|
|
5302
|
+
const extraPropertyEvent = extraPropertyEventMap[name];
|
|
5303
|
+
if (extraPropertyEvent) this.emitPropertyEvent(extraPropertyEvent, name, oldValue, newValue);
|
|
5268
5304
|
return true;
|
|
5269
5305
|
} else {
|
|
5270
5306
|
return false;
|
|
@@ -5274,6 +5310,11 @@ var LeaferUI = function(exports) {
|
|
|
5274
5310
|
return true;
|
|
5275
5311
|
}
|
|
5276
5312
|
},
|
|
5313
|
+
emitPropertyEvent(type, name, oldValue, newValue) {
|
|
5314
|
+
const event = new PropertyEvent(type, this, name, oldValue, newValue);
|
|
5315
|
+
this.isLeafer || this.hasEvent(type) && this.emitEvent(event);
|
|
5316
|
+
this.leafer.emitEvent(event);
|
|
5317
|
+
},
|
|
5277
5318
|
__realSetAttr(name, newValue) {
|
|
5278
5319
|
const data = this.__;
|
|
5279
5320
|
data[name] = newValue;
|
|
@@ -5289,8 +5330,9 @@ var LeaferUI = function(exports) {
|
|
|
5289
5330
|
const {toPoint: toPoint$4, tempPoint: tempPoint$1} = AroundHelper;
|
|
5290
5331
|
const LeafMatrix = {
|
|
5291
5332
|
__updateWorldMatrix() {
|
|
5292
|
-
const {parent: parent, __layout: __layout} = this;
|
|
5293
|
-
multiplyParent$2(this.__local || __layout, parent ? parent.__world : defaultWorld,
|
|
5333
|
+
const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
|
|
5334
|
+
multiplyParent$2(this.__local || __layout, parent ? parent.__scrollWorld || parent.__world : defaultWorld, __world, !!__layout.affectScaleOrRotation, __);
|
|
5335
|
+
if (__scrollWorld) translateInner(Object.assign(__scrollWorld, __world), __.scrollX, __.scrollY);
|
|
5294
5336
|
},
|
|
5295
5337
|
__updateLocalMatrix() {
|
|
5296
5338
|
if (this.__local) {
|
|
@@ -5313,7 +5355,7 @@ var LeaferUI = function(exports) {
|
|
|
5313
5355
|
};
|
|
5314
5356
|
const {updateMatrix: updateMatrix$3, updateAllMatrix: updateAllMatrix$3} = LeafHelper;
|
|
5315
5357
|
const {updateBounds: updateBounds$2} = BranchHelper;
|
|
5316
|
-
const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$2, copy: copy$
|
|
5358
|
+
const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$2, copy: copy$7} = BoundsHelper;
|
|
5317
5359
|
const {toBounds: toBounds$2} = PathBounds;
|
|
5318
5360
|
const LeafBounds = {
|
|
5319
5361
|
__updateWorldBounds() {
|
|
@@ -5382,7 +5424,7 @@ var LeaferUI = function(exports) {
|
|
|
5382
5424
|
__updateLocalRenderBounds() {
|
|
5383
5425
|
toOuterOf$1(this.__layout.renderBounds, this.__localMatrix, this.__layout.localRenderBounds);
|
|
5384
5426
|
},
|
|
5385
|
-
__updateBoxBounds() {
|
|
5427
|
+
__updateBoxBounds(_secondLayout, _bounds) {
|
|
5386
5428
|
const b = this.__layout.boxBounds;
|
|
5387
5429
|
const data = this.__;
|
|
5388
5430
|
if (data.__pathInputed) {
|
|
@@ -5416,13 +5458,13 @@ var LeaferUI = function(exports) {
|
|
|
5416
5458
|
data.__naturalWidth = layout.boxBounds.width;
|
|
5417
5459
|
data.__naturalHeight = layout.boxBounds.height;
|
|
5418
5460
|
},
|
|
5419
|
-
__updateStrokeBounds() {
|
|
5461
|
+
__updateStrokeBounds(_bounds) {
|
|
5420
5462
|
const layout = this.__layout;
|
|
5421
5463
|
copyAndSpread$2(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
|
|
5422
5464
|
},
|
|
5423
|
-
__updateRenderBounds() {
|
|
5465
|
+
__updateRenderBounds(_bounds) {
|
|
5424
5466
|
const layout = this.__layout;
|
|
5425
|
-
layout.renderSpread > 0 ? copyAndSpread$2(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$
|
|
5467
|
+
layout.renderSpread > 0 ? copyAndSpread$2(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$7(layout.renderBounds, layout.strokeBounds);
|
|
5426
5468
|
}
|
|
5427
5469
|
};
|
|
5428
5470
|
const LeafRender = {
|
|
@@ -5513,7 +5555,7 @@ var LeaferUI = function(exports) {
|
|
|
5513
5555
|
const {LEAF: LEAF, create: create} = IncrementId;
|
|
5514
5556
|
const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
|
|
5515
5557
|
const {toOuterOf: toOuterOf} = BoundsHelper;
|
|
5516
|
-
const {copy: copy$
|
|
5558
|
+
const {copy: copy$6, move: move$6} = PointHelper;
|
|
5517
5559
|
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;
|
|
5518
5560
|
exports.Leaf = class Leaf {
|
|
5519
5561
|
get tag() {
|
|
@@ -5559,6 +5601,10 @@ var LeaferUI = function(exports) {
|
|
|
5559
5601
|
get localTransform() {
|
|
5560
5602
|
return this.__layout.getTransform("local");
|
|
5561
5603
|
}
|
|
5604
|
+
get scrollWorldTransform() {
|
|
5605
|
+
this.updateLayout();
|
|
5606
|
+
return this.__scrollWorld || this.__world;
|
|
5607
|
+
}
|
|
5562
5608
|
get boxBounds() {
|
|
5563
5609
|
return this.getBounds("box", "inner");
|
|
5564
5610
|
}
|
|
@@ -5575,7 +5621,7 @@ var LeaferUI = function(exports) {
|
|
|
5575
5621
|
return this.getBounds("render");
|
|
5576
5622
|
}
|
|
5577
5623
|
get worldOpacity() {
|
|
5578
|
-
this.
|
|
5624
|
+
this.updateLayout();
|
|
5579
5625
|
return this.__worldOpacity;
|
|
5580
5626
|
}
|
|
5581
5627
|
get __worldFlipped() {
|
|
@@ -5750,10 +5796,10 @@ var LeaferUI = function(exports) {
|
|
|
5750
5796
|
__updateLocalBoxBounds() {}
|
|
5751
5797
|
__updateLocalStrokeBounds() {}
|
|
5752
5798
|
__updateLocalRenderBounds() {}
|
|
5753
|
-
__updateBoxBounds() {}
|
|
5799
|
+
__updateBoxBounds(_secondLayout, _bounds) {}
|
|
5754
5800
|
__updateContentBounds() {}
|
|
5755
|
-
__updateStrokeBounds() {}
|
|
5756
|
-
__updateRenderBounds() {}
|
|
5801
|
+
__updateStrokeBounds(_bounds) {}
|
|
5802
|
+
__updateRenderBounds(_bounds) {}
|
|
5757
5803
|
__updateAutoLayout() {}
|
|
5758
5804
|
__updateFlowLayout() {}
|
|
5759
5805
|
__updateNaturalSize() {}
|
|
@@ -5825,14 +5871,14 @@ var LeaferUI = function(exports) {
|
|
|
5825
5871
|
if (this.parent) {
|
|
5826
5872
|
this.parent.worldToInner(world, to, distance, relative);
|
|
5827
5873
|
} else {
|
|
5828
|
-
if (to) copy$
|
|
5874
|
+
if (to) copy$6(to, world);
|
|
5829
5875
|
}
|
|
5830
5876
|
}
|
|
5831
5877
|
localToWorld(local, to, distance, relative) {
|
|
5832
5878
|
if (this.parent) {
|
|
5833
5879
|
this.parent.innerToWorld(local, to, distance, relative);
|
|
5834
5880
|
} else {
|
|
5835
|
-
if (to) copy$
|
|
5881
|
+
if (to) copy$6(to, local);
|
|
5836
5882
|
}
|
|
5837
5883
|
}
|
|
5838
5884
|
worldToInner(world, to, distance, relative) {
|
|
@@ -5851,7 +5897,7 @@ var LeaferUI = function(exports) {
|
|
|
5851
5897
|
}
|
|
5852
5898
|
getBoxPointByInner(inner, _relative, _distance, change) {
|
|
5853
5899
|
const point = change ? inner : Object.assign({}, inner), {x: x, y: y} = this.boxBounds;
|
|
5854
|
-
move$
|
|
5900
|
+
move$6(point, -x, -y);
|
|
5855
5901
|
return point;
|
|
5856
5902
|
}
|
|
5857
5903
|
getInnerPoint(world, relative, distance, change) {
|
|
@@ -5861,7 +5907,7 @@ var LeaferUI = function(exports) {
|
|
|
5861
5907
|
}
|
|
5862
5908
|
getInnerPointByBox(box, _relative, _distance, change) {
|
|
5863
5909
|
const point = change ? box : Object.assign({}, box), {x: x, y: y} = this.boxBounds;
|
|
5864
|
-
move$
|
|
5910
|
+
move$6(point, x, y);
|
|
5865
5911
|
return point;
|
|
5866
5912
|
}
|
|
5867
5913
|
getInnerPointByLocal(local, _relative, distance, change) {
|
|
@@ -6047,14 +6093,14 @@ var LeaferUI = function(exports) {
|
|
|
6047
6093
|
}
|
|
6048
6094
|
return 0;
|
|
6049
6095
|
}
|
|
6050
|
-
__updateBoxBounds() {
|
|
6051
|
-
setListWithFn$1(this.__layout.boxBounds, this.children, this.__hasMask ? maskLocalBoxBounds : localBoxBounds);
|
|
6096
|
+
__updateBoxBounds(_secondLayout, bounds) {
|
|
6097
|
+
setListWithFn$1(bounds || this.__layout.boxBounds, this.children, this.__hasMask ? maskLocalBoxBounds : localBoxBounds);
|
|
6052
6098
|
}
|
|
6053
|
-
__updateStrokeBounds() {
|
|
6054
|
-
setListWithFn$1(this.__layout.strokeBounds, this.children, this.__hasMask ? maskLocalStrokeBounds : localStrokeBounds);
|
|
6099
|
+
__updateStrokeBounds(bounds) {
|
|
6100
|
+
setListWithFn$1(bounds || this.__layout.strokeBounds, this.children, this.__hasMask ? maskLocalStrokeBounds : localStrokeBounds);
|
|
6055
6101
|
}
|
|
6056
|
-
__updateRenderBounds() {
|
|
6057
|
-
setListWithFn$1(this.__layout.renderBounds, this.children, this.__hasMask ? maskLocalRenderBounds : localRenderBounds);
|
|
6102
|
+
__updateRenderBounds(bounds) {
|
|
6103
|
+
setListWithFn$1(bounds || this.__layout.renderBounds, this.children, this.__hasMask ? maskLocalRenderBounds : localRenderBounds);
|
|
6058
6104
|
}
|
|
6059
6105
|
__updateSortChildren() {
|
|
6060
6106
|
let affectSort;
|
|
@@ -6297,7 +6343,7 @@ var LeaferUI = function(exports) {
|
|
|
6297
6343
|
this.levelMap = null;
|
|
6298
6344
|
}
|
|
6299
6345
|
}
|
|
6300
|
-
const version = "1.9.
|
|
6346
|
+
const version = "1.9.2";
|
|
6301
6347
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6302
6348
|
get allowBackgroundColor() {
|
|
6303
6349
|
return true;
|
|
@@ -6800,8 +6846,8 @@ var LeaferUI = function(exports) {
|
|
|
6800
6846
|
const {canvas: canvas} = this, bounds = block.getIntersect(canvas.bounds), realBounds = new Bounds(bounds);
|
|
6801
6847
|
canvas.save();
|
|
6802
6848
|
bounds.spread(Renderer.clipSpread).ceil();
|
|
6803
|
-
canvas.clearWorld(bounds
|
|
6804
|
-
canvas.clipWorld(bounds
|
|
6849
|
+
canvas.clearWorld(bounds);
|
|
6850
|
+
canvas.clipWorld(bounds);
|
|
6805
6851
|
this.__render(bounds, realBounds);
|
|
6806
6852
|
canvas.restore();
|
|
6807
6853
|
Run.end(t);
|
|
@@ -7021,6 +7067,7 @@ var LeaferUI = function(exports) {
|
|
|
7021
7067
|
hit = child.__.hitRadius ? true : hitRadiusPoint$1(child.__world, point);
|
|
7022
7068
|
if (child.isBranch) {
|
|
7023
7069
|
if (hit || child.__ignoreHitWorld) {
|
|
7070
|
+
if (child.topChildren) this.eachFind(child.topChildren, false);
|
|
7024
7071
|
this.eachFind(child.children, child.__onlyHitMask);
|
|
7025
7072
|
if (child.isBranchLeaf) this.hitChild(child, point);
|
|
7026
7073
|
}
|
|
@@ -7340,7 +7387,7 @@ var LeaferUI = function(exports) {
|
|
|
7340
7387
|
}
|
|
7341
7388
|
get __clipAfterFill() {
|
|
7342
7389
|
const t = this;
|
|
7343
|
-
return t.overflow
|
|
7390
|
+
return t.overflow !== "show" && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill);
|
|
7344
7391
|
}
|
|
7345
7392
|
}
|
|
7346
7393
|
class LeaferData extends GroupData {
|
|
@@ -7481,6 +7528,39 @@ var LeaferUI = function(exports) {
|
|
|
7481
7528
|
return this.__box ? Math.max(this.__box.__updateRenderSpread(), width) : width;
|
|
7482
7529
|
}
|
|
7483
7530
|
};
|
|
7531
|
+
const DragBoundsHelper = {
|
|
7532
|
+
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
7533
|
+
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
7534
|
+
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
7535
|
+
if (!change) move = Object.assign({}, move);
|
|
7536
|
+
const isBiggerWidth = content.width > dragBounds.width;
|
|
7537
|
+
const isBiggerHeight = content.height > dragBounds.height;
|
|
7538
|
+
if (isBiggerWidth && dragBoundsType !== "outer") {
|
|
7539
|
+
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
7540
|
+
} else {
|
|
7541
|
+
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
7542
|
+
}
|
|
7543
|
+
if (isBiggerHeight && dragBoundsType !== "outer") {
|
|
7544
|
+
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
7545
|
+
} else {
|
|
7546
|
+
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
7547
|
+
}
|
|
7548
|
+
move.x = MathHelper.float(move.x);
|
|
7549
|
+
move.y = MathHelper.float(move.y);
|
|
7550
|
+
return move;
|
|
7551
|
+
},
|
|
7552
|
+
axisMove(leaf, move) {
|
|
7553
|
+
const {draggable: draggable} = leaf;
|
|
7554
|
+
if (draggable === "x") move.y = 0;
|
|
7555
|
+
if (draggable === "y") move.x = 0;
|
|
7556
|
+
},
|
|
7557
|
+
limitMove(leaf, move) {
|
|
7558
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
7559
|
+
if (dragBounds) D$2.getValidMove(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, dragBoundsType, move, true);
|
|
7560
|
+
D$2.axisMove(leaf, move);
|
|
7561
|
+
}
|
|
7562
|
+
};
|
|
7563
|
+
const D$2 = DragBoundsHelper;
|
|
7484
7564
|
const {stintSet: stintSet$1} = DataHelper;
|
|
7485
7565
|
const UIRender = {
|
|
7486
7566
|
__updateChange() {
|
|
@@ -7764,8 +7844,8 @@ var LeaferUI = function(exports) {
|
|
|
7764
7844
|
__decorate([ rotationType(0, true) ], exports.UI.prototype, "skewY", void 0);
|
|
7765
7845
|
__decorate([ positionType(0, true) ], exports.UI.prototype, "offsetX", void 0);
|
|
7766
7846
|
__decorate([ positionType(0, true) ], exports.UI.prototype, "offsetY", void 0);
|
|
7767
|
-
__decorate([
|
|
7768
|
-
__decorate([
|
|
7847
|
+
__decorate([ scrollType(0, true) ], exports.UI.prototype, "scrollX", void 0);
|
|
7848
|
+
__decorate([ scrollType(0, true) ], exports.UI.prototype, "scrollY", void 0);
|
|
7769
7849
|
__decorate([ autoLayoutType() ], exports.UI.prototype, "origin", void 0);
|
|
7770
7850
|
__decorate([ autoLayoutType() ], exports.UI.prototype, "around", void 0);
|
|
7771
7851
|
__decorate([ dataType(false) ], exports.UI.prototype, "lazy", void 0);
|
|
@@ -7780,6 +7860,7 @@ var LeaferUI = function(exports) {
|
|
|
7780
7860
|
__decorate([ boundsType() ], exports.UI.prototype, "heightRange", void 0);
|
|
7781
7861
|
__decorate([ dataType(false) ], exports.UI.prototype, "draggable", void 0);
|
|
7782
7862
|
__decorate([ dataType() ], exports.UI.prototype, "dragBounds", void 0);
|
|
7863
|
+
__decorate([ dataType("auto") ], exports.UI.prototype, "dragBoundsType", void 0);
|
|
7783
7864
|
__decorate([ dataType(false) ], exports.UI.prototype, "editable", void 0);
|
|
7784
7865
|
__decorate([ hitType(true) ], exports.UI.prototype, "hittable", void 0);
|
|
7785
7866
|
__decorate([ hitType("path") ], exports.UI.prototype, "hitFill", void 0);
|
|
@@ -8163,7 +8244,7 @@ var LeaferUI = function(exports) {
|
|
|
8163
8244
|
zoom(_zoomType, _optionsOrPadding, _scroll, _transition) {
|
|
8164
8245
|
return Plugin.need("view");
|
|
8165
8246
|
}
|
|
8166
|
-
getValidMove(moveX, moveY) {
|
|
8247
|
+
getValidMove(moveX, moveY, _checkLimit) {
|
|
8167
8248
|
return {
|
|
8168
8249
|
x: moveX,
|
|
8169
8250
|
y: moveY
|
|
@@ -8244,9 +8325,8 @@ var LeaferUI = function(exports) {
|
|
|
8244
8325
|
};
|
|
8245
8326
|
__decorate([ dataProcessor(RectData) ], exports.Rect.prototype, "__", void 0);
|
|
8246
8327
|
exports.Rect = __decorate([ useModule(RectRender), rewriteAble(), registerUI() ], exports.Rect);
|
|
8247
|
-
const {
|
|
8328
|
+
const {add: add, includes: includes$1, scroll: scroll} = BoundsHelper;
|
|
8248
8329
|
const rect$1 = exports.Rect.prototype, group = exports.Group.prototype;
|
|
8249
|
-
const childrenRenderBounds = {};
|
|
8250
8330
|
exports.Box = class Box extends exports.Group {
|
|
8251
8331
|
get __tag() {
|
|
8252
8332
|
return "Box";
|
|
@@ -8292,22 +8372,24 @@ var LeaferUI = function(exports) {
|
|
|
8292
8372
|
__updateRenderBounds() {
|
|
8293
8373
|
let isOverflow;
|
|
8294
8374
|
if (this.children.length) {
|
|
8295
|
-
const data = this.__, {renderBounds: renderBounds, boxBounds: boxBounds} =
|
|
8296
|
-
|
|
8297
|
-
|
|
8375
|
+
const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
|
|
8376
|
+
const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
|
|
8377
|
+
super.__updateRenderBounds(childrenRenderBounds);
|
|
8378
|
+
scroll(childrenRenderBounds, data);
|
|
8298
8379
|
this.__updateRectRenderBounds();
|
|
8299
|
-
if (data.scrollY || data.scrollX) {
|
|
8300
|
-
childrenRenderBounds.x += data.scrollX;
|
|
8301
|
-
childrenRenderBounds.y += data.scrollY;
|
|
8302
|
-
}
|
|
8303
8380
|
isOverflow = !includes$1(boxBounds, childrenRenderBounds);
|
|
8304
|
-
if (isOverflow && data.overflow
|
|
8381
|
+
if (isOverflow && data.overflow === "show") add(renderBounds, childrenRenderBounds);
|
|
8305
8382
|
} else this.__updateRectRenderBounds();
|
|
8306
8383
|
DataHelper.stintSet(this, "isOverflow", isOverflow);
|
|
8307
|
-
this.
|
|
8384
|
+
this.__checkScroll();
|
|
8308
8385
|
}
|
|
8309
8386
|
__updateRectRenderBounds() {}
|
|
8310
|
-
|
|
8387
|
+
__updateWorldBounds() {
|
|
8388
|
+
if (this.hasScroller) this.__updateScroll();
|
|
8389
|
+
super.__updateWorldBounds();
|
|
8390
|
+
}
|
|
8391
|
+
__checkScroll() {}
|
|
8392
|
+
__updateScroll() {}
|
|
8311
8393
|
__updateRectChange() {}
|
|
8312
8394
|
__updateChange() {
|
|
8313
8395
|
super.__updateChange();
|
|
@@ -8322,7 +8404,7 @@ var LeaferUI = function(exports) {
|
|
|
8322
8404
|
this.__renderRect(canvas, options);
|
|
8323
8405
|
if (this.children.length) this.__renderGroup(canvas, options);
|
|
8324
8406
|
}
|
|
8325
|
-
if (this.
|
|
8407
|
+
if (this.hasScroller) this.scroller.__render(canvas, options);
|
|
8326
8408
|
}
|
|
8327
8409
|
__drawContent(canvas, options) {
|
|
8328
8410
|
this.__renderGroup(canvas, options);
|
|
@@ -8886,7 +8968,7 @@ var LeaferUI = function(exports) {
|
|
|
8886
8968
|
if (this.viewReady) this.renderer.update();
|
|
8887
8969
|
}
|
|
8888
8970
|
__render(canvas, options) {
|
|
8889
|
-
if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options
|
|
8971
|
+
if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options.bounds));
|
|
8890
8972
|
}
|
|
8891
8973
|
__onResize(event) {
|
|
8892
8974
|
this.forEach(leafer => leafer.resize(event));
|
|
@@ -9025,26 +9107,11 @@ var LeaferUI = function(exports) {
|
|
|
9025
9107
|
const move = leaf.getLocalPoint(total, null, true);
|
|
9026
9108
|
PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
|
|
9027
9109
|
if (checkLimit) this.limitMove(leaf, move);
|
|
9110
|
+
DragBoundsHelper.axisMove(leaf, move);
|
|
9028
9111
|
return move;
|
|
9029
9112
|
}
|
|
9030
9113
|
static limitMove(leaf, move) {
|
|
9031
|
-
|
|
9032
|
-
if (dragBounds) this.getMoveInDragBounds(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, move, true);
|
|
9033
|
-
if (draggable === "x") move.y = 0;
|
|
9034
|
-
if (draggable === "y") move.x = 0;
|
|
9035
|
-
}
|
|
9036
|
-
static getMoveInDragBounds(childBox, dragBounds, move, change) {
|
|
9037
|
-
const x = childBox.x + move.x, y = childBox.y + move.y, right = x + childBox.width, bottom = y + childBox.height;
|
|
9038
|
-
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
9039
|
-
if (!change) move = Object.assign({}, move);
|
|
9040
|
-
if (BoundsHelper.includes(childBox, dragBounds)) {
|
|
9041
|
-
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
9042
|
-
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
9043
|
-
} else {
|
|
9044
|
-
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
9045
|
-
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
9046
|
-
}
|
|
9047
|
-
return move;
|
|
9114
|
+
DragBoundsHelper.limitMove(leaf, move);
|
|
9048
9115
|
}
|
|
9049
9116
|
getPageMove(total) {
|
|
9050
9117
|
this.assignMove(total);
|
|
@@ -9279,11 +9346,12 @@ var LeaferUI = function(exports) {
|
|
|
9279
9346
|
const checkLimitMove = !dragLimitAnimate || !!isDragEnd;
|
|
9280
9347
|
list.forEach(leaf => {
|
|
9281
9348
|
if (leaf.draggable) {
|
|
9349
|
+
const axisDrag = isString(leaf.draggable);
|
|
9282
9350
|
const move = exports.DragEvent.getValidMove(leaf, this.dragStartPoints[leaf.innerId], {
|
|
9283
9351
|
x: totalX,
|
|
9284
9352
|
y: totalY
|
|
9285
|
-
}, checkLimitMove);
|
|
9286
|
-
if (dragLimitAnimate && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else leaf.move(move);
|
|
9353
|
+
}, checkLimitMove || axisDrag);
|
|
9354
|
+
if (dragLimitAnimate && !axisDrag && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else leaf.move(move);
|
|
9287
9355
|
}
|
|
9288
9356
|
});
|
|
9289
9357
|
}
|
|
@@ -10933,7 +11001,7 @@ var LeaferUI = function(exports) {
|
|
|
10933
11001
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
10934
11002
|
}
|
|
10935
11003
|
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
10936
|
-
if (end && index < end) other.clearWorld(copyBounds
|
|
11004
|
+
if (end && index < end) other.clearWorld(copyBounds);
|
|
10937
11005
|
});
|
|
10938
11006
|
other.recycle(copyBounds);
|
|
10939
11007
|
}
|
|
@@ -10993,7 +11061,7 @@ var LeaferUI = function(exports) {
|
|
|
10993
11061
|
}
|
|
10994
11062
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), "source-in");
|
|
10995
11063
|
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
10996
|
-
if (end && index < end) other.clearWorld(copyBounds
|
|
11064
|
+
if (end && index < end) other.clearWorld(copyBounds);
|
|
10997
11065
|
});
|
|
10998
11066
|
other.recycle(copyBounds);
|
|
10999
11067
|
}
|
|
@@ -11082,7 +11150,7 @@ var LeaferUI = function(exports) {
|
|
|
11082
11150
|
canvas.resetTransform();
|
|
11083
11151
|
canvas.opacity = maskOpacity;
|
|
11084
11152
|
canvas.copyWorld(content, realBounds, undefined, blendMode);
|
|
11085
|
-
recycle ? content.recycle(realBounds) : content.clearWorld(realBounds
|
|
11153
|
+
recycle ? content.recycle(realBounds) : content.clearWorld(realBounds);
|
|
11086
11154
|
}
|
|
11087
11155
|
const money = "¥¥$€££¢¢";
|
|
11088
11156
|
const letter = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
|
|
@@ -12595,7 +12663,7 @@ var LeaferUI = function(exports) {
|
|
|
12595
12663
|
if (pointType && pointType.includes("resize")) ResizeEvent.resizingKeys = editor.leafList.keys;
|
|
12596
12664
|
}
|
|
12597
12665
|
onDragEnd(e) {
|
|
12598
|
-
if (this.
|
|
12666
|
+
if (this.moving) this.transformTool.onMove(e);
|
|
12599
12667
|
this.dragPoint = null;
|
|
12600
12668
|
this.resetDoing();
|
|
12601
12669
|
const {name: name, pointType: pointType} = e.current;
|
|
@@ -12628,6 +12696,10 @@ var LeaferUI = function(exports) {
|
|
|
12628
12696
|
}
|
|
12629
12697
|
}
|
|
12630
12698
|
}
|
|
12699
|
+
onMoveEnd(e) {
|
|
12700
|
+
if (this.moving) this.transformTool.onMove(e);
|
|
12701
|
+
this.resetDoing();
|
|
12702
|
+
}
|
|
12631
12703
|
onScale(e) {
|
|
12632
12704
|
if (this.canGesture) {
|
|
12633
12705
|
e.stop();
|
|
@@ -12718,7 +12790,7 @@ var LeaferUI = function(exports) {
|
|
|
12718
12790
|
const {rect: rect, editor: editor, __eventIds: events} = this;
|
|
12719
12791
|
events.push(rect.on_([ [ exports.DragEvent.START, this.onDragStart, this ], [ exports.DragEvent.DRAG, this.onDrag, this ], [ exports.DragEvent.END, this.onDragEnd, this ], [ exports.PointerEvent.ENTER, () => updateMoveCursor(this) ], [ exports.PointerEvent.DOUBLE_TAP, this.onDoubleTap, this ], [ exports.PointerEvent.LONG_PRESS, this.onLongPress, this ] ]));
|
|
12720
12792
|
this.waitLeafer(() => {
|
|
12721
|
-
events.push(editor.app.on_([ [ [ exports.KeyEvent.HOLD, exports.KeyEvent.UP ], this.onKey, this ], [ exports.KeyEvent.DOWN, this.onArrow, this ], [ exports.MoveEvent.BEFORE_MOVE, this.onMove, this, true ], [ exports.ZoomEvent.BEFORE_ZOOM, this.onScale, this, true ], [ exports.RotateEvent.BEFORE_ROTATE, this.onRotate, this, true ], [ exports.MoveEvent.END, this.
|
|
12793
|
+
events.push(editor.app.on_([ [ [ exports.KeyEvent.HOLD, exports.KeyEvent.UP ], this.onKey, this ], [ exports.KeyEvent.DOWN, this.onArrow, this ], [ exports.MoveEvent.BEFORE_MOVE, this.onMove, this, true ], [ exports.ZoomEvent.BEFORE_ZOOM, this.onScale, this, true ], [ exports.RotateEvent.BEFORE_ROTATE, this.onRotate, this, true ], [ exports.MoveEvent.END, this.onMoveEnd, this ], [ exports.ZoomEvent.END, this.resetDoing, this ], [ exports.RotateEvent.END, this.resetDoing, this ] ]));
|
|
12722
12794
|
});
|
|
12723
12795
|
}
|
|
12724
12796
|
__removeListenEvents() {
|
|
@@ -12877,7 +12949,7 @@ var LeaferUI = function(exports) {
|
|
|
12877
12949
|
parent.addAt(group, parent.children.indexOf(list[0]));
|
|
12878
12950
|
list.sort(order);
|
|
12879
12951
|
const matrx = new Matrix(element.worldTransform);
|
|
12880
|
-
matrx.divideParent(parent.
|
|
12952
|
+
matrx.divideParent(parent.scrollWorldTransform);
|
|
12881
12953
|
group.setTransform(matrx);
|
|
12882
12954
|
group.editable = true;
|
|
12883
12955
|
group.hitChildren = false;
|
|
@@ -13065,8 +13137,9 @@ var LeaferUI = function(exports) {
|
|
|
13065
13137
|
const {target: target, mergeConfig: mergeConfig, dragStartData: dragStartData, app: app} = this.editBox;
|
|
13066
13138
|
let move, {dragLimitAnimate: dragLimitAnimate} = mergeConfig;
|
|
13067
13139
|
if (isUndefined(dragLimitAnimate)) dragLimitAnimate = app && app.config.pointer.dragLimitAnimate;
|
|
13068
|
-
const isMoveEnd = e.type === exports.
|
|
13069
|
-
const
|
|
13140
|
+
const isMoveEnd = e.type === exports.MoveEvent.END || e.type === exports.DragEvent.END;
|
|
13141
|
+
const axisDrag = isString(target.draggable);
|
|
13142
|
+
const checkLimitMove = !dragLimitAnimate || isMoveEnd || axisDrag;
|
|
13070
13143
|
if (e instanceof exports.MoveEvent) {
|
|
13071
13144
|
move = e.getLocalMove(target);
|
|
13072
13145
|
if (checkLimitMove) exports.DragEvent.limitMove(target, move);
|
|
@@ -13080,7 +13153,9 @@ var LeaferUI = function(exports) {
|
|
|
13080
13153
|
}
|
|
13081
13154
|
move = exports.DragEvent.getValidMove(target, dragStartData.point, total, checkLimitMove);
|
|
13082
13155
|
}
|
|
13083
|
-
if (
|
|
13156
|
+
if (move.x || move.y) {
|
|
13157
|
+
if (dragLimitAnimate && !axisDrag && isMoveEnd) LeafHelper.animateMove(this, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else this.move(move);
|
|
13158
|
+
}
|
|
13084
13159
|
}
|
|
13085
13160
|
onScale(e) {
|
|
13086
13161
|
const {target: target, mergeConfig: mergeConfig, single: single, dragStartData: dragStartData} = this.editBox;
|
|
@@ -13354,6 +13429,10 @@ var LeaferUI = function(exports) {
|
|
|
13354
13429
|
get buttons() {
|
|
13355
13430
|
return this.editBox.buttons;
|
|
13356
13431
|
}
|
|
13432
|
+
get targetLeafer() {
|
|
13433
|
+
const first = this.list[0];
|
|
13434
|
+
return first && first.leafer;
|
|
13435
|
+
}
|
|
13357
13436
|
constructor(userConfig, data) {
|
|
13358
13437
|
super(data);
|
|
13359
13438
|
this.leafList = new LeafList;
|
|
@@ -13510,7 +13589,6 @@ var LeaferUI = function(exports) {
|
|
|
13510
13589
|
this.emitInnerEvent(InnerEditorEvent.BEFORE_OPEN);
|
|
13511
13590
|
this.innerEditor.load();
|
|
13512
13591
|
this.emitInnerEvent(InnerEditorEvent.OPEN);
|
|
13513
|
-
console.log("hello");
|
|
13514
13592
|
}
|
|
13515
13593
|
}
|
|
13516
13594
|
}
|
|
@@ -13559,10 +13637,13 @@ var LeaferUI = function(exports) {
|
|
|
13559
13637
|
onRenderStart() {
|
|
13560
13638
|
if (this.targetChanged) this.update();
|
|
13561
13639
|
}
|
|
13640
|
+
onChildScroll() {
|
|
13641
|
+
if (this.multiple) this.updateEditBox();
|
|
13642
|
+
}
|
|
13562
13643
|
listenTargetEvents() {
|
|
13563
13644
|
if (!this.targetEventIds.length) {
|
|
13564
|
-
const {app: app, leafer: leafer, editMask: editMask} = this;
|
|
13565
|
-
this.targetEventIds = [ leafer.on_(RenderEvent.START, this.onRenderStart, this), app.on_(RenderEvent.CHILD_START, this.onAppRenderStart, this) ];
|
|
13645
|
+
const {app: app, leafer: leafer, targetLeafer: targetLeafer, editMask: editMask} = this;
|
|
13646
|
+
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) ];
|
|
13566
13647
|
if (editMask.visible) editMask.forceRender();
|
|
13567
13648
|
}
|
|
13568
13649
|
}
|
|
@@ -13702,7 +13783,7 @@ var LeaferUI = function(exports) {
|
|
|
13702
13783
|
};
|
|
13703
13784
|
exports.EditTool = __decorate([ registerEditTool() ], exports.EditTool);
|
|
13704
13785
|
const {left: left$1, right: right$1} = exports.Direction9;
|
|
13705
|
-
const {move: move$
|
|
13786
|
+
const {move: move$5, copy: copy$1, toNumberPoints: toNumberPoints} = PointHelper;
|
|
13706
13787
|
exports.LineEditTool = class LineEditTool extends exports.EditTool {
|
|
13707
13788
|
constructor() {
|
|
13708
13789
|
super(...arguments);
|
|
@@ -13775,11 +13856,11 @@ var LeaferUI = function(exports) {
|
|
|
13775
13856
|
dragPoint(fromPoint, toPoint, isDragFrom, around, movePoint) {
|
|
13776
13857
|
const {x: x, y: y} = movePoint;
|
|
13777
13858
|
if (isDragFrom) {
|
|
13778
|
-
move$
|
|
13779
|
-
if (around) move$
|
|
13859
|
+
move$5(fromPoint, x, y);
|
|
13860
|
+
if (around) move$5(toPoint, -x, -y);
|
|
13780
13861
|
} else {
|
|
13781
|
-
if (around) move$
|
|
13782
|
-
move$
|
|
13862
|
+
if (around) move$5(fromPoint, -x, -y);
|
|
13863
|
+
move$5(toPoint, x, y);
|
|
13783
13864
|
}
|
|
13784
13865
|
}
|
|
13785
13866
|
onSkew(_e) {}
|
|
@@ -14291,7 +14372,9 @@ var LeaferUI = function(exports) {
|
|
|
14291
14372
|
addViewportConfig(leafer.parentApp ? leafer.parentApp : leafer, mergeConfig);
|
|
14292
14373
|
if (leafer.isApp || custom) return;
|
|
14293
14374
|
leafer.__eventIds.push(leafer.on_(exports.MoveEvent.BEFORE_MOVE, e => {
|
|
14294
|
-
leafer.zoomLayer.move(leafer.getValidMove(e.moveX, e.moveY));
|
|
14375
|
+
leafer.zoomLayer.move(leafer.getValidMove(e.moveX, e.moveY, false));
|
|
14376
|
+
}), leafer.on_(exports.MoveEvent.END, e => {
|
|
14377
|
+
LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY));
|
|
14295
14378
|
}), leafer.on_(exports.ZoomEvent.BEFORE_ZOOM, e => {
|
|
14296
14379
|
const {zoomLayer: zoomLayer} = leafer;
|
|
14297
14380
|
const changeScale = leafer.getValidScale(e.scale);
|
|
@@ -14490,30 +14573,25 @@ var LeaferUI = function(exports) {
|
|
|
14490
14573
|
}
|
|
14491
14574
|
}
|
|
14492
14575
|
const leafer = exports.Leafer.prototype;
|
|
14493
|
-
const bounds = new Bounds;
|
|
14576
|
+
const bounds = new Bounds, move$4 = new Point;
|
|
14494
14577
|
leafer.initType = function(type) {
|
|
14495
14578
|
LeaferTypeCreator.run(type, this);
|
|
14496
14579
|
};
|
|
14497
|
-
leafer.getValidMove = function(moveX, moveY) {
|
|
14580
|
+
leafer.getValidMove = function(moveX, moveY, checkLimit = true) {
|
|
14498
14581
|
const {scroll: scroll, disabled: disabled} = this.app.config.move;
|
|
14582
|
+
move$4.set(moveX, moveY);
|
|
14499
14583
|
if (scroll) {
|
|
14500
14584
|
const type = scroll === true ? "" : scroll;
|
|
14501
|
-
if (type.includes("x"))
|
|
14502
|
-
|
|
14503
|
-
|
|
14504
|
-
|
|
14505
|
-
|
|
14506
|
-
if (x >= 0 && right <= 0) moveX = 0; else if (moveX > 0) {
|
|
14507
|
-
if (x + moveX > 0) moveX = -x;
|
|
14508
|
-
} else if (moveX < 0 && right + moveX < 0) moveX = -right;
|
|
14509
|
-
if (y >= 0 && bottom <= 0) moveY = 0; else if (moveY > 0) {
|
|
14510
|
-
if (y + moveY > 0) moveY = -y;
|
|
14511
|
-
} else if (moveY < 0 && bottom + moveY < 0) moveY = -bottom;
|
|
14585
|
+
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;
|
|
14586
|
+
if (checkLimit && type.includes("limit")) {
|
|
14587
|
+
bounds.set(this.__world).addPoint(this.zoomLayer);
|
|
14588
|
+
DragBoundsHelper.getValidMove(bounds, this.canvas.bounds, "inner", move$4, true);
|
|
14589
|
+
if (type.includes("x")) move$4.y = 0; else if (type.includes("y")) move$4.x = 0;
|
|
14512
14590
|
}
|
|
14513
14591
|
}
|
|
14514
14592
|
return {
|
|
14515
|
-
x: disabled ? 0 :
|
|
14516
|
-
y: disabled ? 0 :
|
|
14593
|
+
x: disabled ? 0 : move$4.x,
|
|
14594
|
+
y: disabled ? 0 : move$4.y
|
|
14517
14595
|
};
|
|
14518
14596
|
};
|
|
14519
14597
|
leafer.getValidScale = function(changeScale) {
|
|
@@ -17845,6 +17923,7 @@ var LeaferUI = function(exports) {
|
|
|
17845
17923
|
exports.Cursor = Cursor;
|
|
17846
17924
|
exports.DataHelper = DataHelper;
|
|
17847
17925
|
exports.Debug = Debug;
|
|
17926
|
+
exports.DragBoundsHelper = DragBoundsHelper;
|
|
17848
17927
|
exports.Dragger = Dragger;
|
|
17849
17928
|
exports.EditBox = EditBox;
|
|
17850
17929
|
exports.EditDataHelper = EditDataHelper;
|
|
@@ -18000,6 +18079,7 @@ var LeaferUI = function(exports) {
|
|
|
18000
18079
|
exports.effectType = effectType;
|
|
18001
18080
|
exports.emptyData = emptyData;
|
|
18002
18081
|
exports.eraserType = eraserType;
|
|
18082
|
+
exports.extraPropertyEventMap = extraPropertyEventMap;
|
|
18003
18083
|
exports.getBoundsData = getBoundsData;
|
|
18004
18084
|
exports.getDescriptor = getDescriptor;
|
|
18005
18085
|
exports.getMatrixData = getMatrixData;
|
|
@@ -18038,6 +18118,7 @@ var LeaferUI = function(exports) {
|
|
|
18038
18118
|
exports.scaleResizePath = scaleResizePath;
|
|
18039
18119
|
exports.scaleResizePoints = scaleResizePoints;
|
|
18040
18120
|
exports.scaleType = scaleType;
|
|
18121
|
+
exports.scrollType = scrollType;
|
|
18041
18122
|
exports.sortType = sortType;
|
|
18042
18123
|
exports.stateStyleType = stateStyleType;
|
|
18043
18124
|
exports.stateType = stateType;
|