@leafer-ui/worker 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker.cjs +13 -32
- package/dist/worker.esm.js +13 -32
- package/dist/worker.js +77 -117
- package/dist/worker.min.js +1 -1
- package/dist/worker.module.js +77 -117
- package/dist/worker.module.min.js +1 -1
- package/package.json +9 -9
package/dist/worker.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 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,20 +8592,19 @@ 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;
|
|
@@ -8628,20 +8617,15 @@ let Text = class Text extends UI {
|
|
|
8628
8617
|
b.height = autoHeight ? bounds.height : data.height;
|
|
8629
8618
|
if (padding) {
|
|
8630
8619
|
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
|
-
}
|
|
8620
|
+
if (autoWidth)
|
|
8621
|
+
b.x -= left, b.width += (right + left);
|
|
8622
|
+
if (autoHeight)
|
|
8623
|
+
b.y -= top, b.height += (bottom + top);
|
|
8639
8624
|
}
|
|
8640
8625
|
this.__updateNaturalSize();
|
|
8641
8626
|
}
|
|
8642
|
-
else
|
|
8627
|
+
else
|
|
8643
8628
|
super.__updateBoxBounds();
|
|
8644
|
-
}
|
|
8645
8629
|
if (italic)
|
|
8646
8630
|
b.width += fontSize * 0.16;
|
|
8647
8631
|
const contentBounds = includes(b, bounds) ? b : bounds;
|
|
@@ -8764,11 +8748,7 @@ let Pen = class Pen extends Group {
|
|
|
8764
8748
|
this.add(path);
|
|
8765
8749
|
return this;
|
|
8766
8750
|
}
|
|
8767
|
-
beginPath() {
|
|
8768
|
-
this.__path.length = 0;
|
|
8769
|
-
this.paint();
|
|
8770
|
-
return this;
|
|
8771
|
-
}
|
|
8751
|
+
beginPath() { return this; }
|
|
8772
8752
|
moveTo(_x, _y) { return this; }
|
|
8773
8753
|
lineTo(_x, _y) { return this; }
|
|
8774
8754
|
bezierCurveTo(_x1, _y1, _x2, _y2, _x, _y) { return this; }
|
|
@@ -8795,7 +8775,7 @@ __decorate([
|
|
|
8795
8775
|
penPathType()
|
|
8796
8776
|
], Pen.prototype, "path", void 0);
|
|
8797
8777
|
Pen = __decorate([
|
|
8798
|
-
useModule(PathCreator, ['set', '
|
|
8778
|
+
useModule(PathCreator, ['set', 'path', 'paint']),
|
|
8799
8779
|
registerUI()
|
|
8800
8780
|
], Pen);
|
|
8801
8781
|
function penPathType() {
|
|
@@ -8897,10 +8877,9 @@ let App = class App extends Leafer {
|
|
|
8897
8877
|
}
|
|
8898
8878
|
__render(canvas, options) {
|
|
8899
8879
|
if (canvas.context) {
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
canvas.setTransform(a, b, c, d, e, f);
|
|
8903
|
-
}
|
|
8880
|
+
const m = options.matrix;
|
|
8881
|
+
if (m)
|
|
8882
|
+
canvas.setTransform(m.a, m.b, m.c, m.d, m.e, m.f);
|
|
8904
8883
|
this.children.forEach(leafer => canvas.copyWorld(leafer.canvas));
|
|
8905
8884
|
}
|
|
8906
8885
|
}
|
|
@@ -8970,9 +8949,6 @@ class UIEvent extends Event {
|
|
|
8970
8949
|
constructor(params) {
|
|
8971
8950
|
super(params.type);
|
|
8972
8951
|
this.bubbles = true;
|
|
8973
|
-
this.getInner = this.getInnerPoint;
|
|
8974
|
-
this.getLocal = this.getLocalPoint;
|
|
8975
|
-
this.getPage = this.getPagePoint;
|
|
8976
8952
|
Object.assign(this, params);
|
|
8977
8953
|
}
|
|
8978
8954
|
getBoxPoint(relative) {
|
|
@@ -8993,6 +8969,9 @@ class UIEvent extends Event {
|
|
|
8993
8969
|
getPagePoint() {
|
|
8994
8970
|
return this.current.getPagePoint(this);
|
|
8995
8971
|
}
|
|
8972
|
+
getInner(relative) { return this.getInnerPoint(relative); }
|
|
8973
|
+
getLocal(relative) { return this.getLocalPoint(relative); }
|
|
8974
|
+
getPage() { return this.getPagePoint(); }
|
|
8996
8975
|
static changeName(oldName, newName) {
|
|
8997
8976
|
EventCreator.changeName(oldName, newName);
|
|
8998
8977
|
}
|
|
@@ -9024,7 +9003,7 @@ PointerEvent = __decorate([
|
|
|
9024
9003
|
], PointerEvent);
|
|
9025
9004
|
const MyPointerEvent = PointerEvent;
|
|
9026
9005
|
|
|
9027
|
-
const
|
|
9006
|
+
const tempMove = {};
|
|
9028
9007
|
let DragEvent = class DragEvent extends PointerEvent {
|
|
9029
9008
|
static setList(data) {
|
|
9030
9009
|
this.list = data instanceof LeafList ? data : new LeafList(data);
|
|
@@ -9075,19 +9054,19 @@ let DragEvent = class DragEvent extends PointerEvent {
|
|
|
9075
9054
|
}
|
|
9076
9055
|
getPageMove(total) {
|
|
9077
9056
|
this.assignMove(total);
|
|
9078
|
-
return this.current.getPagePoint(
|
|
9057
|
+
return this.current.getPagePoint(tempMove, null, true);
|
|
9079
9058
|
}
|
|
9080
9059
|
getInnerMove(relative, total) {
|
|
9081
9060
|
if (!relative)
|
|
9082
9061
|
relative = this.current;
|
|
9083
9062
|
this.assignMove(total);
|
|
9084
|
-
return relative.getInnerPoint(
|
|
9063
|
+
return relative.getInnerPoint(tempMove, null, true);
|
|
9085
9064
|
}
|
|
9086
9065
|
getLocalMove(relative, total) {
|
|
9087
9066
|
if (!relative)
|
|
9088
9067
|
relative = this.current;
|
|
9089
9068
|
this.assignMove(total);
|
|
9090
|
-
return relative.getLocalPoint(
|
|
9069
|
+
return relative.getLocalPoint(tempMove, null, true);
|
|
9091
9070
|
}
|
|
9092
9071
|
getPageTotal() {
|
|
9093
9072
|
return this.getPageMove(true);
|
|
@@ -9107,8 +9086,8 @@ let DragEvent = class DragEvent extends PointerEvent {
|
|
|
9107
9086
|
return bounds;
|
|
9108
9087
|
}
|
|
9109
9088
|
assignMove(total) {
|
|
9110
|
-
|
|
9111
|
-
|
|
9089
|
+
tempMove.x = total ? this.totalX : this.moveX;
|
|
9090
|
+
tempMove.y = total ? this.totalY : this.moveY;
|
|
9112
9091
|
}
|
|
9113
9092
|
};
|
|
9114
9093
|
DragEvent.BEFORE_DRAG = 'drag.before_drag';
|
|
@@ -9522,9 +9501,8 @@ class Dragger {
|
|
|
9522
9501
|
interaction.emit(DragEvent.OVER, data, path);
|
|
9523
9502
|
}
|
|
9524
9503
|
}
|
|
9525
|
-
else
|
|
9504
|
+
else
|
|
9526
9505
|
interaction.emit(DragEvent.OVER, data, path);
|
|
9527
|
-
}
|
|
9528
9506
|
}
|
|
9529
9507
|
dragEnterOrLeave(data) {
|
|
9530
9508
|
const { interaction } = this;
|
|
@@ -9545,9 +9523,8 @@ class Dragger {
|
|
|
9545
9523
|
this.drag(data);
|
|
9546
9524
|
this.animate(() => { this.dragEnd(data, 1); });
|
|
9547
9525
|
}
|
|
9548
|
-
else
|
|
9526
|
+
else
|
|
9549
9527
|
this.dragEndReal(data);
|
|
9550
|
-
}
|
|
9551
9528
|
}
|
|
9552
9529
|
dragEndReal(data) {
|
|
9553
9530
|
const { interaction, downData, dragData } = this;
|
|
@@ -9744,14 +9721,16 @@ const { pathHasEventType, getMoveEventData, getZoomEventData, getRotateEventData
|
|
|
9744
9721
|
class InteractionBase {
|
|
9745
9722
|
get dragging() { return this.dragger.dragging; }
|
|
9746
9723
|
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
|
|
9724
|
+
get moveMode() { return this.m.drag === true || this.isHoldSpaceKey || this.isHoldMiddleKey || (this.isHoldRightKey && this.dragger.moving) || this.isDragEmpty; }
|
|
9725
|
+
get canHover() { return this.p.hover && !this.config.mobile; }
|
|
9726
|
+
get isDragEmpty() { return this.m.dragEmpty && this.isRootPath(this.hoverData) && (!this.downData || this.isRootPath(this.downData)); }
|
|
9727
|
+
get isMobileDragEmpty() { return this.m.dragEmpty && !this.canHover && this.downData && this.isTreePath(this.downData); }
|
|
9728
|
+
get isHoldMiddleKey() { return this.m.holdMiddleKey && this.downData && PointerButton.middle(this.downData); }
|
|
9729
|
+
get isHoldRightKey() { return this.m.holdRightKey && this.downData && PointerButton.right(this.downData); }
|
|
9730
|
+
get isHoldSpaceKey() { return this.m.holdSpaceKey && Keyboard.isHoldSpaceKey(); }
|
|
9731
|
+
get m() { return this.config.move; }
|
|
9732
|
+
get p() { return this.config.pointer; }
|
|
9733
|
+
get hitRadius() { return this.p.hitRadius; }
|
|
9755
9734
|
constructor(target, canvas, selector, userConfig) {
|
|
9756
9735
|
this.config = DataHelper.clone(config);
|
|
9757
9736
|
this.tapCount = 0;
|
|
@@ -9809,7 +9788,7 @@ class InteractionBase {
|
|
|
9809
9788
|
}
|
|
9810
9789
|
}
|
|
9811
9790
|
pointerMoveReal(data) {
|
|
9812
|
-
const { dragHover, dragDistance } = this.
|
|
9791
|
+
const { dragHover, dragDistance } = this.p;
|
|
9813
9792
|
this.emit(PointerEvent.BEFORE_MOVE, data, this.defaultPath);
|
|
9814
9793
|
if (this.downData) {
|
|
9815
9794
|
const canDrag = PointHelper.getDistance(this.downData, data) > dragDistance;
|
|
@@ -9994,7 +9973,7 @@ class InteractionBase {
|
|
|
9994
9973
|
}
|
|
9995
9974
|
}
|
|
9996
9975
|
findPath(data, options) {
|
|
9997
|
-
const { hitRadius, through } = this.
|
|
9976
|
+
const { hitRadius, through } = this.p;
|
|
9998
9977
|
const { bottomList } = this;
|
|
9999
9978
|
const find = this.selector.getByPoint(data, hitRadius, Object.assign({ bottomList, name: data.type }, (options || { through })));
|
|
10000
9979
|
if (find.throughPath)
|
|
@@ -10016,7 +9995,7 @@ class InteractionBase {
|
|
|
10016
9995
|
data.path = this.defaultPath;
|
|
10017
9996
|
}
|
|
10018
9997
|
canMove(data) {
|
|
10019
|
-
return data && (this.moveMode || (this.
|
|
9998
|
+
return data && (this.moveMode || (this.m.drag === 'auto' && !pathCanDrag(data.path))) && !pathHasOutside(data.path);
|
|
10020
9999
|
}
|
|
10021
10000
|
isDrag(leaf) {
|
|
10022
10001
|
return this.dragger.getList().has(leaf);
|
|
@@ -10114,7 +10093,7 @@ class InteractionBase {
|
|
|
10114
10093
|
this.longPressTimer = setTimeout(() => {
|
|
10115
10094
|
this.longPressed = true;
|
|
10116
10095
|
this.emit(PointerEvent.LONG_PRESS, data);
|
|
10117
|
-
}, this.
|
|
10096
|
+
}, this.p.longPressTime);
|
|
10118
10097
|
}
|
|
10119
10098
|
longTap(data) {
|
|
10120
10099
|
let hasLong;
|
|
@@ -10367,14 +10346,10 @@ function fillText(ui, canvas) {
|
|
|
10367
10346
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
10368
10347
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10369
10348
|
row = rows[i];
|
|
10370
|
-
if (row.text)
|
|
10349
|
+
if (row.text)
|
|
10371
10350
|
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
|
-
}
|
|
10351
|
+
else if (row.data)
|
|
10352
|
+
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
10378
10353
|
if (decorationY)
|
|
10379
10354
|
canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
10380
10355
|
}
|
|
@@ -10440,12 +10415,10 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
|
|
|
10440
10415
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
10441
10416
|
fillText(ui, out);
|
|
10442
10417
|
out.blendMode = 'normal';
|
|
10443
|
-
if (ui.__worldFlipped)
|
|
10418
|
+
if (ui.__worldFlipped)
|
|
10444
10419
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10445
|
-
|
|
10446
|
-
else {
|
|
10420
|
+
else
|
|
10447
10421
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10448
|
-
}
|
|
10449
10422
|
out.recycle(ui.__nowWorld);
|
|
10450
10423
|
}
|
|
10451
10424
|
function drawTextStroke(ui, canvas) {
|
|
@@ -10453,14 +10426,10 @@ function drawTextStroke(ui, canvas) {
|
|
|
10453
10426
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
10454
10427
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10455
10428
|
row = rows[i];
|
|
10456
|
-
if (row.text)
|
|
10429
|
+
if (row.text)
|
|
10457
10430
|
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
|
-
}
|
|
10431
|
+
else if (row.data)
|
|
10432
|
+
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
10464
10433
|
if (decorationY)
|
|
10465
10434
|
canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
10466
10435
|
}
|
|
@@ -10513,12 +10482,10 @@ function stroke(stroke, ui, canvas) {
|
|
|
10513
10482
|
out.stroke();
|
|
10514
10483
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
10515
10484
|
out.clearWorld(ui.__layout.renderBounds);
|
|
10516
|
-
if (ui.__worldFlipped)
|
|
10485
|
+
if (ui.__worldFlipped)
|
|
10517
10486
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10518
|
-
|
|
10519
|
-
else {
|
|
10487
|
+
else
|
|
10520
10488
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10521
|
-
}
|
|
10522
10489
|
out.recycle(ui.__nowWorld);
|
|
10523
10490
|
break;
|
|
10524
10491
|
}
|
|
@@ -10553,12 +10520,10 @@ function strokes(strokes, ui, canvas) {
|
|
|
10553
10520
|
drawStrokesStyle(strokes, false, ui, out);
|
|
10554
10521
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
10555
10522
|
out.clearWorld(renderBounds);
|
|
10556
|
-
if (ui.__worldFlipped)
|
|
10523
|
+
if (ui.__worldFlipped)
|
|
10557
10524
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10558
|
-
|
|
10559
|
-
else {
|
|
10525
|
+
else
|
|
10560
10526
|
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
10561
|
-
}
|
|
10562
10527
|
out.recycle(ui.__nowWorld);
|
|
10563
10528
|
break;
|
|
10564
10529
|
}
|
|
@@ -10622,12 +10587,7 @@ function compute(attrName, ui) {
|
|
|
10622
10587
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
10623
10588
|
if (leafPaints.length && leafPaints[0].image)
|
|
10624
10589
|
hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
|
|
10625
|
-
|
|
10626
|
-
data.__pixelFill = hasOpacityPixel;
|
|
10627
|
-
}
|
|
10628
|
-
else {
|
|
10629
|
-
data.__pixelStroke = hasOpacityPixel;
|
|
10630
|
-
}
|
|
10590
|
+
attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
|
|
10631
10591
|
}
|
|
10632
10592
|
function getLeafPaint(attrName, paint, ui) {
|
|
10633
10593
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|