@leafer-ui/miniapp 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/miniapp.cjs +17 -33
- package/dist/miniapp.esm.js +17 -33
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.module.js +81 -118
- package/dist/miniapp.module.min.js +1 -1
- package/package.json +10 -10
package/dist/miniapp.module.js
CHANGED
|
@@ -2958,7 +2958,6 @@ class PathCreator {
|
|
|
2958
2958
|
set path(value) { this.__path = value; }
|
|
2959
2959
|
get path() { return this.__path; }
|
|
2960
2960
|
constructor(path) {
|
|
2961
|
-
this.clearPath = this.beginPath;
|
|
2962
2961
|
this.set(path);
|
|
2963
2962
|
}
|
|
2964
2963
|
set(path) {
|
|
@@ -3040,6 +3039,9 @@ class PathCreator {
|
|
|
3040
3039
|
this.paint();
|
|
3041
3040
|
return this;
|
|
3042
3041
|
}
|
|
3042
|
+
clearPath() {
|
|
3043
|
+
return this.beginPath();
|
|
3044
|
+
}
|
|
3043
3045
|
paint() { }
|
|
3044
3046
|
}
|
|
3045
3047
|
|
|
@@ -3635,6 +3637,8 @@ const ImageManager = {
|
|
|
3635
3637
|
else {
|
|
3636
3638
|
if (url.includes('.' + format) || url.includes('.' + FileHelper.upperCaseTypeMap[format]))
|
|
3637
3639
|
return true;
|
|
3640
|
+
else if (format === 'png' && !url.includes('.'))
|
|
3641
|
+
return true;
|
|
3638
3642
|
}
|
|
3639
3643
|
return false;
|
|
3640
3644
|
},
|
|
@@ -5252,7 +5256,7 @@ const BranchRender = {
|
|
|
5252
5256
|
const { LEAF, create } = IncrementId;
|
|
5253
5257
|
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
|
|
5254
5258
|
const { toOuterOf } = BoundsHelper;
|
|
5255
|
-
const { copy: copy$4, move
|
|
5259
|
+
const { copy: copy$4, move } = PointHelper;
|
|
5256
5260
|
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
|
|
5257
5261
|
let Leaf = class Leaf {
|
|
5258
5262
|
get tag() { return this.__tag; }
|
|
@@ -5487,7 +5491,7 @@ let Leaf = class Leaf {
|
|
|
5487
5491
|
}
|
|
5488
5492
|
getBoxPointByInner(inner, _relative, _distance, change) {
|
|
5489
5493
|
const point = change ? inner : Object.assign({}, inner), { x, y } = this.boxBounds;
|
|
5490
|
-
move
|
|
5494
|
+
move(point, -x, -y);
|
|
5491
5495
|
return point;
|
|
5492
5496
|
}
|
|
5493
5497
|
getInnerPoint(world, relative, distance, change) {
|
|
@@ -5497,7 +5501,7 @@ let Leaf = class Leaf {
|
|
|
5497
5501
|
}
|
|
5498
5502
|
getInnerPointByBox(box, _relative, _distance, change) {
|
|
5499
5503
|
const point = change ? box : Object.assign({}, box), { x, y } = this.boxBounds;
|
|
5500
|
-
move
|
|
5504
|
+
move(point, x, y);
|
|
5501
5505
|
return point;
|
|
5502
5506
|
}
|
|
5503
5507
|
getInnerPointByLocal(local, _relative, distance, change) {
|
|
@@ -5638,11 +5642,10 @@ let Leaf = class Leaf {
|
|
|
5638
5642
|
}
|
|
5639
5643
|
destroy() {
|
|
5640
5644
|
if (!this.destroyed) {
|
|
5641
|
-
|
|
5642
|
-
if (parent)
|
|
5645
|
+
if (this.parent)
|
|
5643
5646
|
this.remove();
|
|
5644
5647
|
if (this.children)
|
|
5645
|
-
this.
|
|
5648
|
+
this.clear();
|
|
5646
5649
|
this.__emitLifeEvent(ChildEvent.DESTROY);
|
|
5647
5650
|
this.__.destroy();
|
|
5648
5651
|
this.__layout.destroy();
|
|
@@ -5956,7 +5959,7 @@ class LeafLevelList {
|
|
|
5956
5959
|
}
|
|
5957
5960
|
}
|
|
5958
5961
|
|
|
5959
|
-
const version = "1.0.
|
|
5962
|
+
const version = "1.0.9";
|
|
5960
5963
|
|
|
5961
5964
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
5962
5965
|
get allowBackgroundColor() { return false; }
|
|
@@ -6067,7 +6070,10 @@ Object.assign(Creator, {
|
|
|
6067
6070
|
});
|
|
6068
6071
|
function useCanvas(_canvasType, app) {
|
|
6069
6072
|
Platform.origin = {
|
|
6070
|
-
createCanvas: (width, height, _format) =>
|
|
6073
|
+
createCanvas: (width, height, _format) => {
|
|
6074
|
+
const data = { type: '2d', width, height };
|
|
6075
|
+
app.createOffscreenCanvas ? app.createOffscreenCanvas(data) : app.createOffScreenCanvas(data);
|
|
6076
|
+
},
|
|
6071
6077
|
canvasToDataURL: (canvas, type, quality) => canvas.toDataURL(mineType(type), quality),
|
|
6072
6078
|
canvasToBolb: (canvas, type, quality) => canvas.toBuffer(type, { quality }),
|
|
6073
6079
|
canvasSaveAs: (canvas, filePath, quality) => {
|
|
@@ -7094,12 +7100,8 @@ const State = {
|
|
|
7094
7100
|
};
|
|
7095
7101
|
const Transition = {
|
|
7096
7102
|
list: {},
|
|
7097
|
-
register(attrName, fn) {
|
|
7098
|
-
|
|
7099
|
-
},
|
|
7100
|
-
get(attrName) {
|
|
7101
|
-
return Transition.list[attrName];
|
|
7102
|
-
}
|
|
7103
|
+
register(attrName, fn) { Transition.list[attrName] = fn; },
|
|
7104
|
+
get(attrName) { return Transition.list[attrName]; }
|
|
7103
7105
|
};
|
|
7104
7106
|
|
|
7105
7107
|
const { parse, objectToCanvasData } = PathConvert;
|
|
@@ -7545,8 +7547,8 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7545
7547
|
pen.set(path = []), this.__drawPathByBox(pen);
|
|
7546
7548
|
return curve ? PathConvert.toCanvasData(path, true) : path;
|
|
7547
7549
|
}
|
|
7548
|
-
getPathString(curve, pathForRender) {
|
|
7549
|
-
return PathConvert.stringify(this.getPath(curve, pathForRender));
|
|
7550
|
+
getPathString(curve, pathForRender, floatLength) {
|
|
7551
|
+
return PathConvert.stringify(this.getPath(curve, pathForRender), floatLength);
|
|
7550
7552
|
}
|
|
7551
7553
|
load() {
|
|
7552
7554
|
this.__.__computePaint();
|
|
@@ -7955,11 +7957,11 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7955
7957
|
start() {
|
|
7956
7958
|
clearTimeout(this.__startTimer);
|
|
7957
7959
|
if (!this.running && this.canvas) {
|
|
7960
|
+
this.running = true;
|
|
7958
7961
|
this.ready ? this.emitLeafer(LeaferEvent.RESTART) : this.emitLeafer(LeaferEvent.START);
|
|
7959
7962
|
this.__controllers.forEach(item => item.start());
|
|
7960
7963
|
if (!this.isApp)
|
|
7961
7964
|
this.renderer.render();
|
|
7962
|
-
this.running = true;
|
|
7963
7965
|
}
|
|
7964
7966
|
}
|
|
7965
7967
|
stop() {
|
|
@@ -8065,12 +8067,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8065
8067
|
}
|
|
8066
8068
|
__changeFill(newValue) {
|
|
8067
8069
|
this.config.fill = newValue;
|
|
8068
|
-
if (this.canvas.allowBackgroundColor)
|
|
8070
|
+
if (this.canvas.allowBackgroundColor)
|
|
8069
8071
|
this.canvas.backgroundColor = newValue;
|
|
8070
|
-
|
|
8071
|
-
else {
|
|
8072
|
+
else
|
|
8072
8073
|
this.forceRender();
|
|
8073
|
-
}
|
|
8074
8074
|
}
|
|
8075
8075
|
__onCreated() {
|
|
8076
8076
|
this.created = true;
|
|
@@ -8137,13 +8137,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8137
8137
|
if (bind)
|
|
8138
8138
|
item = item.bind(bind);
|
|
8139
8139
|
this.__viewCompletedWait.push(item);
|
|
8140
|
-
if (this.viewCompleted)
|
|
8140
|
+
if (this.viewCompleted)
|
|
8141
8141
|
this.__checkViewCompleted(false);
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
if (!this.running)
|
|
8145
|
-
this.start();
|
|
8146
|
-
}
|
|
8142
|
+
else if (!this.running)
|
|
8143
|
+
this.start();
|
|
8147
8144
|
}
|
|
8148
8145
|
nextRender(item, bind, off) {
|
|
8149
8146
|
if (bind)
|
|
@@ -8157,9 +8154,8 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8157
8154
|
}
|
|
8158
8155
|
}
|
|
8159
8156
|
}
|
|
8160
|
-
else
|
|
8157
|
+
else
|
|
8161
8158
|
list.push(item);
|
|
8162
|
-
}
|
|
8163
8159
|
}
|
|
8164
8160
|
zoom(_zoomType, _padding, _fixedScale) {
|
|
8165
8161
|
return needPlugin('view');
|
|
@@ -8203,10 +8199,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8203
8199
|
this.stop();
|
|
8204
8200
|
this.emitEvent(new LeaferEvent(LeaferEvent.END, this));
|
|
8205
8201
|
this.__removeListenEvents();
|
|
8206
|
-
this.__controllers.forEach(item =>
|
|
8207
|
-
if (!(this.parent && item === this.interaction))
|
|
8208
|
-
item.destroy();
|
|
8209
|
-
});
|
|
8202
|
+
this.__controllers.forEach(item => !(this.parent && item === this.interaction) && item.destroy());
|
|
8210
8203
|
this.__controllers.length = 0;
|
|
8211
8204
|
if (!this.parent) {
|
|
8212
8205
|
if (this.selector)
|
|
@@ -8739,20 +8732,19 @@ let Text = class Text extends UI {
|
|
|
8739
8732
|
}
|
|
8740
8733
|
__updateTextDrawData() {
|
|
8741
8734
|
const data = this.__;
|
|
8742
|
-
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8743
|
-
}
|
|
8744
|
-
__updateBoxBounds() {
|
|
8745
|
-
const data = this.__;
|
|
8746
|
-
const layout = this.__layout;
|
|
8747
8735
|
const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow, padding } = data;
|
|
8748
|
-
const autoWidth = data.__autoWidth;
|
|
8749
|
-
const autoHeight = data.__autoHeight;
|
|
8750
8736
|
data.__lineHeight = UnitConvert.number(lineHeight, fontSize);
|
|
8751
8737
|
data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
|
|
8752
8738
|
data.__padding = padding ? MathHelper.fourNumber(padding) : undefined;
|
|
8753
8739
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
8754
8740
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
8755
8741
|
data.__clipText = textOverflow !== 'show' && !data.__autoSize;
|
|
8742
|
+
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8743
|
+
}
|
|
8744
|
+
__updateBoxBounds() {
|
|
8745
|
+
const data = this.__;
|
|
8746
|
+
const layout = this.__layout;
|
|
8747
|
+
const { fontSize, italic, padding, __autoWidth: autoWidth, __autoHeight: autoHeight } = data;
|
|
8756
8748
|
this.__updateTextDrawData();
|
|
8757
8749
|
const { bounds } = data.__textDrawData;
|
|
8758
8750
|
const b = layout.boxBounds;
|
|
@@ -8765,20 +8757,15 @@ let Text = class Text extends UI {
|
|
|
8765
8757
|
b.height = autoHeight ? bounds.height : data.height;
|
|
8766
8758
|
if (padding) {
|
|
8767
8759
|
const [top, right, bottom, left] = data.__padding;
|
|
8768
|
-
if (autoWidth)
|
|
8769
|
-
b.x -= left;
|
|
8770
|
-
|
|
8771
|
-
|
|
8772
|
-
if (autoHeight) {
|
|
8773
|
-
b.y -= top;
|
|
8774
|
-
b.height += (bottom + top);
|
|
8775
|
-
}
|
|
8760
|
+
if (autoWidth)
|
|
8761
|
+
b.x -= left, b.width += (right + left);
|
|
8762
|
+
if (autoHeight)
|
|
8763
|
+
b.y -= top, b.height += (bottom + top);
|
|
8776
8764
|
}
|
|
8777
8765
|
this.__updateNaturalSize();
|
|
8778
8766
|
}
|
|
8779
|
-
else
|
|
8767
|
+
else
|
|
8780
8768
|
super.__updateBoxBounds();
|
|
8781
|
-
}
|
|
8782
8769
|
if (italic)
|
|
8783
8770
|
b.width += fontSize * 0.16;
|
|
8784
8771
|
const contentBounds = includes(b, bounds) ? b : bounds;
|
|
@@ -8901,11 +8888,7 @@ let Pen = class Pen extends Group {
|
|
|
8901
8888
|
this.add(path);
|
|
8902
8889
|
return this;
|
|
8903
8890
|
}
|
|
8904
|
-
beginPath() {
|
|
8905
|
-
this.__path.length = 0;
|
|
8906
|
-
this.paint();
|
|
8907
|
-
return this;
|
|
8908
|
-
}
|
|
8891
|
+
beginPath() { return this; }
|
|
8909
8892
|
moveTo(_x, _y) { return this; }
|
|
8910
8893
|
lineTo(_x, _y) { return this; }
|
|
8911
8894
|
bezierCurveTo(_x1, _y1, _x2, _y2, _x, _y) { return this; }
|
|
@@ -8932,7 +8915,7 @@ __decorate([
|
|
|
8932
8915
|
penPathType()
|
|
8933
8916
|
], Pen.prototype, "path", void 0);
|
|
8934
8917
|
Pen = __decorate([
|
|
8935
|
-
useModule(PathCreator, ['set', '
|
|
8918
|
+
useModule(PathCreator, ['set', 'path', 'paint']),
|
|
8936
8919
|
registerUI()
|
|
8937
8920
|
], Pen);
|
|
8938
8921
|
function penPathType() {
|
|
@@ -9034,10 +9017,9 @@ let App = class App extends Leafer {
|
|
|
9034
9017
|
}
|
|
9035
9018
|
__render(canvas, options) {
|
|
9036
9019
|
if (canvas.context) {
|
|
9037
|
-
|
|
9038
|
-
|
|
9039
|
-
canvas.setTransform(a, b, c, d, e, f);
|
|
9040
|
-
}
|
|
9020
|
+
const m = options.matrix;
|
|
9021
|
+
if (m)
|
|
9022
|
+
canvas.setTransform(m.a, m.b, m.c, m.d, m.e, m.f);
|
|
9041
9023
|
this.children.forEach(leafer => canvas.copyWorld(leafer.canvas));
|
|
9042
9024
|
}
|
|
9043
9025
|
}
|
|
@@ -9107,9 +9089,6 @@ class UIEvent extends Event {
|
|
|
9107
9089
|
constructor(params) {
|
|
9108
9090
|
super(params.type);
|
|
9109
9091
|
this.bubbles = true;
|
|
9110
|
-
this.getInner = this.getInnerPoint;
|
|
9111
|
-
this.getLocal = this.getLocalPoint;
|
|
9112
|
-
this.getPage = this.getPagePoint;
|
|
9113
9092
|
Object.assign(this, params);
|
|
9114
9093
|
}
|
|
9115
9094
|
getBoxPoint(relative) {
|
|
@@ -9130,6 +9109,9 @@ class UIEvent extends Event {
|
|
|
9130
9109
|
getPagePoint() {
|
|
9131
9110
|
return this.current.getPagePoint(this);
|
|
9132
9111
|
}
|
|
9112
|
+
getInner(relative) { return this.getInnerPoint(relative); }
|
|
9113
|
+
getLocal(relative) { return this.getLocalPoint(relative); }
|
|
9114
|
+
getPage() { return this.getPagePoint(); }
|
|
9133
9115
|
static changeName(oldName, newName) {
|
|
9134
9116
|
EventCreator.changeName(oldName, newName);
|
|
9135
9117
|
}
|
|
@@ -9161,7 +9143,7 @@ PointerEvent = __decorate([
|
|
|
9161
9143
|
], PointerEvent);
|
|
9162
9144
|
const MyPointerEvent = PointerEvent;
|
|
9163
9145
|
|
|
9164
|
-
const
|
|
9146
|
+
const tempMove = {};
|
|
9165
9147
|
let DragEvent = class DragEvent extends PointerEvent {
|
|
9166
9148
|
static setList(data) {
|
|
9167
9149
|
this.list = data instanceof LeafList ? data : new LeafList(data);
|
|
@@ -9212,19 +9194,19 @@ let DragEvent = class DragEvent extends PointerEvent {
|
|
|
9212
9194
|
}
|
|
9213
9195
|
getPageMove(total) {
|
|
9214
9196
|
this.assignMove(total);
|
|
9215
|
-
return this.current.getPagePoint(
|
|
9197
|
+
return this.current.getPagePoint(tempMove, null, true);
|
|
9216
9198
|
}
|
|
9217
9199
|
getInnerMove(relative, total) {
|
|
9218
9200
|
if (!relative)
|
|
9219
9201
|
relative = this.current;
|
|
9220
9202
|
this.assignMove(total);
|
|
9221
|
-
return relative.getInnerPoint(
|
|
9203
|
+
return relative.getInnerPoint(tempMove, null, true);
|
|
9222
9204
|
}
|
|
9223
9205
|
getLocalMove(relative, total) {
|
|
9224
9206
|
if (!relative)
|
|
9225
9207
|
relative = this.current;
|
|
9226
9208
|
this.assignMove(total);
|
|
9227
|
-
return relative.getLocalPoint(
|
|
9209
|
+
return relative.getLocalPoint(tempMove, null, true);
|
|
9228
9210
|
}
|
|
9229
9211
|
getPageTotal() {
|
|
9230
9212
|
return this.getPageMove(true);
|
|
@@ -9244,8 +9226,8 @@ let DragEvent = class DragEvent extends PointerEvent {
|
|
|
9244
9226
|
return bounds;
|
|
9245
9227
|
}
|
|
9246
9228
|
assignMove(total) {
|
|
9247
|
-
|
|
9248
|
-
|
|
9229
|
+
tempMove.x = total ? this.totalX : this.moveX;
|
|
9230
|
+
tempMove.y = total ? this.totalY : this.moveY;
|
|
9249
9231
|
}
|
|
9250
9232
|
};
|
|
9251
9233
|
DragEvent.BEFORE_DRAG = 'drag.before_drag';
|
|
@@ -9659,9 +9641,8 @@ class Dragger {
|
|
|
9659
9641
|
interaction.emit(DragEvent.OVER, data, path);
|
|
9660
9642
|
}
|
|
9661
9643
|
}
|
|
9662
|
-
else
|
|
9644
|
+
else
|
|
9663
9645
|
interaction.emit(DragEvent.OVER, data, path);
|
|
9664
|
-
}
|
|
9665
9646
|
}
|
|
9666
9647
|
dragEnterOrLeave(data) {
|
|
9667
9648
|
const { interaction } = this;
|
|
@@ -9682,9 +9663,8 @@ class Dragger {
|
|
|
9682
9663
|
this.drag(data);
|
|
9683
9664
|
this.animate(() => { this.dragEnd(data, 1); });
|
|
9684
9665
|
}
|
|
9685
|
-
else
|
|
9666
|
+
else
|
|
9686
9667
|
this.dragEndReal(data);
|
|
9687
|
-
}
|
|
9688
9668
|
}
|
|
9689
9669
|
dragEndReal(data) {
|
|
9690
9670
|
const { interaction, downData, dragData } = this;
|
|
@@ -9881,14 +9861,16 @@ const { pathHasEventType, getMoveEventData, getZoomEventData, getRotateEventData
|
|
|
9881
9861
|
class InteractionBase {
|
|
9882
9862
|
get dragging() { return this.dragger.dragging; }
|
|
9883
9863
|
get transforming() { return this.transformer.transforming; }
|
|
9884
|
-
get moveMode() { return this.
|
|
9885
|
-
get canHover() { return this.
|
|
9886
|
-
get isDragEmpty() { return this.
|
|
9887
|
-
get isMobileDragEmpty() { return this.
|
|
9888
|
-
get isHoldMiddleKey() { return this.
|
|
9889
|
-
get isHoldRightKey() { return this.
|
|
9890
|
-
get isHoldSpaceKey() { return this.
|
|
9891
|
-
get
|
|
9864
|
+
get moveMode() { return this.m.drag === true || this.isHoldSpaceKey || this.isHoldMiddleKey || (this.isHoldRightKey && this.dragger.moving) || this.isDragEmpty; }
|
|
9865
|
+
get canHover() { return this.p.hover && !this.config.mobile; }
|
|
9866
|
+
get isDragEmpty() { return this.m.dragEmpty && this.isRootPath(this.hoverData) && (!this.downData || this.isRootPath(this.downData)); }
|
|
9867
|
+
get isMobileDragEmpty() { return this.m.dragEmpty && !this.canHover && this.downData && this.isTreePath(this.downData); }
|
|
9868
|
+
get isHoldMiddleKey() { return this.m.holdMiddleKey && this.downData && PointerButton.middle(this.downData); }
|
|
9869
|
+
get isHoldRightKey() { return this.m.holdRightKey && this.downData && PointerButton.right(this.downData); }
|
|
9870
|
+
get isHoldSpaceKey() { return this.m.holdSpaceKey && Keyboard.isHoldSpaceKey(); }
|
|
9871
|
+
get m() { return this.config.move; }
|
|
9872
|
+
get p() { return this.config.pointer; }
|
|
9873
|
+
get hitRadius() { return this.p.hitRadius; }
|
|
9892
9874
|
constructor(target, canvas, selector, userConfig) {
|
|
9893
9875
|
this.config = DataHelper.clone(config);
|
|
9894
9876
|
this.tapCount = 0;
|
|
@@ -9946,7 +9928,7 @@ class InteractionBase {
|
|
|
9946
9928
|
}
|
|
9947
9929
|
}
|
|
9948
9930
|
pointerMoveReal(data) {
|
|
9949
|
-
const { dragHover, dragDistance } = this.
|
|
9931
|
+
const { dragHover, dragDistance } = this.p;
|
|
9950
9932
|
this.emit(PointerEvent.BEFORE_MOVE, data, this.defaultPath);
|
|
9951
9933
|
if (this.downData) {
|
|
9952
9934
|
const canDrag = PointHelper.getDistance(this.downData, data) > dragDistance;
|
|
@@ -10131,7 +10113,7 @@ class InteractionBase {
|
|
|
10131
10113
|
}
|
|
10132
10114
|
}
|
|
10133
10115
|
findPath(data, options) {
|
|
10134
|
-
const { hitRadius, through } = this.
|
|
10116
|
+
const { hitRadius, through } = this.p;
|
|
10135
10117
|
const { bottomList } = this;
|
|
10136
10118
|
const find = this.selector.getByPoint(data, hitRadius, Object.assign({ bottomList, name: data.type }, (options || { through })));
|
|
10137
10119
|
if (find.throughPath)
|
|
@@ -10153,7 +10135,7 @@ class InteractionBase {
|
|
|
10153
10135
|
data.path = this.defaultPath;
|
|
10154
10136
|
}
|
|
10155
10137
|
canMove(data) {
|
|
10156
|
-
return data && (this.moveMode || (this.
|
|
10138
|
+
return data && (this.moveMode || (this.m.drag === 'auto' && !pathCanDrag(data.path))) && !pathHasOutside(data.path);
|
|
10157
10139
|
}
|
|
10158
10140
|
isDrag(leaf) {
|
|
10159
10141
|
return this.dragger.getList().has(leaf);
|
|
@@ -10251,7 +10233,7 @@ class InteractionBase {
|
|
|
10251
10233
|
this.longPressTimer = setTimeout(() => {
|
|
10252
10234
|
this.longPressed = true;
|
|
10253
10235
|
this.emit(PointerEvent.LONG_PRESS, data);
|
|
10254
|
-
}, this.
|
|
10236
|
+
}, this.p.longPressTime);
|
|
10255
10237
|
}
|
|
10256
10238
|
longTap(data) {
|
|
10257
10239
|
let hasLong;
|
|
@@ -10609,14 +10591,10 @@ function fillText(ui, canvas) {
|
|
|
10609
10591
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
10610
10592
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10611
10593
|
row = rows[i];
|
|
10612
|
-
if (row.text)
|
|
10594
|
+
if (row.text)
|
|
10613
10595
|
canvas.fillText(row.text, row.x, row.y);
|
|
10614
|
-
|
|
10615
|
-
|
|
10616
|
-
row.data.forEach(charData => {
|
|
10617
|
-
canvas.fillText(charData.char, charData.x, row.y);
|
|
10618
|
-
});
|
|
10619
|
-
}
|
|
10596
|
+
else if (row.data)
|
|
10597
|
+
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
10620
10598
|
if (decorationY)
|
|
10621
10599
|
canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
10622
10600
|
}
|
|
@@ -10682,12 +10660,10 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
|
|
|
10682
10660
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
10683
10661
|
fillText(ui, out);
|
|
10684
10662
|
out.blendMode = 'normal';
|
|
10685
|
-
if (ui.__worldFlipped)
|
|
10663
|
+
if (ui.__worldFlipped)
|
|
10686
10664
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10687
|
-
|
|
10688
|
-
else {
|
|
10665
|
+
else
|
|
10689
10666
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10690
|
-
}
|
|
10691
10667
|
out.recycle(ui.__nowWorld);
|
|
10692
10668
|
}
|
|
10693
10669
|
function drawTextStroke(ui, canvas) {
|
|
@@ -10695,14 +10671,10 @@ function drawTextStroke(ui, canvas) {
|
|
|
10695
10671
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
10696
10672
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10697
10673
|
row = rows[i];
|
|
10698
|
-
if (row.text)
|
|
10674
|
+
if (row.text)
|
|
10699
10675
|
canvas.strokeText(row.text, row.x, row.y);
|
|
10700
|
-
|
|
10701
|
-
|
|
10702
|
-
row.data.forEach(charData => {
|
|
10703
|
-
canvas.strokeText(charData.char, charData.x, row.y);
|
|
10704
|
-
});
|
|
10705
|
-
}
|
|
10676
|
+
else if (row.data)
|
|
10677
|
+
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
10706
10678
|
if (decorationY)
|
|
10707
10679
|
canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
10708
10680
|
}
|
|
@@ -10755,12 +10727,10 @@ function stroke(stroke, ui, canvas) {
|
|
|
10755
10727
|
out.stroke();
|
|
10756
10728
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
10757
10729
|
out.clearWorld(ui.__layout.renderBounds);
|
|
10758
|
-
if (ui.__worldFlipped)
|
|
10730
|
+
if (ui.__worldFlipped)
|
|
10759
10731
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10760
|
-
|
|
10761
|
-
else {
|
|
10732
|
+
else
|
|
10762
10733
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10763
|
-
}
|
|
10764
10734
|
out.recycle(ui.__nowWorld);
|
|
10765
10735
|
break;
|
|
10766
10736
|
}
|
|
@@ -10795,12 +10765,10 @@ function strokes(strokes, ui, canvas) {
|
|
|
10795
10765
|
drawStrokesStyle(strokes, false, ui, out);
|
|
10796
10766
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
10797
10767
|
out.clearWorld(renderBounds);
|
|
10798
|
-
if (ui.__worldFlipped)
|
|
10768
|
+
if (ui.__worldFlipped)
|
|
10799
10769
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10800
|
-
|
|
10801
|
-
else {
|
|
10770
|
+
else
|
|
10802
10771
|
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
10803
|
-
}
|
|
10804
10772
|
out.recycle(ui.__nowWorld);
|
|
10805
10773
|
break;
|
|
10806
10774
|
}
|
|
@@ -10864,12 +10832,7 @@ function compute(attrName, ui) {
|
|
|
10864
10832
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
10865
10833
|
if (leafPaints.length && leafPaints[0].image)
|
|
10866
10834
|
hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
|
|
10867
|
-
|
|
10868
|
-
data.__pixelFill = hasOpacityPixel;
|
|
10869
|
-
}
|
|
10870
|
-
else {
|
|
10871
|
-
data.__pixelStroke = hasOpacityPixel;
|
|
10872
|
-
}
|
|
10835
|
+
attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
|
|
10873
10836
|
}
|
|
10874
10837
|
function getLeafPaint(attrName, paint, ui) {
|
|
10875
10838
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|