leafer-ui 1.0.6 → 1.0.8
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/README.md +2 -0
- package/dist/web.cjs +20 -37
- package/dist/web.esm.js +20 -37
- package/dist/web.esm.min.js +1 -1
- package/dist/web.js +95 -133
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.module.js +95 -133
- package/dist/web.module.min.js +1 -1
- package/package.json +11 -11
package/dist/web.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
|
},
|
|
@@ -4429,13 +4433,10 @@ var LeaferUI = (function (exports) {
|
|
|
4429
4433
|
update() {
|
|
4430
4434
|
const { leafer } = this.leaf;
|
|
4431
4435
|
if (leafer) {
|
|
4432
|
-
if (leafer.ready)
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
}
|
|
4436
|
-
else {
|
|
4436
|
+
if (leafer.ready)
|
|
4437
|
+
leafer.watcher.changed && leafer.layouter.layout();
|
|
4438
|
+
else
|
|
4437
4439
|
leafer.start();
|
|
4438
|
-
}
|
|
4439
4440
|
}
|
|
4440
4441
|
else {
|
|
4441
4442
|
let root = this.leaf;
|
|
@@ -5258,7 +5259,7 @@ var LeaferUI = (function (exports) {
|
|
|
5258
5259
|
const { LEAF, create } = IncrementId;
|
|
5259
5260
|
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
|
|
5260
5261
|
const { toOuterOf } = BoundsHelper;
|
|
5261
|
-
const { copy: copy$4, move
|
|
5262
|
+
const { copy: copy$4, move } = PointHelper;
|
|
5262
5263
|
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
|
|
5263
5264
|
exports.Leaf = class Leaf {
|
|
5264
5265
|
get tag() { return this.__tag; }
|
|
@@ -5493,7 +5494,7 @@ var LeaferUI = (function (exports) {
|
|
|
5493
5494
|
}
|
|
5494
5495
|
getBoxPointByInner(inner, _relative, _distance, change) {
|
|
5495
5496
|
const point = change ? inner : Object.assign({}, inner), { x, y } = this.boxBounds;
|
|
5496
|
-
move
|
|
5497
|
+
move(point, -x, -y);
|
|
5497
5498
|
return point;
|
|
5498
5499
|
}
|
|
5499
5500
|
getInnerPoint(world, relative, distance, change) {
|
|
@@ -5503,7 +5504,7 @@ var LeaferUI = (function (exports) {
|
|
|
5503
5504
|
}
|
|
5504
5505
|
getInnerPointByBox(box, _relative, _distance, change) {
|
|
5505
5506
|
const point = change ? box : Object.assign({}, box), { x, y } = this.boxBounds;
|
|
5506
|
-
move
|
|
5507
|
+
move(point, x, y);
|
|
5507
5508
|
return point;
|
|
5508
5509
|
}
|
|
5509
5510
|
getInnerPointByLocal(local, _relative, distance, change) {
|
|
@@ -5644,11 +5645,10 @@ var LeaferUI = (function (exports) {
|
|
|
5644
5645
|
}
|
|
5645
5646
|
destroy() {
|
|
5646
5647
|
if (!this.destroyed) {
|
|
5647
|
-
|
|
5648
|
-
if (parent)
|
|
5648
|
+
if (this.parent)
|
|
5649
5649
|
this.remove();
|
|
5650
5650
|
if (this.children)
|
|
5651
|
-
this.
|
|
5651
|
+
this.clear();
|
|
5652
5652
|
this.__emitLifeEvent(ChildEvent.DESTROY);
|
|
5653
5653
|
this.__.destroy();
|
|
5654
5654
|
this.__layout.destroy();
|
|
@@ -5962,7 +5962,7 @@ var LeaferUI = (function (exports) {
|
|
|
5962
5962
|
}
|
|
5963
5963
|
}
|
|
5964
5964
|
|
|
5965
|
-
const version = "1.0.
|
|
5965
|
+
const version = "1.0.8";
|
|
5966
5966
|
|
|
5967
5967
|
const debug$7 = Debug.get('LeaferCanvas');
|
|
5968
5968
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -6854,7 +6854,8 @@ var LeaferUI = (function (exports) {
|
|
|
6854
6854
|
path.add(leaf);
|
|
6855
6855
|
leaf = leaf.parent;
|
|
6856
6856
|
}
|
|
6857
|
-
|
|
6857
|
+
if (this.target)
|
|
6858
|
+
path.add(this.target);
|
|
6858
6859
|
return path;
|
|
6859
6860
|
}
|
|
6860
6861
|
getHitablePath(leaf) {
|
|
@@ -6940,8 +6941,8 @@ var LeaferUI = (function (exports) {
|
|
|
6940
6941
|
this.innerIdMap = {};
|
|
6941
6942
|
this.idMap = {};
|
|
6942
6943
|
this.methods = {
|
|
6943
|
-
id: (leaf, name) => leaf.id === name ? (this.idMap[name] = leaf, 1) : 0,
|
|
6944
|
-
innerId: (leaf, innerId) => leaf.innerId === innerId ? (this.innerIdMap[innerId] = leaf, 1) : 0,
|
|
6944
|
+
id: (leaf, name) => leaf.id === name ? (this.target && (this.idMap[name] = leaf), 1) : 0,
|
|
6945
|
+
innerId: (leaf, innerId) => leaf.innerId === innerId ? (this.target && (this.innerIdMap[innerId] = leaf), 1) : 0,
|
|
6945
6946
|
className: (leaf, name) => leaf.className === name ? 1 : 0,
|
|
6946
6947
|
tag: (leaf, name) => leaf.__tag === name ? 1 : 0,
|
|
6947
6948
|
tags: (leaf, nameMap) => nameMap[leaf.__tag] ? 1 : 0
|
|
@@ -6950,7 +6951,8 @@ var LeaferUI = (function (exports) {
|
|
|
6950
6951
|
if (userConfig)
|
|
6951
6952
|
this.config = DataHelper.default(userConfig, this.config);
|
|
6952
6953
|
this.picker = new Picker(target, this);
|
|
6953
|
-
|
|
6954
|
+
if (target)
|
|
6955
|
+
this.__listenEvents();
|
|
6954
6956
|
}
|
|
6955
6957
|
getBy(condition, branch, one, options) {
|
|
6956
6958
|
switch (typeof condition) {
|
|
@@ -6985,7 +6987,7 @@ var LeaferUI = (function (exports) {
|
|
|
6985
6987
|
}
|
|
6986
6988
|
}
|
|
6987
6989
|
getByPoint(hitPoint, hitRadius, options) {
|
|
6988
|
-
if (Platform.name === 'node')
|
|
6990
|
+
if (Platform.name === 'node' && this.target)
|
|
6989
6991
|
this.target.emit(LayoutEvent.CHECK_UPDATE);
|
|
6990
6992
|
return this.picker.getByPoint(hitPoint, hitRadius, options);
|
|
6991
6993
|
}
|
|
@@ -7134,12 +7136,8 @@ var LeaferUI = (function (exports) {
|
|
|
7134
7136
|
};
|
|
7135
7137
|
const Transition = {
|
|
7136
7138
|
list: {},
|
|
7137
|
-
register(attrName, fn) {
|
|
7138
|
-
|
|
7139
|
-
},
|
|
7140
|
-
get(attrName) {
|
|
7141
|
-
return Transition.list[attrName];
|
|
7142
|
-
}
|
|
7139
|
+
register(attrName, fn) { Transition.list[attrName] = fn; },
|
|
7140
|
+
get(attrName) { return Transition.list[attrName]; }
|
|
7143
7141
|
};
|
|
7144
7142
|
|
|
7145
7143
|
const { parse, objectToCanvasData } = PathConvert;
|
|
@@ -7585,8 +7583,8 @@ var LeaferUI = (function (exports) {
|
|
|
7585
7583
|
pen.set(path = []), this.__drawPathByBox(pen);
|
|
7586
7584
|
return curve ? PathConvert.toCanvasData(path, true) : path;
|
|
7587
7585
|
}
|
|
7588
|
-
getPathString(curve, pathForRender) {
|
|
7589
|
-
return PathConvert.stringify(this.getPath(curve, pathForRender));
|
|
7586
|
+
getPathString(curve, pathForRender, floatLength) {
|
|
7587
|
+
return PathConvert.stringify(this.getPath(curve, pathForRender), floatLength);
|
|
7590
7588
|
}
|
|
7591
7589
|
load() {
|
|
7592
7590
|
this.__.__computePaint();
|
|
@@ -7995,11 +7993,11 @@ var LeaferUI = (function (exports) {
|
|
|
7995
7993
|
start() {
|
|
7996
7994
|
clearTimeout(this.__startTimer);
|
|
7997
7995
|
if (!this.running && this.canvas) {
|
|
7996
|
+
this.running = true;
|
|
7998
7997
|
this.ready ? this.emitLeafer(LeaferEvent.RESTART) : this.emitLeafer(LeaferEvent.START);
|
|
7999
7998
|
this.__controllers.forEach(item => item.start());
|
|
8000
7999
|
if (!this.isApp)
|
|
8001
8000
|
this.renderer.render();
|
|
8002
|
-
this.running = true;
|
|
8003
8001
|
}
|
|
8004
8002
|
}
|
|
8005
8003
|
stop() {
|
|
@@ -8105,12 +8103,10 @@ var LeaferUI = (function (exports) {
|
|
|
8105
8103
|
}
|
|
8106
8104
|
__changeFill(newValue) {
|
|
8107
8105
|
this.config.fill = newValue;
|
|
8108
|
-
if (this.canvas.allowBackgroundColor)
|
|
8106
|
+
if (this.canvas.allowBackgroundColor)
|
|
8109
8107
|
this.canvas.backgroundColor = newValue;
|
|
8110
|
-
|
|
8111
|
-
else {
|
|
8108
|
+
else
|
|
8112
8109
|
this.forceRender();
|
|
8113
|
-
}
|
|
8114
8110
|
}
|
|
8115
8111
|
__onCreated() {
|
|
8116
8112
|
this.created = true;
|
|
@@ -8177,13 +8173,10 @@ var LeaferUI = (function (exports) {
|
|
|
8177
8173
|
if (bind)
|
|
8178
8174
|
item = item.bind(bind);
|
|
8179
8175
|
this.__viewCompletedWait.push(item);
|
|
8180
|
-
if (this.viewCompleted)
|
|
8176
|
+
if (this.viewCompleted)
|
|
8181
8177
|
this.__checkViewCompleted(false);
|
|
8182
|
-
|
|
8183
|
-
|
|
8184
|
-
if (!this.running)
|
|
8185
|
-
this.start();
|
|
8186
|
-
}
|
|
8178
|
+
else if (!this.running)
|
|
8179
|
+
this.start();
|
|
8187
8180
|
}
|
|
8188
8181
|
nextRender(item, bind, off) {
|
|
8189
8182
|
if (bind)
|
|
@@ -8197,9 +8190,8 @@ var LeaferUI = (function (exports) {
|
|
|
8197
8190
|
}
|
|
8198
8191
|
}
|
|
8199
8192
|
}
|
|
8200
|
-
else
|
|
8193
|
+
else
|
|
8201
8194
|
list.push(item);
|
|
8202
|
-
}
|
|
8203
8195
|
}
|
|
8204
8196
|
zoom(_zoomType, _padding, _fixedScale) {
|
|
8205
8197
|
return needPlugin('view');
|
|
@@ -8243,10 +8235,7 @@ var LeaferUI = (function (exports) {
|
|
|
8243
8235
|
this.stop();
|
|
8244
8236
|
this.emitEvent(new LeaferEvent(LeaferEvent.END, this));
|
|
8245
8237
|
this.__removeListenEvents();
|
|
8246
|
-
this.__controllers.forEach(item =>
|
|
8247
|
-
if (!(this.parent && item === this.interaction))
|
|
8248
|
-
item.destroy();
|
|
8249
|
-
});
|
|
8238
|
+
this.__controllers.forEach(item => !(this.parent && item === this.interaction) && item.destroy());
|
|
8250
8239
|
this.__controllers.length = 0;
|
|
8251
8240
|
if (!this.parent) {
|
|
8252
8241
|
if (this.selector)
|
|
@@ -8779,23 +8768,23 @@ var LeaferUI = (function (exports) {
|
|
|
8779
8768
|
}
|
|
8780
8769
|
__updateTextDrawData() {
|
|
8781
8770
|
const data = this.__;
|
|
8782
|
-
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8783
|
-
}
|
|
8784
|
-
__updateBoxBounds() {
|
|
8785
|
-
const data = this.__;
|
|
8786
|
-
const layout = this.__layout;
|
|
8787
8771
|
const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow, padding } = data;
|
|
8788
|
-
const autoWidth = data.__autoWidth;
|
|
8789
|
-
const autoHeight = data.__autoHeight;
|
|
8790
8772
|
data.__lineHeight = UnitConvert.number(lineHeight, fontSize);
|
|
8791
8773
|
data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
|
|
8792
8774
|
data.__padding = padding ? MathHelper.fourNumber(padding) : undefined;
|
|
8793
8775
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
8794
8776
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
8795
8777
|
data.__clipText = textOverflow !== 'show' && !data.__autoSize;
|
|
8778
|
+
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8779
|
+
}
|
|
8780
|
+
__updateBoxBounds() {
|
|
8781
|
+
const data = this.__;
|
|
8782
|
+
const layout = this.__layout;
|
|
8783
|
+
const { fontSize, italic, padding, __autoWidth: autoWidth, __autoHeight: autoHeight } = data;
|
|
8796
8784
|
this.__updateTextDrawData();
|
|
8797
8785
|
const { bounds } = data.__textDrawData;
|
|
8798
8786
|
const b = layout.boxBounds;
|
|
8787
|
+
console.log(bounds, autoWidth, autoHeight);
|
|
8799
8788
|
if (data.__lineHeight < fontSize)
|
|
8800
8789
|
spread(bounds, fontSize / 2);
|
|
8801
8790
|
if (autoWidth || autoHeight) {
|
|
@@ -8805,20 +8794,15 @@ var LeaferUI = (function (exports) {
|
|
|
8805
8794
|
b.height = autoHeight ? bounds.height : data.height;
|
|
8806
8795
|
if (padding) {
|
|
8807
8796
|
const [top, right, bottom, left] = data.__padding;
|
|
8808
|
-
if (autoWidth)
|
|
8809
|
-
b.x -= left;
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
if (autoHeight) {
|
|
8813
|
-
b.y -= top;
|
|
8814
|
-
b.height += (bottom + top);
|
|
8815
|
-
}
|
|
8797
|
+
if (autoWidth)
|
|
8798
|
+
b.x -= left, b.width += (right + left);
|
|
8799
|
+
if (autoHeight)
|
|
8800
|
+
b.y -= top, b.height += (bottom + top);
|
|
8816
8801
|
}
|
|
8817
8802
|
this.__updateNaturalSize();
|
|
8818
8803
|
}
|
|
8819
|
-
else
|
|
8804
|
+
else
|
|
8820
8805
|
super.__updateBoxBounds();
|
|
8821
|
-
}
|
|
8822
8806
|
if (italic)
|
|
8823
8807
|
b.width += fontSize * 0.16;
|
|
8824
8808
|
const contentBounds = includes(b, bounds) ? b : bounds;
|
|
@@ -8827,9 +8811,8 @@ var LeaferUI = (function (exports) {
|
|
|
8827
8811
|
layout.renderChanged = true;
|
|
8828
8812
|
setList(data.__textBoxBounds = {}, [b, bounds]);
|
|
8829
8813
|
}
|
|
8830
|
-
else
|
|
8814
|
+
else
|
|
8831
8815
|
data.__textBoxBounds = contentBounds;
|
|
8832
|
-
}
|
|
8833
8816
|
}
|
|
8834
8817
|
__updateRenderSpread() {
|
|
8835
8818
|
let width = super.__updateRenderSpread();
|
|
@@ -8942,11 +8925,7 @@ var LeaferUI = (function (exports) {
|
|
|
8942
8925
|
this.add(path);
|
|
8943
8926
|
return this;
|
|
8944
8927
|
}
|
|
8945
|
-
beginPath() {
|
|
8946
|
-
this.__path.length = 0;
|
|
8947
|
-
this.paint();
|
|
8948
|
-
return this;
|
|
8949
|
-
}
|
|
8928
|
+
beginPath() { return this; }
|
|
8950
8929
|
moveTo(_x, _y) { return this; }
|
|
8951
8930
|
lineTo(_x, _y) { return this; }
|
|
8952
8931
|
bezierCurveTo(_x1, _y1, _x2, _y2, _x, _y) { return this; }
|
|
@@ -8973,7 +8952,7 @@ var LeaferUI = (function (exports) {
|
|
|
8973
8952
|
penPathType()
|
|
8974
8953
|
], exports.Pen.prototype, "path", void 0);
|
|
8975
8954
|
exports.Pen = __decorate([
|
|
8976
|
-
useModule(PathCreator, ['set', '
|
|
8955
|
+
useModule(PathCreator, ['set', 'path', 'paint']),
|
|
8977
8956
|
registerUI()
|
|
8978
8957
|
], exports.Pen);
|
|
8979
8958
|
function penPathType() {
|
|
@@ -9075,10 +9054,9 @@ var LeaferUI = (function (exports) {
|
|
|
9075
9054
|
}
|
|
9076
9055
|
__render(canvas, options) {
|
|
9077
9056
|
if (canvas.context) {
|
|
9078
|
-
|
|
9079
|
-
|
|
9080
|
-
canvas.setTransform(a, b, c, d, e, f);
|
|
9081
|
-
}
|
|
9057
|
+
const m = options.matrix;
|
|
9058
|
+
if (m)
|
|
9059
|
+
canvas.setTransform(m.a, m.b, m.c, m.d, m.e, m.f);
|
|
9082
9060
|
this.children.forEach(leafer => canvas.copyWorld(leafer.canvas));
|
|
9083
9061
|
}
|
|
9084
9062
|
}
|
|
@@ -9148,9 +9126,6 @@ var LeaferUI = (function (exports) {
|
|
|
9148
9126
|
constructor(params) {
|
|
9149
9127
|
super(params.type);
|
|
9150
9128
|
this.bubbles = true;
|
|
9151
|
-
this.getInner = this.getInnerPoint;
|
|
9152
|
-
this.getLocal = this.getLocalPoint;
|
|
9153
|
-
this.getPage = this.getPagePoint;
|
|
9154
9129
|
Object.assign(this, params);
|
|
9155
9130
|
}
|
|
9156
9131
|
getBoxPoint(relative) {
|
|
@@ -9171,6 +9146,9 @@ var LeaferUI = (function (exports) {
|
|
|
9171
9146
|
getPagePoint() {
|
|
9172
9147
|
return this.current.getPagePoint(this);
|
|
9173
9148
|
}
|
|
9149
|
+
getInner(relative) { return this.getInnerPoint(relative); }
|
|
9150
|
+
getLocal(relative) { return this.getLocalPoint(relative); }
|
|
9151
|
+
getPage() { return this.getPagePoint(); }
|
|
9174
9152
|
static changeName(oldName, newName) {
|
|
9175
9153
|
EventCreator.changeName(oldName, newName);
|
|
9176
9154
|
}
|
|
@@ -9202,7 +9180,7 @@ var LeaferUI = (function (exports) {
|
|
|
9202
9180
|
], exports.PointerEvent);
|
|
9203
9181
|
const MyPointerEvent = exports.PointerEvent;
|
|
9204
9182
|
|
|
9205
|
-
const
|
|
9183
|
+
const tempMove = {};
|
|
9206
9184
|
exports.DragEvent = class DragEvent extends exports.PointerEvent {
|
|
9207
9185
|
static setList(data) {
|
|
9208
9186
|
this.list = data instanceof LeafList ? data : new LeafList(data);
|
|
@@ -9253,19 +9231,19 @@ var LeaferUI = (function (exports) {
|
|
|
9253
9231
|
}
|
|
9254
9232
|
getPageMove(total) {
|
|
9255
9233
|
this.assignMove(total);
|
|
9256
|
-
return this.current.getPagePoint(
|
|
9234
|
+
return this.current.getPagePoint(tempMove, null, true);
|
|
9257
9235
|
}
|
|
9258
9236
|
getInnerMove(relative, total) {
|
|
9259
9237
|
if (!relative)
|
|
9260
9238
|
relative = this.current;
|
|
9261
9239
|
this.assignMove(total);
|
|
9262
|
-
return relative.getInnerPoint(
|
|
9240
|
+
return relative.getInnerPoint(tempMove, null, true);
|
|
9263
9241
|
}
|
|
9264
9242
|
getLocalMove(relative, total) {
|
|
9265
9243
|
if (!relative)
|
|
9266
9244
|
relative = this.current;
|
|
9267
9245
|
this.assignMove(total);
|
|
9268
|
-
return relative.getLocalPoint(
|
|
9246
|
+
return relative.getLocalPoint(tempMove, null, true);
|
|
9269
9247
|
}
|
|
9270
9248
|
getPageTotal() {
|
|
9271
9249
|
return this.getPageMove(true);
|
|
@@ -9285,8 +9263,8 @@ var LeaferUI = (function (exports) {
|
|
|
9285
9263
|
return bounds;
|
|
9286
9264
|
}
|
|
9287
9265
|
assignMove(total) {
|
|
9288
|
-
|
|
9289
|
-
|
|
9266
|
+
tempMove.x = total ? this.totalX : this.moveX;
|
|
9267
|
+
tempMove.y = total ? this.totalY : this.moveY;
|
|
9290
9268
|
}
|
|
9291
9269
|
};
|
|
9292
9270
|
exports.DragEvent.BEFORE_DRAG = 'drag.before_drag';
|
|
@@ -9700,9 +9678,8 @@ var LeaferUI = (function (exports) {
|
|
|
9700
9678
|
interaction.emit(exports.DragEvent.OVER, data, path);
|
|
9701
9679
|
}
|
|
9702
9680
|
}
|
|
9703
|
-
else
|
|
9681
|
+
else
|
|
9704
9682
|
interaction.emit(exports.DragEvent.OVER, data, path);
|
|
9705
|
-
}
|
|
9706
9683
|
}
|
|
9707
9684
|
dragEnterOrLeave(data) {
|
|
9708
9685
|
const { interaction } = this;
|
|
@@ -9723,9 +9700,8 @@ var LeaferUI = (function (exports) {
|
|
|
9723
9700
|
this.drag(data);
|
|
9724
9701
|
this.animate(() => { this.dragEnd(data, 1); });
|
|
9725
9702
|
}
|
|
9726
|
-
else
|
|
9703
|
+
else
|
|
9727
9704
|
this.dragEndReal(data);
|
|
9728
|
-
}
|
|
9729
9705
|
}
|
|
9730
9706
|
dragEndReal(data) {
|
|
9731
9707
|
const { interaction, downData, dragData } = this;
|
|
@@ -9922,14 +9898,16 @@ var LeaferUI = (function (exports) {
|
|
|
9922
9898
|
class InteractionBase {
|
|
9923
9899
|
get dragging() { return this.dragger.dragging; }
|
|
9924
9900
|
get transforming() { return this.transformer.transforming; }
|
|
9925
|
-
get moveMode() { return this.
|
|
9926
|
-
get canHover() { return this.
|
|
9927
|
-
get isDragEmpty() { return this.
|
|
9928
|
-
get isMobileDragEmpty() { return this.
|
|
9929
|
-
get isHoldMiddleKey() { return this.
|
|
9930
|
-
get isHoldRightKey() { return this.
|
|
9931
|
-
get isHoldSpaceKey() { return this.
|
|
9932
|
-
get
|
|
9901
|
+
get moveMode() { return this.m.drag === true || this.isHoldSpaceKey || this.isHoldMiddleKey || (this.isHoldRightKey && this.dragger.moving) || this.isDragEmpty; }
|
|
9902
|
+
get canHover() { return this.p.hover && !this.config.mobile; }
|
|
9903
|
+
get isDragEmpty() { return this.m.dragEmpty && this.isRootPath(this.hoverData) && (!this.downData || this.isRootPath(this.downData)); }
|
|
9904
|
+
get isMobileDragEmpty() { return this.m.dragEmpty && !this.canHover && this.downData && this.isTreePath(this.downData); }
|
|
9905
|
+
get isHoldMiddleKey() { return this.m.holdMiddleKey && this.downData && PointerButton.middle(this.downData); }
|
|
9906
|
+
get isHoldRightKey() { return this.m.holdRightKey && this.downData && PointerButton.right(this.downData); }
|
|
9907
|
+
get isHoldSpaceKey() { return this.m.holdSpaceKey && Keyboard.isHoldSpaceKey(); }
|
|
9908
|
+
get m() { return this.config.move; }
|
|
9909
|
+
get p() { return this.config.pointer; }
|
|
9910
|
+
get hitRadius() { return this.p.hitRadius; }
|
|
9933
9911
|
constructor(target, canvas, selector, userConfig) {
|
|
9934
9912
|
this.config = DataHelper.clone(config);
|
|
9935
9913
|
this.tapCount = 0;
|
|
@@ -9987,7 +9965,7 @@ var LeaferUI = (function (exports) {
|
|
|
9987
9965
|
}
|
|
9988
9966
|
}
|
|
9989
9967
|
pointerMoveReal(data) {
|
|
9990
|
-
const { dragHover, dragDistance } = this.
|
|
9968
|
+
const { dragHover, dragDistance } = this.p;
|
|
9991
9969
|
this.emit(exports.PointerEvent.BEFORE_MOVE, data, this.defaultPath);
|
|
9992
9970
|
if (this.downData) {
|
|
9993
9971
|
const canDrag = PointHelper.getDistance(this.downData, data) > dragDistance;
|
|
@@ -10172,7 +10150,7 @@ var LeaferUI = (function (exports) {
|
|
|
10172
10150
|
}
|
|
10173
10151
|
}
|
|
10174
10152
|
findPath(data, options) {
|
|
10175
|
-
const { hitRadius, through } = this.
|
|
10153
|
+
const { hitRadius, through } = this.p;
|
|
10176
10154
|
const { bottomList } = this;
|
|
10177
10155
|
const find = this.selector.getByPoint(data, hitRadius, Object.assign({ bottomList, name: data.type }, (options || { through })));
|
|
10178
10156
|
if (find.throughPath)
|
|
@@ -10194,7 +10172,7 @@ var LeaferUI = (function (exports) {
|
|
|
10194
10172
|
data.path = this.defaultPath;
|
|
10195
10173
|
}
|
|
10196
10174
|
canMove(data) {
|
|
10197
|
-
return data && (this.moveMode || (this.
|
|
10175
|
+
return data && (this.moveMode || (this.m.drag === 'auto' && !pathCanDrag$1(data.path))) && !pathHasOutside(data.path);
|
|
10198
10176
|
}
|
|
10199
10177
|
isDrag(leaf) {
|
|
10200
10178
|
return this.dragger.getList().has(leaf);
|
|
@@ -10292,7 +10270,7 @@ var LeaferUI = (function (exports) {
|
|
|
10292
10270
|
this.longPressTimer = setTimeout(() => {
|
|
10293
10271
|
this.longPressed = true;
|
|
10294
10272
|
this.emit(exports.PointerEvent.LONG_PRESS, data);
|
|
10295
|
-
}, this.
|
|
10273
|
+
}, this.p.longPressTime);
|
|
10296
10274
|
}
|
|
10297
10275
|
longTap(data) {
|
|
10298
10276
|
let hasLong;
|
|
@@ -10503,17 +10481,20 @@ var LeaferUI = (function (exports) {
|
|
|
10503
10481
|
};
|
|
10504
10482
|
|
|
10505
10483
|
const ui = exports.UI.prototype, group = exports.Group.prototype;
|
|
10484
|
+
function getSelector(ui) {
|
|
10485
|
+
return ui.leafer ? ui.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector()));
|
|
10486
|
+
}
|
|
10506
10487
|
ui.find = function (condition, options) {
|
|
10507
|
-
return this.
|
|
10488
|
+
return getSelector(this).getBy(condition, this, false, options);
|
|
10508
10489
|
};
|
|
10509
10490
|
ui.findOne = function (condition, options) {
|
|
10510
|
-
return this.
|
|
10491
|
+
return getSelector(this).getBy(condition, this, true, options);
|
|
10511
10492
|
};
|
|
10512
10493
|
group.pick = function (hitPoint, options) {
|
|
10513
10494
|
this.__layout.update();
|
|
10514
10495
|
if (!options)
|
|
10515
10496
|
options = {};
|
|
10516
|
-
return this.
|
|
10497
|
+
return getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
|
|
10517
10498
|
};
|
|
10518
10499
|
|
|
10519
10500
|
const canvas$1 = LeaferCanvasBase.prototype;
|
|
@@ -10894,14 +10875,10 @@ var LeaferUI = (function (exports) {
|
|
|
10894
10875
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
10895
10876
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10896
10877
|
row = rows[i];
|
|
10897
|
-
if (row.text)
|
|
10878
|
+
if (row.text)
|
|
10898
10879
|
canvas.fillText(row.text, row.x, row.y);
|
|
10899
|
-
|
|
10900
|
-
|
|
10901
|
-
row.data.forEach(charData => {
|
|
10902
|
-
canvas.fillText(charData.char, charData.x, row.y);
|
|
10903
|
-
});
|
|
10904
|
-
}
|
|
10880
|
+
else if (row.data)
|
|
10881
|
+
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
10905
10882
|
if (decorationY)
|
|
10906
10883
|
canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
10907
10884
|
}
|
|
@@ -10967,12 +10944,10 @@ var LeaferUI = (function (exports) {
|
|
|
10967
10944
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
10968
10945
|
fillText(ui, out);
|
|
10969
10946
|
out.blendMode = 'normal';
|
|
10970
|
-
if (ui.__worldFlipped)
|
|
10947
|
+
if (ui.__worldFlipped)
|
|
10971
10948
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10972
|
-
|
|
10973
|
-
else {
|
|
10949
|
+
else
|
|
10974
10950
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10975
|
-
}
|
|
10976
10951
|
out.recycle(ui.__nowWorld);
|
|
10977
10952
|
}
|
|
10978
10953
|
function drawTextStroke(ui, canvas) {
|
|
@@ -10980,14 +10955,10 @@ var LeaferUI = (function (exports) {
|
|
|
10980
10955
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
10981
10956
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10982
10957
|
row = rows[i];
|
|
10983
|
-
if (row.text)
|
|
10958
|
+
if (row.text)
|
|
10984
10959
|
canvas.strokeText(row.text, row.x, row.y);
|
|
10985
|
-
|
|
10986
|
-
|
|
10987
|
-
row.data.forEach(charData => {
|
|
10988
|
-
canvas.strokeText(charData.char, charData.x, row.y);
|
|
10989
|
-
});
|
|
10990
|
-
}
|
|
10960
|
+
else if (row.data)
|
|
10961
|
+
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
10991
10962
|
if (decorationY)
|
|
10992
10963
|
canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
10993
10964
|
}
|
|
@@ -11040,12 +11011,10 @@ var LeaferUI = (function (exports) {
|
|
|
11040
11011
|
out.stroke();
|
|
11041
11012
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
11042
11013
|
out.clearWorld(ui.__layout.renderBounds);
|
|
11043
|
-
if (ui.__worldFlipped)
|
|
11014
|
+
if (ui.__worldFlipped)
|
|
11044
11015
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
11045
|
-
|
|
11046
|
-
else {
|
|
11016
|
+
else
|
|
11047
11017
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
11048
|
-
}
|
|
11049
11018
|
out.recycle(ui.__nowWorld);
|
|
11050
11019
|
break;
|
|
11051
11020
|
}
|
|
@@ -11080,12 +11049,10 @@ var LeaferUI = (function (exports) {
|
|
|
11080
11049
|
drawStrokesStyle(strokes, false, ui, out);
|
|
11081
11050
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
11082
11051
|
out.clearWorld(renderBounds);
|
|
11083
|
-
if (ui.__worldFlipped)
|
|
11052
|
+
if (ui.__worldFlipped)
|
|
11084
11053
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
11085
|
-
|
|
11086
|
-
else {
|
|
11054
|
+
else
|
|
11087
11055
|
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
11088
|
-
}
|
|
11089
11056
|
out.recycle(ui.__nowWorld);
|
|
11090
11057
|
break;
|
|
11091
11058
|
}
|
|
@@ -11149,12 +11116,7 @@ var LeaferUI = (function (exports) {
|
|
|
11149
11116
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
11150
11117
|
if (leafPaints.length && leafPaints[0].image)
|
|
11151
11118
|
hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
|
|
11152
|
-
|
|
11153
|
-
data.__pixelFill = hasOpacityPixel;
|
|
11154
|
-
}
|
|
11155
|
-
else {
|
|
11156
|
-
data.__pixelStroke = hasOpacityPixel;
|
|
11157
|
-
}
|
|
11119
|
+
attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
|
|
11158
11120
|
}
|
|
11159
11121
|
function getLeafPaint(attrName, paint, ui) {
|
|
11160
11122
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|