@leafer-ui/miniapp 1.1.0 → 1.1.2
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 +13 -12
- package/dist/miniapp.esm.js +13 -12
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.module.js +130 -360
- package/dist/miniapp.module.min.js +1 -1
- package/package.json +10 -10
package/dist/miniapp.module.js
CHANGED
|
@@ -1411,14 +1411,14 @@ const UICreator = {
|
|
|
1411
1411
|
list: {},
|
|
1412
1412
|
register(UI) {
|
|
1413
1413
|
const { __tag: tag } = UI.prototype;
|
|
1414
|
-
if (list$
|
|
1414
|
+
if (list$1[tag])
|
|
1415
1415
|
debug$e.repeat(tag);
|
|
1416
|
-
list$
|
|
1416
|
+
list$1[tag] = UI;
|
|
1417
1417
|
},
|
|
1418
1418
|
get(tag, data, x, y, width, height) {
|
|
1419
|
-
if (!list$
|
|
1419
|
+
if (!list$1[tag])
|
|
1420
1420
|
debug$e.error('not register ' + tag);
|
|
1421
|
-
const ui = new list$
|
|
1421
|
+
const ui = new list$1[tag](data);
|
|
1422
1422
|
if (x !== undefined) {
|
|
1423
1423
|
ui.x = x;
|
|
1424
1424
|
if (y)
|
|
@@ -1431,7 +1431,7 @@ const UICreator = {
|
|
|
1431
1431
|
return ui;
|
|
1432
1432
|
}
|
|
1433
1433
|
};
|
|
1434
|
-
const { list: list$
|
|
1434
|
+
const { list: list$1 } = UICreator;
|
|
1435
1435
|
|
|
1436
1436
|
const debug$d = Debug.get('EventCreator');
|
|
1437
1437
|
const EventCreator = {
|
|
@@ -1513,17 +1513,19 @@ const DataHelper = {
|
|
|
1513
1513
|
assign(t, defaultData);
|
|
1514
1514
|
return t;
|
|
1515
1515
|
},
|
|
1516
|
-
assign(t, merge) {
|
|
1516
|
+
assign(t, merge, exclude) {
|
|
1517
1517
|
let value;
|
|
1518
1518
|
Object.keys(merge).forEach(key => {
|
|
1519
|
-
var _a;
|
|
1519
|
+
var _a, _b;
|
|
1520
1520
|
value = merge[key];
|
|
1521
|
-
if ((value === null || value === void 0 ? void 0 : value.constructor) === Object)
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1521
|
+
if ((value === null || value === void 0 ? void 0 : value.constructor) === Object && ((_a = t[key]) === null || _a === void 0 ? void 0 : _a.constructor) === Object)
|
|
1522
|
+
return assign(t[key], merge[key], exclude && exclude[key]);
|
|
1523
|
+
if (exclude && (key in exclude)) {
|
|
1524
|
+
if (((_b = exclude[key]) === null || _b === void 0 ? void 0 : _b.constructor) === Object)
|
|
1525
|
+
assign(t[key] = {}, merge[key], exclude[key]);
|
|
1526
|
+
return;
|
|
1526
1527
|
}
|
|
1528
|
+
t[key] = merge[key];
|
|
1527
1529
|
});
|
|
1528
1530
|
},
|
|
1529
1531
|
copyAttrs(t, from, include) {
|
|
@@ -3891,6 +3893,8 @@ function opacityType(defaultValue) {
|
|
|
3891
3893
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3892
3894
|
set(value) {
|
|
3893
3895
|
this.__setAttr(key, value) && (this.__layout.opacityChanged || this.__layout.opacityChange());
|
|
3896
|
+
if (this.mask)
|
|
3897
|
+
checkMask(this);
|
|
3894
3898
|
}
|
|
3895
3899
|
}));
|
|
3896
3900
|
}
|
|
@@ -3907,9 +3911,20 @@ function visibleType(defaultValue) {
|
|
|
3907
3911
|
this.__runAnimation('in');
|
|
3908
3912
|
}
|
|
3909
3913
|
doVisible(this, key, value, oldValue);
|
|
3914
|
+
if (this.mask)
|
|
3915
|
+
checkMask(this);
|
|
3910
3916
|
}
|
|
3911
3917
|
}));
|
|
3912
3918
|
}
|
|
3919
|
+
function checkMask(leaf) {
|
|
3920
|
+
const { parent } = leaf;
|
|
3921
|
+
if (parent) {
|
|
3922
|
+
const { __hasMask } = parent;
|
|
3923
|
+
parent.__updateMask();
|
|
3924
|
+
if (__hasMask !== parent.__hasMask)
|
|
3925
|
+
parent.forceUpdate();
|
|
3926
|
+
}
|
|
3927
|
+
}
|
|
3913
3928
|
function doVisible(leaf, key, value, oldValue) {
|
|
3914
3929
|
if (leaf.__setAttr(key, value)) {
|
|
3915
3930
|
leaf.__layout.opacityChanged || leaf.__layout.opacityChange();
|
|
@@ -4048,11 +4063,11 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
4048
4063
|
}
|
|
4049
4064
|
|
|
4050
4065
|
const debug$8 = new Debug('rewrite');
|
|
4051
|
-
const list
|
|
4066
|
+
const list = [];
|
|
4052
4067
|
const excludeNames = ['destroy', 'constructor'];
|
|
4053
4068
|
function rewrite(method) {
|
|
4054
4069
|
return (target, key) => {
|
|
4055
|
-
list
|
|
4070
|
+
list.push({ name: target.constructor.name + '.' + key, run: () => { target[key] = method; } });
|
|
4056
4071
|
};
|
|
4057
4072
|
}
|
|
4058
4073
|
function rewriteAble() {
|
|
@@ -4061,13 +4076,13 @@ function rewriteAble() {
|
|
|
4061
4076
|
};
|
|
4062
4077
|
}
|
|
4063
4078
|
function doRewrite(error) {
|
|
4064
|
-
if (list
|
|
4065
|
-
list
|
|
4079
|
+
if (list.length) {
|
|
4080
|
+
list.forEach(item => {
|
|
4066
4081
|
if (error)
|
|
4067
4082
|
debug$8.error(item.name, '需在Class上装饰@rewriteAble()');
|
|
4068
4083
|
item.run();
|
|
4069
4084
|
});
|
|
4070
|
-
list
|
|
4085
|
+
list.length = 0;
|
|
4071
4086
|
}
|
|
4072
4087
|
}
|
|
4073
4088
|
setTimeout(() => doRewrite(true));
|
|
@@ -5434,8 +5449,8 @@ let Leaf = class Leaf {
|
|
|
5434
5449
|
canvas.clearRect(r.x, r.y, r.width, r.height);
|
|
5435
5450
|
canvas.restore();
|
|
5436
5451
|
}
|
|
5437
|
-
__updateMask(
|
|
5438
|
-
this.__hasMask =
|
|
5452
|
+
__updateMask(_value) {
|
|
5453
|
+
this.__hasMask = this.children.some(item => item.__.mask && item.__.visible && item.__.opacity);
|
|
5439
5454
|
}
|
|
5440
5455
|
__renderMask(_canvas, _options) { }
|
|
5441
5456
|
__getNowWorld(options) {
|
|
@@ -5678,6 +5693,7 @@ Leaf = __decorate([
|
|
|
5678
5693
|
const { setListWithFn } = BoundsHelper;
|
|
5679
5694
|
const { sort } = BranchHelper;
|
|
5680
5695
|
const { localBoxBounds, localStrokeBounds, localRenderBounds, maskLocalBoxBounds, maskLocalStrokeBounds, maskLocalRenderBounds } = LeafBoundsHelper;
|
|
5696
|
+
const debug$6 = new Debug('Branch');
|
|
5681
5697
|
let Branch = class Branch extends Leaf {
|
|
5682
5698
|
__updateStrokeSpread() {
|
|
5683
5699
|
const { children } = this;
|
|
@@ -5718,8 +5734,8 @@ let Branch = class Branch extends Leaf {
|
|
|
5718
5734
|
}
|
|
5719
5735
|
}
|
|
5720
5736
|
add(child, index) {
|
|
5721
|
-
if (child === this)
|
|
5722
|
-
return;
|
|
5737
|
+
if (child === this || child.destroyed)
|
|
5738
|
+
return debug$6.warn('add self or destroyed');
|
|
5723
5739
|
const noIndex = index === undefined;
|
|
5724
5740
|
if (!child.__) {
|
|
5725
5741
|
if (child instanceof Array)
|
|
@@ -5733,8 +5749,9 @@ let Branch = class Branch extends Leaf {
|
|
|
5733
5749
|
noIndex ? this.children.push(child) : this.children.splice(index, 0, child);
|
|
5734
5750
|
if (child.isBranch)
|
|
5735
5751
|
this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1;
|
|
5736
|
-
|
|
5737
|
-
|
|
5752
|
+
const childLayout = child.__layout;
|
|
5753
|
+
childLayout.boxChanged || childLayout.boxChange();
|
|
5754
|
+
childLayout.matrixChanged || childLayout.matrixChange();
|
|
5738
5755
|
if (child.__bubbleMap)
|
|
5739
5756
|
child.__emitLifeEvent(ChildEvent.ADD);
|
|
5740
5757
|
if (this.leafer) {
|
|
@@ -5972,7 +5989,7 @@ class LeafLevelList {
|
|
|
5972
5989
|
}
|
|
5973
5990
|
}
|
|
5974
5991
|
|
|
5975
|
-
const version = "1.1.
|
|
5992
|
+
const version = "1.1.1";
|
|
5976
5993
|
|
|
5977
5994
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
5978
5995
|
get allowBackgroundColor() { return false; }
|
|
@@ -6386,7 +6403,7 @@ class LayoutBlockData {
|
|
|
6386
6403
|
}
|
|
6387
6404
|
|
|
6388
6405
|
const { updateAllMatrix, updateAllChange } = LeafHelper;
|
|
6389
|
-
const debug$
|
|
6406
|
+
const debug$5 = Debug.get('Layouter');
|
|
6390
6407
|
class Layouter {
|
|
6391
6408
|
constructor(target, userConfig) {
|
|
6392
6409
|
this.totalTimes = 0;
|
|
@@ -6421,7 +6438,7 @@ class Layouter {
|
|
|
6421
6438
|
target.emitEvent(new LayoutEvent(LayoutEvent.END, this.layoutedBlocks, this.times));
|
|
6422
6439
|
}
|
|
6423
6440
|
catch (e) {
|
|
6424
|
-
debug$
|
|
6441
|
+
debug$5.error(e);
|
|
6425
6442
|
}
|
|
6426
6443
|
this.layoutedBlocks = null;
|
|
6427
6444
|
}
|
|
@@ -6435,9 +6452,9 @@ class Layouter {
|
|
|
6435
6452
|
}
|
|
6436
6453
|
layoutOnce() {
|
|
6437
6454
|
if (this.layouting)
|
|
6438
|
-
return debug$
|
|
6455
|
+
return debug$5.warn('layouting');
|
|
6439
6456
|
if (this.times > 3)
|
|
6440
|
-
return debug$
|
|
6457
|
+
return debug$5.warn('layout max times');
|
|
6441
6458
|
this.times++;
|
|
6442
6459
|
this.totalTimes++;
|
|
6443
6460
|
this.layouting = true;
|
|
@@ -6541,7 +6558,7 @@ class Layouter {
|
|
|
6541
6558
|
}
|
|
6542
6559
|
}
|
|
6543
6560
|
|
|
6544
|
-
const debug$
|
|
6561
|
+
const debug$4 = Debug.get('Renderer');
|
|
6545
6562
|
class Renderer {
|
|
6546
6563
|
get needFill() { return !!(!this.canvas.allowBackgroundColor && this.config.fill); }
|
|
6547
6564
|
constructor(target, canvas, userConfig) {
|
|
@@ -6557,29 +6574,29 @@ class Renderer {
|
|
|
6557
6574
|
if (userConfig)
|
|
6558
6575
|
this.config = DataHelper.default(userConfig, this.config);
|
|
6559
6576
|
this.__listenEvents();
|
|
6560
|
-
this.__requestRender();
|
|
6561
6577
|
}
|
|
6562
6578
|
start() {
|
|
6563
6579
|
this.running = true;
|
|
6580
|
+
this.update(false);
|
|
6564
6581
|
}
|
|
6565
6582
|
stop() {
|
|
6566
6583
|
this.running = false;
|
|
6567
6584
|
}
|
|
6568
|
-
update() {
|
|
6569
|
-
this.changed
|
|
6585
|
+
update(change = true) {
|
|
6586
|
+
if (!this.changed)
|
|
6587
|
+
this.changed = change;
|
|
6588
|
+
this.__requestRender();
|
|
6570
6589
|
}
|
|
6571
6590
|
requestLayout() {
|
|
6572
6591
|
this.target.emit(LayoutEvent.REQUEST);
|
|
6573
6592
|
}
|
|
6574
6593
|
render(callback) {
|
|
6575
|
-
if (!(this.running && this.canvas.view))
|
|
6576
|
-
this.
|
|
6577
|
-
return;
|
|
6578
|
-
}
|
|
6594
|
+
if (!(this.running && this.canvas.view))
|
|
6595
|
+
return this.update();
|
|
6579
6596
|
const { target } = this;
|
|
6580
6597
|
this.times = 0;
|
|
6581
6598
|
this.totalBounds = new Bounds();
|
|
6582
|
-
debug$
|
|
6599
|
+
debug$4.log(target.innerName, '--->');
|
|
6583
6600
|
try {
|
|
6584
6601
|
if (!target.isApp)
|
|
6585
6602
|
target.app.emit(RenderEvent.CHILD_START, target);
|
|
@@ -6590,9 +6607,9 @@ class Renderer {
|
|
|
6590
6607
|
}
|
|
6591
6608
|
catch (e) {
|
|
6592
6609
|
this.rendering = false;
|
|
6593
|
-
debug$
|
|
6610
|
+
debug$4.error(e);
|
|
6594
6611
|
}
|
|
6595
|
-
debug$
|
|
6612
|
+
debug$4.log('-------------|');
|
|
6596
6613
|
}
|
|
6597
6614
|
renderAgain() {
|
|
6598
6615
|
if (this.rendering) {
|
|
@@ -6604,9 +6621,9 @@ class Renderer {
|
|
|
6604
6621
|
}
|
|
6605
6622
|
renderOnce(callback) {
|
|
6606
6623
|
if (this.rendering)
|
|
6607
|
-
return debug$
|
|
6624
|
+
return debug$4.warn('rendering');
|
|
6608
6625
|
if (this.times > 3)
|
|
6609
|
-
return debug$
|
|
6626
|
+
return debug$4.warn('render max times');
|
|
6610
6627
|
this.times++;
|
|
6611
6628
|
this.totalTimes++;
|
|
6612
6629
|
this.rendering = true;
|
|
@@ -6643,7 +6660,7 @@ class Renderer {
|
|
|
6643
6660
|
partRender() {
|
|
6644
6661
|
const { canvas, updateBlocks: list } = this;
|
|
6645
6662
|
if (!list)
|
|
6646
|
-
return debug$
|
|
6663
|
+
return debug$4.warn('PartRender: need update attr');
|
|
6647
6664
|
this.mergeBlocks();
|
|
6648
6665
|
list.forEach(block => { if (canvas.bounds.hit(block) && !block.isEmpty())
|
|
6649
6666
|
this.clipRender(block); });
|
|
@@ -6709,16 +6726,17 @@ class Renderer {
|
|
|
6709
6726
|
}
|
|
6710
6727
|
}
|
|
6711
6728
|
__requestRender() {
|
|
6712
|
-
|
|
6729
|
+
if (this.requestTime)
|
|
6730
|
+
return;
|
|
6731
|
+
const requestTime = this.requestTime = Date.now();
|
|
6713
6732
|
Platform.requestRender(() => {
|
|
6714
|
-
this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() -
|
|
6733
|
+
this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - requestTime)));
|
|
6734
|
+
this.requestTime = 0;
|
|
6715
6735
|
if (this.running) {
|
|
6716
6736
|
if (this.changed && this.canvas.view)
|
|
6717
6737
|
this.render();
|
|
6718
6738
|
this.target.emit(RenderEvent.NEXT);
|
|
6719
6739
|
}
|
|
6720
|
-
if (this.target)
|
|
6721
|
-
this.__requestRender();
|
|
6722
6740
|
});
|
|
6723
6741
|
}
|
|
6724
6742
|
__onResize(e) {
|
|
@@ -6734,7 +6752,7 @@ class Renderer {
|
|
|
6734
6752
|
}
|
|
6735
6753
|
}
|
|
6736
6754
|
this.addBlock(new Bounds(0, 0, 1, 1));
|
|
6737
|
-
this.
|
|
6755
|
+
this.update();
|
|
6738
6756
|
}
|
|
6739
6757
|
__onLayoutEnd(event) {
|
|
6740
6758
|
if (event.data)
|
|
@@ -6745,7 +6763,7 @@ class Renderer {
|
|
|
6745
6763
|
empty = (!leaf.__world.width || !leaf.__world.height);
|
|
6746
6764
|
if (empty) {
|
|
6747
6765
|
if (!leaf.isLeafer)
|
|
6748
|
-
debug$
|
|
6766
|
+
debug$4.tip(leaf.innerName, ': empty');
|
|
6749
6767
|
empty = (!leaf.isBranch || leaf.isBranchLeaf);
|
|
6750
6768
|
}
|
|
6751
6769
|
return empty;
|
|
@@ -7120,7 +7138,7 @@ const Transition = {
|
|
|
7120
7138
|
|
|
7121
7139
|
const { parse, objectToCanvasData } = PathConvert;
|
|
7122
7140
|
const emptyPaint = {};
|
|
7123
|
-
const debug$
|
|
7141
|
+
const debug$3 = Debug.get('UIData');
|
|
7124
7142
|
class UIData extends LeafData {
|
|
7125
7143
|
get scale() { const { scaleX, scaleY } = this; return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX; }
|
|
7126
7144
|
get __strokeWidth() {
|
|
@@ -7142,7 +7160,7 @@ class UIData extends LeafData {
|
|
|
7142
7160
|
return true;
|
|
7143
7161
|
return t.fill && this.__hasStroke;
|
|
7144
7162
|
}
|
|
7145
|
-
get __clipAfterFill() { return (
|
|
7163
|
+
get __clipAfterFill() { const t = this; return (t.cornerRadius || t.innerShadow || t.__pathInputed); }
|
|
7146
7164
|
get __autoWidth() { return !this._width; }
|
|
7147
7165
|
get __autoHeight() { return !this._height; }
|
|
7148
7166
|
get __autoSide() { return !this._width || !this._height; }
|
|
@@ -7157,7 +7175,7 @@ class UIData extends LeafData {
|
|
|
7157
7175
|
if (value < 0) {
|
|
7158
7176
|
this._width = -value;
|
|
7159
7177
|
this.__leaf.scaleX *= -1;
|
|
7160
|
-
debug$
|
|
7178
|
+
debug$3.warn('width < 0, instead -scaleX ', this);
|
|
7161
7179
|
}
|
|
7162
7180
|
else
|
|
7163
7181
|
this._width = value;
|
|
@@ -7166,7 +7184,7 @@ class UIData extends LeafData {
|
|
|
7166
7184
|
if (value < 0) {
|
|
7167
7185
|
this._height = -value;
|
|
7168
7186
|
this.__leaf.scaleY *= -1;
|
|
7169
|
-
debug$
|
|
7187
|
+
debug$3.warn('height < 0, instead -scaleY', this);
|
|
7170
7188
|
}
|
|
7171
7189
|
else
|
|
7172
7190
|
this._height = value;
|
|
@@ -7256,7 +7274,7 @@ class GroupData extends UIData {
|
|
|
7256
7274
|
|
|
7257
7275
|
class BoxData extends GroupData {
|
|
7258
7276
|
get __boxStroke() { return !this.__pathInputed; }
|
|
7259
|
-
get __drawAfterFill() { return
|
|
7277
|
+
get __drawAfterFill() { const t = this; return (t.overflow === 'hide' && (t.__clipAfterFill || t.innerShadow) && t.__leaf.children.length); }
|
|
7260
7278
|
get __clipAfterFill() { return this.__leaf.isOverflow || super.__clipAfterFill; }
|
|
7261
7279
|
}
|
|
7262
7280
|
|
|
@@ -7902,7 +7920,7 @@ Group = __decorate([
|
|
|
7902
7920
|
], Group);
|
|
7903
7921
|
|
|
7904
7922
|
var Leafer_1;
|
|
7905
|
-
const debug$
|
|
7923
|
+
const debug$2 = Debug.get('Leafer');
|
|
7906
7924
|
let Leafer = Leafer_1 = class Leafer extends Group {
|
|
7907
7925
|
get __tag() { return 'Leafer'; }
|
|
7908
7926
|
get isApp() { return false; }
|
|
@@ -7916,20 +7934,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7916
7934
|
constructor(userConfig, data) {
|
|
7917
7935
|
super(data);
|
|
7918
7936
|
this.config = {
|
|
7919
|
-
type: 'design',
|
|
7920
7937
|
start: true,
|
|
7921
7938
|
hittable: true,
|
|
7922
7939
|
smooth: true,
|
|
7923
|
-
lazySpeard: 100
|
|
7924
|
-
zoom: {
|
|
7925
|
-
min: 0.01,
|
|
7926
|
-
max: 256
|
|
7927
|
-
},
|
|
7928
|
-
move: {
|
|
7929
|
-
holdSpaceKey: true,
|
|
7930
|
-
holdMiddleKey: true,
|
|
7931
|
-
autoDistance: 2
|
|
7932
|
-
}
|
|
7940
|
+
lazySpeard: 100
|
|
7933
7941
|
};
|
|
7934
7942
|
this.leafs = 0;
|
|
7935
7943
|
this.__eventIds = [];
|
|
@@ -7946,23 +7954,27 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7946
7954
|
init(userConfig, parentApp) {
|
|
7947
7955
|
if (this.canvas)
|
|
7948
7956
|
return;
|
|
7949
|
-
this.__setLeafer(this);
|
|
7950
|
-
if (userConfig)
|
|
7951
|
-
DataHelper.assign(this.config, userConfig);
|
|
7952
7957
|
let start;
|
|
7953
7958
|
const { config } = this;
|
|
7954
|
-
this.
|
|
7959
|
+
this.__setLeafer(this);
|
|
7960
|
+
if (parentApp) {
|
|
7961
|
+
this.parentApp = parentApp;
|
|
7962
|
+
this.__bindApp(parentApp);
|
|
7963
|
+
start = parentApp.running;
|
|
7964
|
+
}
|
|
7965
|
+
if (userConfig) {
|
|
7966
|
+
this.parent = parentApp;
|
|
7967
|
+
this.initType(userConfig.type);
|
|
7968
|
+
this.parent = undefined;
|
|
7969
|
+
DataHelper.assign(config, userConfig);
|
|
7970
|
+
}
|
|
7955
7971
|
const canvas = this.canvas = Creator.canvas(config);
|
|
7956
7972
|
this.__controllers.push(this.renderer = Creator.renderer(this, canvas, config), this.watcher = Creator.watcher(this, config), this.layouter = Creator.layouter(this, config));
|
|
7957
7973
|
if (this.isApp)
|
|
7958
7974
|
this.__setApp();
|
|
7959
7975
|
this.__checkAutoLayout(config, parentApp);
|
|
7960
7976
|
this.view = canvas.view;
|
|
7961
|
-
if (parentApp) {
|
|
7962
|
-
this.__bindApp(parentApp);
|
|
7963
|
-
start = parentApp.running;
|
|
7964
|
-
}
|
|
7965
|
-
else {
|
|
7977
|
+
if (!parentApp) {
|
|
7966
7978
|
this.selector = Creator.selector(this);
|
|
7967
7979
|
this.interaction = Creator.interaction(this, canvas, this.selector, config);
|
|
7968
7980
|
if (this.interaction) {
|
|
@@ -8019,7 +8031,11 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8019
8031
|
forceRender(bounds) {
|
|
8020
8032
|
this.renderer.addBlock(bounds ? new Bounds(bounds) : this.canvas.bounds);
|
|
8021
8033
|
if (this.viewReady)
|
|
8022
|
-
this.renderer.
|
|
8034
|
+
this.renderer.render();
|
|
8035
|
+
}
|
|
8036
|
+
requestRender(change = false) {
|
|
8037
|
+
if (this.renderer)
|
|
8038
|
+
this.renderer.update(change);
|
|
8023
8039
|
}
|
|
8024
8040
|
updateCursor(cursor) {
|
|
8025
8041
|
const i = this.interaction;
|
|
@@ -8066,7 +8082,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8066
8082
|
if (this.canvas) {
|
|
8067
8083
|
if (canvasSizeAttrs.includes(attrName)) {
|
|
8068
8084
|
if (!newValue)
|
|
8069
|
-
debug$
|
|
8085
|
+
debug$2.warn(attrName + ' is 0');
|
|
8070
8086
|
this.__changeCanvasSize(attrName, newValue);
|
|
8071
8087
|
}
|
|
8072
8088
|
else if (attrName === 'fill') {
|
|
@@ -8127,8 +8143,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8127
8143
|
const { imageReady } = this;
|
|
8128
8144
|
if (imageReady && !this.viewCompleted)
|
|
8129
8145
|
this.__checkViewCompleted();
|
|
8130
|
-
if (!imageReady)
|
|
8146
|
+
if (!imageReady) {
|
|
8131
8147
|
this.viewCompleted = false;
|
|
8148
|
+
this.requestRender();
|
|
8149
|
+
}
|
|
8132
8150
|
}
|
|
8133
8151
|
}
|
|
8134
8152
|
__checkViewCompleted(emit = true) {
|
|
@@ -8186,6 +8204,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8186
8204
|
}
|
|
8187
8205
|
else
|
|
8188
8206
|
list.push(item);
|
|
8207
|
+
this.requestRender();
|
|
8189
8208
|
}
|
|
8190
8209
|
zoom(_zoomType, _padding, _fixedScale) {
|
|
8191
8210
|
return needPlugin('view');
|
|
@@ -8239,14 +8258,14 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8239
8258
|
this.canvasManager.destroy();
|
|
8240
8259
|
}
|
|
8241
8260
|
this.canvas.destroy();
|
|
8242
|
-
this.config.view = this.view = null;
|
|
8261
|
+
this.config.view = this.view = this.parentApp = null;
|
|
8243
8262
|
if (this.userConfig)
|
|
8244
8263
|
this.userConfig.view = null;
|
|
8245
8264
|
super.destroy();
|
|
8246
8265
|
setTimeout(() => { ImageManager.clearRecycled(); }, 100);
|
|
8247
8266
|
}
|
|
8248
8267
|
catch (e) {
|
|
8249
|
-
debug$
|
|
8268
|
+
debug$2.error(e);
|
|
8250
8269
|
}
|
|
8251
8270
|
}
|
|
8252
8271
|
};
|
|
@@ -8966,9 +8985,9 @@ let App = class App extends Leafer {
|
|
|
8966
8985
|
if (ground)
|
|
8967
8986
|
this.ground = this.addLeafer(ground);
|
|
8968
8987
|
if (tree || editor)
|
|
8969
|
-
this.tree = this.addLeafer(tree);
|
|
8988
|
+
this.tree = this.addLeafer(tree || { type: userConfig.type || 'design' });
|
|
8970
8989
|
if (sky || editor)
|
|
8971
|
-
this.sky = this.addLeafer(sky
|
|
8990
|
+
this.sky = this.addLeafer(sky);
|
|
8972
8991
|
if (editor)
|
|
8973
8992
|
this.sky.add(this.editor = Creator.editor(editor));
|
|
8974
8993
|
}
|
|
@@ -9322,184 +9341,7 @@ KeyEvent = __decorate([
|
|
|
9322
9341
|
registerUIEvent()
|
|
9323
9342
|
], KeyEvent);
|
|
9324
9343
|
|
|
9325
|
-
function addInteractionWindow(leafer) {
|
|
9326
|
-
if (leafer.isApp)
|
|
9327
|
-
return;
|
|
9328
|
-
leafer.__eventIds.push(leafer.on_(MoveEvent.BEFORE_MOVE, (e) => {
|
|
9329
|
-
leafer.zoomLayer.move(leafer.getValidMove(e.moveX, e.moveY));
|
|
9330
|
-
}), leafer.on_(ZoomEvent.BEFORE_ZOOM, (e) => {
|
|
9331
|
-
const { zoomLayer } = leafer;
|
|
9332
|
-
const changeScale = leafer.getValidScale(e.scale);
|
|
9333
|
-
if (changeScale !== 1) {
|
|
9334
|
-
PointHelper.scaleOf(zoomLayer, e, changeScale);
|
|
9335
|
-
zoomLayer.scale = zoomLayer.__.scaleX * changeScale;
|
|
9336
|
-
}
|
|
9337
|
-
}));
|
|
9338
|
-
}
|
|
9339
|
-
|
|
9340
|
-
function document(leafer) {
|
|
9341
|
-
addInteractionWindow(leafer);
|
|
9342
|
-
const { move, zoom } = leafer.config;
|
|
9343
|
-
move.scroll = 'limit';
|
|
9344
|
-
zoom.min = 1;
|
|
9345
|
-
}
|
|
9346
|
-
|
|
9347
|
-
function block(leafer) {
|
|
9348
|
-
const { config } = leafer;
|
|
9349
|
-
(config.wheel || (config.wheel = {})).preventDefault = false;
|
|
9350
|
-
(config.touch || (config.touch = {})).preventDefault = 'auto';
|
|
9351
|
-
}
|
|
9352
|
-
|
|
9353
|
-
const debug$2 = Debug.get('LeaferTypeCreator');
|
|
9354
|
-
const LeaferTypeCreator = {
|
|
9355
|
-
list: {},
|
|
9356
|
-
register(name, fn) {
|
|
9357
|
-
list[name] && debug$2.repeat(name);
|
|
9358
|
-
list[name] = fn;
|
|
9359
|
-
},
|
|
9360
|
-
run(name, leafer) {
|
|
9361
|
-
const fn = list[name];
|
|
9362
|
-
fn && fn(leafer);
|
|
9363
|
-
}
|
|
9364
|
-
};
|
|
9365
|
-
const { list, register } = LeaferTypeCreator;
|
|
9366
|
-
register('design', addInteractionWindow);
|
|
9367
|
-
register('document', document);
|
|
9368
|
-
register('block', block);
|
|
9369
|
-
|
|
9370
|
-
const leafer = Leafer.prototype;
|
|
9371
|
-
leafer.initType = function (type) {
|
|
9372
|
-
LeaferTypeCreator.run(type, this);
|
|
9373
|
-
};
|
|
9374
|
-
leafer.getValidMove = function (moveX, moveY) {
|
|
9375
|
-
const { scroll, disabled } = this.app.config.move;
|
|
9376
|
-
if (scroll) {
|
|
9377
|
-
Math.abs(moveX) > Math.abs(moveY) ? moveY = 0 : moveX = 0;
|
|
9378
|
-
if (scroll === 'limit') {
|
|
9379
|
-
const { x, y, width, height } = new Bounds(this.__world).addPoint(this.zoomLayer);
|
|
9380
|
-
const right = x + width - this.width, bottom = y + height - this.height;
|
|
9381
|
-
if (x >= 0 && right <= 0)
|
|
9382
|
-
moveX = 0;
|
|
9383
|
-
else if (moveX > 0) {
|
|
9384
|
-
if (x + moveX > 0)
|
|
9385
|
-
moveX = -x;
|
|
9386
|
-
}
|
|
9387
|
-
else if (moveX < 0 && right + moveX < 0)
|
|
9388
|
-
moveX = -right;
|
|
9389
|
-
if (y >= 0 && bottom <= 0)
|
|
9390
|
-
moveY = 0;
|
|
9391
|
-
else if (moveY > 0) {
|
|
9392
|
-
if (y + moveY > 0)
|
|
9393
|
-
moveY = -y;
|
|
9394
|
-
}
|
|
9395
|
-
else if (moveY < 0 && bottom + moveY < 0)
|
|
9396
|
-
moveY = -bottom;
|
|
9397
|
-
}
|
|
9398
|
-
}
|
|
9399
|
-
return { x: disabled ? 0 : moveX, y: disabled ? 0 : moveY };
|
|
9400
|
-
};
|
|
9401
|
-
leafer.getValidScale = function (changeScale) {
|
|
9402
|
-
const { scaleX } = this.zoomLayer.__, { min, max, disabled } = this.app.config.zoom, absScale = Math.abs(scaleX * changeScale);
|
|
9403
|
-
if (absScale < min)
|
|
9404
|
-
changeScale = min / scaleX;
|
|
9405
|
-
else if (absScale > max)
|
|
9406
|
-
changeScale = max / scaleX;
|
|
9407
|
-
return disabled ? 1 : changeScale;
|
|
9408
|
-
};
|
|
9409
|
-
|
|
9410
|
-
class Transformer {
|
|
9411
|
-
get transforming() { return !!(this.moveData || this.zoomData || this.rotateData); }
|
|
9412
|
-
constructor(interaction) {
|
|
9413
|
-
this.interaction = interaction;
|
|
9414
|
-
}
|
|
9415
|
-
move(data) {
|
|
9416
|
-
const { interaction } = this;
|
|
9417
|
-
if (!data.moveType)
|
|
9418
|
-
data.moveType = 'move';
|
|
9419
|
-
if (!this.moveData) {
|
|
9420
|
-
const { path } = interaction.selector.getByPoint(data, interaction.hitRadius);
|
|
9421
|
-
data.path = path;
|
|
9422
|
-
this.moveData = Object.assign(Object.assign({}, data), { moveX: 0, moveY: 0 });
|
|
9423
|
-
interaction.cancelHover();
|
|
9424
|
-
interaction.emit(MoveEvent.START, this.moveData);
|
|
9425
|
-
}
|
|
9426
|
-
data.path = this.moveData.path;
|
|
9427
|
-
interaction.emit(MoveEvent.BEFORE_MOVE, data);
|
|
9428
|
-
interaction.emit(MoveEvent.MOVE, data);
|
|
9429
|
-
this.transformEndWait();
|
|
9430
|
-
}
|
|
9431
|
-
zoom(data) {
|
|
9432
|
-
const { interaction } = this;
|
|
9433
|
-
if (!this.zoomData) {
|
|
9434
|
-
const { path } = interaction.selector.getByPoint(data, interaction.hitRadius);
|
|
9435
|
-
data.path = path;
|
|
9436
|
-
this.zoomData = Object.assign(Object.assign({}, data), { scale: 1 });
|
|
9437
|
-
interaction.cancelHover();
|
|
9438
|
-
interaction.emit(ZoomEvent.START, this.zoomData);
|
|
9439
|
-
}
|
|
9440
|
-
data.path = this.zoomData.path;
|
|
9441
|
-
interaction.emit(ZoomEvent.BEFORE_ZOOM, data);
|
|
9442
|
-
interaction.emit(ZoomEvent.ZOOM, data);
|
|
9443
|
-
this.transformEndWait();
|
|
9444
|
-
}
|
|
9445
|
-
rotate(data) {
|
|
9446
|
-
const { interaction } = this;
|
|
9447
|
-
if (!this.rotateData) {
|
|
9448
|
-
const { path } = interaction.selector.getByPoint(data, interaction.hitRadius);
|
|
9449
|
-
data.path = path;
|
|
9450
|
-
this.rotateData = Object.assign(Object.assign({}, data), { rotation: 0 });
|
|
9451
|
-
interaction.cancelHover();
|
|
9452
|
-
interaction.emit(RotateEvent.START, this.rotateData);
|
|
9453
|
-
}
|
|
9454
|
-
data.path = this.rotateData.path;
|
|
9455
|
-
interaction.emit(RotateEvent.BEFORE_ROTATE, data);
|
|
9456
|
-
interaction.emit(RotateEvent.ROTATE, data);
|
|
9457
|
-
this.transformEndWait();
|
|
9458
|
-
}
|
|
9459
|
-
transformEndWait() {
|
|
9460
|
-
clearTimeout(this.transformTimer);
|
|
9461
|
-
this.transformTimer = setTimeout(() => {
|
|
9462
|
-
this.transformEnd();
|
|
9463
|
-
}, this.interaction.config.pointer.transformTime);
|
|
9464
|
-
}
|
|
9465
|
-
transformEnd() {
|
|
9466
|
-
this.moveEnd();
|
|
9467
|
-
this.zoomEnd();
|
|
9468
|
-
this.rotateEnd();
|
|
9469
|
-
}
|
|
9470
|
-
moveEnd() {
|
|
9471
|
-
if (this.moveData) {
|
|
9472
|
-
this.interaction.emit(MoveEvent.END, this.moveData);
|
|
9473
|
-
this.moveData = null;
|
|
9474
|
-
}
|
|
9475
|
-
}
|
|
9476
|
-
zoomEnd() {
|
|
9477
|
-
if (this.zoomData) {
|
|
9478
|
-
this.interaction.emit(ZoomEvent.END, this.zoomData);
|
|
9479
|
-
this.zoomData = null;
|
|
9480
|
-
}
|
|
9481
|
-
}
|
|
9482
|
-
rotateEnd() {
|
|
9483
|
-
if (this.rotateData) {
|
|
9484
|
-
this.interaction.emit(RotateEvent.END, this.rotateData);
|
|
9485
|
-
this.rotateData = null;
|
|
9486
|
-
}
|
|
9487
|
-
}
|
|
9488
|
-
destroy() {
|
|
9489
|
-
this.zoomData = this.moveData = this.rotateData = null;
|
|
9490
|
-
}
|
|
9491
|
-
}
|
|
9492
|
-
|
|
9493
9344
|
const InteractionHelper = {
|
|
9494
|
-
getMoveEventData(center, move, event) {
|
|
9495
|
-
return Object.assign(Object.assign({}, event), { x: center.x, y: center.y, moveX: move.x, moveY: move.y });
|
|
9496
|
-
},
|
|
9497
|
-
getRotateEventData(center, angle, event) {
|
|
9498
|
-
return Object.assign(Object.assign({}, event), { x: center.x, y: center.y, rotation: angle });
|
|
9499
|
-
},
|
|
9500
|
-
getZoomEventData(center, scale, event) {
|
|
9501
|
-
return Object.assign(Object.assign({}, event), { x: center.x, y: center.y, scale });
|
|
9502
|
-
},
|
|
9503
9345
|
getDragEventData(startPoint, lastPoint, event) {
|
|
9504
9346
|
return Object.assign(Object.assign({}, event), { x: event.x, y: event.y, moveX: event.x - lastPoint.x, moveY: event.y - lastPoint.y, totalX: event.x - startPoint.x, totalY: event.y - startPoint.y });
|
|
9505
9347
|
},
|
|
@@ -9508,18 +9350,14 @@ const InteractionHelper = {
|
|
|
9508
9350
|
data });
|
|
9509
9351
|
},
|
|
9510
9352
|
getSwipeDirection(angle) {
|
|
9511
|
-
if (angle < -45 && angle > -135)
|
|
9353
|
+
if (angle < -45 && angle > -135)
|
|
9512
9354
|
return SwipeEvent.UP;
|
|
9513
|
-
|
|
9514
|
-
else if (angle > 45 && angle < 135) {
|
|
9355
|
+
else if (angle > 45 && angle < 135)
|
|
9515
9356
|
return SwipeEvent.DOWN;
|
|
9516
|
-
|
|
9517
|
-
else if (angle <= 45 && angle >= -45) {
|
|
9357
|
+
else if (angle <= 45 && angle >= -45)
|
|
9518
9358
|
return SwipeEvent.RIGHT;
|
|
9519
|
-
|
|
9520
|
-
else {
|
|
9359
|
+
else
|
|
9521
9360
|
return SwipeEvent.LEFT;
|
|
9522
|
-
}
|
|
9523
9361
|
},
|
|
9524
9362
|
getSwipeEventData(startPoint, lastDragData, event) {
|
|
9525
9363
|
return Object.assign(Object.assign({}, event), { moveX: lastDragData.moveX, moveY: lastDragData.moveY, totalX: event.x - startPoint.x, totalY: event.y - startPoint.y, type: I.getSwipeDirection(PointHelper.getAngle(startPoint, event)) });
|
|
@@ -9592,9 +9430,8 @@ class Dragger {
|
|
|
9592
9430
|
interaction.emit(MoveEvent.START, this.dragData);
|
|
9593
9431
|
}
|
|
9594
9432
|
}
|
|
9595
|
-
if (!this.moving)
|
|
9433
|
+
if (!this.moving)
|
|
9596
9434
|
this.dragStart(data, canDrag);
|
|
9597
|
-
}
|
|
9598
9435
|
this.drag(data);
|
|
9599
9436
|
}
|
|
9600
9437
|
dragStart(data, canDrag) {
|
|
@@ -9672,16 +9509,9 @@ class Dragger {
|
|
|
9672
9509
|
dragEnd(data, speed) {
|
|
9673
9510
|
if (!this.dragging && !this.moving)
|
|
9674
9511
|
return;
|
|
9675
|
-
|
|
9676
|
-
|
|
9677
|
-
|
|
9678
|
-
speed = (speed || (data.pointerType === 'touch' ? 2 : 1)) * 0.9;
|
|
9679
|
-
PointHelper.move(data, moveX * speed, moveY * speed);
|
|
9680
|
-
this.drag(data);
|
|
9681
|
-
this.animate(() => { this.dragEnd(data, 1); });
|
|
9682
|
-
}
|
|
9683
|
-
else
|
|
9684
|
-
this.dragEndReal(data);
|
|
9512
|
+
if (this.checkDragEndAnimate(data, speed))
|
|
9513
|
+
return;
|
|
9514
|
+
this.dragEndReal(data);
|
|
9685
9515
|
}
|
|
9686
9516
|
dragEndReal(data) {
|
|
9687
9517
|
const { interaction, downData, dragData } = this;
|
|
@@ -9708,12 +9538,6 @@ class Dragger {
|
|
|
9708
9538
|
this.dragReset();
|
|
9709
9539
|
this.animate(null, 'off');
|
|
9710
9540
|
}
|
|
9711
|
-
animate(func, off) {
|
|
9712
|
-
const animateWait = func || this.animateWait;
|
|
9713
|
-
if (animateWait)
|
|
9714
|
-
this.interaction.target.nextRender(animateWait, null, off);
|
|
9715
|
-
this.animateWait = func;
|
|
9716
|
-
}
|
|
9717
9541
|
swipe(data, downData, dragData, endDragData) {
|
|
9718
9542
|
const { interaction } = this;
|
|
9719
9543
|
if (PointHelper.getDistance(downData, data) > interaction.config.pointer.swipeDistance) {
|
|
@@ -9730,39 +9554,11 @@ class Dragger {
|
|
|
9730
9554
|
dragReset() {
|
|
9731
9555
|
DragEvent.list = DragEvent.data = this.draggableList = this.dragData = this.downData = this.dragOverPath = this.dragEnterPath = null;
|
|
9732
9556
|
}
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
}
|
|
9739
|
-
autoMoveOnDragOut(data) {
|
|
9740
|
-
const { interaction, downData, canDragOut } = this;
|
|
9741
|
-
const { autoDistance, dragOut } = interaction.config.move;
|
|
9742
|
-
if (!dragOut || !canDragOut || !autoDistance)
|
|
9743
|
-
return;
|
|
9744
|
-
const bounds = interaction.shrinkCanvasBounds;
|
|
9745
|
-
const { x, y } = bounds;
|
|
9746
|
-
const right = BoundsHelper.maxX(bounds);
|
|
9747
|
-
const bottom = BoundsHelper.maxY(bounds);
|
|
9748
|
-
const moveX = data.x < x ? autoDistance : (right < data.x ? -autoDistance : 0);
|
|
9749
|
-
const moveY = data.y < y ? autoDistance : (bottom < data.y ? -autoDistance : 0);
|
|
9750
|
-
let totalX = 0, totalY = 0;
|
|
9751
|
-
this.autoMoveTimer = setInterval(() => {
|
|
9752
|
-
totalX += moveX;
|
|
9753
|
-
totalY += moveY;
|
|
9754
|
-
PointHelper.move(downData, moveX, moveY);
|
|
9755
|
-
PointHelper.move(this.dragData, moveX, moveY);
|
|
9756
|
-
interaction.move(Object.assign(Object.assign({}, data), { moveX, moveY, totalX, totalY, moveType: 'drag' }));
|
|
9757
|
-
interaction.pointerMoveReal(data);
|
|
9758
|
-
}, 10);
|
|
9759
|
-
}
|
|
9760
|
-
autoMoveCancel() {
|
|
9761
|
-
if (this.autoMoveTimer) {
|
|
9762
|
-
clearInterval(this.autoMoveTimer);
|
|
9763
|
-
this.autoMoveTimer = 0;
|
|
9764
|
-
}
|
|
9765
|
-
}
|
|
9557
|
+
checkDragEndAnimate(_data, _speed) { return false; }
|
|
9558
|
+
animate(_func, _off) { }
|
|
9559
|
+
checkDragOut(_data) { }
|
|
9560
|
+
autoMoveOnDragOut(_data) { }
|
|
9561
|
+
autoMoveCancel() { }
|
|
9766
9562
|
destroy() {
|
|
9767
9563
|
this.dragReset();
|
|
9768
9564
|
}
|
|
@@ -9832,28 +9628,12 @@ function exclude(leaf, excludePath) {
|
|
|
9832
9628
|
return excludePath && excludePath.has(leaf);
|
|
9833
9629
|
}
|
|
9834
9630
|
|
|
9835
|
-
const MultiTouchHelper = {
|
|
9836
|
-
getData(list) {
|
|
9837
|
-
const a = list[0];
|
|
9838
|
-
const b = list[1];
|
|
9839
|
-
const lastCenter = PointHelper.getCenter(a.from, b.from);
|
|
9840
|
-
const center = PointHelper.getCenter(a.to, b.to);
|
|
9841
|
-
const move = { x: center.x - lastCenter.x, y: center.y - lastCenter.y };
|
|
9842
|
-
const lastDistance = PointHelper.getDistance(a.from, b.from);
|
|
9843
|
-
const distance = PointHelper.getDistance(a.to, b.to);
|
|
9844
|
-
const scale = distance / lastDistance;
|
|
9845
|
-
const angle = PointHelper.getRotation(a.from, b.from, a.to, b.to);
|
|
9846
|
-
return { move, scale, angle, center };
|
|
9847
|
-
}
|
|
9848
|
-
};
|
|
9849
|
-
|
|
9850
9631
|
const config = {
|
|
9851
9632
|
wheel: {
|
|
9852
9633
|
zoomSpeed: 0.5,
|
|
9853
9634
|
moveSpeed: 0.5,
|
|
9854
9635
|
rotateSpeed: 0.5,
|
|
9855
9636
|
delta: { x: 80 / 4, y: 8.0 },
|
|
9856
|
-
preventDefault: true
|
|
9857
9637
|
},
|
|
9858
9638
|
pointer: {
|
|
9859
9639
|
hitRadius: 5,
|
|
@@ -9864,17 +9644,18 @@ const config = {
|
|
|
9864
9644
|
dragHover: true,
|
|
9865
9645
|
dragDistance: 2,
|
|
9866
9646
|
swipeDistance: 20,
|
|
9867
|
-
preventDefaultMenu: true
|
|
9868
9647
|
},
|
|
9869
9648
|
touch: {
|
|
9870
|
-
preventDefault:
|
|
9649
|
+
preventDefault: 'auto'
|
|
9871
9650
|
},
|
|
9872
9651
|
multiTouch: {},
|
|
9652
|
+
move: { autoDistance: 2 },
|
|
9653
|
+
zoom: {},
|
|
9873
9654
|
cursor: true,
|
|
9874
9655
|
keyEvent: true
|
|
9875
9656
|
};
|
|
9876
9657
|
|
|
9877
|
-
const { pathHasEventType,
|
|
9658
|
+
const { pathHasEventType, pathCanDrag, pathHasOutside } = InteractionHelper;
|
|
9878
9659
|
class InteractionBase {
|
|
9879
9660
|
get dragging() { return this.dragger.dragging; }
|
|
9880
9661
|
get transforming() { return this.transformer.transforming; }
|
|
@@ -9896,7 +9677,7 @@ class InteractionBase {
|
|
|
9896
9677
|
this.canvas = canvas;
|
|
9897
9678
|
this.selector = selector;
|
|
9898
9679
|
this.defaultPath = new LeafList(target);
|
|
9899
|
-
this.
|
|
9680
|
+
this.createTransformer();
|
|
9900
9681
|
this.dragger = new Dragger(this);
|
|
9901
9682
|
if (userConfig)
|
|
9902
9683
|
this.config = DataHelper.default(userConfig, this.config);
|
|
@@ -9997,14 +9778,6 @@ class InteractionBase {
|
|
|
9997
9778
|
data.isCancel = true;
|
|
9998
9779
|
this.pointerUp(data);
|
|
9999
9780
|
}
|
|
10000
|
-
multiTouch(data, list) {
|
|
10001
|
-
if (this.config.multiTouch.disabled)
|
|
10002
|
-
return;
|
|
10003
|
-
const { move, angle, scale, center } = MultiTouchHelper.getData(list);
|
|
10004
|
-
this.rotate(getRotateEventData(center, angle, data));
|
|
10005
|
-
this.zoom(getZoomEventData(center, scale, data));
|
|
10006
|
-
this.move(getMoveEventData(center, move, data));
|
|
10007
|
-
}
|
|
10008
9781
|
menu(data) {
|
|
10009
9782
|
this.findPath(data);
|
|
10010
9783
|
this.emit(PointerEvent.MENU, data);
|
|
@@ -10018,18 +9791,13 @@ class InteractionBase {
|
|
|
10018
9791
|
this.waitRightTap = this.waitMenuTap = false;
|
|
10019
9792
|
}
|
|
10020
9793
|
}
|
|
10021
|
-
|
|
10022
|
-
|
|
10023
|
-
}
|
|
10024
|
-
|
|
10025
|
-
|
|
10026
|
-
}
|
|
10027
|
-
|
|
10028
|
-
this.transformer.rotate(data);
|
|
10029
|
-
}
|
|
10030
|
-
transformEnd() {
|
|
10031
|
-
this.transformer.transformEnd();
|
|
10032
|
-
}
|
|
9794
|
+
createTransformer() { }
|
|
9795
|
+
move(_data) { }
|
|
9796
|
+
zoom(_data) { }
|
|
9797
|
+
rotate(_data) { }
|
|
9798
|
+
transformEnd() { }
|
|
9799
|
+
wheel(_data) { }
|
|
9800
|
+
multiTouch(_data, _list) { }
|
|
10033
9801
|
keyDown(data) {
|
|
10034
9802
|
if (!this.config.keyEvent)
|
|
10035
9803
|
return;
|
|
@@ -10267,8 +10035,9 @@ class InteractionBase {
|
|
|
10267
10035
|
this.longPressed = false;
|
|
10268
10036
|
}
|
|
10269
10037
|
__onResize() {
|
|
10038
|
+
const { dragOut } = this.m;
|
|
10270
10039
|
this.shrinkCanvasBounds = new Bounds(this.canvas.bounds);
|
|
10271
|
-
this.shrinkCanvasBounds.spread(-2);
|
|
10040
|
+
this.shrinkCanvasBounds.spread(-(typeof dragOut === 'number' ? dragOut : 2));
|
|
10272
10041
|
}
|
|
10273
10042
|
__listenEvents() {
|
|
10274
10043
|
const { target } = this;
|
|
@@ -10288,7 +10057,8 @@ class InteractionBase {
|
|
|
10288
10057
|
this.stop();
|
|
10289
10058
|
this.__removeListenEvents();
|
|
10290
10059
|
this.dragger.destroy();
|
|
10291
|
-
this.transformer
|
|
10060
|
+
if (this.transformer)
|
|
10061
|
+
this.transformer.destroy();
|
|
10292
10062
|
this.downData = this.overPath = this.enterPath = null;
|
|
10293
10063
|
}
|
|
10294
10064
|
}
|
|
@@ -12312,4 +12082,4 @@ if (platform === 'ios') {
|
|
|
12312
12082
|
};
|
|
12313
12083
|
}
|
|
12314
12084
|
|
|
12315
|
-
export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage,
|
|
12085
|
+
export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isNull, layoutProcessor, maskType, naturalBoundsType, needPlugin, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$3 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
|