leafer-ui 1.9.1 → 1.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web.cjs +6 -5
- package/dist/web.esm.js +6 -5
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +221 -149
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +226 -151
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +11 -11
package/dist/web.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$5;
|
|
677
|
-
copy$
|
|
676
|
+
copy$a(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$5;
|
|
683
|
-
copy$
|
|
682
|
+
copy$a(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$5;
|
|
689
|
-
copy$
|
|
688
|
+
copy$a(temp, t);
|
|
690
689
|
P$5.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$5 = PointHelper;
|
|
763
|
-
const {getDistanceFrom: getDistanceFrom, copy: copy$
|
|
762
|
+
const {getDistanceFrom: getDistanceFrom, copy: copy$a, getAtan2: getAtan2} = P$5;
|
|
764
763
|
class Point {
|
|
765
764
|
constructor(x, y) {
|
|
766
765
|
this.set(x, y);
|
|
@@ -1129,6 +1128,10 @@ var LeaferUI = function(exports) {
|
|
|
1129
1128
|
t.x += x;
|
|
1130
1129
|
t.y += y;
|
|
1131
1130
|
},
|
|
1131
|
+
scroll(t, data) {
|
|
1132
|
+
t.x += data.scrollX;
|
|
1133
|
+
t.y += data.scrollY;
|
|
1134
|
+
},
|
|
1132
1135
|
getByMove(t, x, y) {
|
|
1133
1136
|
t = Object.assign({}, t);
|
|
1134
1137
|
B.move(t, x, y);
|
|
@@ -1138,7 +1141,7 @@ var LeaferUI = function(exports) {
|
|
|
1138
1141
|
if (!to) {
|
|
1139
1142
|
to = t;
|
|
1140
1143
|
} else {
|
|
1141
|
-
copy$
|
|
1144
|
+
copy$9(to, t);
|
|
1142
1145
|
}
|
|
1143
1146
|
if (parent) {
|
|
1144
1147
|
to.offsetX = -(B.maxX(parent) - t.x);
|
|
@@ -1290,7 +1293,7 @@ var LeaferUI = function(exports) {
|
|
|
1290
1293
|
if (bounds && (bounds.width || bounds.height)) {
|
|
1291
1294
|
if (first) {
|
|
1292
1295
|
first = false;
|
|
1293
|
-
if (!addMode) copy$
|
|
1296
|
+
if (!addMode) copy$9(t, bounds);
|
|
1294
1297
|
} else {
|
|
1295
1298
|
add$1(t, bounds);
|
|
1296
1299
|
}
|
|
@@ -1375,7 +1378,7 @@ var LeaferUI = function(exports) {
|
|
|
1375
1378
|
}
|
|
1376
1379
|
};
|
|
1377
1380
|
const B = BoundsHelper;
|
|
1378
|
-
const {add: add$1, copy: copy$
|
|
1381
|
+
const {add: add$1, copy: copy$9} = B;
|
|
1379
1382
|
class Bounds {
|
|
1380
1383
|
get minX() {
|
|
1381
1384
|
return BoundsHelper.minX(this);
|
|
@@ -1584,17 +1587,17 @@ var LeaferUI = function(exports) {
|
|
|
1584
1587
|
showHit ? canvas.stroke() : canvas.strokeWorld(w, color);
|
|
1585
1588
|
}
|
|
1586
1589
|
log(...messages) {
|
|
1587
|
-
if (D$
|
|
1588
|
-
if (D$
|
|
1589
|
-
if (D$
|
|
1590
|
+
if (D$5.enable) {
|
|
1591
|
+
if (D$5.filterList.length && D$5.filterList.every(name => name !== this.name)) return;
|
|
1592
|
+
if (D$5.excludeList.length && D$5.excludeList.some(name => name === this.name)) return;
|
|
1590
1593
|
console.log("%c" + this.name, "color:#21ae62", ...messages);
|
|
1591
1594
|
}
|
|
1592
1595
|
}
|
|
1593
1596
|
tip(...messages) {
|
|
1594
|
-
if (D$
|
|
1597
|
+
if (D$5.enable) this.warn(...messages);
|
|
1595
1598
|
}
|
|
1596
1599
|
warn(...messages) {
|
|
1597
|
-
if (D$
|
|
1600
|
+
if (D$5.showWarn) console.warn(this.name, ...messages);
|
|
1598
1601
|
}
|
|
1599
1602
|
repeat(name, ...messages) {
|
|
1600
1603
|
if (!this.repeatMap[name]) {
|
|
@@ -1617,7 +1620,7 @@ var LeaferUI = function(exports) {
|
|
|
1617
1620
|
if (!name) name = []; else if (isString(name)) name = [ name ];
|
|
1618
1621
|
return name;
|
|
1619
1622
|
}
|
|
1620
|
-
const D$
|
|
1623
|
+
const D$5 = Debug;
|
|
1621
1624
|
const debug$g = Debug.get("RunTime");
|
|
1622
1625
|
const Run = {
|
|
1623
1626
|
currentId: 0,
|
|
@@ -1982,7 +1985,7 @@ var LeaferUI = function(exports) {
|
|
|
1982
1985
|
__decorate([ contextMethod() ], Canvas.prototype, "fillText", null);
|
|
1983
1986
|
__decorate([ contextMethod() ], Canvas.prototype, "measureText", null);
|
|
1984
1987
|
__decorate([ contextMethod() ], Canvas.prototype, "strokeText", null);
|
|
1985
|
-
const {copy: copy$
|
|
1988
|
+
const {copy: copy$8, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
1986
1989
|
const minSize = {
|
|
1987
1990
|
width: 1,
|
|
1988
1991
|
height: 1,
|
|
@@ -2144,44 +2147,44 @@ var LeaferUI = function(exports) {
|
|
|
2144
2147
|
const {pixelRatio: pixelRatio} = this;
|
|
2145
2148
|
this.filter = `blur(${blur * pixelRatio}px)`;
|
|
2146
2149
|
}
|
|
2147
|
-
copyWorld(canvas, from, to, blendMode) {
|
|
2150
|
+
copyWorld(canvas, from, to, blendMode, ceilPixel = true) {
|
|
2148
2151
|
if (blendMode) this.blendMode = blendMode;
|
|
2149
2152
|
if (from) {
|
|
2150
|
-
|
|
2151
|
-
if (!to) to =
|
|
2152
|
-
this.drawImage(canvas.view,
|
|
2153
|
+
this.setTempPixelBounds(from, ceilPixel);
|
|
2154
|
+
if (!to) to = tempPixelBounds; else this.setTempPixelBounds2(to, ceilPixel), to = tempPixelBounds2;
|
|
2155
|
+
this.drawImage(canvas.view, tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height, to.x, to.y, to.width, to.height);
|
|
2153
2156
|
} else {
|
|
2154
2157
|
this.drawImage(canvas.view, 0, 0);
|
|
2155
2158
|
}
|
|
2156
2159
|
if (blendMode) this.blendMode = "source-over";
|
|
2157
2160
|
}
|
|
2158
|
-
copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode) {
|
|
2159
|
-
if (blendMode) this.blendMode = blendMode;
|
|
2161
|
+
copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode, ceilPixel = true) {
|
|
2160
2162
|
if (fromWorld.b || fromWorld.c) {
|
|
2161
2163
|
this.save();
|
|
2162
2164
|
this.resetTransform();
|
|
2163
|
-
this.copyWorld(canvas, fromWorld, BoundsHelper.tempToOuterOf(toInnerBounds, fromWorld));
|
|
2165
|
+
this.copyWorld(canvas, fromWorld, BoundsHelper.tempToOuterOf(toInnerBounds, fromWorld), blendMode, ceilPixel);
|
|
2164
2166
|
this.restore();
|
|
2165
2167
|
} else {
|
|
2166
|
-
|
|
2167
|
-
this.
|
|
2168
|
+
if (blendMode) this.blendMode = blendMode;
|
|
2169
|
+
this.setTempPixelBounds(fromWorld, ceilPixel);
|
|
2170
|
+
this.drawImage(canvas.view, tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height, toInnerBounds.x, toInnerBounds.y, toInnerBounds.width, toInnerBounds.height);
|
|
2171
|
+
if (blendMode) this.blendMode = "source-over";
|
|
2168
2172
|
}
|
|
2169
|
-
if (blendMode) this.blendMode = "source-over";
|
|
2170
2173
|
}
|
|
2171
|
-
copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform) {
|
|
2174
|
+
copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform, ceilPixel = true) {
|
|
2172
2175
|
this.resetTransform();
|
|
2173
|
-
this.copyWorld(canvas, from, to, blendMode);
|
|
2176
|
+
this.copyWorld(canvas, from, to, blendMode, ceilPixel);
|
|
2174
2177
|
if (!onlyResetTransform) this.useWorldTransform();
|
|
2175
2178
|
}
|
|
2176
2179
|
useGrayscaleAlpha(bounds) {
|
|
2177
|
-
this.
|
|
2180
|
+
this.setTempPixelBounds(bounds, true, true);
|
|
2178
2181
|
let alpha, pixel;
|
|
2179
|
-
const {context: context} = this, imageData = context.getImageData(
|
|
2182
|
+
const {context: context} = this, imageData = context.getImageData(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height), {data: data} = imageData;
|
|
2180
2183
|
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
2181
2184
|
pixel = data[i] * .299 + data[i + 1] * .587 + data[i + 2] * .114;
|
|
2182
2185
|
if (alpha = data[i + 3]) data[i + 3] = alpha === 255 ? pixel : alpha * (pixel / 255);
|
|
2183
2186
|
}
|
|
2184
|
-
context.putImageData(imageData,
|
|
2187
|
+
context.putImageData(imageData, tempPixelBounds.x, tempPixelBounds.y);
|
|
2185
2188
|
}
|
|
2186
2189
|
useMask(maskCanvas, fromBounds, toBounds) {
|
|
2187
2190
|
this.copyWorld(maskCanvas, fromBounds, toBounds, "destination-in");
|
|
@@ -2189,42 +2192,48 @@ var LeaferUI = function(exports) {
|
|
|
2189
2192
|
useEraser(eraserCanvas, fromBounds, toBounds) {
|
|
2190
2193
|
this.copyWorld(eraserCanvas, fromBounds, toBounds, "destination-out");
|
|
2191
2194
|
}
|
|
2192
|
-
fillWorld(bounds, color, blendMode) {
|
|
2195
|
+
fillWorld(bounds, color, blendMode, ceilPixel) {
|
|
2193
2196
|
if (blendMode) this.blendMode = blendMode;
|
|
2194
2197
|
this.fillStyle = color;
|
|
2195
|
-
this.
|
|
2196
|
-
this.fillRect(
|
|
2198
|
+
this.setTempPixelBounds(bounds, ceilPixel);
|
|
2199
|
+
this.fillRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
|
|
2197
2200
|
if (blendMode) this.blendMode = "source-over";
|
|
2198
2201
|
}
|
|
2199
|
-
strokeWorld(bounds, color, blendMode) {
|
|
2202
|
+
strokeWorld(bounds, color, blendMode, ceilPixel) {
|
|
2200
2203
|
if (blendMode) this.blendMode = blendMode;
|
|
2201
2204
|
this.strokeStyle = color;
|
|
2202
|
-
this.
|
|
2203
|
-
this.strokeRect(
|
|
2205
|
+
this.setTempPixelBounds(bounds, ceilPixel);
|
|
2206
|
+
this.strokeRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
|
|
2204
2207
|
if (blendMode) this.blendMode = "source-over";
|
|
2205
2208
|
}
|
|
2206
|
-
clipWorld(bounds, ceilPixel) {
|
|
2209
|
+
clipWorld(bounds, ceilPixel = true) {
|
|
2207
2210
|
this.beginPath();
|
|
2208
|
-
this.
|
|
2209
|
-
this.rect(
|
|
2211
|
+
this.setTempPixelBounds(bounds, ceilPixel);
|
|
2212
|
+
this.rect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
|
|
2210
2213
|
this.clip();
|
|
2211
2214
|
}
|
|
2212
2215
|
clipUI(ruleData) {
|
|
2213
2216
|
ruleData.windingRule ? this.clip(ruleData.windingRule) : this.clip();
|
|
2214
2217
|
}
|
|
2215
|
-
clearWorld(bounds, ceilPixel) {
|
|
2216
|
-
this.
|
|
2217
|
-
this.clearRect(
|
|
2218
|
+
clearWorld(bounds, ceilPixel = true) {
|
|
2219
|
+
this.setTempPixelBounds(bounds, ceilPixel);
|
|
2220
|
+
this.clearRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
|
|
2218
2221
|
}
|
|
2219
2222
|
clear() {
|
|
2220
2223
|
const {pixelRatio: pixelRatio} = this;
|
|
2221
2224
|
this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2);
|
|
2222
2225
|
}
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2226
|
+
setTempPixelBounds(bounds, ceil, intersect) {
|
|
2227
|
+
this.copyToPixelBounds(tempPixelBounds, bounds, ceil, intersect);
|
|
2228
|
+
}
|
|
2229
|
+
setTempPixelBounds2(bounds, ceil, intersect) {
|
|
2230
|
+
this.copyToPixelBounds(tempPixelBounds2, bounds, ceil, intersect);
|
|
2231
|
+
}
|
|
2232
|
+
copyToPixelBounds(pixelBounds, bounds, ceil, intersect) {
|
|
2233
|
+
pixelBounds.set(bounds);
|
|
2234
|
+
if (intersect) pixelBounds.intersect(this.bounds);
|
|
2235
|
+
pixelBounds.scale(this.pixelRatio);
|
|
2236
|
+
if (ceil) pixelBounds.ceil();
|
|
2228
2237
|
}
|
|
2229
2238
|
isSameSize(size) {
|
|
2230
2239
|
return this.width === size.width && this.height === size.height && (!size.pixelRatio || this.pixelRatio === size.pixelRatio);
|
|
@@ -2232,7 +2241,7 @@ var LeaferUI = function(exports) {
|
|
|
2232
2241
|
getSameCanvas(useSameWorldTransform, useSameSmooth) {
|
|
2233
2242
|
const {size: size, pixelSnap: pixelSnap} = this, canvas = this.manager ? this.manager.get(size) : Creator.canvas(Object.assign({}, size));
|
|
2234
2243
|
canvas.save();
|
|
2235
|
-
if (useSameWorldTransform) copy$
|
|
2244
|
+
if (useSameWorldTransform) copy$8(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
|
|
2236
2245
|
if (useSameSmooth) canvas.smooth = this.smooth;
|
|
2237
2246
|
canvas.pixelSnap !== pixelSnap && (canvas.pixelSnap = pixelSnap);
|
|
2238
2247
|
return canvas;
|
|
@@ -2240,7 +2249,7 @@ var LeaferUI = function(exports) {
|
|
|
2240
2249
|
recycle(clearBounds) {
|
|
2241
2250
|
if (!this.recycled) {
|
|
2242
2251
|
this.restore();
|
|
2243
|
-
clearBounds ? this.clearWorld(clearBounds
|
|
2252
|
+
clearBounds ? this.clearWorld(clearBounds) : this.clear();
|
|
2244
2253
|
this.manager ? this.manager.recycle(this) : this.destroy();
|
|
2245
2254
|
}
|
|
2246
2255
|
}
|
|
@@ -2598,7 +2607,7 @@ var LeaferUI = function(exports) {
|
|
|
2598
2607
|
}
|
|
2599
2608
|
}
|
|
2600
2609
|
};
|
|
2601
|
-
const {M: M$4, m: m, L: L$5, l: l, H: H, h: h, V: V, v: v, C: C$3, c: c, S: S, s: s, Q: Q$3, q: q, T: T, t: t, A: A, a: a, Z: Z$4, z: z, N: N$3, D: D$
|
|
2610
|
+
const {M: M$4, m: m, L: L$5, l: l, H: H, h: h, V: V, v: v, C: C$3, c: c, S: S, s: s, Q: Q$3, q: q, T: T, t: t, A: A, a: a, Z: Z$4, z: z, N: N$3, D: D$4, X: X$3, G: G$3, F: F$4, O: O$3, P: P$3, U: U$3} = PathCommandMap;
|
|
2602
2611
|
const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
|
|
2603
2612
|
const {ellipticalArc: ellipticalArc} = EllipseHelper;
|
|
2604
2613
|
const debug$d = Debug.get("PathConvert");
|
|
@@ -2813,7 +2822,7 @@ var LeaferUI = function(exports) {
|
|
|
2813
2822
|
i += 5;
|
|
2814
2823
|
break;
|
|
2815
2824
|
|
|
2816
|
-
case D$
|
|
2825
|
+
case D$4:
|
|
2817
2826
|
x = old[i + 1];
|
|
2818
2827
|
y = old[i + 2];
|
|
2819
2828
|
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 +2921,7 @@ var LeaferUI = function(exports) {
|
|
|
2912
2921
|
}
|
|
2913
2922
|
};
|
|
2914
2923
|
const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
|
|
2915
|
-
const {M: M$3, L: L$4, C: C$2, Q: Q$2, Z: Z$3, N: N$2, D: D$
|
|
2924
|
+
const {M: M$3, L: L$4, C: C$2, Q: Q$2, Z: Z$3, N: N$2, D: D$3, X: X$2, G: G$2, F: F$3, O: O$2, P: P$2, U: U$2} = PathCommandMap;
|
|
2916
2925
|
const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
|
|
2917
2926
|
const {tan: tan, min: min, abs: abs$1} = Math;
|
|
2918
2927
|
const startPoint = {};
|
|
@@ -2944,7 +2953,7 @@ var LeaferUI = function(exports) {
|
|
|
2944
2953
|
} else {
|
|
2945
2954
|
const fourCorners = MathHelper.fourNumber(cornerRadius);
|
|
2946
2955
|
if (fourCorners) {
|
|
2947
|
-
data.push(D$
|
|
2956
|
+
data.push(D$3, x, y, width, height, ...fourCorners);
|
|
2948
2957
|
} else {
|
|
2949
2958
|
data.push(N$2, x, y, width, height);
|
|
2950
2959
|
}
|
|
@@ -3083,7 +3092,7 @@ var LeaferUI = function(exports) {
|
|
|
3083
3092
|
}
|
|
3084
3093
|
paint() {}
|
|
3085
3094
|
}
|
|
3086
|
-
const {M: M$2, L: L$3, C: C$1, Q: Q$1, Z: Z$2, N: N$1, D: D$
|
|
3095
|
+
const {M: M$2, L: L$3, C: C$1, Q: Q$1, Z: Z$2, N: N$1, D: D$2, X: X$1, G: G$1, F: F$2, O: O$1, P: P$1, U: U$1} = PathCommandMap;
|
|
3087
3096
|
const debug$c = Debug.get("PathDrawer");
|
|
3088
3097
|
const PathDrawer = {
|
|
3089
3098
|
drawPathByData(drawer, data) {
|
|
@@ -3123,7 +3132,7 @@ var LeaferUI = function(exports) {
|
|
|
3123
3132
|
i += 5;
|
|
3124
3133
|
break;
|
|
3125
3134
|
|
|
3126
|
-
case D$
|
|
3135
|
+
case D$2:
|
|
3127
3136
|
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
3137
|
i += 9;
|
|
3129
3138
|
break;
|
|
@@ -3165,9 +3174,9 @@ var LeaferUI = function(exports) {
|
|
|
3165
3174
|
}
|
|
3166
3175
|
}
|
|
3167
3176
|
};
|
|
3168
|
-
const {M: M$1, L: L$2, C: C, Q: Q, Z: Z$1, N: N, D: D, X: X, G: G, F: F$1, O: O, P: P, U: U} = PathCommandMap;
|
|
3177
|
+
const {M: M$1, L: L$2, C: C, Q: Q, Z: Z$1, N: N, D: D$1, X: X, G: G, F: F$1, O: O, P: P, U: U} = PathCommandMap;
|
|
3169
3178
|
const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
|
|
3170
|
-
const {addPointBounds: addPointBounds, copy: copy$
|
|
3179
|
+
const {addPointBounds: addPointBounds, copy: copy$7, addPoint: addPoint, setPoint: setPoint, addBounds: addBounds, toBounds: toBounds$2} = TwoPointBoundsHelper;
|
|
3171
3180
|
const debug$b = Debug.get("PathBounds");
|
|
3172
3181
|
let radius, radiusX, radiusY;
|
|
3173
3182
|
const tempPointBounds = {};
|
|
@@ -3233,17 +3242,17 @@ var LeaferUI = function(exports) {
|
|
|
3233
3242
|
i += 5;
|
|
3234
3243
|
break;
|
|
3235
3244
|
|
|
3236
|
-
case D:
|
|
3245
|
+
case D$1:
|
|
3237
3246
|
case X:
|
|
3238
3247
|
x = data[i + 1];
|
|
3239
3248
|
y = data[i + 2];
|
|
3240
3249
|
addBounds(setPointBounds, x, y, data[i + 3], data[i + 4]);
|
|
3241
|
-
i += command === D ? 9 : 6;
|
|
3250
|
+
i += command === D$1 ? 9 : 6;
|
|
3242
3251
|
break;
|
|
3243
3252
|
|
|
3244
3253
|
case G:
|
|
3245
3254
|
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$
|
|
3255
|
+
i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3247
3256
|
x = setEndPoint.x;
|
|
3248
3257
|
y = setEndPoint.y;
|
|
3249
3258
|
i += 9;
|
|
@@ -3261,7 +3270,7 @@ var LeaferUI = function(exports) {
|
|
|
3261
3270
|
|
|
3262
3271
|
case O:
|
|
3263
3272
|
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$
|
|
3273
|
+
i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3265
3274
|
x = setEndPoint.x;
|
|
3266
3275
|
y = setEndPoint.y;
|
|
3267
3276
|
i += 7;
|
|
@@ -3278,7 +3287,7 @@ var LeaferUI = function(exports) {
|
|
|
3278
3287
|
|
|
3279
3288
|
case U:
|
|
3280
3289
|
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$
|
|
3290
|
+
i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3282
3291
|
x = setEndPoint.x;
|
|
3283
3292
|
y = setEndPoint.y;
|
|
3284
3293
|
i += 6;
|
|
@@ -3896,6 +3905,16 @@ var LeaferUI = function(exports) {
|
|
|
3896
3905
|
}
|
|
3897
3906
|
}));
|
|
3898
3907
|
}
|
|
3908
|
+
function scrollType(defaultValue, checkFiniteNumber) {
|
|
3909
|
+
return decorateLeafAttr(defaultValue, key => attr({
|
|
3910
|
+
set(value) {
|
|
3911
|
+
if (this.__setAttr(key, value, checkFiniteNumber)) {
|
|
3912
|
+
this.__layout.matrixChanged || this.__layout.matrixChange();
|
|
3913
|
+
this.__scrollWorld || (this.__scrollWorld = {});
|
|
3914
|
+
}
|
|
3915
|
+
}
|
|
3916
|
+
}));
|
|
3917
|
+
}
|
|
3899
3918
|
function autoLayoutType(defaultValue) {
|
|
3900
3919
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
3901
3920
|
set(value) {
|
|
@@ -4198,7 +4217,7 @@ var LeaferUI = function(exports) {
|
|
|
4198
4217
|
EventCreator.register(target);
|
|
4199
4218
|
};
|
|
4200
4219
|
}
|
|
4201
|
-
const {copy: copy$
|
|
4220
|
+
const {copy: copy$6, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter: skewOfOuter, multiplyParent: multiplyParent$3, divideParent: divideParent, getLayout: getLayout} = MatrixHelper;
|
|
4202
4221
|
const matrix$1 = {}, {round: round} = Math;
|
|
4203
4222
|
const LeafHelper = {
|
|
4204
4223
|
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
@@ -4272,7 +4291,7 @@ var LeaferUI = function(exports) {
|
|
|
4272
4291
|
x: x,
|
|
4273
4292
|
y: y
|
|
4274
4293
|
};
|
|
4275
|
-
isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : t.parent && toInnerPoint$1(t.parent.
|
|
4294
|
+
isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : t.parent && toInnerPoint$1(t.parent.scrollWorldTransform, local, local, true);
|
|
4276
4295
|
L.moveLocal(t, local.x, local.y, transition);
|
|
4277
4296
|
},
|
|
4278
4297
|
moveLocal(t, x, y = 0, transition) {
|
|
@@ -4294,9 +4313,9 @@ var LeaferUI = function(exports) {
|
|
|
4294
4313
|
if (scaleY) transition = scaleY;
|
|
4295
4314
|
scaleY = scaleX;
|
|
4296
4315
|
}
|
|
4297
|
-
copy$
|
|
4316
|
+
copy$6(matrix$1, o);
|
|
4298
4317
|
scaleOfOuter$2(matrix$1, origin, scaleX, scaleY);
|
|
4299
|
-
if (
|
|
4318
|
+
if (L.hasHighPosition(t)) {
|
|
4300
4319
|
L.setTransform(t, matrix$1, resize, transition);
|
|
4301
4320
|
} else {
|
|
4302
4321
|
const x = t.x + matrix$1.e - o.e, y = t.y + matrix$1.f - o.f;
|
|
@@ -4313,9 +4332,9 @@ var LeaferUI = function(exports) {
|
|
|
4313
4332
|
},
|
|
4314
4333
|
rotateOfLocal(t, origin, angle, transition) {
|
|
4315
4334
|
const o = t.__localMatrix;
|
|
4316
|
-
copy$
|
|
4335
|
+
copy$6(matrix$1, o);
|
|
4317
4336
|
rotateOfOuter$2(matrix$1, origin, angle);
|
|
4318
|
-
if (
|
|
4337
|
+
if (L.hasHighPosition(t)) L.setTransform(t, matrix$1, false, transition); else t.set({
|
|
4319
4338
|
x: t.x + matrix$1.e - o.e,
|
|
4320
4339
|
y: t.y + matrix$1.f - o.f,
|
|
4321
4340
|
rotation: MathHelper.formatRotation(t.rotation + angle)
|
|
@@ -4325,24 +4344,28 @@ var LeaferUI = function(exports) {
|
|
|
4325
4344
|
L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
|
|
4326
4345
|
},
|
|
4327
4346
|
skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
|
|
4328
|
-
copy$
|
|
4347
|
+
copy$6(matrix$1, t.__localMatrix);
|
|
4329
4348
|
skewOfOuter(matrix$1, origin, skewX, skewY);
|
|
4330
4349
|
L.setTransform(t, matrix$1, resize, transition);
|
|
4331
4350
|
},
|
|
4332
4351
|
transformWorld(t, transform, resize, transition) {
|
|
4333
|
-
copy$
|
|
4352
|
+
copy$6(matrix$1, t.worldTransform);
|
|
4334
4353
|
multiplyParent$3(matrix$1, transform);
|
|
4335
|
-
if (t.parent) divideParent(matrix$1, t.parent.
|
|
4354
|
+
if (t.parent) divideParent(matrix$1, t.parent.scrollWorldTransform);
|
|
4336
4355
|
L.setTransform(t, matrix$1, resize, transition);
|
|
4337
4356
|
},
|
|
4338
4357
|
transform(t, transform, resize, transition) {
|
|
4339
|
-
copy$
|
|
4358
|
+
copy$6(matrix$1, t.localTransform);
|
|
4340
4359
|
multiplyParent$3(matrix$1, transform);
|
|
4341
4360
|
L.setTransform(t, matrix$1, resize, transition);
|
|
4342
4361
|
},
|
|
4343
4362
|
setTransform(t, transform, resize, transition) {
|
|
4344
4363
|
const data = t.__, originPoint = data.origin && L.getInnerOrigin(t, data.origin);
|
|
4345
4364
|
const layout = getLayout(transform, originPoint, data.around && L.getInnerOrigin(t, data.around));
|
|
4365
|
+
if (L.hasOffset(t)) {
|
|
4366
|
+
layout.x -= data.offsetX;
|
|
4367
|
+
layout.y -= data.offsetY;
|
|
4368
|
+
}
|
|
4346
4369
|
if (resize) {
|
|
4347
4370
|
const scaleX = layout.scaleX / t.scaleX, scaleY = layout.scaleY / t.scaleY;
|
|
4348
4371
|
delete layout.scaleX, delete layout.scaleY;
|
|
@@ -4370,14 +4393,20 @@ var LeaferUI = function(exports) {
|
|
|
4370
4393
|
return innerOrigin;
|
|
4371
4394
|
},
|
|
4372
4395
|
getRelativeWorld(t, relative, temp) {
|
|
4373
|
-
copy$
|
|
4374
|
-
divideParent(matrix$1, relative.
|
|
4396
|
+
copy$6(matrix$1, t.worldTransform);
|
|
4397
|
+
divideParent(matrix$1, relative.scrollWorldTransform);
|
|
4375
4398
|
return temp ? matrix$1 : Object.assign({}, matrix$1);
|
|
4376
4399
|
},
|
|
4377
4400
|
drop(t, parent, index, resize) {
|
|
4378
4401
|
t.setTransform(L.getRelativeWorld(t, parent, true), resize);
|
|
4379
4402
|
parent.add(t, index);
|
|
4380
4403
|
},
|
|
4404
|
+
hasHighPosition(t) {
|
|
4405
|
+
return t.origin || t.around || L.hasOffset(t);
|
|
4406
|
+
},
|
|
4407
|
+
hasOffset(t) {
|
|
4408
|
+
return t.offsetX || t.offsetY;
|
|
4409
|
+
},
|
|
4381
4410
|
hasParent(p, parent) {
|
|
4382
4411
|
if (!parent) return false;
|
|
4383
4412
|
while (p) {
|
|
@@ -4400,8 +4429,7 @@ var LeaferUI = function(exports) {
|
|
|
4400
4429
|
const L = LeafHelper;
|
|
4401
4430
|
const {updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1} = L;
|
|
4402
4431
|
function getTempLocal(t, world) {
|
|
4403
|
-
t.
|
|
4404
|
-
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
|
|
4432
|
+
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.scrollWorldTransform) : world;
|
|
4405
4433
|
}
|
|
4406
4434
|
const LeafBoundsHelper = {
|
|
4407
4435
|
worldBounds(target) {
|
|
@@ -4517,7 +4545,7 @@ var LeaferUI = function(exports) {
|
|
|
4517
4545
|
}
|
|
4518
4546
|
};
|
|
4519
4547
|
const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$2} = LeafHelper;
|
|
4520
|
-
const {toOuterOf: toOuterOf$2, getPoints: getPoints, copy: copy$
|
|
4548
|
+
const {toOuterOf: toOuterOf$2, getPoints: getPoints, copy: copy$5} = BoundsHelper;
|
|
4521
4549
|
const localContent = "_localContentBounds";
|
|
4522
4550
|
const worldContent = "_worldContentBounds", worldBox = "_worldBoxBounds", worldStroke = "_worldStrokeBounds";
|
|
4523
4551
|
class LeafLayout {
|
|
@@ -4753,7 +4781,7 @@ var LeaferUI = function(exports) {
|
|
|
4753
4781
|
matrix = getRelativeWorld$1(leaf, relative, true);
|
|
4754
4782
|
}
|
|
4755
4783
|
if (!layoutBounds) layoutBounds = MatrixHelper.getLayout(matrix);
|
|
4756
|
-
copy$
|
|
4784
|
+
copy$5(layoutBounds, bounds);
|
|
4757
4785
|
PointHelper.copy(layoutBounds, point);
|
|
4758
4786
|
if (unscale) {
|
|
4759
4787
|
const {scaleX: scaleX, scaleY: scaleY} = layoutBounds;
|
|
@@ -4932,6 +4960,7 @@ var LeaferUI = function(exports) {
|
|
|
4932
4960
|
ChildEvent.MOUNTED = "mounted";
|
|
4933
4961
|
ChildEvent.UNMOUNTED = "unmounted";
|
|
4934
4962
|
ChildEvent.DESTROY = "destroy";
|
|
4963
|
+
const SCROLL = "property.scroll";
|
|
4935
4964
|
class PropertyEvent extends Event {
|
|
4936
4965
|
constructor(type, target, attrName, oldValue, newValue) {
|
|
4937
4966
|
super(type, target);
|
|
@@ -4942,6 +4971,11 @@ var LeaferUI = function(exports) {
|
|
|
4942
4971
|
}
|
|
4943
4972
|
PropertyEvent.CHANGE = "property.change";
|
|
4944
4973
|
PropertyEvent.LEAFER_CHANGE = "property.leafer_change";
|
|
4974
|
+
PropertyEvent.SCROLL = SCROLL;
|
|
4975
|
+
const extraPropertyEventMap = {
|
|
4976
|
+
scrollX: SCROLL,
|
|
4977
|
+
scrollY: SCROLL
|
|
4978
|
+
};
|
|
4945
4979
|
class ImageEvent extends Event {
|
|
4946
4980
|
constructor(type, data) {
|
|
4947
4981
|
super(type);
|
|
@@ -5163,7 +5197,9 @@ var LeaferUI = function(exports) {
|
|
|
5163
5197
|
if (!id) return;
|
|
5164
5198
|
const list = isArray(id) ? id : [ id ];
|
|
5165
5199
|
list.forEach(item => {
|
|
5166
|
-
if (
|
|
5200
|
+
if (item) {
|
|
5201
|
+
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);
|
|
5202
|
+
}
|
|
5167
5203
|
});
|
|
5168
5204
|
list.length = 0;
|
|
5169
5205
|
}
|
|
@@ -5252,8 +5288,6 @@ var LeaferUI = function(exports) {
|
|
|
5252
5288
|
}
|
|
5253
5289
|
if (isObject(newValue) || oldValue !== newValue) {
|
|
5254
5290
|
this.__realSetAttr(name, newValue);
|
|
5255
|
-
const {CHANGE: CHANGE} = PropertyEvent;
|
|
5256
|
-
const event = new PropertyEvent(CHANGE, this, name, oldValue, newValue);
|
|
5257
5291
|
if (this.isLeafer) {
|
|
5258
5292
|
this.emitEvent(new PropertyEvent(PropertyEvent.LEAFER_CHANGE, this, name, oldValue, newValue));
|
|
5259
5293
|
const transformEventName = leaferTransformAttrMap[name];
|
|
@@ -5261,10 +5295,10 @@ var LeaferUI = function(exports) {
|
|
|
5261
5295
|
this.emitEvent(new LeaferEvent(transformEventName, this));
|
|
5262
5296
|
this.emitEvent(new LeaferEvent(LeaferEvent.TRANSFORM, this));
|
|
5263
5297
|
}
|
|
5264
|
-
} else {
|
|
5265
|
-
if (this.hasEvent(CHANGE)) this.emitEvent(event);
|
|
5266
5298
|
}
|
|
5267
|
-
this.
|
|
5299
|
+
this.emitPropertyEvent(PropertyEvent.CHANGE, name, oldValue, newValue);
|
|
5300
|
+
const extraPropertyEvent = extraPropertyEventMap[name];
|
|
5301
|
+
if (extraPropertyEvent) this.emitPropertyEvent(extraPropertyEvent, name, oldValue, newValue);
|
|
5268
5302
|
return true;
|
|
5269
5303
|
} else {
|
|
5270
5304
|
return false;
|
|
@@ -5274,6 +5308,11 @@ var LeaferUI = function(exports) {
|
|
|
5274
5308
|
return true;
|
|
5275
5309
|
}
|
|
5276
5310
|
},
|
|
5311
|
+
emitPropertyEvent(type, name, oldValue, newValue) {
|
|
5312
|
+
const event = new PropertyEvent(type, this, name, oldValue, newValue);
|
|
5313
|
+
this.isLeafer || this.hasEvent(type) && this.emitEvent(event);
|
|
5314
|
+
this.leafer.emitEvent(event);
|
|
5315
|
+
},
|
|
5277
5316
|
__realSetAttr(name, newValue) {
|
|
5278
5317
|
const data = this.__;
|
|
5279
5318
|
data[name] = newValue;
|
|
@@ -5289,8 +5328,9 @@ var LeaferUI = function(exports) {
|
|
|
5289
5328
|
const {toPoint: toPoint$3, tempPoint: tempPoint} = AroundHelper;
|
|
5290
5329
|
const LeafMatrix = {
|
|
5291
5330
|
__updateWorldMatrix() {
|
|
5292
|
-
const {parent: parent, __layout: __layout} = this;
|
|
5293
|
-
multiplyParent$2(this.__local || __layout, parent ? parent.__world : defaultWorld,
|
|
5331
|
+
const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
|
|
5332
|
+
multiplyParent$2(this.__local || __layout, parent ? parent.__scrollWorld || parent.__world : defaultWorld, __world, !!__layout.affectScaleOrRotation, __);
|
|
5333
|
+
if (__scrollWorld) translateInner(Object.assign(__scrollWorld, __world), __.scrollX, __.scrollY);
|
|
5294
5334
|
},
|
|
5295
5335
|
__updateLocalMatrix() {
|
|
5296
5336
|
if (this.__local) {
|
|
@@ -5313,7 +5353,7 @@ var LeaferUI = function(exports) {
|
|
|
5313
5353
|
};
|
|
5314
5354
|
const {updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2} = LeafHelper;
|
|
5315
5355
|
const {updateBounds: updateBounds$1} = BranchHelper;
|
|
5316
|
-
const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$
|
|
5356
|
+
const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$4} = BoundsHelper;
|
|
5317
5357
|
const {toBounds: toBounds$1} = PathBounds;
|
|
5318
5358
|
const LeafBounds = {
|
|
5319
5359
|
__updateWorldBounds() {
|
|
@@ -5382,7 +5422,7 @@ var LeaferUI = function(exports) {
|
|
|
5382
5422
|
__updateLocalRenderBounds() {
|
|
5383
5423
|
toOuterOf$1(this.__layout.renderBounds, this.__localMatrix, this.__layout.localRenderBounds);
|
|
5384
5424
|
},
|
|
5385
|
-
__updateBoxBounds() {
|
|
5425
|
+
__updateBoxBounds(_secondLayout, _bounds) {
|
|
5386
5426
|
const b = this.__layout.boxBounds;
|
|
5387
5427
|
const data = this.__;
|
|
5388
5428
|
if (data.__pathInputed) {
|
|
@@ -5416,13 +5456,13 @@ var LeaferUI = function(exports) {
|
|
|
5416
5456
|
data.__naturalWidth = layout.boxBounds.width;
|
|
5417
5457
|
data.__naturalHeight = layout.boxBounds.height;
|
|
5418
5458
|
},
|
|
5419
|
-
__updateStrokeBounds() {
|
|
5459
|
+
__updateStrokeBounds(_bounds) {
|
|
5420
5460
|
const layout = this.__layout;
|
|
5421
5461
|
copyAndSpread$1(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
|
|
5422
5462
|
},
|
|
5423
|
-
__updateRenderBounds() {
|
|
5463
|
+
__updateRenderBounds(_bounds) {
|
|
5424
5464
|
const layout = this.__layout;
|
|
5425
|
-
layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$
|
|
5465
|
+
layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$4(layout.renderBounds, layout.strokeBounds);
|
|
5426
5466
|
}
|
|
5427
5467
|
};
|
|
5428
5468
|
const LeafRender = {
|
|
@@ -5513,7 +5553,7 @@ var LeaferUI = function(exports) {
|
|
|
5513
5553
|
const {LEAF: LEAF, create: create} = IncrementId;
|
|
5514
5554
|
const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
|
|
5515
5555
|
const {toOuterOf: toOuterOf} = BoundsHelper;
|
|
5516
|
-
const {copy: copy$
|
|
5556
|
+
const {copy: copy$3, move: move} = PointHelper;
|
|
5517
5557
|
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
5558
|
exports.Leaf = class Leaf {
|
|
5519
5559
|
get tag() {
|
|
@@ -5559,6 +5599,10 @@ var LeaferUI = function(exports) {
|
|
|
5559
5599
|
get localTransform() {
|
|
5560
5600
|
return this.__layout.getTransform("local");
|
|
5561
5601
|
}
|
|
5602
|
+
get scrollWorldTransform() {
|
|
5603
|
+
this.updateLayout();
|
|
5604
|
+
return this.__scrollWorld || this.__world;
|
|
5605
|
+
}
|
|
5562
5606
|
get boxBounds() {
|
|
5563
5607
|
return this.getBounds("box", "inner");
|
|
5564
5608
|
}
|
|
@@ -5575,7 +5619,7 @@ var LeaferUI = function(exports) {
|
|
|
5575
5619
|
return this.getBounds("render");
|
|
5576
5620
|
}
|
|
5577
5621
|
get worldOpacity() {
|
|
5578
|
-
this.
|
|
5622
|
+
this.updateLayout();
|
|
5579
5623
|
return this.__worldOpacity;
|
|
5580
5624
|
}
|
|
5581
5625
|
get __worldFlipped() {
|
|
@@ -5750,10 +5794,10 @@ var LeaferUI = function(exports) {
|
|
|
5750
5794
|
__updateLocalBoxBounds() {}
|
|
5751
5795
|
__updateLocalStrokeBounds() {}
|
|
5752
5796
|
__updateLocalRenderBounds() {}
|
|
5753
|
-
__updateBoxBounds() {}
|
|
5797
|
+
__updateBoxBounds(_secondLayout, _bounds) {}
|
|
5754
5798
|
__updateContentBounds() {}
|
|
5755
|
-
__updateStrokeBounds() {}
|
|
5756
|
-
__updateRenderBounds() {}
|
|
5799
|
+
__updateStrokeBounds(_bounds) {}
|
|
5800
|
+
__updateRenderBounds(_bounds) {}
|
|
5757
5801
|
__updateAutoLayout() {}
|
|
5758
5802
|
__updateFlowLayout() {}
|
|
5759
5803
|
__updateNaturalSize() {}
|
|
@@ -5825,14 +5869,14 @@ var LeaferUI = function(exports) {
|
|
|
5825
5869
|
if (this.parent) {
|
|
5826
5870
|
this.parent.worldToInner(world, to, distance, relative);
|
|
5827
5871
|
} else {
|
|
5828
|
-
if (to) copy$
|
|
5872
|
+
if (to) copy$3(to, world);
|
|
5829
5873
|
}
|
|
5830
5874
|
}
|
|
5831
5875
|
localToWorld(local, to, distance, relative) {
|
|
5832
5876
|
if (this.parent) {
|
|
5833
5877
|
this.parent.innerToWorld(local, to, distance, relative);
|
|
5834
5878
|
} else {
|
|
5835
|
-
if (to) copy$
|
|
5879
|
+
if (to) copy$3(to, local);
|
|
5836
5880
|
}
|
|
5837
5881
|
}
|
|
5838
5882
|
worldToInner(world, to, distance, relative) {
|
|
@@ -6047,14 +6091,14 @@ var LeaferUI = function(exports) {
|
|
|
6047
6091
|
}
|
|
6048
6092
|
return 0;
|
|
6049
6093
|
}
|
|
6050
|
-
__updateBoxBounds() {
|
|
6051
|
-
setListWithFn(this.__layout.boxBounds, this.children, this.__hasMask ? maskLocalBoxBounds : localBoxBounds);
|
|
6094
|
+
__updateBoxBounds(_secondLayout, bounds) {
|
|
6095
|
+
setListWithFn(bounds || this.__layout.boxBounds, this.children, this.__hasMask ? maskLocalBoxBounds : localBoxBounds);
|
|
6052
6096
|
}
|
|
6053
|
-
__updateStrokeBounds() {
|
|
6054
|
-
setListWithFn(this.__layout.strokeBounds, this.children, this.__hasMask ? maskLocalStrokeBounds : localStrokeBounds);
|
|
6097
|
+
__updateStrokeBounds(bounds) {
|
|
6098
|
+
setListWithFn(bounds || this.__layout.strokeBounds, this.children, this.__hasMask ? maskLocalStrokeBounds : localStrokeBounds);
|
|
6055
6099
|
}
|
|
6056
|
-
__updateRenderBounds() {
|
|
6057
|
-
setListWithFn(this.__layout.renderBounds, this.children, this.__hasMask ? maskLocalRenderBounds : localRenderBounds);
|
|
6100
|
+
__updateRenderBounds(bounds) {
|
|
6101
|
+
setListWithFn(bounds || this.__layout.renderBounds, this.children, this.__hasMask ? maskLocalRenderBounds : localRenderBounds);
|
|
6058
6102
|
}
|
|
6059
6103
|
__updateSortChildren() {
|
|
6060
6104
|
let affectSort;
|
|
@@ -6297,7 +6341,7 @@ var LeaferUI = function(exports) {
|
|
|
6297
6341
|
this.levelMap = null;
|
|
6298
6342
|
}
|
|
6299
6343
|
}
|
|
6300
|
-
const version = "1.9.
|
|
6344
|
+
const version = "1.9.3";
|
|
6301
6345
|
const debug$5 = Debug.get("LeaferCanvas");
|
|
6302
6346
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6303
6347
|
set zIndex(zIndex) {
|
|
@@ -6985,8 +7029,8 @@ var LeaferUI = function(exports) {
|
|
|
6985
7029
|
const {canvas: canvas} = this, bounds = block.getIntersect(canvas.bounds), realBounds = new Bounds(bounds);
|
|
6986
7030
|
canvas.save();
|
|
6987
7031
|
bounds.spread(Renderer.clipSpread).ceil();
|
|
6988
|
-
canvas.clearWorld(bounds
|
|
6989
|
-
canvas.clipWorld(bounds
|
|
7032
|
+
canvas.clearWorld(bounds);
|
|
7033
|
+
canvas.clipWorld(bounds);
|
|
6990
7034
|
this.__render(bounds, realBounds);
|
|
6991
7035
|
canvas.restore();
|
|
6992
7036
|
Run.end(t);
|
|
@@ -7206,6 +7250,7 @@ var LeaferUI = function(exports) {
|
|
|
7206
7250
|
hit = child.__.hitRadius ? true : hitRadiusPoint$1(child.__world, point);
|
|
7207
7251
|
if (child.isBranch) {
|
|
7208
7252
|
if (hit || child.__ignoreHitWorld) {
|
|
7253
|
+
if (child.topChildren) this.eachFind(child.topChildren, false);
|
|
7209
7254
|
this.eachFind(child.children, child.__onlyHitMask);
|
|
7210
7255
|
if (child.isBranchLeaf) this.hitChild(child, point);
|
|
7211
7256
|
}
|
|
@@ -7525,7 +7570,7 @@ var LeaferUI = function(exports) {
|
|
|
7525
7570
|
}
|
|
7526
7571
|
get __clipAfterFill() {
|
|
7527
7572
|
const t = this;
|
|
7528
|
-
return t.overflow
|
|
7573
|
+
return t.overflow !== "show" && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill);
|
|
7529
7574
|
}
|
|
7530
7575
|
}
|
|
7531
7576
|
class LeaferData extends GroupData {
|
|
@@ -7666,6 +7711,39 @@ var LeaferUI = function(exports) {
|
|
|
7666
7711
|
return this.__box ? Math.max(this.__box.__updateRenderSpread(), width) : width;
|
|
7667
7712
|
}
|
|
7668
7713
|
};
|
|
7714
|
+
const DragBoundsHelper = {
|
|
7715
|
+
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
7716
|
+
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
7717
|
+
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
7718
|
+
if (!change) move = Object.assign({}, move);
|
|
7719
|
+
const isBiggerWidth = content.width > dragBounds.width;
|
|
7720
|
+
const isBiggerHeight = content.height > dragBounds.height;
|
|
7721
|
+
if (isBiggerWidth && dragBoundsType !== "outer") {
|
|
7722
|
+
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
7723
|
+
} else {
|
|
7724
|
+
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
7725
|
+
}
|
|
7726
|
+
if (isBiggerHeight && dragBoundsType !== "outer") {
|
|
7727
|
+
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
7728
|
+
} else {
|
|
7729
|
+
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
7730
|
+
}
|
|
7731
|
+
move.x = MathHelper.float(move.x);
|
|
7732
|
+
move.y = MathHelper.float(move.y);
|
|
7733
|
+
return move;
|
|
7734
|
+
},
|
|
7735
|
+
axisMove(leaf, move) {
|
|
7736
|
+
const {draggable: draggable} = leaf;
|
|
7737
|
+
if (draggable === "x") move.y = 0;
|
|
7738
|
+
if (draggable === "y") move.x = 0;
|
|
7739
|
+
},
|
|
7740
|
+
limitMove(leaf, move) {
|
|
7741
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
7742
|
+
if (dragBounds) D.getValidMove(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, dragBoundsType, move, true);
|
|
7743
|
+
D.axisMove(leaf, move);
|
|
7744
|
+
}
|
|
7745
|
+
};
|
|
7746
|
+
const D = DragBoundsHelper;
|
|
7669
7747
|
const {stintSet: stintSet$1} = DataHelper;
|
|
7670
7748
|
const UIRender = {
|
|
7671
7749
|
__updateChange() {
|
|
@@ -7949,8 +8027,8 @@ var LeaferUI = function(exports) {
|
|
|
7949
8027
|
__decorate([ rotationType(0, true) ], exports.UI.prototype, "skewY", void 0);
|
|
7950
8028
|
__decorate([ positionType(0, true) ], exports.UI.prototype, "offsetX", void 0);
|
|
7951
8029
|
__decorate([ positionType(0, true) ], exports.UI.prototype, "offsetY", void 0);
|
|
7952
|
-
__decorate([
|
|
7953
|
-
__decorate([
|
|
8030
|
+
__decorate([ scrollType(0, true) ], exports.UI.prototype, "scrollX", void 0);
|
|
8031
|
+
__decorate([ scrollType(0, true) ], exports.UI.prototype, "scrollY", void 0);
|
|
7954
8032
|
__decorate([ autoLayoutType() ], exports.UI.prototype, "origin", void 0);
|
|
7955
8033
|
__decorate([ autoLayoutType() ], exports.UI.prototype, "around", void 0);
|
|
7956
8034
|
__decorate([ dataType(false) ], exports.UI.prototype, "lazy", void 0);
|
|
@@ -7965,6 +8043,7 @@ var LeaferUI = function(exports) {
|
|
|
7965
8043
|
__decorate([ boundsType() ], exports.UI.prototype, "heightRange", void 0);
|
|
7966
8044
|
__decorate([ dataType(false) ], exports.UI.prototype, "draggable", void 0);
|
|
7967
8045
|
__decorate([ dataType() ], exports.UI.prototype, "dragBounds", void 0);
|
|
8046
|
+
__decorate([ dataType("auto") ], exports.UI.prototype, "dragBoundsType", void 0);
|
|
7968
8047
|
__decorate([ dataType(false) ], exports.UI.prototype, "editable", void 0);
|
|
7969
8048
|
__decorate([ hitType(true) ], exports.UI.prototype, "hittable", void 0);
|
|
7970
8049
|
__decorate([ hitType("path") ], exports.UI.prototype, "hitFill", void 0);
|
|
@@ -8348,7 +8427,7 @@ var LeaferUI = function(exports) {
|
|
|
8348
8427
|
zoom(_zoomType, _optionsOrPadding, _scroll, _transition) {
|
|
8349
8428
|
return Plugin.need("view");
|
|
8350
8429
|
}
|
|
8351
|
-
getValidMove(moveX, moveY) {
|
|
8430
|
+
getValidMove(moveX, moveY, _checkLimit) {
|
|
8352
8431
|
return {
|
|
8353
8432
|
x: moveX,
|
|
8354
8433
|
y: moveY
|
|
@@ -8429,9 +8508,8 @@ var LeaferUI = function(exports) {
|
|
|
8429
8508
|
};
|
|
8430
8509
|
__decorate([ dataProcessor(RectData) ], exports.Rect.prototype, "__", void 0);
|
|
8431
8510
|
exports.Rect = __decorate([ useModule(RectRender), rewriteAble(), registerUI() ], exports.Rect);
|
|
8432
|
-
const {
|
|
8511
|
+
const {add: add, includes: includes$1, scroll: scroll} = BoundsHelper;
|
|
8433
8512
|
const rect$1 = exports.Rect.prototype, group = exports.Group.prototype;
|
|
8434
|
-
const childrenRenderBounds = {};
|
|
8435
8513
|
exports.Box = class Box extends exports.Group {
|
|
8436
8514
|
get __tag() {
|
|
8437
8515
|
return "Box";
|
|
@@ -8477,22 +8555,27 @@ var LeaferUI = function(exports) {
|
|
|
8477
8555
|
__updateRenderBounds() {
|
|
8478
8556
|
let isOverflow;
|
|
8479
8557
|
if (this.children.length) {
|
|
8480
|
-
const data = this.__, {renderBounds: renderBounds, boxBounds: boxBounds} =
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
childrenRenderBounds
|
|
8486
|
-
childrenRenderBounds.y += data.scrollY;
|
|
8558
|
+
const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
|
|
8559
|
+
const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
|
|
8560
|
+
super.__updateRenderBounds(childrenRenderBounds);
|
|
8561
|
+
if (data.overflow.includes("scroll")) {
|
|
8562
|
+
add(childrenRenderBounds, boxBounds);
|
|
8563
|
+
scroll(childrenRenderBounds, data);
|
|
8487
8564
|
}
|
|
8565
|
+
this.__updateRectRenderBounds();
|
|
8488
8566
|
isOverflow = !includes$1(boxBounds, childrenRenderBounds);
|
|
8489
|
-
if (isOverflow && data.overflow
|
|
8567
|
+
if (isOverflow && data.overflow === "show") add(renderBounds, childrenRenderBounds);
|
|
8490
8568
|
} else this.__updateRectRenderBounds();
|
|
8491
8569
|
DataHelper.stintSet(this, "isOverflow", isOverflow);
|
|
8492
|
-
this.
|
|
8570
|
+
this.__checkScroll();
|
|
8493
8571
|
}
|
|
8494
8572
|
__updateRectRenderBounds() {}
|
|
8495
|
-
|
|
8573
|
+
__updateWorldBounds() {
|
|
8574
|
+
if (this.hasScroller) this.__updateScroll();
|
|
8575
|
+
super.__updateWorldBounds();
|
|
8576
|
+
}
|
|
8577
|
+
__checkScroll() {}
|
|
8578
|
+
__updateScroll() {}
|
|
8496
8579
|
__updateRectChange() {}
|
|
8497
8580
|
__updateChange() {
|
|
8498
8581
|
super.__updateChange();
|
|
@@ -8507,7 +8590,7 @@ var LeaferUI = function(exports) {
|
|
|
8507
8590
|
this.__renderRect(canvas, options);
|
|
8508
8591
|
if (this.children.length) this.__renderGroup(canvas, options);
|
|
8509
8592
|
}
|
|
8510
|
-
if (this.
|
|
8593
|
+
if (this.hasScroller) this.scroller.__render(canvas, options);
|
|
8511
8594
|
}
|
|
8512
8595
|
__drawContent(canvas, options) {
|
|
8513
8596
|
this.__renderGroup(canvas, options);
|
|
@@ -9071,7 +9154,7 @@ var LeaferUI = function(exports) {
|
|
|
9071
9154
|
if (this.viewReady) this.renderer.update();
|
|
9072
9155
|
}
|
|
9073
9156
|
__render(canvas, options) {
|
|
9074
|
-
if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options
|
|
9157
|
+
if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options.bounds));
|
|
9075
9158
|
}
|
|
9076
9159
|
__onResize(event) {
|
|
9077
9160
|
this.forEach(leafer => leafer.resize(event));
|
|
@@ -9210,26 +9293,11 @@ var LeaferUI = function(exports) {
|
|
|
9210
9293
|
const move = leaf.getLocalPoint(total, null, true);
|
|
9211
9294
|
PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
|
|
9212
9295
|
if (checkLimit) this.limitMove(leaf, move);
|
|
9296
|
+
DragBoundsHelper.axisMove(leaf, move);
|
|
9213
9297
|
return move;
|
|
9214
9298
|
}
|
|
9215
9299
|
static limitMove(leaf, move) {
|
|
9216
|
-
|
|
9217
|
-
if (dragBounds) this.getMoveInDragBounds(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, move, true);
|
|
9218
|
-
if (draggable === "x") move.y = 0;
|
|
9219
|
-
if (draggable === "y") move.x = 0;
|
|
9220
|
-
}
|
|
9221
|
-
static getMoveInDragBounds(childBox, dragBounds, move, change) {
|
|
9222
|
-
const x = childBox.x + move.x, y = childBox.y + move.y, right = x + childBox.width, bottom = y + childBox.height;
|
|
9223
|
-
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
9224
|
-
if (!change) move = Object.assign({}, move);
|
|
9225
|
-
if (BoundsHelper.includes(childBox, dragBounds)) {
|
|
9226
|
-
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
9227
|
-
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
9228
|
-
} else {
|
|
9229
|
-
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
9230
|
-
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
9231
|
-
}
|
|
9232
|
-
return move;
|
|
9300
|
+
DragBoundsHelper.limitMove(leaf, move);
|
|
9233
9301
|
}
|
|
9234
9302
|
getPageMove(total) {
|
|
9235
9303
|
this.assignMove(total);
|
|
@@ -9464,11 +9532,12 @@ var LeaferUI = function(exports) {
|
|
|
9464
9532
|
const checkLimitMove = !dragLimitAnimate || !!isDragEnd;
|
|
9465
9533
|
list.forEach(leaf => {
|
|
9466
9534
|
if (leaf.draggable) {
|
|
9535
|
+
const axisDrag = isString(leaf.draggable);
|
|
9467
9536
|
const move = exports.DragEvent.getValidMove(leaf, this.dragStartPoints[leaf.innerId], {
|
|
9468
9537
|
x: totalX,
|
|
9469
9538
|
y: totalY
|
|
9470
|
-
}, checkLimitMove);
|
|
9471
|
-
if (dragLimitAnimate && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else leaf.move(move);
|
|
9539
|
+
}, checkLimitMove || axisDrag);
|
|
9540
|
+
if (dragLimitAnimate && !axisDrag && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else leaf.move(move);
|
|
9472
9541
|
}
|
|
9473
9542
|
});
|
|
9474
9543
|
}
|
|
@@ -11442,7 +11511,7 @@ var LeaferUI = function(exports) {
|
|
|
11442
11511
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
11443
11512
|
}
|
|
11444
11513
|
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
11445
|
-
if (end && index < end) other.clearWorld(copyBounds
|
|
11514
|
+
if (end && index < end) other.clearWorld(copyBounds);
|
|
11446
11515
|
});
|
|
11447
11516
|
other.recycle(copyBounds);
|
|
11448
11517
|
}
|
|
@@ -11502,7 +11571,7 @@ var LeaferUI = function(exports) {
|
|
|
11502
11571
|
}
|
|
11503
11572
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), "source-in");
|
|
11504
11573
|
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
11505
|
-
if (end && index < end) other.clearWorld(copyBounds
|
|
11574
|
+
if (end && index < end) other.clearWorld(copyBounds);
|
|
11506
11575
|
});
|
|
11507
11576
|
other.recycle(copyBounds);
|
|
11508
11577
|
}
|
|
@@ -11591,7 +11660,7 @@ var LeaferUI = function(exports) {
|
|
|
11591
11660
|
canvas.resetTransform();
|
|
11592
11661
|
canvas.opacity = maskOpacity;
|
|
11593
11662
|
canvas.copyWorld(content, realBounds, undefined, blendMode);
|
|
11594
|
-
recycle ? content.recycle(realBounds) : content.clearWorld(realBounds
|
|
11663
|
+
recycle ? content.recycle(realBounds) : content.clearWorld(realBounds);
|
|
11595
11664
|
}
|
|
11596
11665
|
const money = "¥¥$€££¢¢";
|
|
11597
11666
|
const letter = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
|
|
@@ -12096,6 +12165,7 @@ var LeaferUI = function(exports) {
|
|
|
12096
12165
|
exports.Cursor = Cursor;
|
|
12097
12166
|
exports.DataHelper = DataHelper;
|
|
12098
12167
|
exports.Debug = Debug;
|
|
12168
|
+
exports.DragBoundsHelper = DragBoundsHelper;
|
|
12099
12169
|
exports.Dragger = Dragger;
|
|
12100
12170
|
exports.Effect = Effect;
|
|
12101
12171
|
exports.EllipseData = EllipseData;
|
|
@@ -12218,6 +12288,7 @@ var LeaferUI = function(exports) {
|
|
|
12218
12288
|
exports.effectType = effectType;
|
|
12219
12289
|
exports.emptyData = emptyData;
|
|
12220
12290
|
exports.eraserType = eraserType;
|
|
12291
|
+
exports.extraPropertyEventMap = extraPropertyEventMap;
|
|
12221
12292
|
exports.getBoundsData = getBoundsData;
|
|
12222
12293
|
exports.getDescriptor = getDescriptor;
|
|
12223
12294
|
exports.getMatrixData = getMatrixData;
|
|
@@ -12248,6 +12319,7 @@ var LeaferUI = function(exports) {
|
|
|
12248
12319
|
exports.rewriteAble = rewriteAble;
|
|
12249
12320
|
exports.rotationType = rotationType;
|
|
12250
12321
|
exports.scaleType = scaleType;
|
|
12322
|
+
exports.scrollType = scrollType;
|
|
12251
12323
|
exports.sortType = sortType;
|
|
12252
12324
|
exports.strokeType = strokeType;
|
|
12253
12325
|
exports.surfaceType = surfaceType;
|