leafer-ui 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/README.md +2 -0
- package/dist/web.cjs +13 -32
- package/dist/web.esm.js +13 -32
- package/dist/web.js +78 -117
- package/dist/web.min.js +1 -1
- package/dist/web.module.js +78 -117
- package/dist/web.module.min.js +1 -1
- package/package.json +11 -11
package/dist/web.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
|
const debug$7 = Debug.get('LeaferCanvas');
|
|
5962
5965
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -7130,12 +7133,8 @@ const State = {
|
|
|
7130
7133
|
};
|
|
7131
7134
|
const Transition = {
|
|
7132
7135
|
list: {},
|
|
7133
|
-
register(attrName, fn) {
|
|
7134
|
-
|
|
7135
|
-
},
|
|
7136
|
-
get(attrName) {
|
|
7137
|
-
return Transition.list[attrName];
|
|
7138
|
-
}
|
|
7136
|
+
register(attrName, fn) { Transition.list[attrName] = fn; },
|
|
7137
|
+
get(attrName) { return Transition.list[attrName]; }
|
|
7139
7138
|
};
|
|
7140
7139
|
|
|
7141
7140
|
const { parse, objectToCanvasData } = PathConvert;
|
|
@@ -7581,8 +7580,8 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7581
7580
|
pen.set(path = []), this.__drawPathByBox(pen);
|
|
7582
7581
|
return curve ? PathConvert.toCanvasData(path, true) : path;
|
|
7583
7582
|
}
|
|
7584
|
-
getPathString(curve, pathForRender) {
|
|
7585
|
-
return PathConvert.stringify(this.getPath(curve, pathForRender));
|
|
7583
|
+
getPathString(curve, pathForRender, floatLength) {
|
|
7584
|
+
return PathConvert.stringify(this.getPath(curve, pathForRender), floatLength);
|
|
7586
7585
|
}
|
|
7587
7586
|
load() {
|
|
7588
7587
|
this.__.__computePaint();
|
|
@@ -7991,11 +7990,11 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7991
7990
|
start() {
|
|
7992
7991
|
clearTimeout(this.__startTimer);
|
|
7993
7992
|
if (!this.running && this.canvas) {
|
|
7993
|
+
this.running = true;
|
|
7994
7994
|
this.ready ? this.emitLeafer(LeaferEvent.RESTART) : this.emitLeafer(LeaferEvent.START);
|
|
7995
7995
|
this.__controllers.forEach(item => item.start());
|
|
7996
7996
|
if (!this.isApp)
|
|
7997
7997
|
this.renderer.render();
|
|
7998
|
-
this.running = true;
|
|
7999
7998
|
}
|
|
8000
7999
|
}
|
|
8001
8000
|
stop() {
|
|
@@ -8101,12 +8100,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8101
8100
|
}
|
|
8102
8101
|
__changeFill(newValue) {
|
|
8103
8102
|
this.config.fill = newValue;
|
|
8104
|
-
if (this.canvas.allowBackgroundColor)
|
|
8103
|
+
if (this.canvas.allowBackgroundColor)
|
|
8105
8104
|
this.canvas.backgroundColor = newValue;
|
|
8106
|
-
|
|
8107
|
-
else {
|
|
8105
|
+
else
|
|
8108
8106
|
this.forceRender();
|
|
8109
|
-
}
|
|
8110
8107
|
}
|
|
8111
8108
|
__onCreated() {
|
|
8112
8109
|
this.created = true;
|
|
@@ -8173,13 +8170,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8173
8170
|
if (bind)
|
|
8174
8171
|
item = item.bind(bind);
|
|
8175
8172
|
this.__viewCompletedWait.push(item);
|
|
8176
|
-
if (this.viewCompleted)
|
|
8173
|
+
if (this.viewCompleted)
|
|
8177
8174
|
this.__checkViewCompleted(false);
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
if (!this.running)
|
|
8181
|
-
this.start();
|
|
8182
|
-
}
|
|
8175
|
+
else if (!this.running)
|
|
8176
|
+
this.start();
|
|
8183
8177
|
}
|
|
8184
8178
|
nextRender(item, bind, off) {
|
|
8185
8179
|
if (bind)
|
|
@@ -8193,9 +8187,8 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8193
8187
|
}
|
|
8194
8188
|
}
|
|
8195
8189
|
}
|
|
8196
|
-
else
|
|
8190
|
+
else
|
|
8197
8191
|
list.push(item);
|
|
8198
|
-
}
|
|
8199
8192
|
}
|
|
8200
8193
|
zoom(_zoomType, _padding, _fixedScale) {
|
|
8201
8194
|
return needPlugin('view');
|
|
@@ -8239,10 +8232,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8239
8232
|
this.stop();
|
|
8240
8233
|
this.emitEvent(new LeaferEvent(LeaferEvent.END, this));
|
|
8241
8234
|
this.__removeListenEvents();
|
|
8242
|
-
this.__controllers.forEach(item =>
|
|
8243
|
-
if (!(this.parent && item === this.interaction))
|
|
8244
|
-
item.destroy();
|
|
8245
|
-
});
|
|
8235
|
+
this.__controllers.forEach(item => !(this.parent && item === this.interaction) && item.destroy());
|
|
8246
8236
|
this.__controllers.length = 0;
|
|
8247
8237
|
if (!this.parent) {
|
|
8248
8238
|
if (this.selector)
|
|
@@ -8775,23 +8765,23 @@ let Text = class Text extends UI {
|
|
|
8775
8765
|
}
|
|
8776
8766
|
__updateTextDrawData() {
|
|
8777
8767
|
const data = this.__;
|
|
8778
|
-
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8779
|
-
}
|
|
8780
|
-
__updateBoxBounds() {
|
|
8781
|
-
const data = this.__;
|
|
8782
|
-
const layout = this.__layout;
|
|
8783
8768
|
const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow, padding } = data;
|
|
8784
|
-
const autoWidth = data.__autoWidth;
|
|
8785
|
-
const autoHeight = data.__autoHeight;
|
|
8786
8769
|
data.__lineHeight = UnitConvert.number(lineHeight, fontSize);
|
|
8787
8770
|
data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
|
|
8788
8771
|
data.__padding = padding ? MathHelper.fourNumber(padding) : undefined;
|
|
8789
8772
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
8790
8773
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
8791
8774
|
data.__clipText = textOverflow !== 'show' && !data.__autoSize;
|
|
8775
|
+
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8776
|
+
}
|
|
8777
|
+
__updateBoxBounds() {
|
|
8778
|
+
const data = this.__;
|
|
8779
|
+
const layout = this.__layout;
|
|
8780
|
+
const { fontSize, italic, padding, __autoWidth: autoWidth, __autoHeight: autoHeight } = data;
|
|
8792
8781
|
this.__updateTextDrawData();
|
|
8793
8782
|
const { bounds } = data.__textDrawData;
|
|
8794
8783
|
const b = layout.boxBounds;
|
|
8784
|
+
console.log(bounds, autoWidth, autoHeight);
|
|
8795
8785
|
if (data.__lineHeight < fontSize)
|
|
8796
8786
|
spread(bounds, fontSize / 2);
|
|
8797
8787
|
if (autoWidth || autoHeight) {
|
|
@@ -8801,20 +8791,15 @@ let Text = class Text extends UI {
|
|
|
8801
8791
|
b.height = autoHeight ? bounds.height : data.height;
|
|
8802
8792
|
if (padding) {
|
|
8803
8793
|
const [top, right, bottom, left] = data.__padding;
|
|
8804
|
-
if (autoWidth)
|
|
8805
|
-
b.x -= left;
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
if (autoHeight) {
|
|
8809
|
-
b.y -= top;
|
|
8810
|
-
b.height += (bottom + top);
|
|
8811
|
-
}
|
|
8794
|
+
if (autoWidth)
|
|
8795
|
+
b.x -= left, b.width += (right + left);
|
|
8796
|
+
if (autoHeight)
|
|
8797
|
+
b.y -= top, b.height += (bottom + top);
|
|
8812
8798
|
}
|
|
8813
8799
|
this.__updateNaturalSize();
|
|
8814
8800
|
}
|
|
8815
|
-
else
|
|
8801
|
+
else
|
|
8816
8802
|
super.__updateBoxBounds();
|
|
8817
|
-
}
|
|
8818
8803
|
if (italic)
|
|
8819
8804
|
b.width += fontSize * 0.16;
|
|
8820
8805
|
const contentBounds = includes(b, bounds) ? b : bounds;
|
|
@@ -8937,11 +8922,7 @@ let Pen = class Pen extends Group {
|
|
|
8937
8922
|
this.add(path);
|
|
8938
8923
|
return this;
|
|
8939
8924
|
}
|
|
8940
|
-
beginPath() {
|
|
8941
|
-
this.__path.length = 0;
|
|
8942
|
-
this.paint();
|
|
8943
|
-
return this;
|
|
8944
|
-
}
|
|
8925
|
+
beginPath() { return this; }
|
|
8945
8926
|
moveTo(_x, _y) { return this; }
|
|
8946
8927
|
lineTo(_x, _y) { return this; }
|
|
8947
8928
|
bezierCurveTo(_x1, _y1, _x2, _y2, _x, _y) { return this; }
|
|
@@ -8968,7 +8949,7 @@ __decorate([
|
|
|
8968
8949
|
penPathType()
|
|
8969
8950
|
], Pen.prototype, "path", void 0);
|
|
8970
8951
|
Pen = __decorate([
|
|
8971
|
-
useModule(PathCreator, ['set', '
|
|
8952
|
+
useModule(PathCreator, ['set', 'path', 'paint']),
|
|
8972
8953
|
registerUI()
|
|
8973
8954
|
], Pen);
|
|
8974
8955
|
function penPathType() {
|
|
@@ -9070,10 +9051,9 @@ let App = class App extends Leafer {
|
|
|
9070
9051
|
}
|
|
9071
9052
|
__render(canvas, options) {
|
|
9072
9053
|
if (canvas.context) {
|
|
9073
|
-
|
|
9074
|
-
|
|
9075
|
-
canvas.setTransform(a, b, c, d, e, f);
|
|
9076
|
-
}
|
|
9054
|
+
const m = options.matrix;
|
|
9055
|
+
if (m)
|
|
9056
|
+
canvas.setTransform(m.a, m.b, m.c, m.d, m.e, m.f);
|
|
9077
9057
|
this.children.forEach(leafer => canvas.copyWorld(leafer.canvas));
|
|
9078
9058
|
}
|
|
9079
9059
|
}
|
|
@@ -9143,9 +9123,6 @@ class UIEvent extends Event {
|
|
|
9143
9123
|
constructor(params) {
|
|
9144
9124
|
super(params.type);
|
|
9145
9125
|
this.bubbles = true;
|
|
9146
|
-
this.getInner = this.getInnerPoint;
|
|
9147
|
-
this.getLocal = this.getLocalPoint;
|
|
9148
|
-
this.getPage = this.getPagePoint;
|
|
9149
9126
|
Object.assign(this, params);
|
|
9150
9127
|
}
|
|
9151
9128
|
getBoxPoint(relative) {
|
|
@@ -9166,6 +9143,9 @@ class UIEvent extends Event {
|
|
|
9166
9143
|
getPagePoint() {
|
|
9167
9144
|
return this.current.getPagePoint(this);
|
|
9168
9145
|
}
|
|
9146
|
+
getInner(relative) { return this.getInnerPoint(relative); }
|
|
9147
|
+
getLocal(relative) { return this.getLocalPoint(relative); }
|
|
9148
|
+
getPage() { return this.getPagePoint(); }
|
|
9169
9149
|
static changeName(oldName, newName) {
|
|
9170
9150
|
EventCreator.changeName(oldName, newName);
|
|
9171
9151
|
}
|
|
@@ -9197,7 +9177,7 @@ PointerEvent = __decorate([
|
|
|
9197
9177
|
], PointerEvent);
|
|
9198
9178
|
const MyPointerEvent = PointerEvent;
|
|
9199
9179
|
|
|
9200
|
-
const
|
|
9180
|
+
const tempMove = {};
|
|
9201
9181
|
let DragEvent = class DragEvent extends PointerEvent {
|
|
9202
9182
|
static setList(data) {
|
|
9203
9183
|
this.list = data instanceof LeafList ? data : new LeafList(data);
|
|
@@ -9248,19 +9228,19 @@ let DragEvent = class DragEvent extends PointerEvent {
|
|
|
9248
9228
|
}
|
|
9249
9229
|
getPageMove(total) {
|
|
9250
9230
|
this.assignMove(total);
|
|
9251
|
-
return this.current.getPagePoint(
|
|
9231
|
+
return this.current.getPagePoint(tempMove, null, true);
|
|
9252
9232
|
}
|
|
9253
9233
|
getInnerMove(relative, total) {
|
|
9254
9234
|
if (!relative)
|
|
9255
9235
|
relative = this.current;
|
|
9256
9236
|
this.assignMove(total);
|
|
9257
|
-
return relative.getInnerPoint(
|
|
9237
|
+
return relative.getInnerPoint(tempMove, null, true);
|
|
9258
9238
|
}
|
|
9259
9239
|
getLocalMove(relative, total) {
|
|
9260
9240
|
if (!relative)
|
|
9261
9241
|
relative = this.current;
|
|
9262
9242
|
this.assignMove(total);
|
|
9263
|
-
return relative.getLocalPoint(
|
|
9243
|
+
return relative.getLocalPoint(tempMove, null, true);
|
|
9264
9244
|
}
|
|
9265
9245
|
getPageTotal() {
|
|
9266
9246
|
return this.getPageMove(true);
|
|
@@ -9280,8 +9260,8 @@ let DragEvent = class DragEvent extends PointerEvent {
|
|
|
9280
9260
|
return bounds;
|
|
9281
9261
|
}
|
|
9282
9262
|
assignMove(total) {
|
|
9283
|
-
|
|
9284
|
-
|
|
9263
|
+
tempMove.x = total ? this.totalX : this.moveX;
|
|
9264
|
+
tempMove.y = total ? this.totalY : this.moveY;
|
|
9285
9265
|
}
|
|
9286
9266
|
};
|
|
9287
9267
|
DragEvent.BEFORE_DRAG = 'drag.before_drag';
|
|
@@ -9695,9 +9675,8 @@ class Dragger {
|
|
|
9695
9675
|
interaction.emit(DragEvent.OVER, data, path);
|
|
9696
9676
|
}
|
|
9697
9677
|
}
|
|
9698
|
-
else
|
|
9678
|
+
else
|
|
9699
9679
|
interaction.emit(DragEvent.OVER, data, path);
|
|
9700
|
-
}
|
|
9701
9680
|
}
|
|
9702
9681
|
dragEnterOrLeave(data) {
|
|
9703
9682
|
const { interaction } = this;
|
|
@@ -9718,9 +9697,8 @@ class Dragger {
|
|
|
9718
9697
|
this.drag(data);
|
|
9719
9698
|
this.animate(() => { this.dragEnd(data, 1); });
|
|
9720
9699
|
}
|
|
9721
|
-
else
|
|
9700
|
+
else
|
|
9722
9701
|
this.dragEndReal(data);
|
|
9723
|
-
}
|
|
9724
9702
|
}
|
|
9725
9703
|
dragEndReal(data) {
|
|
9726
9704
|
const { interaction, downData, dragData } = this;
|
|
@@ -9917,14 +9895,16 @@ const { pathHasEventType, getMoveEventData: getMoveEventData$1, getZoomEventData
|
|
|
9917
9895
|
class InteractionBase {
|
|
9918
9896
|
get dragging() { return this.dragger.dragging; }
|
|
9919
9897
|
get transforming() { return this.transformer.transforming; }
|
|
9920
|
-
get moveMode() { return this.
|
|
9921
|
-
get canHover() { return this.
|
|
9922
|
-
get isDragEmpty() { return this.
|
|
9923
|
-
get isMobileDragEmpty() { return this.
|
|
9924
|
-
get isHoldMiddleKey() { return this.
|
|
9925
|
-
get isHoldRightKey() { return this.
|
|
9926
|
-
get isHoldSpaceKey() { return this.
|
|
9927
|
-
get
|
|
9898
|
+
get moveMode() { return this.m.drag === true || this.isHoldSpaceKey || this.isHoldMiddleKey || (this.isHoldRightKey && this.dragger.moving) || this.isDragEmpty; }
|
|
9899
|
+
get canHover() { return this.p.hover && !this.config.mobile; }
|
|
9900
|
+
get isDragEmpty() { return this.m.dragEmpty && this.isRootPath(this.hoverData) && (!this.downData || this.isRootPath(this.downData)); }
|
|
9901
|
+
get isMobileDragEmpty() { return this.m.dragEmpty && !this.canHover && this.downData && this.isTreePath(this.downData); }
|
|
9902
|
+
get isHoldMiddleKey() { return this.m.holdMiddleKey && this.downData && PointerButton.middle(this.downData); }
|
|
9903
|
+
get isHoldRightKey() { return this.m.holdRightKey && this.downData && PointerButton.right(this.downData); }
|
|
9904
|
+
get isHoldSpaceKey() { return this.m.holdSpaceKey && Keyboard.isHoldSpaceKey(); }
|
|
9905
|
+
get m() { return this.config.move; }
|
|
9906
|
+
get p() { return this.config.pointer; }
|
|
9907
|
+
get hitRadius() { return this.p.hitRadius; }
|
|
9928
9908
|
constructor(target, canvas, selector, userConfig) {
|
|
9929
9909
|
this.config = DataHelper.clone(config);
|
|
9930
9910
|
this.tapCount = 0;
|
|
@@ -9982,7 +9962,7 @@ class InteractionBase {
|
|
|
9982
9962
|
}
|
|
9983
9963
|
}
|
|
9984
9964
|
pointerMoveReal(data) {
|
|
9985
|
-
const { dragHover, dragDistance } = this.
|
|
9965
|
+
const { dragHover, dragDistance } = this.p;
|
|
9986
9966
|
this.emit(PointerEvent.BEFORE_MOVE, data, this.defaultPath);
|
|
9987
9967
|
if (this.downData) {
|
|
9988
9968
|
const canDrag = PointHelper.getDistance(this.downData, data) > dragDistance;
|
|
@@ -10167,7 +10147,7 @@ class InteractionBase {
|
|
|
10167
10147
|
}
|
|
10168
10148
|
}
|
|
10169
10149
|
findPath(data, options) {
|
|
10170
|
-
const { hitRadius, through } = this.
|
|
10150
|
+
const { hitRadius, through } = this.p;
|
|
10171
10151
|
const { bottomList } = this;
|
|
10172
10152
|
const find = this.selector.getByPoint(data, hitRadius, Object.assign({ bottomList, name: data.type }, (options || { through })));
|
|
10173
10153
|
if (find.throughPath)
|
|
@@ -10189,7 +10169,7 @@ class InteractionBase {
|
|
|
10189
10169
|
data.path = this.defaultPath;
|
|
10190
10170
|
}
|
|
10191
10171
|
canMove(data) {
|
|
10192
|
-
return data && (this.moveMode || (this.
|
|
10172
|
+
return data && (this.moveMode || (this.m.drag === 'auto' && !pathCanDrag$1(data.path))) && !pathHasOutside(data.path);
|
|
10193
10173
|
}
|
|
10194
10174
|
isDrag(leaf) {
|
|
10195
10175
|
return this.dragger.getList().has(leaf);
|
|
@@ -10287,7 +10267,7 @@ class InteractionBase {
|
|
|
10287
10267
|
this.longPressTimer = setTimeout(() => {
|
|
10288
10268
|
this.longPressed = true;
|
|
10289
10269
|
this.emit(PointerEvent.LONG_PRESS, data);
|
|
10290
|
-
}, this.
|
|
10270
|
+
}, this.p.longPressTime);
|
|
10291
10271
|
}
|
|
10292
10272
|
longTap(data) {
|
|
10293
10273
|
let hasLong;
|
|
@@ -10892,14 +10872,10 @@ function fillText(ui, canvas) {
|
|
|
10892
10872
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
10893
10873
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10894
10874
|
row = rows[i];
|
|
10895
|
-
if (row.text)
|
|
10875
|
+
if (row.text)
|
|
10896
10876
|
canvas.fillText(row.text, row.x, row.y);
|
|
10897
|
-
|
|
10898
|
-
|
|
10899
|
-
row.data.forEach(charData => {
|
|
10900
|
-
canvas.fillText(charData.char, charData.x, row.y);
|
|
10901
|
-
});
|
|
10902
|
-
}
|
|
10877
|
+
else if (row.data)
|
|
10878
|
+
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
10903
10879
|
if (decorationY)
|
|
10904
10880
|
canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
10905
10881
|
}
|
|
@@ -10965,12 +10941,10 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
|
|
|
10965
10941
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
10966
10942
|
fillText(ui, out);
|
|
10967
10943
|
out.blendMode = 'normal';
|
|
10968
|
-
if (ui.__worldFlipped)
|
|
10944
|
+
if (ui.__worldFlipped)
|
|
10969
10945
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10970
|
-
|
|
10971
|
-
else {
|
|
10946
|
+
else
|
|
10972
10947
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10973
|
-
}
|
|
10974
10948
|
out.recycle(ui.__nowWorld);
|
|
10975
10949
|
}
|
|
10976
10950
|
function drawTextStroke(ui, canvas) {
|
|
@@ -10978,14 +10952,10 @@ function drawTextStroke(ui, canvas) {
|
|
|
10978
10952
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
10979
10953
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10980
10954
|
row = rows[i];
|
|
10981
|
-
if (row.text)
|
|
10955
|
+
if (row.text)
|
|
10982
10956
|
canvas.strokeText(row.text, row.x, row.y);
|
|
10983
|
-
|
|
10984
|
-
|
|
10985
|
-
row.data.forEach(charData => {
|
|
10986
|
-
canvas.strokeText(charData.char, charData.x, row.y);
|
|
10987
|
-
});
|
|
10988
|
-
}
|
|
10957
|
+
else if (row.data)
|
|
10958
|
+
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
10989
10959
|
if (decorationY)
|
|
10990
10960
|
canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
10991
10961
|
}
|
|
@@ -11038,12 +11008,10 @@ function stroke(stroke, ui, canvas) {
|
|
|
11038
11008
|
out.stroke();
|
|
11039
11009
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
11040
11010
|
out.clearWorld(ui.__layout.renderBounds);
|
|
11041
|
-
if (ui.__worldFlipped)
|
|
11011
|
+
if (ui.__worldFlipped)
|
|
11042
11012
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
11043
|
-
|
|
11044
|
-
else {
|
|
11013
|
+
else
|
|
11045
11014
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
11046
|
-
}
|
|
11047
11015
|
out.recycle(ui.__nowWorld);
|
|
11048
11016
|
break;
|
|
11049
11017
|
}
|
|
@@ -11078,12 +11046,10 @@ function strokes(strokes, ui, canvas) {
|
|
|
11078
11046
|
drawStrokesStyle(strokes, false, ui, out);
|
|
11079
11047
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
11080
11048
|
out.clearWorld(renderBounds);
|
|
11081
|
-
if (ui.__worldFlipped)
|
|
11049
|
+
if (ui.__worldFlipped)
|
|
11082
11050
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
11083
|
-
|
|
11084
|
-
else {
|
|
11051
|
+
else
|
|
11085
11052
|
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
11086
|
-
}
|
|
11087
11053
|
out.recycle(ui.__nowWorld);
|
|
11088
11054
|
break;
|
|
11089
11055
|
}
|
|
@@ -11147,12 +11113,7 @@ function compute(attrName, ui) {
|
|
|
11147
11113
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
11148
11114
|
if (leafPaints.length && leafPaints[0].image)
|
|
11149
11115
|
hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
|
|
11150
|
-
|
|
11151
|
-
data.__pixelFill = hasOpacityPixel;
|
|
11152
|
-
}
|
|
11153
|
-
else {
|
|
11154
|
-
data.__pixelStroke = hasOpacityPixel;
|
|
11155
|
-
}
|
|
11116
|
+
attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
|
|
11156
11117
|
}
|
|
11157
11118
|
function getLeafPaint(attrName, paint, ui) {
|
|
11158
11119
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|