@leafer-ui/miniapp 1.0.7 → 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/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 +82 -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.8";
|
|
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,23 +8732,23 @@ 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;
|
|
8751
|
+
console.log(bounds, autoWidth, autoHeight);
|
|
8759
8752
|
if (data.__lineHeight < fontSize)
|
|
8760
8753
|
spread(bounds, fontSize / 2);
|
|
8761
8754
|
if (autoWidth || autoHeight) {
|
|
@@ -8765,20 +8758,15 @@ let Text = class Text extends UI {
|
|
|
8765
8758
|
b.height = autoHeight ? bounds.height : data.height;
|
|
8766
8759
|
if (padding) {
|
|
8767
8760
|
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
|
-
}
|
|
8761
|
+
if (autoWidth)
|
|
8762
|
+
b.x -= left, b.width += (right + left);
|
|
8763
|
+
if (autoHeight)
|
|
8764
|
+
b.y -= top, b.height += (bottom + top);
|
|
8776
8765
|
}
|
|
8777
8766
|
this.__updateNaturalSize();
|
|
8778
8767
|
}
|
|
8779
|
-
else
|
|
8768
|
+
else
|
|
8780
8769
|
super.__updateBoxBounds();
|
|
8781
|
-
}
|
|
8782
8770
|
if (italic)
|
|
8783
8771
|
b.width += fontSize * 0.16;
|
|
8784
8772
|
const contentBounds = includes(b, bounds) ? b : bounds;
|
|
@@ -8901,11 +8889,7 @@ let Pen = class Pen extends Group {
|
|
|
8901
8889
|
this.add(path);
|
|
8902
8890
|
return this;
|
|
8903
8891
|
}
|
|
8904
|
-
beginPath() {
|
|
8905
|
-
this.__path.length = 0;
|
|
8906
|
-
this.paint();
|
|
8907
|
-
return this;
|
|
8908
|
-
}
|
|
8892
|
+
beginPath() { return this; }
|
|
8909
8893
|
moveTo(_x, _y) { return this; }
|
|
8910
8894
|
lineTo(_x, _y) { return this; }
|
|
8911
8895
|
bezierCurveTo(_x1, _y1, _x2, _y2, _x, _y) { return this; }
|
|
@@ -8932,7 +8916,7 @@ __decorate([
|
|
|
8932
8916
|
penPathType()
|
|
8933
8917
|
], Pen.prototype, "path", void 0);
|
|
8934
8918
|
Pen = __decorate([
|
|
8935
|
-
useModule(PathCreator, ['set', '
|
|
8919
|
+
useModule(PathCreator, ['set', 'path', 'paint']),
|
|
8936
8920
|
registerUI()
|
|
8937
8921
|
], Pen);
|
|
8938
8922
|
function penPathType() {
|
|
@@ -9034,10 +9018,9 @@ let App = class App extends Leafer {
|
|
|
9034
9018
|
}
|
|
9035
9019
|
__render(canvas, options) {
|
|
9036
9020
|
if (canvas.context) {
|
|
9037
|
-
|
|
9038
|
-
|
|
9039
|
-
canvas.setTransform(a, b, c, d, e, f);
|
|
9040
|
-
}
|
|
9021
|
+
const m = options.matrix;
|
|
9022
|
+
if (m)
|
|
9023
|
+
canvas.setTransform(m.a, m.b, m.c, m.d, m.e, m.f);
|
|
9041
9024
|
this.children.forEach(leafer => canvas.copyWorld(leafer.canvas));
|
|
9042
9025
|
}
|
|
9043
9026
|
}
|
|
@@ -9107,9 +9090,6 @@ class UIEvent extends Event {
|
|
|
9107
9090
|
constructor(params) {
|
|
9108
9091
|
super(params.type);
|
|
9109
9092
|
this.bubbles = true;
|
|
9110
|
-
this.getInner = this.getInnerPoint;
|
|
9111
|
-
this.getLocal = this.getLocalPoint;
|
|
9112
|
-
this.getPage = this.getPagePoint;
|
|
9113
9093
|
Object.assign(this, params);
|
|
9114
9094
|
}
|
|
9115
9095
|
getBoxPoint(relative) {
|
|
@@ -9130,6 +9110,9 @@ class UIEvent extends Event {
|
|
|
9130
9110
|
getPagePoint() {
|
|
9131
9111
|
return this.current.getPagePoint(this);
|
|
9132
9112
|
}
|
|
9113
|
+
getInner(relative) { return this.getInnerPoint(relative); }
|
|
9114
|
+
getLocal(relative) { return this.getLocalPoint(relative); }
|
|
9115
|
+
getPage() { return this.getPagePoint(); }
|
|
9133
9116
|
static changeName(oldName, newName) {
|
|
9134
9117
|
EventCreator.changeName(oldName, newName);
|
|
9135
9118
|
}
|
|
@@ -9161,7 +9144,7 @@ PointerEvent = __decorate([
|
|
|
9161
9144
|
], PointerEvent);
|
|
9162
9145
|
const MyPointerEvent = PointerEvent;
|
|
9163
9146
|
|
|
9164
|
-
const
|
|
9147
|
+
const tempMove = {};
|
|
9165
9148
|
let DragEvent = class DragEvent extends PointerEvent {
|
|
9166
9149
|
static setList(data) {
|
|
9167
9150
|
this.list = data instanceof LeafList ? data : new LeafList(data);
|
|
@@ -9212,19 +9195,19 @@ let DragEvent = class DragEvent extends PointerEvent {
|
|
|
9212
9195
|
}
|
|
9213
9196
|
getPageMove(total) {
|
|
9214
9197
|
this.assignMove(total);
|
|
9215
|
-
return this.current.getPagePoint(
|
|
9198
|
+
return this.current.getPagePoint(tempMove, null, true);
|
|
9216
9199
|
}
|
|
9217
9200
|
getInnerMove(relative, total) {
|
|
9218
9201
|
if (!relative)
|
|
9219
9202
|
relative = this.current;
|
|
9220
9203
|
this.assignMove(total);
|
|
9221
|
-
return relative.getInnerPoint(
|
|
9204
|
+
return relative.getInnerPoint(tempMove, null, true);
|
|
9222
9205
|
}
|
|
9223
9206
|
getLocalMove(relative, total) {
|
|
9224
9207
|
if (!relative)
|
|
9225
9208
|
relative = this.current;
|
|
9226
9209
|
this.assignMove(total);
|
|
9227
|
-
return relative.getLocalPoint(
|
|
9210
|
+
return relative.getLocalPoint(tempMove, null, true);
|
|
9228
9211
|
}
|
|
9229
9212
|
getPageTotal() {
|
|
9230
9213
|
return this.getPageMove(true);
|
|
@@ -9244,8 +9227,8 @@ let DragEvent = class DragEvent extends PointerEvent {
|
|
|
9244
9227
|
return bounds;
|
|
9245
9228
|
}
|
|
9246
9229
|
assignMove(total) {
|
|
9247
|
-
|
|
9248
|
-
|
|
9230
|
+
tempMove.x = total ? this.totalX : this.moveX;
|
|
9231
|
+
tempMove.y = total ? this.totalY : this.moveY;
|
|
9249
9232
|
}
|
|
9250
9233
|
};
|
|
9251
9234
|
DragEvent.BEFORE_DRAG = 'drag.before_drag';
|
|
@@ -9659,9 +9642,8 @@ class Dragger {
|
|
|
9659
9642
|
interaction.emit(DragEvent.OVER, data, path);
|
|
9660
9643
|
}
|
|
9661
9644
|
}
|
|
9662
|
-
else
|
|
9645
|
+
else
|
|
9663
9646
|
interaction.emit(DragEvent.OVER, data, path);
|
|
9664
|
-
}
|
|
9665
9647
|
}
|
|
9666
9648
|
dragEnterOrLeave(data) {
|
|
9667
9649
|
const { interaction } = this;
|
|
@@ -9682,9 +9664,8 @@ class Dragger {
|
|
|
9682
9664
|
this.drag(data);
|
|
9683
9665
|
this.animate(() => { this.dragEnd(data, 1); });
|
|
9684
9666
|
}
|
|
9685
|
-
else
|
|
9667
|
+
else
|
|
9686
9668
|
this.dragEndReal(data);
|
|
9687
|
-
}
|
|
9688
9669
|
}
|
|
9689
9670
|
dragEndReal(data) {
|
|
9690
9671
|
const { interaction, downData, dragData } = this;
|
|
@@ -9881,14 +9862,16 @@ const { pathHasEventType, getMoveEventData, getZoomEventData, getRotateEventData
|
|
|
9881
9862
|
class InteractionBase {
|
|
9882
9863
|
get dragging() { return this.dragger.dragging; }
|
|
9883
9864
|
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
|
|
9865
|
+
get moveMode() { return this.m.drag === true || this.isHoldSpaceKey || this.isHoldMiddleKey || (this.isHoldRightKey && this.dragger.moving) || this.isDragEmpty; }
|
|
9866
|
+
get canHover() { return this.p.hover && !this.config.mobile; }
|
|
9867
|
+
get isDragEmpty() { return this.m.dragEmpty && this.isRootPath(this.hoverData) && (!this.downData || this.isRootPath(this.downData)); }
|
|
9868
|
+
get isMobileDragEmpty() { return this.m.dragEmpty && !this.canHover && this.downData && this.isTreePath(this.downData); }
|
|
9869
|
+
get isHoldMiddleKey() { return this.m.holdMiddleKey && this.downData && PointerButton.middle(this.downData); }
|
|
9870
|
+
get isHoldRightKey() { return this.m.holdRightKey && this.downData && PointerButton.right(this.downData); }
|
|
9871
|
+
get isHoldSpaceKey() { return this.m.holdSpaceKey && Keyboard.isHoldSpaceKey(); }
|
|
9872
|
+
get m() { return this.config.move; }
|
|
9873
|
+
get p() { return this.config.pointer; }
|
|
9874
|
+
get hitRadius() { return this.p.hitRadius; }
|
|
9892
9875
|
constructor(target, canvas, selector, userConfig) {
|
|
9893
9876
|
this.config = DataHelper.clone(config);
|
|
9894
9877
|
this.tapCount = 0;
|
|
@@ -9946,7 +9929,7 @@ class InteractionBase {
|
|
|
9946
9929
|
}
|
|
9947
9930
|
}
|
|
9948
9931
|
pointerMoveReal(data) {
|
|
9949
|
-
const { dragHover, dragDistance } = this.
|
|
9932
|
+
const { dragHover, dragDistance } = this.p;
|
|
9950
9933
|
this.emit(PointerEvent.BEFORE_MOVE, data, this.defaultPath);
|
|
9951
9934
|
if (this.downData) {
|
|
9952
9935
|
const canDrag = PointHelper.getDistance(this.downData, data) > dragDistance;
|
|
@@ -10131,7 +10114,7 @@ class InteractionBase {
|
|
|
10131
10114
|
}
|
|
10132
10115
|
}
|
|
10133
10116
|
findPath(data, options) {
|
|
10134
|
-
const { hitRadius, through } = this.
|
|
10117
|
+
const { hitRadius, through } = this.p;
|
|
10135
10118
|
const { bottomList } = this;
|
|
10136
10119
|
const find = this.selector.getByPoint(data, hitRadius, Object.assign({ bottomList, name: data.type }, (options || { through })));
|
|
10137
10120
|
if (find.throughPath)
|
|
@@ -10153,7 +10136,7 @@ class InteractionBase {
|
|
|
10153
10136
|
data.path = this.defaultPath;
|
|
10154
10137
|
}
|
|
10155
10138
|
canMove(data) {
|
|
10156
|
-
return data && (this.moveMode || (this.
|
|
10139
|
+
return data && (this.moveMode || (this.m.drag === 'auto' && !pathCanDrag(data.path))) && !pathHasOutside(data.path);
|
|
10157
10140
|
}
|
|
10158
10141
|
isDrag(leaf) {
|
|
10159
10142
|
return this.dragger.getList().has(leaf);
|
|
@@ -10251,7 +10234,7 @@ class InteractionBase {
|
|
|
10251
10234
|
this.longPressTimer = setTimeout(() => {
|
|
10252
10235
|
this.longPressed = true;
|
|
10253
10236
|
this.emit(PointerEvent.LONG_PRESS, data);
|
|
10254
|
-
}, this.
|
|
10237
|
+
}, this.p.longPressTime);
|
|
10255
10238
|
}
|
|
10256
10239
|
longTap(data) {
|
|
10257
10240
|
let hasLong;
|
|
@@ -10609,14 +10592,10 @@ function fillText(ui, canvas) {
|
|
|
10609
10592
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
10610
10593
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10611
10594
|
row = rows[i];
|
|
10612
|
-
if (row.text)
|
|
10595
|
+
if (row.text)
|
|
10613
10596
|
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
|
-
}
|
|
10597
|
+
else if (row.data)
|
|
10598
|
+
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
10620
10599
|
if (decorationY)
|
|
10621
10600
|
canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
10622
10601
|
}
|
|
@@ -10682,12 +10661,10 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
|
|
|
10682
10661
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
10683
10662
|
fillText(ui, out);
|
|
10684
10663
|
out.blendMode = 'normal';
|
|
10685
|
-
if (ui.__worldFlipped)
|
|
10664
|
+
if (ui.__worldFlipped)
|
|
10686
10665
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10687
|
-
|
|
10688
|
-
else {
|
|
10666
|
+
else
|
|
10689
10667
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10690
|
-
}
|
|
10691
10668
|
out.recycle(ui.__nowWorld);
|
|
10692
10669
|
}
|
|
10693
10670
|
function drawTextStroke(ui, canvas) {
|
|
@@ -10695,14 +10672,10 @@ function drawTextStroke(ui, canvas) {
|
|
|
10695
10672
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
10696
10673
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10697
10674
|
row = rows[i];
|
|
10698
|
-
if (row.text)
|
|
10675
|
+
if (row.text)
|
|
10699
10676
|
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
|
-
}
|
|
10677
|
+
else if (row.data)
|
|
10678
|
+
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
10706
10679
|
if (decorationY)
|
|
10707
10680
|
canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
10708
10681
|
}
|
|
@@ -10755,12 +10728,10 @@ function stroke(stroke, ui, canvas) {
|
|
|
10755
10728
|
out.stroke();
|
|
10756
10729
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
10757
10730
|
out.clearWorld(ui.__layout.renderBounds);
|
|
10758
|
-
if (ui.__worldFlipped)
|
|
10731
|
+
if (ui.__worldFlipped)
|
|
10759
10732
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10760
|
-
|
|
10761
|
-
else {
|
|
10733
|
+
else
|
|
10762
10734
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10763
|
-
}
|
|
10764
10735
|
out.recycle(ui.__nowWorld);
|
|
10765
10736
|
break;
|
|
10766
10737
|
}
|
|
@@ -10795,12 +10766,10 @@ function strokes(strokes, ui, canvas) {
|
|
|
10795
10766
|
drawStrokesStyle(strokes, false, ui, out);
|
|
10796
10767
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
10797
10768
|
out.clearWorld(renderBounds);
|
|
10798
|
-
if (ui.__worldFlipped)
|
|
10769
|
+
if (ui.__worldFlipped)
|
|
10799
10770
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10800
|
-
|
|
10801
|
-
else {
|
|
10771
|
+
else
|
|
10802
10772
|
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
10803
|
-
}
|
|
10804
10773
|
out.recycle(ui.__nowWorld);
|
|
10805
10774
|
break;
|
|
10806
10775
|
}
|
|
@@ -10864,12 +10833,7 @@ function compute(attrName, ui) {
|
|
|
10864
10833
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
10865
10834
|
if (leafPaints.length && leafPaints[0].image)
|
|
10866
10835
|
hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
|
|
10867
|
-
|
|
10868
|
-
data.__pixelFill = hasOpacityPixel;
|
|
10869
|
-
}
|
|
10870
|
-
else {
|
|
10871
|
-
data.__pixelStroke = hasOpacityPixel;
|
|
10872
|
-
}
|
|
10836
|
+
attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
|
|
10873
10837
|
}
|
|
10874
10838
|
function getLeafPaint(attrName, paint, ui) {
|
|
10875
10839
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|