@leafer-ui/worker 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/worker.cjs +13 -12
- package/dist/worker.esm.js +13 -12
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.js +130 -362
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.module.js +130 -360
- package/dist/worker.module.min.js +1 -1
- package/package.json +9 -9
package/dist/worker.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 true; }
|
|
@@ -6246,7 +6263,7 @@ class LayoutBlockData {
|
|
|
6246
6263
|
}
|
|
6247
6264
|
|
|
6248
6265
|
const { updateAllMatrix, updateAllChange } = LeafHelper;
|
|
6249
|
-
const debug$
|
|
6266
|
+
const debug$5 = Debug.get('Layouter');
|
|
6250
6267
|
class Layouter {
|
|
6251
6268
|
constructor(target, userConfig) {
|
|
6252
6269
|
this.totalTimes = 0;
|
|
@@ -6281,7 +6298,7 @@ class Layouter {
|
|
|
6281
6298
|
target.emitEvent(new LayoutEvent(LayoutEvent.END, this.layoutedBlocks, this.times));
|
|
6282
6299
|
}
|
|
6283
6300
|
catch (e) {
|
|
6284
|
-
debug$
|
|
6301
|
+
debug$5.error(e);
|
|
6285
6302
|
}
|
|
6286
6303
|
this.layoutedBlocks = null;
|
|
6287
6304
|
}
|
|
@@ -6295,9 +6312,9 @@ class Layouter {
|
|
|
6295
6312
|
}
|
|
6296
6313
|
layoutOnce() {
|
|
6297
6314
|
if (this.layouting)
|
|
6298
|
-
return debug$
|
|
6315
|
+
return debug$5.warn('layouting');
|
|
6299
6316
|
if (this.times > 3)
|
|
6300
|
-
return debug$
|
|
6317
|
+
return debug$5.warn('layout max times');
|
|
6301
6318
|
this.times++;
|
|
6302
6319
|
this.totalTimes++;
|
|
6303
6320
|
this.layouting = true;
|
|
@@ -6401,7 +6418,7 @@ class Layouter {
|
|
|
6401
6418
|
}
|
|
6402
6419
|
}
|
|
6403
6420
|
|
|
6404
|
-
const debug$
|
|
6421
|
+
const debug$4 = Debug.get('Renderer');
|
|
6405
6422
|
class Renderer {
|
|
6406
6423
|
get needFill() { return !!(!this.canvas.allowBackgroundColor && this.config.fill); }
|
|
6407
6424
|
constructor(target, canvas, userConfig) {
|
|
@@ -6417,29 +6434,29 @@ class Renderer {
|
|
|
6417
6434
|
if (userConfig)
|
|
6418
6435
|
this.config = DataHelper.default(userConfig, this.config);
|
|
6419
6436
|
this.__listenEvents();
|
|
6420
|
-
this.__requestRender();
|
|
6421
6437
|
}
|
|
6422
6438
|
start() {
|
|
6423
6439
|
this.running = true;
|
|
6440
|
+
this.update(false);
|
|
6424
6441
|
}
|
|
6425
6442
|
stop() {
|
|
6426
6443
|
this.running = false;
|
|
6427
6444
|
}
|
|
6428
|
-
update() {
|
|
6429
|
-
this.changed
|
|
6445
|
+
update(change = true) {
|
|
6446
|
+
if (!this.changed)
|
|
6447
|
+
this.changed = change;
|
|
6448
|
+
this.__requestRender();
|
|
6430
6449
|
}
|
|
6431
6450
|
requestLayout() {
|
|
6432
6451
|
this.target.emit(LayoutEvent.REQUEST);
|
|
6433
6452
|
}
|
|
6434
6453
|
render(callback) {
|
|
6435
|
-
if (!(this.running && this.canvas.view))
|
|
6436
|
-
this.
|
|
6437
|
-
return;
|
|
6438
|
-
}
|
|
6454
|
+
if (!(this.running && this.canvas.view))
|
|
6455
|
+
return this.update();
|
|
6439
6456
|
const { target } = this;
|
|
6440
6457
|
this.times = 0;
|
|
6441
6458
|
this.totalBounds = new Bounds();
|
|
6442
|
-
debug$
|
|
6459
|
+
debug$4.log(target.innerName, '--->');
|
|
6443
6460
|
try {
|
|
6444
6461
|
if (!target.isApp)
|
|
6445
6462
|
target.app.emit(RenderEvent.CHILD_START, target);
|
|
@@ -6450,9 +6467,9 @@ class Renderer {
|
|
|
6450
6467
|
}
|
|
6451
6468
|
catch (e) {
|
|
6452
6469
|
this.rendering = false;
|
|
6453
|
-
debug$
|
|
6470
|
+
debug$4.error(e);
|
|
6454
6471
|
}
|
|
6455
|
-
debug$
|
|
6472
|
+
debug$4.log('-------------|');
|
|
6456
6473
|
}
|
|
6457
6474
|
renderAgain() {
|
|
6458
6475
|
if (this.rendering) {
|
|
@@ -6464,9 +6481,9 @@ class Renderer {
|
|
|
6464
6481
|
}
|
|
6465
6482
|
renderOnce(callback) {
|
|
6466
6483
|
if (this.rendering)
|
|
6467
|
-
return debug$
|
|
6484
|
+
return debug$4.warn('rendering');
|
|
6468
6485
|
if (this.times > 3)
|
|
6469
|
-
return debug$
|
|
6486
|
+
return debug$4.warn('render max times');
|
|
6470
6487
|
this.times++;
|
|
6471
6488
|
this.totalTimes++;
|
|
6472
6489
|
this.rendering = true;
|
|
@@ -6503,7 +6520,7 @@ class Renderer {
|
|
|
6503
6520
|
partRender() {
|
|
6504
6521
|
const { canvas, updateBlocks: list } = this;
|
|
6505
6522
|
if (!list)
|
|
6506
|
-
return debug$
|
|
6523
|
+
return debug$4.warn('PartRender: need update attr');
|
|
6507
6524
|
this.mergeBlocks();
|
|
6508
6525
|
list.forEach(block => { if (canvas.bounds.hit(block) && !block.isEmpty())
|
|
6509
6526
|
this.clipRender(block); });
|
|
@@ -6569,16 +6586,17 @@ class Renderer {
|
|
|
6569
6586
|
}
|
|
6570
6587
|
}
|
|
6571
6588
|
__requestRender() {
|
|
6572
|
-
|
|
6589
|
+
if (this.requestTime)
|
|
6590
|
+
return;
|
|
6591
|
+
const requestTime = this.requestTime = Date.now();
|
|
6573
6592
|
Platform.requestRender(() => {
|
|
6574
|
-
this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() -
|
|
6593
|
+
this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - requestTime)));
|
|
6594
|
+
this.requestTime = 0;
|
|
6575
6595
|
if (this.running) {
|
|
6576
6596
|
if (this.changed && this.canvas.view)
|
|
6577
6597
|
this.render();
|
|
6578
6598
|
this.target.emit(RenderEvent.NEXT);
|
|
6579
6599
|
}
|
|
6580
|
-
if (this.target)
|
|
6581
|
-
this.__requestRender();
|
|
6582
6600
|
});
|
|
6583
6601
|
}
|
|
6584
6602
|
__onResize(e) {
|
|
@@ -6594,7 +6612,7 @@ class Renderer {
|
|
|
6594
6612
|
}
|
|
6595
6613
|
}
|
|
6596
6614
|
this.addBlock(new Bounds(0, 0, 1, 1));
|
|
6597
|
-
this.
|
|
6615
|
+
this.update();
|
|
6598
6616
|
}
|
|
6599
6617
|
__onLayoutEnd(event) {
|
|
6600
6618
|
if (event.data)
|
|
@@ -6605,7 +6623,7 @@ class Renderer {
|
|
|
6605
6623
|
empty = (!leaf.__world.width || !leaf.__world.height);
|
|
6606
6624
|
if (empty) {
|
|
6607
6625
|
if (!leaf.isLeafer)
|
|
6608
|
-
debug$
|
|
6626
|
+
debug$4.tip(leaf.innerName, ': empty');
|
|
6609
6627
|
empty = (!leaf.isBranch || leaf.isBranchLeaf);
|
|
6610
6628
|
}
|
|
6611
6629
|
return empty;
|
|
@@ -6980,7 +6998,7 @@ const Transition = {
|
|
|
6980
6998
|
|
|
6981
6999
|
const { parse, objectToCanvasData } = PathConvert;
|
|
6982
7000
|
const emptyPaint = {};
|
|
6983
|
-
const debug$
|
|
7001
|
+
const debug$3 = Debug.get('UIData');
|
|
6984
7002
|
class UIData extends LeafData {
|
|
6985
7003
|
get scale() { const { scaleX, scaleY } = this; return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX; }
|
|
6986
7004
|
get __strokeWidth() {
|
|
@@ -7002,7 +7020,7 @@ class UIData extends LeafData {
|
|
|
7002
7020
|
return true;
|
|
7003
7021
|
return t.fill && this.__hasStroke;
|
|
7004
7022
|
}
|
|
7005
|
-
get __clipAfterFill() { return (
|
|
7023
|
+
get __clipAfterFill() { const t = this; return (t.cornerRadius || t.innerShadow || t.__pathInputed); }
|
|
7006
7024
|
get __autoWidth() { return !this._width; }
|
|
7007
7025
|
get __autoHeight() { return !this._height; }
|
|
7008
7026
|
get __autoSide() { return !this._width || !this._height; }
|
|
@@ -7017,7 +7035,7 @@ class UIData extends LeafData {
|
|
|
7017
7035
|
if (value < 0) {
|
|
7018
7036
|
this._width = -value;
|
|
7019
7037
|
this.__leaf.scaleX *= -1;
|
|
7020
|
-
debug$
|
|
7038
|
+
debug$3.warn('width < 0, instead -scaleX ', this);
|
|
7021
7039
|
}
|
|
7022
7040
|
else
|
|
7023
7041
|
this._width = value;
|
|
@@ -7026,7 +7044,7 @@ class UIData extends LeafData {
|
|
|
7026
7044
|
if (value < 0) {
|
|
7027
7045
|
this._height = -value;
|
|
7028
7046
|
this.__leaf.scaleY *= -1;
|
|
7029
|
-
debug$
|
|
7047
|
+
debug$3.warn('height < 0, instead -scaleY', this);
|
|
7030
7048
|
}
|
|
7031
7049
|
else
|
|
7032
7050
|
this._height = value;
|
|
@@ -7116,7 +7134,7 @@ class GroupData extends UIData {
|
|
|
7116
7134
|
|
|
7117
7135
|
class BoxData extends GroupData {
|
|
7118
7136
|
get __boxStroke() { return !this.__pathInputed; }
|
|
7119
|
-
get __drawAfterFill() { return
|
|
7137
|
+
get __drawAfterFill() { const t = this; return (t.overflow === 'hide' && (t.__clipAfterFill || t.innerShadow) && t.__leaf.children.length); }
|
|
7120
7138
|
get __clipAfterFill() { return this.__leaf.isOverflow || super.__clipAfterFill; }
|
|
7121
7139
|
}
|
|
7122
7140
|
|
|
@@ -7762,7 +7780,7 @@ Group = __decorate([
|
|
|
7762
7780
|
], Group);
|
|
7763
7781
|
|
|
7764
7782
|
var Leafer_1;
|
|
7765
|
-
const debug$
|
|
7783
|
+
const debug$2 = Debug.get('Leafer');
|
|
7766
7784
|
let Leafer = Leafer_1 = class Leafer extends Group {
|
|
7767
7785
|
get __tag() { return 'Leafer'; }
|
|
7768
7786
|
get isApp() { return false; }
|
|
@@ -7776,20 +7794,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7776
7794
|
constructor(userConfig, data) {
|
|
7777
7795
|
super(data);
|
|
7778
7796
|
this.config = {
|
|
7779
|
-
type: 'design',
|
|
7780
7797
|
start: true,
|
|
7781
7798
|
hittable: true,
|
|
7782
7799
|
smooth: true,
|
|
7783
|
-
lazySpeard: 100
|
|
7784
|
-
zoom: {
|
|
7785
|
-
min: 0.01,
|
|
7786
|
-
max: 256
|
|
7787
|
-
},
|
|
7788
|
-
move: {
|
|
7789
|
-
holdSpaceKey: true,
|
|
7790
|
-
holdMiddleKey: true,
|
|
7791
|
-
autoDistance: 2
|
|
7792
|
-
}
|
|
7800
|
+
lazySpeard: 100
|
|
7793
7801
|
};
|
|
7794
7802
|
this.leafs = 0;
|
|
7795
7803
|
this.__eventIds = [];
|
|
@@ -7806,23 +7814,27 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7806
7814
|
init(userConfig, parentApp) {
|
|
7807
7815
|
if (this.canvas)
|
|
7808
7816
|
return;
|
|
7809
|
-
this.__setLeafer(this);
|
|
7810
|
-
if (userConfig)
|
|
7811
|
-
DataHelper.assign(this.config, userConfig);
|
|
7812
7817
|
let start;
|
|
7813
7818
|
const { config } = this;
|
|
7814
|
-
this.
|
|
7819
|
+
this.__setLeafer(this);
|
|
7820
|
+
if (parentApp) {
|
|
7821
|
+
this.parentApp = parentApp;
|
|
7822
|
+
this.__bindApp(parentApp);
|
|
7823
|
+
start = parentApp.running;
|
|
7824
|
+
}
|
|
7825
|
+
if (userConfig) {
|
|
7826
|
+
this.parent = parentApp;
|
|
7827
|
+
this.initType(userConfig.type);
|
|
7828
|
+
this.parent = undefined;
|
|
7829
|
+
DataHelper.assign(config, userConfig);
|
|
7830
|
+
}
|
|
7815
7831
|
const canvas = this.canvas = Creator.canvas(config);
|
|
7816
7832
|
this.__controllers.push(this.renderer = Creator.renderer(this, canvas, config), this.watcher = Creator.watcher(this, config), this.layouter = Creator.layouter(this, config));
|
|
7817
7833
|
if (this.isApp)
|
|
7818
7834
|
this.__setApp();
|
|
7819
7835
|
this.__checkAutoLayout(config, parentApp);
|
|
7820
7836
|
this.view = canvas.view;
|
|
7821
|
-
if (parentApp) {
|
|
7822
|
-
this.__bindApp(parentApp);
|
|
7823
|
-
start = parentApp.running;
|
|
7824
|
-
}
|
|
7825
|
-
else {
|
|
7837
|
+
if (!parentApp) {
|
|
7826
7838
|
this.selector = Creator.selector(this);
|
|
7827
7839
|
this.interaction = Creator.interaction(this, canvas, this.selector, config);
|
|
7828
7840
|
if (this.interaction) {
|
|
@@ -7879,7 +7891,11 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7879
7891
|
forceRender(bounds) {
|
|
7880
7892
|
this.renderer.addBlock(bounds ? new Bounds(bounds) : this.canvas.bounds);
|
|
7881
7893
|
if (this.viewReady)
|
|
7882
|
-
this.renderer.
|
|
7894
|
+
this.renderer.render();
|
|
7895
|
+
}
|
|
7896
|
+
requestRender(change = false) {
|
|
7897
|
+
if (this.renderer)
|
|
7898
|
+
this.renderer.update(change);
|
|
7883
7899
|
}
|
|
7884
7900
|
updateCursor(cursor) {
|
|
7885
7901
|
const i = this.interaction;
|
|
@@ -7926,7 +7942,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7926
7942
|
if (this.canvas) {
|
|
7927
7943
|
if (canvasSizeAttrs.includes(attrName)) {
|
|
7928
7944
|
if (!newValue)
|
|
7929
|
-
debug$
|
|
7945
|
+
debug$2.warn(attrName + ' is 0');
|
|
7930
7946
|
this.__changeCanvasSize(attrName, newValue);
|
|
7931
7947
|
}
|
|
7932
7948
|
else if (attrName === 'fill') {
|
|
@@ -7987,8 +8003,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7987
8003
|
const { imageReady } = this;
|
|
7988
8004
|
if (imageReady && !this.viewCompleted)
|
|
7989
8005
|
this.__checkViewCompleted();
|
|
7990
|
-
if (!imageReady)
|
|
8006
|
+
if (!imageReady) {
|
|
7991
8007
|
this.viewCompleted = false;
|
|
8008
|
+
this.requestRender();
|
|
8009
|
+
}
|
|
7992
8010
|
}
|
|
7993
8011
|
}
|
|
7994
8012
|
__checkViewCompleted(emit = true) {
|
|
@@ -8046,6 +8064,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8046
8064
|
}
|
|
8047
8065
|
else
|
|
8048
8066
|
list.push(item);
|
|
8067
|
+
this.requestRender();
|
|
8049
8068
|
}
|
|
8050
8069
|
zoom(_zoomType, _padding, _fixedScale) {
|
|
8051
8070
|
return needPlugin('view');
|
|
@@ -8099,14 +8118,14 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8099
8118
|
this.canvasManager.destroy();
|
|
8100
8119
|
}
|
|
8101
8120
|
this.canvas.destroy();
|
|
8102
|
-
this.config.view = this.view = null;
|
|
8121
|
+
this.config.view = this.view = this.parentApp = null;
|
|
8103
8122
|
if (this.userConfig)
|
|
8104
8123
|
this.userConfig.view = null;
|
|
8105
8124
|
super.destroy();
|
|
8106
8125
|
setTimeout(() => { ImageManager.clearRecycled(); }, 100);
|
|
8107
8126
|
}
|
|
8108
8127
|
catch (e) {
|
|
8109
|
-
debug$
|
|
8128
|
+
debug$2.error(e);
|
|
8110
8129
|
}
|
|
8111
8130
|
}
|
|
8112
8131
|
};
|
|
@@ -8826,9 +8845,9 @@ let App = class App extends Leafer {
|
|
|
8826
8845
|
if (ground)
|
|
8827
8846
|
this.ground = this.addLeafer(ground);
|
|
8828
8847
|
if (tree || editor)
|
|
8829
|
-
this.tree = this.addLeafer(tree);
|
|
8848
|
+
this.tree = this.addLeafer(tree || { type: userConfig.type || 'design' });
|
|
8830
8849
|
if (sky || editor)
|
|
8831
|
-
this.sky = this.addLeafer(sky
|
|
8850
|
+
this.sky = this.addLeafer(sky);
|
|
8832
8851
|
if (editor)
|
|
8833
8852
|
this.sky.add(this.editor = Creator.editor(editor));
|
|
8834
8853
|
}
|
|
@@ -9182,184 +9201,7 @@ KeyEvent = __decorate([
|
|
|
9182
9201
|
registerUIEvent()
|
|
9183
9202
|
], KeyEvent);
|
|
9184
9203
|
|
|
9185
|
-
function addInteractionWindow(leafer) {
|
|
9186
|
-
if (leafer.isApp)
|
|
9187
|
-
return;
|
|
9188
|
-
leafer.__eventIds.push(leafer.on_(MoveEvent.BEFORE_MOVE, (e) => {
|
|
9189
|
-
leafer.zoomLayer.move(leafer.getValidMove(e.moveX, e.moveY));
|
|
9190
|
-
}), leafer.on_(ZoomEvent.BEFORE_ZOOM, (e) => {
|
|
9191
|
-
const { zoomLayer } = leafer;
|
|
9192
|
-
const changeScale = leafer.getValidScale(e.scale);
|
|
9193
|
-
if (changeScale !== 1) {
|
|
9194
|
-
PointHelper.scaleOf(zoomLayer, e, changeScale);
|
|
9195
|
-
zoomLayer.scale = zoomLayer.__.scaleX * changeScale;
|
|
9196
|
-
}
|
|
9197
|
-
}));
|
|
9198
|
-
}
|
|
9199
|
-
|
|
9200
|
-
function document(leafer) {
|
|
9201
|
-
addInteractionWindow(leafer);
|
|
9202
|
-
const { move, zoom } = leafer.config;
|
|
9203
|
-
move.scroll = 'limit';
|
|
9204
|
-
zoom.min = 1;
|
|
9205
|
-
}
|
|
9206
|
-
|
|
9207
|
-
function block(leafer) {
|
|
9208
|
-
const { config } = leafer;
|
|
9209
|
-
(config.wheel || (config.wheel = {})).preventDefault = false;
|
|
9210
|
-
(config.touch || (config.touch = {})).preventDefault = 'auto';
|
|
9211
|
-
}
|
|
9212
|
-
|
|
9213
|
-
const debug$2 = Debug.get('LeaferTypeCreator');
|
|
9214
|
-
const LeaferTypeCreator = {
|
|
9215
|
-
list: {},
|
|
9216
|
-
register(name, fn) {
|
|
9217
|
-
list[name] && debug$2.repeat(name);
|
|
9218
|
-
list[name] = fn;
|
|
9219
|
-
},
|
|
9220
|
-
run(name, leafer) {
|
|
9221
|
-
const fn = list[name];
|
|
9222
|
-
fn && fn(leafer);
|
|
9223
|
-
}
|
|
9224
|
-
};
|
|
9225
|
-
const { list, register } = LeaferTypeCreator;
|
|
9226
|
-
register('design', addInteractionWindow);
|
|
9227
|
-
register('document', document);
|
|
9228
|
-
register('block', block);
|
|
9229
|
-
|
|
9230
|
-
const leafer = Leafer.prototype;
|
|
9231
|
-
leafer.initType = function (type) {
|
|
9232
|
-
LeaferTypeCreator.run(type, this);
|
|
9233
|
-
};
|
|
9234
|
-
leafer.getValidMove = function (moveX, moveY) {
|
|
9235
|
-
const { scroll, disabled } = this.app.config.move;
|
|
9236
|
-
if (scroll) {
|
|
9237
|
-
Math.abs(moveX) > Math.abs(moveY) ? moveY = 0 : moveX = 0;
|
|
9238
|
-
if (scroll === 'limit') {
|
|
9239
|
-
const { x, y, width, height } = new Bounds(this.__world).addPoint(this.zoomLayer);
|
|
9240
|
-
const right = x + width - this.width, bottom = y + height - this.height;
|
|
9241
|
-
if (x >= 0 && right <= 0)
|
|
9242
|
-
moveX = 0;
|
|
9243
|
-
else if (moveX > 0) {
|
|
9244
|
-
if (x + moveX > 0)
|
|
9245
|
-
moveX = -x;
|
|
9246
|
-
}
|
|
9247
|
-
else if (moveX < 0 && right + moveX < 0)
|
|
9248
|
-
moveX = -right;
|
|
9249
|
-
if (y >= 0 && bottom <= 0)
|
|
9250
|
-
moveY = 0;
|
|
9251
|
-
else if (moveY > 0) {
|
|
9252
|
-
if (y + moveY > 0)
|
|
9253
|
-
moveY = -y;
|
|
9254
|
-
}
|
|
9255
|
-
else if (moveY < 0 && bottom + moveY < 0)
|
|
9256
|
-
moveY = -bottom;
|
|
9257
|
-
}
|
|
9258
|
-
}
|
|
9259
|
-
return { x: disabled ? 0 : moveX, y: disabled ? 0 : moveY };
|
|
9260
|
-
};
|
|
9261
|
-
leafer.getValidScale = function (changeScale) {
|
|
9262
|
-
const { scaleX } = this.zoomLayer.__, { min, max, disabled } = this.app.config.zoom, absScale = Math.abs(scaleX * changeScale);
|
|
9263
|
-
if (absScale < min)
|
|
9264
|
-
changeScale = min / scaleX;
|
|
9265
|
-
else if (absScale > max)
|
|
9266
|
-
changeScale = max / scaleX;
|
|
9267
|
-
return disabled ? 1 : changeScale;
|
|
9268
|
-
};
|
|
9269
|
-
|
|
9270
|
-
class Transformer {
|
|
9271
|
-
get transforming() { return !!(this.moveData || this.zoomData || this.rotateData); }
|
|
9272
|
-
constructor(interaction) {
|
|
9273
|
-
this.interaction = interaction;
|
|
9274
|
-
}
|
|
9275
|
-
move(data) {
|
|
9276
|
-
const { interaction } = this;
|
|
9277
|
-
if (!data.moveType)
|
|
9278
|
-
data.moveType = 'move';
|
|
9279
|
-
if (!this.moveData) {
|
|
9280
|
-
const { path } = interaction.selector.getByPoint(data, interaction.hitRadius);
|
|
9281
|
-
data.path = path;
|
|
9282
|
-
this.moveData = Object.assign(Object.assign({}, data), { moveX: 0, moveY: 0 });
|
|
9283
|
-
interaction.cancelHover();
|
|
9284
|
-
interaction.emit(MoveEvent.START, this.moveData);
|
|
9285
|
-
}
|
|
9286
|
-
data.path = this.moveData.path;
|
|
9287
|
-
interaction.emit(MoveEvent.BEFORE_MOVE, data);
|
|
9288
|
-
interaction.emit(MoveEvent.MOVE, data);
|
|
9289
|
-
this.transformEndWait();
|
|
9290
|
-
}
|
|
9291
|
-
zoom(data) {
|
|
9292
|
-
const { interaction } = this;
|
|
9293
|
-
if (!this.zoomData) {
|
|
9294
|
-
const { path } = interaction.selector.getByPoint(data, interaction.hitRadius);
|
|
9295
|
-
data.path = path;
|
|
9296
|
-
this.zoomData = Object.assign(Object.assign({}, data), { scale: 1 });
|
|
9297
|
-
interaction.cancelHover();
|
|
9298
|
-
interaction.emit(ZoomEvent.START, this.zoomData);
|
|
9299
|
-
}
|
|
9300
|
-
data.path = this.zoomData.path;
|
|
9301
|
-
interaction.emit(ZoomEvent.BEFORE_ZOOM, data);
|
|
9302
|
-
interaction.emit(ZoomEvent.ZOOM, data);
|
|
9303
|
-
this.transformEndWait();
|
|
9304
|
-
}
|
|
9305
|
-
rotate(data) {
|
|
9306
|
-
const { interaction } = this;
|
|
9307
|
-
if (!this.rotateData) {
|
|
9308
|
-
const { path } = interaction.selector.getByPoint(data, interaction.hitRadius);
|
|
9309
|
-
data.path = path;
|
|
9310
|
-
this.rotateData = Object.assign(Object.assign({}, data), { rotation: 0 });
|
|
9311
|
-
interaction.cancelHover();
|
|
9312
|
-
interaction.emit(RotateEvent.START, this.rotateData);
|
|
9313
|
-
}
|
|
9314
|
-
data.path = this.rotateData.path;
|
|
9315
|
-
interaction.emit(RotateEvent.BEFORE_ROTATE, data);
|
|
9316
|
-
interaction.emit(RotateEvent.ROTATE, data);
|
|
9317
|
-
this.transformEndWait();
|
|
9318
|
-
}
|
|
9319
|
-
transformEndWait() {
|
|
9320
|
-
clearTimeout(this.transformTimer);
|
|
9321
|
-
this.transformTimer = setTimeout(() => {
|
|
9322
|
-
this.transformEnd();
|
|
9323
|
-
}, this.interaction.config.pointer.transformTime);
|
|
9324
|
-
}
|
|
9325
|
-
transformEnd() {
|
|
9326
|
-
this.moveEnd();
|
|
9327
|
-
this.zoomEnd();
|
|
9328
|
-
this.rotateEnd();
|
|
9329
|
-
}
|
|
9330
|
-
moveEnd() {
|
|
9331
|
-
if (this.moveData) {
|
|
9332
|
-
this.interaction.emit(MoveEvent.END, this.moveData);
|
|
9333
|
-
this.moveData = null;
|
|
9334
|
-
}
|
|
9335
|
-
}
|
|
9336
|
-
zoomEnd() {
|
|
9337
|
-
if (this.zoomData) {
|
|
9338
|
-
this.interaction.emit(ZoomEvent.END, this.zoomData);
|
|
9339
|
-
this.zoomData = null;
|
|
9340
|
-
}
|
|
9341
|
-
}
|
|
9342
|
-
rotateEnd() {
|
|
9343
|
-
if (this.rotateData) {
|
|
9344
|
-
this.interaction.emit(RotateEvent.END, this.rotateData);
|
|
9345
|
-
this.rotateData = null;
|
|
9346
|
-
}
|
|
9347
|
-
}
|
|
9348
|
-
destroy() {
|
|
9349
|
-
this.zoomData = this.moveData = this.rotateData = null;
|
|
9350
|
-
}
|
|
9351
|
-
}
|
|
9352
|
-
|
|
9353
9204
|
const InteractionHelper = {
|
|
9354
|
-
getMoveEventData(center, move, event) {
|
|
9355
|
-
return Object.assign(Object.assign({}, event), { x: center.x, y: center.y, moveX: move.x, moveY: move.y });
|
|
9356
|
-
},
|
|
9357
|
-
getRotateEventData(center, angle, event) {
|
|
9358
|
-
return Object.assign(Object.assign({}, event), { x: center.x, y: center.y, rotation: angle });
|
|
9359
|
-
},
|
|
9360
|
-
getZoomEventData(center, scale, event) {
|
|
9361
|
-
return Object.assign(Object.assign({}, event), { x: center.x, y: center.y, scale });
|
|
9362
|
-
},
|
|
9363
9205
|
getDragEventData(startPoint, lastPoint, event) {
|
|
9364
9206
|
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 });
|
|
9365
9207
|
},
|
|
@@ -9368,18 +9210,14 @@ const InteractionHelper = {
|
|
|
9368
9210
|
data });
|
|
9369
9211
|
},
|
|
9370
9212
|
getSwipeDirection(angle) {
|
|
9371
|
-
if (angle < -45 && angle > -135)
|
|
9213
|
+
if (angle < -45 && angle > -135)
|
|
9372
9214
|
return SwipeEvent.UP;
|
|
9373
|
-
|
|
9374
|
-
else if (angle > 45 && angle < 135) {
|
|
9215
|
+
else if (angle > 45 && angle < 135)
|
|
9375
9216
|
return SwipeEvent.DOWN;
|
|
9376
|
-
|
|
9377
|
-
else if (angle <= 45 && angle >= -45) {
|
|
9217
|
+
else if (angle <= 45 && angle >= -45)
|
|
9378
9218
|
return SwipeEvent.RIGHT;
|
|
9379
|
-
|
|
9380
|
-
else {
|
|
9219
|
+
else
|
|
9381
9220
|
return SwipeEvent.LEFT;
|
|
9382
|
-
}
|
|
9383
9221
|
},
|
|
9384
9222
|
getSwipeEventData(startPoint, lastDragData, event) {
|
|
9385
9223
|
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)) });
|
|
@@ -9452,9 +9290,8 @@ class Dragger {
|
|
|
9452
9290
|
interaction.emit(MoveEvent.START, this.dragData);
|
|
9453
9291
|
}
|
|
9454
9292
|
}
|
|
9455
|
-
if (!this.moving)
|
|
9293
|
+
if (!this.moving)
|
|
9456
9294
|
this.dragStart(data, canDrag);
|
|
9457
|
-
}
|
|
9458
9295
|
this.drag(data);
|
|
9459
9296
|
}
|
|
9460
9297
|
dragStart(data, canDrag) {
|
|
@@ -9532,16 +9369,9 @@ class Dragger {
|
|
|
9532
9369
|
dragEnd(data, speed) {
|
|
9533
9370
|
if (!this.dragging && !this.moving)
|
|
9534
9371
|
return;
|
|
9535
|
-
|
|
9536
|
-
|
|
9537
|
-
|
|
9538
|
-
speed = (speed || (data.pointerType === 'touch' ? 2 : 1)) * 0.9;
|
|
9539
|
-
PointHelper.move(data, moveX * speed, moveY * speed);
|
|
9540
|
-
this.drag(data);
|
|
9541
|
-
this.animate(() => { this.dragEnd(data, 1); });
|
|
9542
|
-
}
|
|
9543
|
-
else
|
|
9544
|
-
this.dragEndReal(data);
|
|
9372
|
+
if (this.checkDragEndAnimate(data, speed))
|
|
9373
|
+
return;
|
|
9374
|
+
this.dragEndReal(data);
|
|
9545
9375
|
}
|
|
9546
9376
|
dragEndReal(data) {
|
|
9547
9377
|
const { interaction, downData, dragData } = this;
|
|
@@ -9568,12 +9398,6 @@ class Dragger {
|
|
|
9568
9398
|
this.dragReset();
|
|
9569
9399
|
this.animate(null, 'off');
|
|
9570
9400
|
}
|
|
9571
|
-
animate(func, off) {
|
|
9572
|
-
const animateWait = func || this.animateWait;
|
|
9573
|
-
if (animateWait)
|
|
9574
|
-
this.interaction.target.nextRender(animateWait, null, off);
|
|
9575
|
-
this.animateWait = func;
|
|
9576
|
-
}
|
|
9577
9401
|
swipe(data, downData, dragData, endDragData) {
|
|
9578
9402
|
const { interaction } = this;
|
|
9579
9403
|
if (PointHelper.getDistance(downData, data) > interaction.config.pointer.swipeDistance) {
|
|
@@ -9590,39 +9414,11 @@ class Dragger {
|
|
|
9590
9414
|
dragReset() {
|
|
9591
9415
|
DragEvent.list = DragEvent.data = this.draggableList = this.dragData = this.downData = this.dragOverPath = this.dragEnterPath = null;
|
|
9592
9416
|
}
|
|
9593
|
-
|
|
9594
|
-
|
|
9595
|
-
|
|
9596
|
-
|
|
9597
|
-
|
|
9598
|
-
}
|
|
9599
|
-
autoMoveOnDragOut(data) {
|
|
9600
|
-
const { interaction, downData, canDragOut } = this;
|
|
9601
|
-
const { autoDistance, dragOut } = interaction.config.move;
|
|
9602
|
-
if (!dragOut || !canDragOut || !autoDistance)
|
|
9603
|
-
return;
|
|
9604
|
-
const bounds = interaction.shrinkCanvasBounds;
|
|
9605
|
-
const { x, y } = bounds;
|
|
9606
|
-
const right = BoundsHelper.maxX(bounds);
|
|
9607
|
-
const bottom = BoundsHelper.maxY(bounds);
|
|
9608
|
-
const moveX = data.x < x ? autoDistance : (right < data.x ? -autoDistance : 0);
|
|
9609
|
-
const moveY = data.y < y ? autoDistance : (bottom < data.y ? -autoDistance : 0);
|
|
9610
|
-
let totalX = 0, totalY = 0;
|
|
9611
|
-
this.autoMoveTimer = setInterval(() => {
|
|
9612
|
-
totalX += moveX;
|
|
9613
|
-
totalY += moveY;
|
|
9614
|
-
PointHelper.move(downData, moveX, moveY);
|
|
9615
|
-
PointHelper.move(this.dragData, moveX, moveY);
|
|
9616
|
-
interaction.move(Object.assign(Object.assign({}, data), { moveX, moveY, totalX, totalY, moveType: 'drag' }));
|
|
9617
|
-
interaction.pointerMoveReal(data);
|
|
9618
|
-
}, 10);
|
|
9619
|
-
}
|
|
9620
|
-
autoMoveCancel() {
|
|
9621
|
-
if (this.autoMoveTimer) {
|
|
9622
|
-
clearInterval(this.autoMoveTimer);
|
|
9623
|
-
this.autoMoveTimer = 0;
|
|
9624
|
-
}
|
|
9625
|
-
}
|
|
9417
|
+
checkDragEndAnimate(_data, _speed) { return false; }
|
|
9418
|
+
animate(_func, _off) { }
|
|
9419
|
+
checkDragOut(_data) { }
|
|
9420
|
+
autoMoveOnDragOut(_data) { }
|
|
9421
|
+
autoMoveCancel() { }
|
|
9626
9422
|
destroy() {
|
|
9627
9423
|
this.dragReset();
|
|
9628
9424
|
}
|
|
@@ -9692,28 +9488,12 @@ function exclude(leaf, excludePath) {
|
|
|
9692
9488
|
return excludePath && excludePath.has(leaf);
|
|
9693
9489
|
}
|
|
9694
9490
|
|
|
9695
|
-
const MultiTouchHelper = {
|
|
9696
|
-
getData(list) {
|
|
9697
|
-
const a = list[0];
|
|
9698
|
-
const b = list[1];
|
|
9699
|
-
const lastCenter = PointHelper.getCenter(a.from, b.from);
|
|
9700
|
-
const center = PointHelper.getCenter(a.to, b.to);
|
|
9701
|
-
const move = { x: center.x - lastCenter.x, y: center.y - lastCenter.y };
|
|
9702
|
-
const lastDistance = PointHelper.getDistance(a.from, b.from);
|
|
9703
|
-
const distance = PointHelper.getDistance(a.to, b.to);
|
|
9704
|
-
const scale = distance / lastDistance;
|
|
9705
|
-
const angle = PointHelper.getRotation(a.from, b.from, a.to, b.to);
|
|
9706
|
-
return { move, scale, angle, center };
|
|
9707
|
-
}
|
|
9708
|
-
};
|
|
9709
|
-
|
|
9710
9491
|
const config = {
|
|
9711
9492
|
wheel: {
|
|
9712
9493
|
zoomSpeed: 0.5,
|
|
9713
9494
|
moveSpeed: 0.5,
|
|
9714
9495
|
rotateSpeed: 0.5,
|
|
9715
9496
|
delta: { x: 80 / 4, y: 8.0 },
|
|
9716
|
-
preventDefault: true
|
|
9717
9497
|
},
|
|
9718
9498
|
pointer: {
|
|
9719
9499
|
hitRadius: 5,
|
|
@@ -9724,17 +9504,18 @@ const config = {
|
|
|
9724
9504
|
dragHover: true,
|
|
9725
9505
|
dragDistance: 2,
|
|
9726
9506
|
swipeDistance: 20,
|
|
9727
|
-
preventDefaultMenu: true
|
|
9728
9507
|
},
|
|
9729
9508
|
touch: {
|
|
9730
|
-
preventDefault:
|
|
9509
|
+
preventDefault: 'auto'
|
|
9731
9510
|
},
|
|
9732
9511
|
multiTouch: {},
|
|
9512
|
+
move: { autoDistance: 2 },
|
|
9513
|
+
zoom: {},
|
|
9733
9514
|
cursor: true,
|
|
9734
9515
|
keyEvent: true
|
|
9735
9516
|
};
|
|
9736
9517
|
|
|
9737
|
-
const { pathHasEventType,
|
|
9518
|
+
const { pathHasEventType, pathCanDrag, pathHasOutside } = InteractionHelper;
|
|
9738
9519
|
class InteractionBase {
|
|
9739
9520
|
get dragging() { return this.dragger.dragging; }
|
|
9740
9521
|
get transforming() { return this.transformer.transforming; }
|
|
@@ -9756,7 +9537,7 @@ class InteractionBase {
|
|
|
9756
9537
|
this.canvas = canvas;
|
|
9757
9538
|
this.selector = selector;
|
|
9758
9539
|
this.defaultPath = new LeafList(target);
|
|
9759
|
-
this.
|
|
9540
|
+
this.createTransformer();
|
|
9760
9541
|
this.dragger = new Dragger(this);
|
|
9761
9542
|
if (userConfig)
|
|
9762
9543
|
this.config = DataHelper.default(userConfig, this.config);
|
|
@@ -9857,14 +9638,6 @@ class InteractionBase {
|
|
|
9857
9638
|
data.isCancel = true;
|
|
9858
9639
|
this.pointerUp(data);
|
|
9859
9640
|
}
|
|
9860
|
-
multiTouch(data, list) {
|
|
9861
|
-
if (this.config.multiTouch.disabled)
|
|
9862
|
-
return;
|
|
9863
|
-
const { move, angle, scale, center } = MultiTouchHelper.getData(list);
|
|
9864
|
-
this.rotate(getRotateEventData(center, angle, data));
|
|
9865
|
-
this.zoom(getZoomEventData(center, scale, data));
|
|
9866
|
-
this.move(getMoveEventData(center, move, data));
|
|
9867
|
-
}
|
|
9868
9641
|
menu(data) {
|
|
9869
9642
|
this.findPath(data);
|
|
9870
9643
|
this.emit(PointerEvent.MENU, data);
|
|
@@ -9878,18 +9651,13 @@ class InteractionBase {
|
|
|
9878
9651
|
this.waitRightTap = this.waitMenuTap = false;
|
|
9879
9652
|
}
|
|
9880
9653
|
}
|
|
9881
|
-
|
|
9882
|
-
|
|
9883
|
-
}
|
|
9884
|
-
|
|
9885
|
-
|
|
9886
|
-
}
|
|
9887
|
-
|
|
9888
|
-
this.transformer.rotate(data);
|
|
9889
|
-
}
|
|
9890
|
-
transformEnd() {
|
|
9891
|
-
this.transformer.transformEnd();
|
|
9892
|
-
}
|
|
9654
|
+
createTransformer() { }
|
|
9655
|
+
move(_data) { }
|
|
9656
|
+
zoom(_data) { }
|
|
9657
|
+
rotate(_data) { }
|
|
9658
|
+
transformEnd() { }
|
|
9659
|
+
wheel(_data) { }
|
|
9660
|
+
multiTouch(_data, _list) { }
|
|
9893
9661
|
keyDown(data) {
|
|
9894
9662
|
if (!this.config.keyEvent)
|
|
9895
9663
|
return;
|
|
@@ -10127,8 +9895,9 @@ class InteractionBase {
|
|
|
10127
9895
|
this.longPressed = false;
|
|
10128
9896
|
}
|
|
10129
9897
|
__onResize() {
|
|
9898
|
+
const { dragOut } = this.m;
|
|
10130
9899
|
this.shrinkCanvasBounds = new Bounds(this.canvas.bounds);
|
|
10131
|
-
this.shrinkCanvasBounds.spread(-2);
|
|
9900
|
+
this.shrinkCanvasBounds.spread(-(typeof dragOut === 'number' ? dragOut : 2));
|
|
10132
9901
|
}
|
|
10133
9902
|
__listenEvents() {
|
|
10134
9903
|
const { target } = this;
|
|
@@ -10148,7 +9917,8 @@ class InteractionBase {
|
|
|
10148
9917
|
this.stop();
|
|
10149
9918
|
this.__removeListenEvents();
|
|
10150
9919
|
this.dragger.destroy();
|
|
10151
|
-
this.transformer
|
|
9920
|
+
if (this.transformer)
|
|
9921
|
+
this.transformer.destroy();
|
|
10152
9922
|
this.downData = this.overPath = this.enterPath = null;
|
|
10153
9923
|
}
|
|
10154
9924
|
}
|
|
@@ -12036,4 +11806,4 @@ Object.assign(Creator, {
|
|
|
12036
11806
|
});
|
|
12037
11807
|
useCanvas();
|
|
12038
11808
|
|
|
12039
|
-
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, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage,
|
|
11809
|
+
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, 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 };
|