@leafer-ui/worker 1.0.7 → 1.0.9
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.cjs +13 -32
- package/dist/worker.esm.js +13 -32
- package/dist/worker.js +77 -117
- package/dist/worker.min.js +1 -1
- package/dist/worker.module.js +77 -117
- package/dist/worker.module.min.js +1 -1
- package/package.json +9 -9
package/dist/worker.cjs
CHANGED
|
@@ -953,14 +953,10 @@ function fillText(ui, canvas) {
|
|
|
953
953
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
954
954
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
955
955
|
row = rows[i];
|
|
956
|
-
if (row.text)
|
|
956
|
+
if (row.text)
|
|
957
957
|
canvas.fillText(row.text, row.x, row.y);
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
row.data.forEach(charData => {
|
|
961
|
-
canvas.fillText(charData.char, charData.x, row.y);
|
|
962
|
-
});
|
|
963
|
-
}
|
|
958
|
+
else if (row.data)
|
|
959
|
+
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
964
960
|
if (decorationY)
|
|
965
961
|
canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
966
962
|
}
|
|
@@ -1026,12 +1022,10 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
|
|
|
1026
1022
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
1027
1023
|
fillText(ui, out);
|
|
1028
1024
|
out.blendMode = 'normal';
|
|
1029
|
-
if (ui.__worldFlipped)
|
|
1025
|
+
if (ui.__worldFlipped)
|
|
1030
1026
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
1031
|
-
|
|
1032
|
-
else {
|
|
1027
|
+
else
|
|
1033
1028
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
1034
|
-
}
|
|
1035
1029
|
out.recycle(ui.__nowWorld);
|
|
1036
1030
|
}
|
|
1037
1031
|
function drawTextStroke(ui, canvas) {
|
|
@@ -1039,14 +1033,10 @@ function drawTextStroke(ui, canvas) {
|
|
|
1039
1033
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
1040
1034
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
1041
1035
|
row = rows[i];
|
|
1042
|
-
if (row.text)
|
|
1036
|
+
if (row.text)
|
|
1043
1037
|
canvas.strokeText(row.text, row.x, row.y);
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
row.data.forEach(charData => {
|
|
1047
|
-
canvas.strokeText(charData.char, charData.x, row.y);
|
|
1048
|
-
});
|
|
1049
|
-
}
|
|
1038
|
+
else if (row.data)
|
|
1039
|
+
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
1050
1040
|
if (decorationY)
|
|
1051
1041
|
canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
1052
1042
|
}
|
|
@@ -1099,12 +1089,10 @@ function stroke(stroke, ui, canvas) {
|
|
|
1099
1089
|
out.stroke();
|
|
1100
1090
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
1101
1091
|
out.clearWorld(ui.__layout.renderBounds);
|
|
1102
|
-
if (ui.__worldFlipped)
|
|
1092
|
+
if (ui.__worldFlipped)
|
|
1103
1093
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
1104
|
-
|
|
1105
|
-
else {
|
|
1094
|
+
else
|
|
1106
1095
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
1107
|
-
}
|
|
1108
1096
|
out.recycle(ui.__nowWorld);
|
|
1109
1097
|
break;
|
|
1110
1098
|
}
|
|
@@ -1139,12 +1127,10 @@ function strokes(strokes, ui, canvas) {
|
|
|
1139
1127
|
drawStrokesStyle(strokes, false, ui, out);
|
|
1140
1128
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
1141
1129
|
out.clearWorld(renderBounds);
|
|
1142
|
-
if (ui.__worldFlipped)
|
|
1130
|
+
if (ui.__worldFlipped)
|
|
1143
1131
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
1144
|
-
|
|
1145
|
-
else {
|
|
1132
|
+
else
|
|
1146
1133
|
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
1147
|
-
}
|
|
1148
1134
|
out.recycle(ui.__nowWorld);
|
|
1149
1135
|
break;
|
|
1150
1136
|
}
|
|
@@ -1208,12 +1194,7 @@ function compute(attrName, ui) {
|
|
|
1208
1194
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
1209
1195
|
if (leafPaints.length && leafPaints[0].image)
|
|
1210
1196
|
hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
|
|
1211
|
-
|
|
1212
|
-
data.__pixelFill = hasOpacityPixel;
|
|
1213
|
-
}
|
|
1214
|
-
else {
|
|
1215
|
-
data.__pixelStroke = hasOpacityPixel;
|
|
1216
|
-
}
|
|
1197
|
+
attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
|
|
1217
1198
|
}
|
|
1218
1199
|
function getLeafPaint(attrName, paint, ui) {
|
|
1219
1200
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
package/dist/worker.esm.js
CHANGED
|
@@ -954,14 +954,10 @@ function fillText(ui, canvas) {
|
|
|
954
954
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
955
955
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
956
956
|
row = rows[i];
|
|
957
|
-
if (row.text)
|
|
957
|
+
if (row.text)
|
|
958
958
|
canvas.fillText(row.text, row.x, row.y);
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
row.data.forEach(charData => {
|
|
962
|
-
canvas.fillText(charData.char, charData.x, row.y);
|
|
963
|
-
});
|
|
964
|
-
}
|
|
959
|
+
else if (row.data)
|
|
960
|
+
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
965
961
|
if (decorationY)
|
|
966
962
|
canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
967
963
|
}
|
|
@@ -1027,12 +1023,10 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
|
|
|
1027
1023
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
1028
1024
|
fillText(ui, out);
|
|
1029
1025
|
out.blendMode = 'normal';
|
|
1030
|
-
if (ui.__worldFlipped)
|
|
1026
|
+
if (ui.__worldFlipped)
|
|
1031
1027
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
1032
|
-
|
|
1033
|
-
else {
|
|
1028
|
+
else
|
|
1034
1029
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
1035
|
-
}
|
|
1036
1030
|
out.recycle(ui.__nowWorld);
|
|
1037
1031
|
}
|
|
1038
1032
|
function drawTextStroke(ui, canvas) {
|
|
@@ -1040,14 +1034,10 @@ function drawTextStroke(ui, canvas) {
|
|
|
1040
1034
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
1041
1035
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
1042
1036
|
row = rows[i];
|
|
1043
|
-
if (row.text)
|
|
1037
|
+
if (row.text)
|
|
1044
1038
|
canvas.strokeText(row.text, row.x, row.y);
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
row.data.forEach(charData => {
|
|
1048
|
-
canvas.strokeText(charData.char, charData.x, row.y);
|
|
1049
|
-
});
|
|
1050
|
-
}
|
|
1039
|
+
else if (row.data)
|
|
1040
|
+
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
1051
1041
|
if (decorationY)
|
|
1052
1042
|
canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
1053
1043
|
}
|
|
@@ -1100,12 +1090,10 @@ function stroke(stroke, ui, canvas) {
|
|
|
1100
1090
|
out.stroke();
|
|
1101
1091
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
1102
1092
|
out.clearWorld(ui.__layout.renderBounds);
|
|
1103
|
-
if (ui.__worldFlipped)
|
|
1093
|
+
if (ui.__worldFlipped)
|
|
1104
1094
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
1105
|
-
|
|
1106
|
-
else {
|
|
1095
|
+
else
|
|
1107
1096
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
1108
|
-
}
|
|
1109
1097
|
out.recycle(ui.__nowWorld);
|
|
1110
1098
|
break;
|
|
1111
1099
|
}
|
|
@@ -1140,12 +1128,10 @@ function strokes(strokes, ui, canvas) {
|
|
|
1140
1128
|
drawStrokesStyle(strokes, false, ui, out);
|
|
1141
1129
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
1142
1130
|
out.clearWorld(renderBounds);
|
|
1143
|
-
if (ui.__worldFlipped)
|
|
1131
|
+
if (ui.__worldFlipped)
|
|
1144
1132
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
1145
|
-
|
|
1146
|
-
else {
|
|
1133
|
+
else
|
|
1147
1134
|
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
1148
|
-
}
|
|
1149
1135
|
out.recycle(ui.__nowWorld);
|
|
1150
1136
|
break;
|
|
1151
1137
|
}
|
|
@@ -1209,12 +1195,7 @@ function compute(attrName, ui) {
|
|
|
1209
1195
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
1210
1196
|
if (leafPaints.length && leafPaints[0].image)
|
|
1211
1197
|
hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
|
|
1212
|
-
|
|
1213
|
-
data.__pixelFill = hasOpacityPixel;
|
|
1214
|
-
}
|
|
1215
|
-
else {
|
|
1216
|
-
data.__pixelStroke = hasOpacityPixel;
|
|
1217
|
-
}
|
|
1198
|
+
attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
|
|
1218
1199
|
}
|
|
1219
1200
|
function getLeafPaint(attrName, paint, ui) {
|
|
1220
1201
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
package/dist/worker.js
CHANGED
|
@@ -2961,7 +2961,6 @@ var LeaferUI = (function (exports) {
|
|
|
2961
2961
|
set path(value) { this.__path = value; }
|
|
2962
2962
|
get path() { return this.__path; }
|
|
2963
2963
|
constructor(path) {
|
|
2964
|
-
this.clearPath = this.beginPath;
|
|
2965
2964
|
this.set(path);
|
|
2966
2965
|
}
|
|
2967
2966
|
set(path) {
|
|
@@ -3043,6 +3042,9 @@ var LeaferUI = (function (exports) {
|
|
|
3043
3042
|
this.paint();
|
|
3044
3043
|
return this;
|
|
3045
3044
|
}
|
|
3045
|
+
clearPath() {
|
|
3046
|
+
return this.beginPath();
|
|
3047
|
+
}
|
|
3046
3048
|
paint() { }
|
|
3047
3049
|
}
|
|
3048
3050
|
|
|
@@ -3638,6 +3640,8 @@ var LeaferUI = (function (exports) {
|
|
|
3638
3640
|
else {
|
|
3639
3641
|
if (url.includes('.' + format) || url.includes('.' + FileHelper.upperCaseTypeMap[format]))
|
|
3640
3642
|
return true;
|
|
3643
|
+
else if (format === 'png' && !url.includes('.'))
|
|
3644
|
+
return true;
|
|
3641
3645
|
}
|
|
3642
3646
|
return false;
|
|
3643
3647
|
},
|
|
@@ -5255,7 +5259,7 @@ var LeaferUI = (function (exports) {
|
|
|
5255
5259
|
const { LEAF, create } = IncrementId;
|
|
5256
5260
|
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
|
|
5257
5261
|
const { toOuterOf } = BoundsHelper;
|
|
5258
|
-
const { copy: copy$4, move
|
|
5262
|
+
const { copy: copy$4, move } = PointHelper;
|
|
5259
5263
|
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
|
|
5260
5264
|
exports.Leaf = class Leaf {
|
|
5261
5265
|
get tag() { return this.__tag; }
|
|
@@ -5490,7 +5494,7 @@ var LeaferUI = (function (exports) {
|
|
|
5490
5494
|
}
|
|
5491
5495
|
getBoxPointByInner(inner, _relative, _distance, change) {
|
|
5492
5496
|
const point = change ? inner : Object.assign({}, inner), { x, y } = this.boxBounds;
|
|
5493
|
-
move
|
|
5497
|
+
move(point, -x, -y);
|
|
5494
5498
|
return point;
|
|
5495
5499
|
}
|
|
5496
5500
|
getInnerPoint(world, relative, distance, change) {
|
|
@@ -5500,7 +5504,7 @@ var LeaferUI = (function (exports) {
|
|
|
5500
5504
|
}
|
|
5501
5505
|
getInnerPointByBox(box, _relative, _distance, change) {
|
|
5502
5506
|
const point = change ? box : Object.assign({}, box), { x, y } = this.boxBounds;
|
|
5503
|
-
move
|
|
5507
|
+
move(point, x, y);
|
|
5504
5508
|
return point;
|
|
5505
5509
|
}
|
|
5506
5510
|
getInnerPointByLocal(local, _relative, distance, change) {
|
|
@@ -5641,11 +5645,10 @@ var LeaferUI = (function (exports) {
|
|
|
5641
5645
|
}
|
|
5642
5646
|
destroy() {
|
|
5643
5647
|
if (!this.destroyed) {
|
|
5644
|
-
|
|
5645
|
-
if (parent)
|
|
5648
|
+
if (this.parent)
|
|
5646
5649
|
this.remove();
|
|
5647
5650
|
if (this.children)
|
|
5648
|
-
this.
|
|
5651
|
+
this.clear();
|
|
5649
5652
|
this.__emitLifeEvent(ChildEvent.DESTROY);
|
|
5650
5653
|
this.__.destroy();
|
|
5651
5654
|
this.__layout.destroy();
|
|
@@ -5959,7 +5962,7 @@ var LeaferUI = (function (exports) {
|
|
|
5959
5962
|
}
|
|
5960
5963
|
}
|
|
5961
5964
|
|
|
5962
|
-
const version = "1.0.
|
|
5965
|
+
const version = "1.0.9";
|
|
5963
5966
|
|
|
5964
5967
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
5965
5968
|
get allowBackgroundColor() { return true; }
|
|
@@ -6960,12 +6963,8 @@ var LeaferUI = (function (exports) {
|
|
|
6960
6963
|
};
|
|
6961
6964
|
const Transition = {
|
|
6962
6965
|
list: {},
|
|
6963
|
-
register(attrName, fn) {
|
|
6964
|
-
|
|
6965
|
-
},
|
|
6966
|
-
get(attrName) {
|
|
6967
|
-
return Transition.list[attrName];
|
|
6968
|
-
}
|
|
6966
|
+
register(attrName, fn) { Transition.list[attrName] = fn; },
|
|
6967
|
+
get(attrName) { return Transition.list[attrName]; }
|
|
6969
6968
|
};
|
|
6970
6969
|
|
|
6971
6970
|
const { parse, objectToCanvasData } = PathConvert;
|
|
@@ -7411,8 +7410,8 @@ var LeaferUI = (function (exports) {
|
|
|
7411
7410
|
pen.set(path = []), this.__drawPathByBox(pen);
|
|
7412
7411
|
return curve ? PathConvert.toCanvasData(path, true) : path;
|
|
7413
7412
|
}
|
|
7414
|
-
getPathString(curve, pathForRender) {
|
|
7415
|
-
return PathConvert.stringify(this.getPath(curve, pathForRender));
|
|
7413
|
+
getPathString(curve, pathForRender, floatLength) {
|
|
7414
|
+
return PathConvert.stringify(this.getPath(curve, pathForRender), floatLength);
|
|
7416
7415
|
}
|
|
7417
7416
|
load() {
|
|
7418
7417
|
this.__.__computePaint();
|
|
@@ -7821,11 +7820,11 @@ var LeaferUI = (function (exports) {
|
|
|
7821
7820
|
start() {
|
|
7822
7821
|
clearTimeout(this.__startTimer);
|
|
7823
7822
|
if (!this.running && this.canvas) {
|
|
7823
|
+
this.running = true;
|
|
7824
7824
|
this.ready ? this.emitLeafer(LeaferEvent.RESTART) : this.emitLeafer(LeaferEvent.START);
|
|
7825
7825
|
this.__controllers.forEach(item => item.start());
|
|
7826
7826
|
if (!this.isApp)
|
|
7827
7827
|
this.renderer.render();
|
|
7828
|
-
this.running = true;
|
|
7829
7828
|
}
|
|
7830
7829
|
}
|
|
7831
7830
|
stop() {
|
|
@@ -7931,12 +7930,10 @@ var LeaferUI = (function (exports) {
|
|
|
7931
7930
|
}
|
|
7932
7931
|
__changeFill(newValue) {
|
|
7933
7932
|
this.config.fill = newValue;
|
|
7934
|
-
if (this.canvas.allowBackgroundColor)
|
|
7933
|
+
if (this.canvas.allowBackgroundColor)
|
|
7935
7934
|
this.canvas.backgroundColor = newValue;
|
|
7936
|
-
|
|
7937
|
-
else {
|
|
7935
|
+
else
|
|
7938
7936
|
this.forceRender();
|
|
7939
|
-
}
|
|
7940
7937
|
}
|
|
7941
7938
|
__onCreated() {
|
|
7942
7939
|
this.created = true;
|
|
@@ -8003,13 +8000,10 @@ var LeaferUI = (function (exports) {
|
|
|
8003
8000
|
if (bind)
|
|
8004
8001
|
item = item.bind(bind);
|
|
8005
8002
|
this.__viewCompletedWait.push(item);
|
|
8006
|
-
if (this.viewCompleted)
|
|
8003
|
+
if (this.viewCompleted)
|
|
8007
8004
|
this.__checkViewCompleted(false);
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
if (!this.running)
|
|
8011
|
-
this.start();
|
|
8012
|
-
}
|
|
8005
|
+
else if (!this.running)
|
|
8006
|
+
this.start();
|
|
8013
8007
|
}
|
|
8014
8008
|
nextRender(item, bind, off) {
|
|
8015
8009
|
if (bind)
|
|
@@ -8023,9 +8017,8 @@ var LeaferUI = (function (exports) {
|
|
|
8023
8017
|
}
|
|
8024
8018
|
}
|
|
8025
8019
|
}
|
|
8026
|
-
else
|
|
8020
|
+
else
|
|
8027
8021
|
list.push(item);
|
|
8028
|
-
}
|
|
8029
8022
|
}
|
|
8030
8023
|
zoom(_zoomType, _padding, _fixedScale) {
|
|
8031
8024
|
return needPlugin('view');
|
|
@@ -8069,10 +8062,7 @@ var LeaferUI = (function (exports) {
|
|
|
8069
8062
|
this.stop();
|
|
8070
8063
|
this.emitEvent(new LeaferEvent(LeaferEvent.END, this));
|
|
8071
8064
|
this.__removeListenEvents();
|
|
8072
|
-
this.__controllers.forEach(item =>
|
|
8073
|
-
if (!(this.parent && item === this.interaction))
|
|
8074
|
-
item.destroy();
|
|
8075
|
-
});
|
|
8065
|
+
this.__controllers.forEach(item => !(this.parent && item === this.interaction) && item.destroy());
|
|
8076
8066
|
this.__controllers.length = 0;
|
|
8077
8067
|
if (!this.parent) {
|
|
8078
8068
|
if (this.selector)
|
|
@@ -8605,20 +8595,19 @@ var LeaferUI = (function (exports) {
|
|
|
8605
8595
|
}
|
|
8606
8596
|
__updateTextDrawData() {
|
|
8607
8597
|
const data = this.__;
|
|
8608
|
-
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8609
|
-
}
|
|
8610
|
-
__updateBoxBounds() {
|
|
8611
|
-
const data = this.__;
|
|
8612
|
-
const layout = this.__layout;
|
|
8613
8598
|
const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow, padding } = data;
|
|
8614
|
-
const autoWidth = data.__autoWidth;
|
|
8615
|
-
const autoHeight = data.__autoHeight;
|
|
8616
8599
|
data.__lineHeight = UnitConvert.number(lineHeight, fontSize);
|
|
8617
8600
|
data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
|
|
8618
8601
|
data.__padding = padding ? MathHelper.fourNumber(padding) : undefined;
|
|
8619
8602
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
8620
8603
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
8621
8604
|
data.__clipText = textOverflow !== 'show' && !data.__autoSize;
|
|
8605
|
+
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8606
|
+
}
|
|
8607
|
+
__updateBoxBounds() {
|
|
8608
|
+
const data = this.__;
|
|
8609
|
+
const layout = this.__layout;
|
|
8610
|
+
const { fontSize, italic, padding, __autoWidth: autoWidth, __autoHeight: autoHeight } = data;
|
|
8622
8611
|
this.__updateTextDrawData();
|
|
8623
8612
|
const { bounds } = data.__textDrawData;
|
|
8624
8613
|
const b = layout.boxBounds;
|
|
@@ -8631,20 +8620,15 @@ var LeaferUI = (function (exports) {
|
|
|
8631
8620
|
b.height = autoHeight ? bounds.height : data.height;
|
|
8632
8621
|
if (padding) {
|
|
8633
8622
|
const [top, right, bottom, left] = data.__padding;
|
|
8634
|
-
if (autoWidth)
|
|
8635
|
-
b.x -= left;
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
if (autoHeight) {
|
|
8639
|
-
b.y -= top;
|
|
8640
|
-
b.height += (bottom + top);
|
|
8641
|
-
}
|
|
8623
|
+
if (autoWidth)
|
|
8624
|
+
b.x -= left, b.width += (right + left);
|
|
8625
|
+
if (autoHeight)
|
|
8626
|
+
b.y -= top, b.height += (bottom + top);
|
|
8642
8627
|
}
|
|
8643
8628
|
this.__updateNaturalSize();
|
|
8644
8629
|
}
|
|
8645
|
-
else
|
|
8630
|
+
else
|
|
8646
8631
|
super.__updateBoxBounds();
|
|
8647
|
-
}
|
|
8648
8632
|
if (italic)
|
|
8649
8633
|
b.width += fontSize * 0.16;
|
|
8650
8634
|
const contentBounds = includes(b, bounds) ? b : bounds;
|
|
@@ -8767,11 +8751,7 @@ var LeaferUI = (function (exports) {
|
|
|
8767
8751
|
this.add(path);
|
|
8768
8752
|
return this;
|
|
8769
8753
|
}
|
|
8770
|
-
beginPath() {
|
|
8771
|
-
this.__path.length = 0;
|
|
8772
|
-
this.paint();
|
|
8773
|
-
return this;
|
|
8774
|
-
}
|
|
8754
|
+
beginPath() { return this; }
|
|
8775
8755
|
moveTo(_x, _y) { return this; }
|
|
8776
8756
|
lineTo(_x, _y) { return this; }
|
|
8777
8757
|
bezierCurveTo(_x1, _y1, _x2, _y2, _x, _y) { return this; }
|
|
@@ -8798,7 +8778,7 @@ var LeaferUI = (function (exports) {
|
|
|
8798
8778
|
penPathType()
|
|
8799
8779
|
], exports.Pen.prototype, "path", void 0);
|
|
8800
8780
|
exports.Pen = __decorate([
|
|
8801
|
-
useModule(PathCreator, ['set', '
|
|
8781
|
+
useModule(PathCreator, ['set', 'path', 'paint']),
|
|
8802
8782
|
registerUI()
|
|
8803
8783
|
], exports.Pen);
|
|
8804
8784
|
function penPathType() {
|
|
@@ -8900,10 +8880,9 @@ var LeaferUI = (function (exports) {
|
|
|
8900
8880
|
}
|
|
8901
8881
|
__render(canvas, options) {
|
|
8902
8882
|
if (canvas.context) {
|
|
8903
|
-
|
|
8904
|
-
|
|
8905
|
-
canvas.setTransform(a, b, c, d, e, f);
|
|
8906
|
-
}
|
|
8883
|
+
const m = options.matrix;
|
|
8884
|
+
if (m)
|
|
8885
|
+
canvas.setTransform(m.a, m.b, m.c, m.d, m.e, m.f);
|
|
8907
8886
|
this.children.forEach(leafer => canvas.copyWorld(leafer.canvas));
|
|
8908
8887
|
}
|
|
8909
8888
|
}
|
|
@@ -8973,9 +8952,6 @@ var LeaferUI = (function (exports) {
|
|
|
8973
8952
|
constructor(params) {
|
|
8974
8953
|
super(params.type);
|
|
8975
8954
|
this.bubbles = true;
|
|
8976
|
-
this.getInner = this.getInnerPoint;
|
|
8977
|
-
this.getLocal = this.getLocalPoint;
|
|
8978
|
-
this.getPage = this.getPagePoint;
|
|
8979
8955
|
Object.assign(this, params);
|
|
8980
8956
|
}
|
|
8981
8957
|
getBoxPoint(relative) {
|
|
@@ -8996,6 +8972,9 @@ var LeaferUI = (function (exports) {
|
|
|
8996
8972
|
getPagePoint() {
|
|
8997
8973
|
return this.current.getPagePoint(this);
|
|
8998
8974
|
}
|
|
8975
|
+
getInner(relative) { return this.getInnerPoint(relative); }
|
|
8976
|
+
getLocal(relative) { return this.getLocalPoint(relative); }
|
|
8977
|
+
getPage() { return this.getPagePoint(); }
|
|
8999
8978
|
static changeName(oldName, newName) {
|
|
9000
8979
|
EventCreator.changeName(oldName, newName);
|
|
9001
8980
|
}
|
|
@@ -9027,7 +9006,7 @@ var LeaferUI = (function (exports) {
|
|
|
9027
9006
|
], exports.PointerEvent);
|
|
9028
9007
|
const MyPointerEvent = exports.PointerEvent;
|
|
9029
9008
|
|
|
9030
|
-
const
|
|
9009
|
+
const tempMove = {};
|
|
9031
9010
|
exports.DragEvent = class DragEvent extends exports.PointerEvent {
|
|
9032
9011
|
static setList(data) {
|
|
9033
9012
|
this.list = data instanceof LeafList ? data : new LeafList(data);
|
|
@@ -9078,19 +9057,19 @@ var LeaferUI = (function (exports) {
|
|
|
9078
9057
|
}
|
|
9079
9058
|
getPageMove(total) {
|
|
9080
9059
|
this.assignMove(total);
|
|
9081
|
-
return this.current.getPagePoint(
|
|
9060
|
+
return this.current.getPagePoint(tempMove, null, true);
|
|
9082
9061
|
}
|
|
9083
9062
|
getInnerMove(relative, total) {
|
|
9084
9063
|
if (!relative)
|
|
9085
9064
|
relative = this.current;
|
|
9086
9065
|
this.assignMove(total);
|
|
9087
|
-
return relative.getInnerPoint(
|
|
9066
|
+
return relative.getInnerPoint(tempMove, null, true);
|
|
9088
9067
|
}
|
|
9089
9068
|
getLocalMove(relative, total) {
|
|
9090
9069
|
if (!relative)
|
|
9091
9070
|
relative = this.current;
|
|
9092
9071
|
this.assignMove(total);
|
|
9093
|
-
return relative.getLocalPoint(
|
|
9072
|
+
return relative.getLocalPoint(tempMove, null, true);
|
|
9094
9073
|
}
|
|
9095
9074
|
getPageTotal() {
|
|
9096
9075
|
return this.getPageMove(true);
|
|
@@ -9110,8 +9089,8 @@ var LeaferUI = (function (exports) {
|
|
|
9110
9089
|
return bounds;
|
|
9111
9090
|
}
|
|
9112
9091
|
assignMove(total) {
|
|
9113
|
-
|
|
9114
|
-
|
|
9092
|
+
tempMove.x = total ? this.totalX : this.moveX;
|
|
9093
|
+
tempMove.y = total ? this.totalY : this.moveY;
|
|
9115
9094
|
}
|
|
9116
9095
|
};
|
|
9117
9096
|
exports.DragEvent.BEFORE_DRAG = 'drag.before_drag';
|
|
@@ -9525,9 +9504,8 @@ var LeaferUI = (function (exports) {
|
|
|
9525
9504
|
interaction.emit(exports.DragEvent.OVER, data, path);
|
|
9526
9505
|
}
|
|
9527
9506
|
}
|
|
9528
|
-
else
|
|
9507
|
+
else
|
|
9529
9508
|
interaction.emit(exports.DragEvent.OVER, data, path);
|
|
9530
|
-
}
|
|
9531
9509
|
}
|
|
9532
9510
|
dragEnterOrLeave(data) {
|
|
9533
9511
|
const { interaction } = this;
|
|
@@ -9548,9 +9526,8 @@ var LeaferUI = (function (exports) {
|
|
|
9548
9526
|
this.drag(data);
|
|
9549
9527
|
this.animate(() => { this.dragEnd(data, 1); });
|
|
9550
9528
|
}
|
|
9551
|
-
else
|
|
9529
|
+
else
|
|
9552
9530
|
this.dragEndReal(data);
|
|
9553
|
-
}
|
|
9554
9531
|
}
|
|
9555
9532
|
dragEndReal(data) {
|
|
9556
9533
|
const { interaction, downData, dragData } = this;
|
|
@@ -9747,14 +9724,16 @@ var LeaferUI = (function (exports) {
|
|
|
9747
9724
|
class InteractionBase {
|
|
9748
9725
|
get dragging() { return this.dragger.dragging; }
|
|
9749
9726
|
get transforming() { return this.transformer.transforming; }
|
|
9750
|
-
get moveMode() { return this.
|
|
9751
|
-
get canHover() { return this.
|
|
9752
|
-
get isDragEmpty() { return this.
|
|
9753
|
-
get isMobileDragEmpty() { return this.
|
|
9754
|
-
get isHoldMiddleKey() { return this.
|
|
9755
|
-
get isHoldRightKey() { return this.
|
|
9756
|
-
get isHoldSpaceKey() { return this.
|
|
9757
|
-
get
|
|
9727
|
+
get moveMode() { return this.m.drag === true || this.isHoldSpaceKey || this.isHoldMiddleKey || (this.isHoldRightKey && this.dragger.moving) || this.isDragEmpty; }
|
|
9728
|
+
get canHover() { return this.p.hover && !this.config.mobile; }
|
|
9729
|
+
get isDragEmpty() { return this.m.dragEmpty && this.isRootPath(this.hoverData) && (!this.downData || this.isRootPath(this.downData)); }
|
|
9730
|
+
get isMobileDragEmpty() { return this.m.dragEmpty && !this.canHover && this.downData && this.isTreePath(this.downData); }
|
|
9731
|
+
get isHoldMiddleKey() { return this.m.holdMiddleKey && this.downData && PointerButton.middle(this.downData); }
|
|
9732
|
+
get isHoldRightKey() { return this.m.holdRightKey && this.downData && PointerButton.right(this.downData); }
|
|
9733
|
+
get isHoldSpaceKey() { return this.m.holdSpaceKey && Keyboard.isHoldSpaceKey(); }
|
|
9734
|
+
get m() { return this.config.move; }
|
|
9735
|
+
get p() { return this.config.pointer; }
|
|
9736
|
+
get hitRadius() { return this.p.hitRadius; }
|
|
9758
9737
|
constructor(target, canvas, selector, userConfig) {
|
|
9759
9738
|
this.config = DataHelper.clone(config);
|
|
9760
9739
|
this.tapCount = 0;
|
|
@@ -9812,7 +9791,7 @@ var LeaferUI = (function (exports) {
|
|
|
9812
9791
|
}
|
|
9813
9792
|
}
|
|
9814
9793
|
pointerMoveReal(data) {
|
|
9815
|
-
const { dragHover, dragDistance } = this.
|
|
9794
|
+
const { dragHover, dragDistance } = this.p;
|
|
9816
9795
|
this.emit(exports.PointerEvent.BEFORE_MOVE, data, this.defaultPath);
|
|
9817
9796
|
if (this.downData) {
|
|
9818
9797
|
const canDrag = PointHelper.getDistance(this.downData, data) > dragDistance;
|
|
@@ -9997,7 +9976,7 @@ var LeaferUI = (function (exports) {
|
|
|
9997
9976
|
}
|
|
9998
9977
|
}
|
|
9999
9978
|
findPath(data, options) {
|
|
10000
|
-
const { hitRadius, through } = this.
|
|
9979
|
+
const { hitRadius, through } = this.p;
|
|
10001
9980
|
const { bottomList } = this;
|
|
10002
9981
|
const find = this.selector.getByPoint(data, hitRadius, Object.assign({ bottomList, name: data.type }, (options || { through })));
|
|
10003
9982
|
if (find.throughPath)
|
|
@@ -10019,7 +9998,7 @@ var LeaferUI = (function (exports) {
|
|
|
10019
9998
|
data.path = this.defaultPath;
|
|
10020
9999
|
}
|
|
10021
10000
|
canMove(data) {
|
|
10022
|
-
return data && (this.moveMode || (this.
|
|
10001
|
+
return data && (this.moveMode || (this.m.drag === 'auto' && !pathCanDrag(data.path))) && !pathHasOutside(data.path);
|
|
10023
10002
|
}
|
|
10024
10003
|
isDrag(leaf) {
|
|
10025
10004
|
return this.dragger.getList().has(leaf);
|
|
@@ -10117,7 +10096,7 @@ var LeaferUI = (function (exports) {
|
|
|
10117
10096
|
this.longPressTimer = setTimeout(() => {
|
|
10118
10097
|
this.longPressed = true;
|
|
10119
10098
|
this.emit(exports.PointerEvent.LONG_PRESS, data);
|
|
10120
|
-
}, this.
|
|
10099
|
+
}, this.p.longPressTime);
|
|
10121
10100
|
}
|
|
10122
10101
|
longTap(data) {
|
|
10123
10102
|
let hasLong;
|
|
@@ -10370,14 +10349,10 @@ var LeaferUI = (function (exports) {
|
|
|
10370
10349
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
10371
10350
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10372
10351
|
row = rows[i];
|
|
10373
|
-
if (row.text)
|
|
10352
|
+
if (row.text)
|
|
10374
10353
|
canvas.fillText(row.text, row.x, row.y);
|
|
10375
|
-
|
|
10376
|
-
|
|
10377
|
-
row.data.forEach(charData => {
|
|
10378
|
-
canvas.fillText(charData.char, charData.x, row.y);
|
|
10379
|
-
});
|
|
10380
|
-
}
|
|
10354
|
+
else if (row.data)
|
|
10355
|
+
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
10381
10356
|
if (decorationY)
|
|
10382
10357
|
canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
10383
10358
|
}
|
|
@@ -10443,12 +10418,10 @@ var LeaferUI = (function (exports) {
|
|
|
10443
10418
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
10444
10419
|
fillText(ui, out);
|
|
10445
10420
|
out.blendMode = 'normal';
|
|
10446
|
-
if (ui.__worldFlipped)
|
|
10421
|
+
if (ui.__worldFlipped)
|
|
10447
10422
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10448
|
-
|
|
10449
|
-
else {
|
|
10423
|
+
else
|
|
10450
10424
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10451
|
-
}
|
|
10452
10425
|
out.recycle(ui.__nowWorld);
|
|
10453
10426
|
}
|
|
10454
10427
|
function drawTextStroke(ui, canvas) {
|
|
@@ -10456,14 +10429,10 @@ var LeaferUI = (function (exports) {
|
|
|
10456
10429
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
10457
10430
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10458
10431
|
row = rows[i];
|
|
10459
|
-
if (row.text)
|
|
10432
|
+
if (row.text)
|
|
10460
10433
|
canvas.strokeText(row.text, row.x, row.y);
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
row.data.forEach(charData => {
|
|
10464
|
-
canvas.strokeText(charData.char, charData.x, row.y);
|
|
10465
|
-
});
|
|
10466
|
-
}
|
|
10434
|
+
else if (row.data)
|
|
10435
|
+
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
10467
10436
|
if (decorationY)
|
|
10468
10437
|
canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
10469
10438
|
}
|
|
@@ -10516,12 +10485,10 @@ var LeaferUI = (function (exports) {
|
|
|
10516
10485
|
out.stroke();
|
|
10517
10486
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
10518
10487
|
out.clearWorld(ui.__layout.renderBounds);
|
|
10519
|
-
if (ui.__worldFlipped)
|
|
10488
|
+
if (ui.__worldFlipped)
|
|
10520
10489
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10521
|
-
|
|
10522
|
-
else {
|
|
10490
|
+
else
|
|
10523
10491
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10524
|
-
}
|
|
10525
10492
|
out.recycle(ui.__nowWorld);
|
|
10526
10493
|
break;
|
|
10527
10494
|
}
|
|
@@ -10556,12 +10523,10 @@ var LeaferUI = (function (exports) {
|
|
|
10556
10523
|
drawStrokesStyle(strokes, false, ui, out);
|
|
10557
10524
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
10558
10525
|
out.clearWorld(renderBounds);
|
|
10559
|
-
if (ui.__worldFlipped)
|
|
10526
|
+
if (ui.__worldFlipped)
|
|
10560
10527
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10561
|
-
|
|
10562
|
-
else {
|
|
10528
|
+
else
|
|
10563
10529
|
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
10564
|
-
}
|
|
10565
10530
|
out.recycle(ui.__nowWorld);
|
|
10566
10531
|
break;
|
|
10567
10532
|
}
|
|
@@ -10625,12 +10590,7 @@ var LeaferUI = (function (exports) {
|
|
|
10625
10590
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
10626
10591
|
if (leafPaints.length && leafPaints[0].image)
|
|
10627
10592
|
hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
|
|
10628
|
-
|
|
10629
|
-
data.__pixelFill = hasOpacityPixel;
|
|
10630
|
-
}
|
|
10631
|
-
else {
|
|
10632
|
-
data.__pixelStroke = hasOpacityPixel;
|
|
10633
|
-
}
|
|
10593
|
+
attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
|
|
10634
10594
|
}
|
|
10635
10595
|
function getLeafPaint(attrName, paint, ui) {
|
|
10636
10596
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|