@leafer-ui/worker 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/worker.cjs +13 -32
- package/dist/worker.esm.js +13 -32
- package/dist/worker.js +78 -117
- package/dist/worker.min.js +1 -1
- package/dist/worker.module.js +78 -117
- package/dist/worker.module.min.js +1 -1
- package/package.json +9 -9
package/dist/worker.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 true; }
|
|
@@ -6957,12 +6960,8 @@ const State = {
|
|
|
6957
6960
|
};
|
|
6958
6961
|
const Transition = {
|
|
6959
6962
|
list: {},
|
|
6960
|
-
register(attrName, fn) {
|
|
6961
|
-
|
|
6962
|
-
},
|
|
6963
|
-
get(attrName) {
|
|
6964
|
-
return Transition.list[attrName];
|
|
6965
|
-
}
|
|
6963
|
+
register(attrName, fn) { Transition.list[attrName] = fn; },
|
|
6964
|
+
get(attrName) { return Transition.list[attrName]; }
|
|
6966
6965
|
};
|
|
6967
6966
|
|
|
6968
6967
|
const { parse, objectToCanvasData } = PathConvert;
|
|
@@ -7408,8 +7407,8 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7408
7407
|
pen.set(path = []), this.__drawPathByBox(pen);
|
|
7409
7408
|
return curve ? PathConvert.toCanvasData(path, true) : path;
|
|
7410
7409
|
}
|
|
7411
|
-
getPathString(curve, pathForRender) {
|
|
7412
|
-
return PathConvert.stringify(this.getPath(curve, pathForRender));
|
|
7410
|
+
getPathString(curve, pathForRender, floatLength) {
|
|
7411
|
+
return PathConvert.stringify(this.getPath(curve, pathForRender), floatLength);
|
|
7413
7412
|
}
|
|
7414
7413
|
load() {
|
|
7415
7414
|
this.__.__computePaint();
|
|
@@ -7818,11 +7817,11 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7818
7817
|
start() {
|
|
7819
7818
|
clearTimeout(this.__startTimer);
|
|
7820
7819
|
if (!this.running && this.canvas) {
|
|
7820
|
+
this.running = true;
|
|
7821
7821
|
this.ready ? this.emitLeafer(LeaferEvent.RESTART) : this.emitLeafer(LeaferEvent.START);
|
|
7822
7822
|
this.__controllers.forEach(item => item.start());
|
|
7823
7823
|
if (!this.isApp)
|
|
7824
7824
|
this.renderer.render();
|
|
7825
|
-
this.running = true;
|
|
7826
7825
|
}
|
|
7827
7826
|
}
|
|
7828
7827
|
stop() {
|
|
@@ -7928,12 +7927,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7928
7927
|
}
|
|
7929
7928
|
__changeFill(newValue) {
|
|
7930
7929
|
this.config.fill = newValue;
|
|
7931
|
-
if (this.canvas.allowBackgroundColor)
|
|
7930
|
+
if (this.canvas.allowBackgroundColor)
|
|
7932
7931
|
this.canvas.backgroundColor = newValue;
|
|
7933
|
-
|
|
7934
|
-
else {
|
|
7932
|
+
else
|
|
7935
7933
|
this.forceRender();
|
|
7936
|
-
}
|
|
7937
7934
|
}
|
|
7938
7935
|
__onCreated() {
|
|
7939
7936
|
this.created = true;
|
|
@@ -8000,13 +7997,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8000
7997
|
if (bind)
|
|
8001
7998
|
item = item.bind(bind);
|
|
8002
7999
|
this.__viewCompletedWait.push(item);
|
|
8003
|
-
if (this.viewCompleted)
|
|
8000
|
+
if (this.viewCompleted)
|
|
8004
8001
|
this.__checkViewCompleted(false);
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
if (!this.running)
|
|
8008
|
-
this.start();
|
|
8009
|
-
}
|
|
8002
|
+
else if (!this.running)
|
|
8003
|
+
this.start();
|
|
8010
8004
|
}
|
|
8011
8005
|
nextRender(item, bind, off) {
|
|
8012
8006
|
if (bind)
|
|
@@ -8020,9 +8014,8 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8020
8014
|
}
|
|
8021
8015
|
}
|
|
8022
8016
|
}
|
|
8023
|
-
else
|
|
8017
|
+
else
|
|
8024
8018
|
list.push(item);
|
|
8025
|
-
}
|
|
8026
8019
|
}
|
|
8027
8020
|
zoom(_zoomType, _padding, _fixedScale) {
|
|
8028
8021
|
return needPlugin('view');
|
|
@@ -8066,10 +8059,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8066
8059
|
this.stop();
|
|
8067
8060
|
this.emitEvent(new LeaferEvent(LeaferEvent.END, this));
|
|
8068
8061
|
this.__removeListenEvents();
|
|
8069
|
-
this.__controllers.forEach(item =>
|
|
8070
|
-
if (!(this.parent && item === this.interaction))
|
|
8071
|
-
item.destroy();
|
|
8072
|
-
});
|
|
8062
|
+
this.__controllers.forEach(item => !(this.parent && item === this.interaction) && item.destroy());
|
|
8073
8063
|
this.__controllers.length = 0;
|
|
8074
8064
|
if (!this.parent) {
|
|
8075
8065
|
if (this.selector)
|
|
@@ -8602,23 +8592,23 @@ let Text = class Text extends UI {
|
|
|
8602
8592
|
}
|
|
8603
8593
|
__updateTextDrawData() {
|
|
8604
8594
|
const data = this.__;
|
|
8605
|
-
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8606
|
-
}
|
|
8607
|
-
__updateBoxBounds() {
|
|
8608
|
-
const data = this.__;
|
|
8609
|
-
const layout = this.__layout;
|
|
8610
8595
|
const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow, padding } = data;
|
|
8611
|
-
const autoWidth = data.__autoWidth;
|
|
8612
|
-
const autoHeight = data.__autoHeight;
|
|
8613
8596
|
data.__lineHeight = UnitConvert.number(lineHeight, fontSize);
|
|
8614
8597
|
data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
|
|
8615
8598
|
data.__padding = padding ? MathHelper.fourNumber(padding) : undefined;
|
|
8616
8599
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
8617
8600
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
8618
8601
|
data.__clipText = textOverflow !== 'show' && !data.__autoSize;
|
|
8602
|
+
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8603
|
+
}
|
|
8604
|
+
__updateBoxBounds() {
|
|
8605
|
+
const data = this.__;
|
|
8606
|
+
const layout = this.__layout;
|
|
8607
|
+
const { fontSize, italic, padding, __autoWidth: autoWidth, __autoHeight: autoHeight } = data;
|
|
8619
8608
|
this.__updateTextDrawData();
|
|
8620
8609
|
const { bounds } = data.__textDrawData;
|
|
8621
8610
|
const b = layout.boxBounds;
|
|
8611
|
+
console.log(bounds, autoWidth, autoHeight);
|
|
8622
8612
|
if (data.__lineHeight < fontSize)
|
|
8623
8613
|
spread(bounds, fontSize / 2);
|
|
8624
8614
|
if (autoWidth || autoHeight) {
|
|
@@ -8628,20 +8618,15 @@ let Text = class Text extends UI {
|
|
|
8628
8618
|
b.height = autoHeight ? bounds.height : data.height;
|
|
8629
8619
|
if (padding) {
|
|
8630
8620
|
const [top, right, bottom, left] = data.__padding;
|
|
8631
|
-
if (autoWidth)
|
|
8632
|
-
b.x -= left;
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
if (autoHeight) {
|
|
8636
|
-
b.y -= top;
|
|
8637
|
-
b.height += (bottom + top);
|
|
8638
|
-
}
|
|
8621
|
+
if (autoWidth)
|
|
8622
|
+
b.x -= left, b.width += (right + left);
|
|
8623
|
+
if (autoHeight)
|
|
8624
|
+
b.y -= top, b.height += (bottom + top);
|
|
8639
8625
|
}
|
|
8640
8626
|
this.__updateNaturalSize();
|
|
8641
8627
|
}
|
|
8642
|
-
else
|
|
8628
|
+
else
|
|
8643
8629
|
super.__updateBoxBounds();
|
|
8644
|
-
}
|
|
8645
8630
|
if (italic)
|
|
8646
8631
|
b.width += fontSize * 0.16;
|
|
8647
8632
|
const contentBounds = includes(b, bounds) ? b : bounds;
|
|
@@ -8764,11 +8749,7 @@ let Pen = class Pen extends Group {
|
|
|
8764
8749
|
this.add(path);
|
|
8765
8750
|
return this;
|
|
8766
8751
|
}
|
|
8767
|
-
beginPath() {
|
|
8768
|
-
this.__path.length = 0;
|
|
8769
|
-
this.paint();
|
|
8770
|
-
return this;
|
|
8771
|
-
}
|
|
8752
|
+
beginPath() { return this; }
|
|
8772
8753
|
moveTo(_x, _y) { return this; }
|
|
8773
8754
|
lineTo(_x, _y) { return this; }
|
|
8774
8755
|
bezierCurveTo(_x1, _y1, _x2, _y2, _x, _y) { return this; }
|
|
@@ -8795,7 +8776,7 @@ __decorate([
|
|
|
8795
8776
|
penPathType()
|
|
8796
8777
|
], Pen.prototype, "path", void 0);
|
|
8797
8778
|
Pen = __decorate([
|
|
8798
|
-
useModule(PathCreator, ['set', '
|
|
8779
|
+
useModule(PathCreator, ['set', 'path', 'paint']),
|
|
8799
8780
|
registerUI()
|
|
8800
8781
|
], Pen);
|
|
8801
8782
|
function penPathType() {
|
|
@@ -8897,10 +8878,9 @@ let App = class App extends Leafer {
|
|
|
8897
8878
|
}
|
|
8898
8879
|
__render(canvas, options) {
|
|
8899
8880
|
if (canvas.context) {
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
canvas.setTransform(a, b, c, d, e, f);
|
|
8903
|
-
}
|
|
8881
|
+
const m = options.matrix;
|
|
8882
|
+
if (m)
|
|
8883
|
+
canvas.setTransform(m.a, m.b, m.c, m.d, m.e, m.f);
|
|
8904
8884
|
this.children.forEach(leafer => canvas.copyWorld(leafer.canvas));
|
|
8905
8885
|
}
|
|
8906
8886
|
}
|
|
@@ -8970,9 +8950,6 @@ class UIEvent extends Event {
|
|
|
8970
8950
|
constructor(params) {
|
|
8971
8951
|
super(params.type);
|
|
8972
8952
|
this.bubbles = true;
|
|
8973
|
-
this.getInner = this.getInnerPoint;
|
|
8974
|
-
this.getLocal = this.getLocalPoint;
|
|
8975
|
-
this.getPage = this.getPagePoint;
|
|
8976
8953
|
Object.assign(this, params);
|
|
8977
8954
|
}
|
|
8978
8955
|
getBoxPoint(relative) {
|
|
@@ -8993,6 +8970,9 @@ class UIEvent extends Event {
|
|
|
8993
8970
|
getPagePoint() {
|
|
8994
8971
|
return this.current.getPagePoint(this);
|
|
8995
8972
|
}
|
|
8973
|
+
getInner(relative) { return this.getInnerPoint(relative); }
|
|
8974
|
+
getLocal(relative) { return this.getLocalPoint(relative); }
|
|
8975
|
+
getPage() { return this.getPagePoint(); }
|
|
8996
8976
|
static changeName(oldName, newName) {
|
|
8997
8977
|
EventCreator.changeName(oldName, newName);
|
|
8998
8978
|
}
|
|
@@ -9024,7 +9004,7 @@ PointerEvent = __decorate([
|
|
|
9024
9004
|
], PointerEvent);
|
|
9025
9005
|
const MyPointerEvent = PointerEvent;
|
|
9026
9006
|
|
|
9027
|
-
const
|
|
9007
|
+
const tempMove = {};
|
|
9028
9008
|
let DragEvent = class DragEvent extends PointerEvent {
|
|
9029
9009
|
static setList(data) {
|
|
9030
9010
|
this.list = data instanceof LeafList ? data : new LeafList(data);
|
|
@@ -9075,19 +9055,19 @@ let DragEvent = class DragEvent extends PointerEvent {
|
|
|
9075
9055
|
}
|
|
9076
9056
|
getPageMove(total) {
|
|
9077
9057
|
this.assignMove(total);
|
|
9078
|
-
return this.current.getPagePoint(
|
|
9058
|
+
return this.current.getPagePoint(tempMove, null, true);
|
|
9079
9059
|
}
|
|
9080
9060
|
getInnerMove(relative, total) {
|
|
9081
9061
|
if (!relative)
|
|
9082
9062
|
relative = this.current;
|
|
9083
9063
|
this.assignMove(total);
|
|
9084
|
-
return relative.getInnerPoint(
|
|
9064
|
+
return relative.getInnerPoint(tempMove, null, true);
|
|
9085
9065
|
}
|
|
9086
9066
|
getLocalMove(relative, total) {
|
|
9087
9067
|
if (!relative)
|
|
9088
9068
|
relative = this.current;
|
|
9089
9069
|
this.assignMove(total);
|
|
9090
|
-
return relative.getLocalPoint(
|
|
9070
|
+
return relative.getLocalPoint(tempMove, null, true);
|
|
9091
9071
|
}
|
|
9092
9072
|
getPageTotal() {
|
|
9093
9073
|
return this.getPageMove(true);
|
|
@@ -9107,8 +9087,8 @@ let DragEvent = class DragEvent extends PointerEvent {
|
|
|
9107
9087
|
return bounds;
|
|
9108
9088
|
}
|
|
9109
9089
|
assignMove(total) {
|
|
9110
|
-
|
|
9111
|
-
|
|
9090
|
+
tempMove.x = total ? this.totalX : this.moveX;
|
|
9091
|
+
tempMove.y = total ? this.totalY : this.moveY;
|
|
9112
9092
|
}
|
|
9113
9093
|
};
|
|
9114
9094
|
DragEvent.BEFORE_DRAG = 'drag.before_drag';
|
|
@@ -9522,9 +9502,8 @@ class Dragger {
|
|
|
9522
9502
|
interaction.emit(DragEvent.OVER, data, path);
|
|
9523
9503
|
}
|
|
9524
9504
|
}
|
|
9525
|
-
else
|
|
9505
|
+
else
|
|
9526
9506
|
interaction.emit(DragEvent.OVER, data, path);
|
|
9527
|
-
}
|
|
9528
9507
|
}
|
|
9529
9508
|
dragEnterOrLeave(data) {
|
|
9530
9509
|
const { interaction } = this;
|
|
@@ -9545,9 +9524,8 @@ class Dragger {
|
|
|
9545
9524
|
this.drag(data);
|
|
9546
9525
|
this.animate(() => { this.dragEnd(data, 1); });
|
|
9547
9526
|
}
|
|
9548
|
-
else
|
|
9527
|
+
else
|
|
9549
9528
|
this.dragEndReal(data);
|
|
9550
|
-
}
|
|
9551
9529
|
}
|
|
9552
9530
|
dragEndReal(data) {
|
|
9553
9531
|
const { interaction, downData, dragData } = this;
|
|
@@ -9744,14 +9722,16 @@ const { pathHasEventType, getMoveEventData, getZoomEventData, getRotateEventData
|
|
|
9744
9722
|
class InteractionBase {
|
|
9745
9723
|
get dragging() { return this.dragger.dragging; }
|
|
9746
9724
|
get transforming() { return this.transformer.transforming; }
|
|
9747
|
-
get moveMode() { return this.
|
|
9748
|
-
get canHover() { return this.
|
|
9749
|
-
get isDragEmpty() { return this.
|
|
9750
|
-
get isMobileDragEmpty() { return this.
|
|
9751
|
-
get isHoldMiddleKey() { return this.
|
|
9752
|
-
get isHoldRightKey() { return this.
|
|
9753
|
-
get isHoldSpaceKey() { return this.
|
|
9754
|
-
get
|
|
9725
|
+
get moveMode() { return this.m.drag === true || this.isHoldSpaceKey || this.isHoldMiddleKey || (this.isHoldRightKey && this.dragger.moving) || this.isDragEmpty; }
|
|
9726
|
+
get canHover() { return this.p.hover && !this.config.mobile; }
|
|
9727
|
+
get isDragEmpty() { return this.m.dragEmpty && this.isRootPath(this.hoverData) && (!this.downData || this.isRootPath(this.downData)); }
|
|
9728
|
+
get isMobileDragEmpty() { return this.m.dragEmpty && !this.canHover && this.downData && this.isTreePath(this.downData); }
|
|
9729
|
+
get isHoldMiddleKey() { return this.m.holdMiddleKey && this.downData && PointerButton.middle(this.downData); }
|
|
9730
|
+
get isHoldRightKey() { return this.m.holdRightKey && this.downData && PointerButton.right(this.downData); }
|
|
9731
|
+
get isHoldSpaceKey() { return this.m.holdSpaceKey && Keyboard.isHoldSpaceKey(); }
|
|
9732
|
+
get m() { return this.config.move; }
|
|
9733
|
+
get p() { return this.config.pointer; }
|
|
9734
|
+
get hitRadius() { return this.p.hitRadius; }
|
|
9755
9735
|
constructor(target, canvas, selector, userConfig) {
|
|
9756
9736
|
this.config = DataHelper.clone(config);
|
|
9757
9737
|
this.tapCount = 0;
|
|
@@ -9809,7 +9789,7 @@ class InteractionBase {
|
|
|
9809
9789
|
}
|
|
9810
9790
|
}
|
|
9811
9791
|
pointerMoveReal(data) {
|
|
9812
|
-
const { dragHover, dragDistance } = this.
|
|
9792
|
+
const { dragHover, dragDistance } = this.p;
|
|
9813
9793
|
this.emit(PointerEvent.BEFORE_MOVE, data, this.defaultPath);
|
|
9814
9794
|
if (this.downData) {
|
|
9815
9795
|
const canDrag = PointHelper.getDistance(this.downData, data) > dragDistance;
|
|
@@ -9994,7 +9974,7 @@ class InteractionBase {
|
|
|
9994
9974
|
}
|
|
9995
9975
|
}
|
|
9996
9976
|
findPath(data, options) {
|
|
9997
|
-
const { hitRadius, through } = this.
|
|
9977
|
+
const { hitRadius, through } = this.p;
|
|
9998
9978
|
const { bottomList } = this;
|
|
9999
9979
|
const find = this.selector.getByPoint(data, hitRadius, Object.assign({ bottomList, name: data.type }, (options || { through })));
|
|
10000
9980
|
if (find.throughPath)
|
|
@@ -10016,7 +9996,7 @@ class InteractionBase {
|
|
|
10016
9996
|
data.path = this.defaultPath;
|
|
10017
9997
|
}
|
|
10018
9998
|
canMove(data) {
|
|
10019
|
-
return data && (this.moveMode || (this.
|
|
9999
|
+
return data && (this.moveMode || (this.m.drag === 'auto' && !pathCanDrag(data.path))) && !pathHasOutside(data.path);
|
|
10020
10000
|
}
|
|
10021
10001
|
isDrag(leaf) {
|
|
10022
10002
|
return this.dragger.getList().has(leaf);
|
|
@@ -10114,7 +10094,7 @@ class InteractionBase {
|
|
|
10114
10094
|
this.longPressTimer = setTimeout(() => {
|
|
10115
10095
|
this.longPressed = true;
|
|
10116
10096
|
this.emit(PointerEvent.LONG_PRESS, data);
|
|
10117
|
-
}, this.
|
|
10097
|
+
}, this.p.longPressTime);
|
|
10118
10098
|
}
|
|
10119
10099
|
longTap(data) {
|
|
10120
10100
|
let hasLong;
|
|
@@ -10367,14 +10347,10 @@ function fillText(ui, canvas) {
|
|
|
10367
10347
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
10368
10348
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10369
10349
|
row = rows[i];
|
|
10370
|
-
if (row.text)
|
|
10350
|
+
if (row.text)
|
|
10371
10351
|
canvas.fillText(row.text, row.x, row.y);
|
|
10372
|
-
|
|
10373
|
-
|
|
10374
|
-
row.data.forEach(charData => {
|
|
10375
|
-
canvas.fillText(charData.char, charData.x, row.y);
|
|
10376
|
-
});
|
|
10377
|
-
}
|
|
10352
|
+
else if (row.data)
|
|
10353
|
+
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
10378
10354
|
if (decorationY)
|
|
10379
10355
|
canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
10380
10356
|
}
|
|
@@ -10440,12 +10416,10 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
|
|
|
10440
10416
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
10441
10417
|
fillText(ui, out);
|
|
10442
10418
|
out.blendMode = 'normal';
|
|
10443
|
-
if (ui.__worldFlipped)
|
|
10419
|
+
if (ui.__worldFlipped)
|
|
10444
10420
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10445
|
-
|
|
10446
|
-
else {
|
|
10421
|
+
else
|
|
10447
10422
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10448
|
-
}
|
|
10449
10423
|
out.recycle(ui.__nowWorld);
|
|
10450
10424
|
}
|
|
10451
10425
|
function drawTextStroke(ui, canvas) {
|
|
@@ -10453,14 +10427,10 @@ function drawTextStroke(ui, canvas) {
|
|
|
10453
10427
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
10454
10428
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10455
10429
|
row = rows[i];
|
|
10456
|
-
if (row.text)
|
|
10430
|
+
if (row.text)
|
|
10457
10431
|
canvas.strokeText(row.text, row.x, row.y);
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
row.data.forEach(charData => {
|
|
10461
|
-
canvas.strokeText(charData.char, charData.x, row.y);
|
|
10462
|
-
});
|
|
10463
|
-
}
|
|
10432
|
+
else if (row.data)
|
|
10433
|
+
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
10464
10434
|
if (decorationY)
|
|
10465
10435
|
canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
10466
10436
|
}
|
|
@@ -10513,12 +10483,10 @@ function stroke(stroke, ui, canvas) {
|
|
|
10513
10483
|
out.stroke();
|
|
10514
10484
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
10515
10485
|
out.clearWorld(ui.__layout.renderBounds);
|
|
10516
|
-
if (ui.__worldFlipped)
|
|
10486
|
+
if (ui.__worldFlipped)
|
|
10517
10487
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10518
|
-
|
|
10519
|
-
else {
|
|
10488
|
+
else
|
|
10520
10489
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10521
|
-
}
|
|
10522
10490
|
out.recycle(ui.__nowWorld);
|
|
10523
10491
|
break;
|
|
10524
10492
|
}
|
|
@@ -10553,12 +10521,10 @@ function strokes(strokes, ui, canvas) {
|
|
|
10553
10521
|
drawStrokesStyle(strokes, false, ui, out);
|
|
10554
10522
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
10555
10523
|
out.clearWorld(renderBounds);
|
|
10556
|
-
if (ui.__worldFlipped)
|
|
10524
|
+
if (ui.__worldFlipped)
|
|
10557
10525
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10558
|
-
|
|
10559
|
-
else {
|
|
10526
|
+
else
|
|
10560
10527
|
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
10561
|
-
}
|
|
10562
10528
|
out.recycle(ui.__nowWorld);
|
|
10563
10529
|
break;
|
|
10564
10530
|
}
|
|
@@ -10622,12 +10588,7 @@ function compute(attrName, ui) {
|
|
|
10622
10588
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
10623
10589
|
if (leafPaints.length && leafPaints[0].image)
|
|
10624
10590
|
hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
|
|
10625
|
-
|
|
10626
|
-
data.__pixelFill = hasOpacityPixel;
|
|
10627
|
-
}
|
|
10628
|
-
else {
|
|
10629
|
-
data.__pixelStroke = hasOpacityPixel;
|
|
10630
|
-
}
|
|
10591
|
+
attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
|
|
10631
10592
|
}
|
|
10632
10593
|
function getLeafPaint(attrName, paint, ui) {
|
|
10633
10594
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|