@leafer-draw/worker 1.0.2 → 1.0.3
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 +34 -21
- package/dist/worker.esm.js +35 -22
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.js +385 -349
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.module.js +382 -346
- package/dist/worker.module.min.js +1 -1
- package/package.json +6 -6
package/dist/worker.module.js
CHANGED
|
@@ -119,11 +119,18 @@ const MathHelper = {
|
|
|
119
119
|
scaleData.scaleX = (typeof size === 'number' ? size : size.width) / originSize.width;
|
|
120
120
|
scaleData.scaleY = (typeof size === 'number' ? size : size.height) / originSize.height;
|
|
121
121
|
}
|
|
122
|
-
else if (scale)
|
|
123
|
-
scaleData
|
|
124
|
-
scaleData.scaleY = typeof scale === 'number' ? scale : scale.y;
|
|
125
|
-
}
|
|
122
|
+
else if (scale)
|
|
123
|
+
MathHelper.assignScale(scaleData, scale);
|
|
126
124
|
return scaleData;
|
|
125
|
+
},
|
|
126
|
+
assignScale(scaleData, scale) {
|
|
127
|
+
if (typeof scale === 'number') {
|
|
128
|
+
scaleData.scaleX = scaleData.scaleY = scale;
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
scaleData.scaleX = scale.x;
|
|
132
|
+
scaleData.scaleY = scale.y;
|
|
133
|
+
}
|
|
127
134
|
}
|
|
128
135
|
};
|
|
129
136
|
const OneRadian = PI$4 / 180;
|
|
@@ -1255,7 +1262,6 @@ const AroundHelper = {
|
|
|
1255
1262
|
tempPoint: {},
|
|
1256
1263
|
get: get$4,
|
|
1257
1264
|
toPoint(around, bounds, to, onlySize, pointBounds) {
|
|
1258
|
-
to || (to = {});
|
|
1259
1265
|
const point = get$4(around);
|
|
1260
1266
|
to.x = point.x;
|
|
1261
1267
|
to.y = point.y;
|
|
@@ -1390,6 +1396,10 @@ const Run = {
|
|
|
1390
1396
|
};
|
|
1391
1397
|
const R = Run;
|
|
1392
1398
|
|
|
1399
|
+
function needPlugin(name) {
|
|
1400
|
+
console.error('need plugin: @leafer-in/' + name);
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1393
1403
|
const debug$c = Debug.get('UICreator');
|
|
1394
1404
|
const UICreator = {
|
|
1395
1405
|
list: {},
|
|
@@ -1652,6 +1662,9 @@ var Answer;
|
|
|
1652
1662
|
Answer[Answer["YesAndSkip"] = 3] = "YesAndSkip";
|
|
1653
1663
|
})(Answer || (Answer = {}));
|
|
1654
1664
|
const emptyData = {};
|
|
1665
|
+
function isNull(value) {
|
|
1666
|
+
return value === undefined || value === null;
|
|
1667
|
+
}
|
|
1655
1668
|
|
|
1656
1669
|
/******************************************************************************
|
|
1657
1670
|
Copyright (c) Microsoft Corporation.
|
|
@@ -2417,7 +2430,7 @@ const BezierHelper = {
|
|
|
2417
2430
|
let startY = y = rotationSin * radiusX * startCos + rotationCos * radiusY * startSin;
|
|
2418
2431
|
let fromX = cx + x, fromY = cy + y;
|
|
2419
2432
|
if (data)
|
|
2420
|
-
data.push(L$6, fromX, fromY);
|
|
2433
|
+
data.push(data.length ? L$6 : M$5, fromX, fromY);
|
|
2421
2434
|
if (setPointBounds)
|
|
2422
2435
|
setPoint$2(setPointBounds, fromX, fromY);
|
|
2423
2436
|
if (setStartPoint)
|
|
@@ -3086,8 +3099,7 @@ const PathBounds = {
|
|
|
3086
3099
|
toTwoPointBounds(data, setPointBounds) {
|
|
3087
3100
|
if (!data || !data.length)
|
|
3088
3101
|
return setPoint$1(setPointBounds, 0, 0);
|
|
3089
|
-
let command;
|
|
3090
|
-
let i = 0, x = 0, y = 0, x1, y1, toX, toY;
|
|
3102
|
+
let i = 0, x = 0, y = 0, x1, y1, toX, toY, command;
|
|
3091
3103
|
const len = data.length;
|
|
3092
3104
|
while (i < len) {
|
|
3093
3105
|
command = data[i];
|
|
@@ -3743,7 +3755,7 @@ function autoLayoutType(defaultValue) {
|
|
|
3743
3755
|
set(value) {
|
|
3744
3756
|
if (this.__setAttr(key, value)) {
|
|
3745
3757
|
this.__layout.matrixChanged || this.__layout.matrixChange();
|
|
3746
|
-
this.__hasAutoLayout = !!
|
|
3758
|
+
this.__hasAutoLayout = !!(this.origin || this.around || this.flow);
|
|
3747
3759
|
if (!this.__local)
|
|
3748
3760
|
this.__layout.createLocal();
|
|
3749
3761
|
}
|
|
@@ -3836,14 +3848,25 @@ function visibleType(defaultValue) {
|
|
|
3836
3848
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3837
3849
|
set(value) {
|
|
3838
3850
|
const oldValue = this.visible;
|
|
3839
|
-
if (
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3851
|
+
if (oldValue === true && value === 0) {
|
|
3852
|
+
if (this.animationOut)
|
|
3853
|
+
return this.__runAnimation('out', () => doVisible(this, key, value, oldValue));
|
|
3854
|
+
}
|
|
3855
|
+
else if (oldValue === 0 && value === true) {
|
|
3856
|
+
if (this.animation)
|
|
3857
|
+
this.__runAnimation('in');
|
|
3843
3858
|
}
|
|
3859
|
+
doVisible(this, key, value, oldValue);
|
|
3844
3860
|
}
|
|
3845
3861
|
}));
|
|
3846
3862
|
}
|
|
3863
|
+
function doVisible(leaf, key, value, oldValue) {
|
|
3864
|
+
if (leaf.__setAttr(key, value)) {
|
|
3865
|
+
leaf.__layout.opacityChanged || leaf.__layout.opacityChange();
|
|
3866
|
+
if (oldValue === 0 || value === 0)
|
|
3867
|
+
doBoundsType(leaf);
|
|
3868
|
+
}
|
|
3869
|
+
}
|
|
3847
3870
|
function sortType(defaultValue) {
|
|
3848
3871
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3849
3872
|
set(value) {
|
|
@@ -3927,7 +3950,16 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
3927
3950
|
if (defaultValue === undefined) {
|
|
3928
3951
|
property.get = function () { return this[computedKey]; };
|
|
3929
3952
|
}
|
|
3930
|
-
else if (
|
|
3953
|
+
else if (typeof defaultValue === 'object') {
|
|
3954
|
+
const { clone } = DataHelper;
|
|
3955
|
+
property.get = function () {
|
|
3956
|
+
let v = this[computedKey];
|
|
3957
|
+
if (v === undefined)
|
|
3958
|
+
this[computedKey] = v = clone(defaultValue);
|
|
3959
|
+
return v;
|
|
3960
|
+
};
|
|
3961
|
+
}
|
|
3962
|
+
if (key === 'width') {
|
|
3931
3963
|
property.get = function () {
|
|
3932
3964
|
const v = this[computedKey];
|
|
3933
3965
|
if (v === undefined) {
|
|
@@ -4594,144 +4626,6 @@ class LeafLayout {
|
|
|
4594
4626
|
destroy() { }
|
|
4595
4627
|
}
|
|
4596
4628
|
|
|
4597
|
-
const empty = {};
|
|
4598
|
-
const LeafEventer = {
|
|
4599
|
-
on(type, listener, options) {
|
|
4600
|
-
let capture, once;
|
|
4601
|
-
if (options) {
|
|
4602
|
-
if (options === 'once') {
|
|
4603
|
-
once = true;
|
|
4604
|
-
}
|
|
4605
|
-
else if (typeof options === 'boolean') {
|
|
4606
|
-
capture = options;
|
|
4607
|
-
}
|
|
4608
|
-
else {
|
|
4609
|
-
capture = options.capture;
|
|
4610
|
-
once = options.once;
|
|
4611
|
-
}
|
|
4612
|
-
}
|
|
4613
|
-
let events;
|
|
4614
|
-
const map = __getListenerMap(this, capture, true);
|
|
4615
|
-
const typeList = typeof type === 'string' ? type.split(' ') : type;
|
|
4616
|
-
const item = once ? { listener, once } : { listener };
|
|
4617
|
-
typeList.forEach(type => {
|
|
4618
|
-
if (type) {
|
|
4619
|
-
events = map[type];
|
|
4620
|
-
if (events) {
|
|
4621
|
-
if (events.findIndex(item => item.listener === listener) === -1)
|
|
4622
|
-
events.push(item);
|
|
4623
|
-
}
|
|
4624
|
-
else {
|
|
4625
|
-
map[type] = [item];
|
|
4626
|
-
}
|
|
4627
|
-
}
|
|
4628
|
-
});
|
|
4629
|
-
},
|
|
4630
|
-
off(type, listener, options) {
|
|
4631
|
-
if (type) {
|
|
4632
|
-
const typeList = typeof type === 'string' ? type.split(' ') : type;
|
|
4633
|
-
if (listener) {
|
|
4634
|
-
let capture;
|
|
4635
|
-
if (options)
|
|
4636
|
-
capture = typeof options === 'boolean' ? options : (options === 'once' ? false : options.capture);
|
|
4637
|
-
let events, index;
|
|
4638
|
-
const map = __getListenerMap(this, capture);
|
|
4639
|
-
typeList.forEach(type => {
|
|
4640
|
-
if (type) {
|
|
4641
|
-
events = map[type];
|
|
4642
|
-
if (events) {
|
|
4643
|
-
index = events.findIndex(item => item.listener === listener);
|
|
4644
|
-
if (index > -1)
|
|
4645
|
-
events.splice(index, 1);
|
|
4646
|
-
if (!events.length)
|
|
4647
|
-
delete map[type];
|
|
4648
|
-
}
|
|
4649
|
-
}
|
|
4650
|
-
});
|
|
4651
|
-
}
|
|
4652
|
-
else {
|
|
4653
|
-
const { __bubbleMap: b, __captureMap: c } = this;
|
|
4654
|
-
typeList.forEach(type => {
|
|
4655
|
-
if (b)
|
|
4656
|
-
delete b[type];
|
|
4657
|
-
if (c)
|
|
4658
|
-
delete c[type];
|
|
4659
|
-
});
|
|
4660
|
-
}
|
|
4661
|
-
}
|
|
4662
|
-
else {
|
|
4663
|
-
this.__bubbleMap = this.__captureMap = undefined;
|
|
4664
|
-
}
|
|
4665
|
-
},
|
|
4666
|
-
on_(type, listener, bind, options) {
|
|
4667
|
-
if (bind)
|
|
4668
|
-
listener = listener.bind(bind);
|
|
4669
|
-
this.on(type, listener, options);
|
|
4670
|
-
return { type, current: this, listener, options };
|
|
4671
|
-
},
|
|
4672
|
-
off_(id) {
|
|
4673
|
-
if (!id)
|
|
4674
|
-
return;
|
|
4675
|
-
const list = id instanceof Array ? id : [id];
|
|
4676
|
-
list.forEach(item => item.current.off(item.type, item.listener, item.options));
|
|
4677
|
-
list.length = 0;
|
|
4678
|
-
},
|
|
4679
|
-
once(type, listener, capture) {
|
|
4680
|
-
this.on(type, listener, { once: true, capture });
|
|
4681
|
-
},
|
|
4682
|
-
emit(type, event, capture) {
|
|
4683
|
-
if (!event && EventCreator.has(type))
|
|
4684
|
-
event = EventCreator.get(type, { type, target: this, current: this });
|
|
4685
|
-
const map = __getListenerMap(this, capture);
|
|
4686
|
-
const list = map[type];
|
|
4687
|
-
if (list) {
|
|
4688
|
-
let item;
|
|
4689
|
-
for (let i = 0, len = list.length; i < len; i++) {
|
|
4690
|
-
item = list[i];
|
|
4691
|
-
item.listener(event);
|
|
4692
|
-
if (item.once) {
|
|
4693
|
-
this.off(type, item.listener, capture);
|
|
4694
|
-
i--, len--;
|
|
4695
|
-
}
|
|
4696
|
-
if (event && event.isStopNow)
|
|
4697
|
-
break;
|
|
4698
|
-
}
|
|
4699
|
-
}
|
|
4700
|
-
this.syncEventer && this.syncEventer.emitEvent(event, capture);
|
|
4701
|
-
},
|
|
4702
|
-
emitEvent(event, capture) {
|
|
4703
|
-
event.current = this;
|
|
4704
|
-
this.emit(event.type, event, capture);
|
|
4705
|
-
},
|
|
4706
|
-
hasEvent(type, capture) {
|
|
4707
|
-
if (this.syncEventer && this.syncEventer.hasEvent(type, capture))
|
|
4708
|
-
return true;
|
|
4709
|
-
const { __bubbleMap: b, __captureMap: c } = this;
|
|
4710
|
-
const hasB = b && b[type], hasC = c && c[type];
|
|
4711
|
-
return !!(capture === undefined ? (hasB || hasC) : (capture ? hasC : hasB));
|
|
4712
|
-
},
|
|
4713
|
-
};
|
|
4714
|
-
function __getListenerMap(eventer, capture, create) {
|
|
4715
|
-
if (capture) {
|
|
4716
|
-
const { __captureMap: c } = eventer;
|
|
4717
|
-
if (c) {
|
|
4718
|
-
return c;
|
|
4719
|
-
}
|
|
4720
|
-
else {
|
|
4721
|
-
return create ? eventer.__captureMap = {} : empty;
|
|
4722
|
-
}
|
|
4723
|
-
}
|
|
4724
|
-
else {
|
|
4725
|
-
const { __bubbleMap: b } = eventer;
|
|
4726
|
-
if (b) {
|
|
4727
|
-
return b;
|
|
4728
|
-
}
|
|
4729
|
-
else {
|
|
4730
|
-
return create ? eventer.__bubbleMap = {} : empty;
|
|
4731
|
-
}
|
|
4732
|
-
}
|
|
4733
|
-
}
|
|
4734
|
-
|
|
4735
4629
|
class Event {
|
|
4736
4630
|
constructor(type, target) {
|
|
4737
4631
|
this.bubbles = false;
|
|
@@ -4766,7 +4660,10 @@ class ChildEvent extends Event {
|
|
|
4766
4660
|
}
|
|
4767
4661
|
ChildEvent.ADD = 'child.add';
|
|
4768
4662
|
ChildEvent.REMOVE = 'child.remove';
|
|
4769
|
-
ChildEvent.
|
|
4663
|
+
ChildEvent.CREATED = 'created';
|
|
4664
|
+
ChildEvent.MOUNTED = 'mounted';
|
|
4665
|
+
ChildEvent.UNMOUNTED = 'unmounted';
|
|
4666
|
+
ChildEvent.DESTROY = 'destroy';
|
|
4770
4667
|
|
|
4771
4668
|
class PropertyEvent extends Event {
|
|
4772
4669
|
constructor(type, target, attrName, oldValue, newValue) {
|
|
@@ -4844,10 +4741,6 @@ LayoutEvent.AFTER = 'layout.after';
|
|
|
4844
4741
|
LayoutEvent.AGAIN = 'layout.again';
|
|
4845
4742
|
LayoutEvent.END = 'layout.end';
|
|
4846
4743
|
|
|
4847
|
-
class AnimateEvent extends Event {
|
|
4848
|
-
}
|
|
4849
|
-
AnimateEvent.FRAME = 'animate.frame';
|
|
4850
|
-
|
|
4851
4744
|
class RenderEvent extends Event {
|
|
4852
4745
|
constructor(type, times, bounds, options) {
|
|
4853
4746
|
super(type);
|
|
@@ -4880,6 +4773,157 @@ LeaferEvent.STOP = 'leafer.stop';
|
|
|
4880
4773
|
LeaferEvent.RESTART = 'leafer.restart';
|
|
4881
4774
|
LeaferEvent.END = 'leafer.end';
|
|
4882
4775
|
|
|
4776
|
+
const empty = {};
|
|
4777
|
+
class Eventer {
|
|
4778
|
+
set event(map) { this.on(map); }
|
|
4779
|
+
on(type, listener, options) {
|
|
4780
|
+
if (!listener) {
|
|
4781
|
+
let event, map = type;
|
|
4782
|
+
for (let key in map)
|
|
4783
|
+
event = map[key], event instanceof Array ? this.on(key, event[0], event[1]) : this.on(key, event);
|
|
4784
|
+
return;
|
|
4785
|
+
}
|
|
4786
|
+
let capture, once;
|
|
4787
|
+
if (options) {
|
|
4788
|
+
if (options === 'once') {
|
|
4789
|
+
once = true;
|
|
4790
|
+
}
|
|
4791
|
+
else if (typeof options === 'boolean') {
|
|
4792
|
+
capture = options;
|
|
4793
|
+
}
|
|
4794
|
+
else {
|
|
4795
|
+
capture = options.capture;
|
|
4796
|
+
once = options.once;
|
|
4797
|
+
}
|
|
4798
|
+
}
|
|
4799
|
+
let events;
|
|
4800
|
+
const map = __getListenerMap(this, capture, true);
|
|
4801
|
+
const typeList = typeof type === 'string' ? type.split(' ') : type;
|
|
4802
|
+
const item = once ? { listener, once } : { listener };
|
|
4803
|
+
typeList.forEach(type => {
|
|
4804
|
+
if (type) {
|
|
4805
|
+
events = map[type];
|
|
4806
|
+
if (events) {
|
|
4807
|
+
if (events.findIndex(item => item.listener === listener) === -1)
|
|
4808
|
+
events.push(item);
|
|
4809
|
+
}
|
|
4810
|
+
else {
|
|
4811
|
+
map[type] = [item];
|
|
4812
|
+
}
|
|
4813
|
+
}
|
|
4814
|
+
});
|
|
4815
|
+
}
|
|
4816
|
+
off(type, listener, options) {
|
|
4817
|
+
if (type) {
|
|
4818
|
+
const typeList = typeof type === 'string' ? type.split(' ') : type;
|
|
4819
|
+
if (listener) {
|
|
4820
|
+
let capture;
|
|
4821
|
+
if (options)
|
|
4822
|
+
capture = typeof options === 'boolean' ? options : (options === 'once' ? false : options.capture);
|
|
4823
|
+
let events, index;
|
|
4824
|
+
const map = __getListenerMap(this, capture);
|
|
4825
|
+
typeList.forEach(type => {
|
|
4826
|
+
if (type) {
|
|
4827
|
+
events = map[type];
|
|
4828
|
+
if (events) {
|
|
4829
|
+
index = events.findIndex(item => item.listener === listener);
|
|
4830
|
+
if (index > -1)
|
|
4831
|
+
events.splice(index, 1);
|
|
4832
|
+
if (!events.length)
|
|
4833
|
+
delete map[type];
|
|
4834
|
+
}
|
|
4835
|
+
}
|
|
4836
|
+
});
|
|
4837
|
+
}
|
|
4838
|
+
else {
|
|
4839
|
+
const { __bubbleMap: b, __captureMap: c } = this;
|
|
4840
|
+
typeList.forEach(type => {
|
|
4841
|
+
if (b)
|
|
4842
|
+
delete b[type];
|
|
4843
|
+
if (c)
|
|
4844
|
+
delete c[type];
|
|
4845
|
+
});
|
|
4846
|
+
}
|
|
4847
|
+
}
|
|
4848
|
+
else {
|
|
4849
|
+
this.__bubbleMap = this.__captureMap = undefined;
|
|
4850
|
+
}
|
|
4851
|
+
}
|
|
4852
|
+
on_(type, listener, bind, options) {
|
|
4853
|
+
if (bind)
|
|
4854
|
+
listener = listener.bind(bind);
|
|
4855
|
+
this.on(type, listener, options);
|
|
4856
|
+
return { type, current: this, listener, options };
|
|
4857
|
+
}
|
|
4858
|
+
off_(id) {
|
|
4859
|
+
if (!id)
|
|
4860
|
+
return;
|
|
4861
|
+
const list = id instanceof Array ? id : [id];
|
|
4862
|
+
list.forEach(item => item.current.off(item.type, item.listener, item.options));
|
|
4863
|
+
list.length = 0;
|
|
4864
|
+
}
|
|
4865
|
+
once(type, listener, capture) {
|
|
4866
|
+
this.on(type, listener, { once: true, capture });
|
|
4867
|
+
}
|
|
4868
|
+
emit(type, event, capture) {
|
|
4869
|
+
if (!event && EventCreator.has(type))
|
|
4870
|
+
event = EventCreator.get(type, { type, target: this, current: this });
|
|
4871
|
+
const map = __getListenerMap(this, capture);
|
|
4872
|
+
const list = map[type];
|
|
4873
|
+
if (list) {
|
|
4874
|
+
let item;
|
|
4875
|
+
for (let i = 0, len = list.length; i < len; i++) {
|
|
4876
|
+
item = list[i];
|
|
4877
|
+
item.listener(event);
|
|
4878
|
+
if (item.once) {
|
|
4879
|
+
this.off(type, item.listener, capture);
|
|
4880
|
+
i--, len--;
|
|
4881
|
+
}
|
|
4882
|
+
if (event && event.isStopNow)
|
|
4883
|
+
break;
|
|
4884
|
+
}
|
|
4885
|
+
}
|
|
4886
|
+
this.syncEventer && this.syncEventer.emitEvent(event, capture);
|
|
4887
|
+
}
|
|
4888
|
+
emitEvent(event, capture) {
|
|
4889
|
+
event.current = this;
|
|
4890
|
+
this.emit(event.type, event, capture);
|
|
4891
|
+
}
|
|
4892
|
+
hasEvent(type, capture) {
|
|
4893
|
+
if (this.syncEventer && this.syncEventer.hasEvent(type, capture))
|
|
4894
|
+
return true;
|
|
4895
|
+
const { __bubbleMap: b, __captureMap: c } = this;
|
|
4896
|
+
const hasB = b && b[type], hasC = c && c[type];
|
|
4897
|
+
return !!(capture === undefined ? (hasB || hasC) : (capture ? hasC : hasB));
|
|
4898
|
+
}
|
|
4899
|
+
destroy() {
|
|
4900
|
+
this.__captureMap = this.__bubbleMap = this.syncEventer = null;
|
|
4901
|
+
}
|
|
4902
|
+
}
|
|
4903
|
+
function __getListenerMap(eventer, capture, create) {
|
|
4904
|
+
if (capture) {
|
|
4905
|
+
const { __captureMap: c } = eventer;
|
|
4906
|
+
if (c) {
|
|
4907
|
+
return c;
|
|
4908
|
+
}
|
|
4909
|
+
else {
|
|
4910
|
+
return create ? eventer.__captureMap = {} : empty;
|
|
4911
|
+
}
|
|
4912
|
+
}
|
|
4913
|
+
else {
|
|
4914
|
+
const { __bubbleMap: b } = eventer;
|
|
4915
|
+
if (b) {
|
|
4916
|
+
return b;
|
|
4917
|
+
}
|
|
4918
|
+
else {
|
|
4919
|
+
return create ? eventer.__bubbleMap = {} : empty;
|
|
4920
|
+
}
|
|
4921
|
+
}
|
|
4922
|
+
}
|
|
4923
|
+
|
|
4924
|
+
const { on, on_, off, off_, once, emit: emit$1, emitEvent, hasEvent, destroy } = Eventer.prototype;
|
|
4925
|
+
const LeafEventer = { on, on_, off, off_, once, emit: emit$1, emitEvent, hasEvent, destroyEventer: destroy };
|
|
4926
|
+
|
|
4883
4927
|
const { isFinite } = Number;
|
|
4884
4928
|
const debug$5 = Debug.get('setAttr');
|
|
4885
4929
|
const LeafDataProxy = {
|
|
@@ -4891,9 +4935,7 @@ const LeafDataProxy = {
|
|
|
4891
4935
|
newValue = undefined;
|
|
4892
4936
|
}
|
|
4893
4937
|
if (typeof newValue === 'object' || oldValue !== newValue) {
|
|
4894
|
-
this.
|
|
4895
|
-
if (this.__proxyData)
|
|
4896
|
-
this.setProxyAttr(name, newValue);
|
|
4938
|
+
this.__realSetAttr(name, newValue);
|
|
4897
4939
|
const { CHANGE } = PropertyEvent;
|
|
4898
4940
|
const event = new PropertyEvent(CHANGE, this, name, oldValue, newValue);
|
|
4899
4941
|
if (this.isLeafer) {
|
|
@@ -4911,12 +4953,18 @@ const LeafDataProxy = {
|
|
|
4911
4953
|
}
|
|
4912
4954
|
}
|
|
4913
4955
|
else {
|
|
4914
|
-
this.
|
|
4915
|
-
if (this.__proxyData)
|
|
4916
|
-
this.setProxyAttr(name, newValue);
|
|
4956
|
+
this.__realSetAttr(name, newValue);
|
|
4917
4957
|
return true;
|
|
4918
4958
|
}
|
|
4919
4959
|
},
|
|
4960
|
+
__realSetAttr(name, newValue) {
|
|
4961
|
+
const data = this.__;
|
|
4962
|
+
data[name] = newValue;
|
|
4963
|
+
if (this.__proxyData)
|
|
4964
|
+
this.setProxyAttr(name, newValue);
|
|
4965
|
+
if (data.normalStyle)
|
|
4966
|
+
this.lockNormalStyle || data.normalStyle[name] === undefined || (data.normalStyle[name] = newValue);
|
|
4967
|
+
},
|
|
4920
4968
|
__getAttr(name) {
|
|
4921
4969
|
if (this.__proxyData)
|
|
4922
4970
|
return this.getProxyAttr(name);
|
|
@@ -5019,6 +5067,8 @@ const LeafBounds = {
|
|
|
5019
5067
|
layout.boundsChanged = false;
|
|
5020
5068
|
},
|
|
5021
5069
|
__updateLocalBoxBounds() {
|
|
5070
|
+
if (this.__hasMotionPath)
|
|
5071
|
+
this.__updateMotionPath();
|
|
5022
5072
|
if (this.__hasAutoLayout)
|
|
5023
5073
|
this.__updateAutoLayout();
|
|
5024
5074
|
toOuterOf$1(this.__layout.boxBounds, this.__local, this.__local);
|
|
@@ -5171,7 +5221,7 @@ const BranchRender = {
|
|
|
5171
5221
|
const { LEAF, create } = IncrementId;
|
|
5172
5222
|
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
|
|
5173
5223
|
const { toOuterOf } = BoundsHelper;
|
|
5174
|
-
const { copy: copy$3 } = PointHelper;
|
|
5224
|
+
const { copy: copy$3, move } = PointHelper;
|
|
5175
5225
|
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
|
|
5176
5226
|
let Leaf = class Leaf {
|
|
5177
5227
|
get tag() { return this.__tag; }
|
|
@@ -5198,13 +5248,16 @@ let Leaf = class Leaf {
|
|
|
5198
5248
|
get __ignoreHitWorld() { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren; }
|
|
5199
5249
|
get __inLazyBounds() { const { leafer } = this; return leafer && leafer.created && leafer.lazyBounds.hit(this.__world); }
|
|
5200
5250
|
get pathInputed() { return this.__.__pathInputed; }
|
|
5201
|
-
set event(map) {
|
|
5202
|
-
event = map[key], event instanceof Array ? this.on(key, event[0], event[1]) : this.on(key, event); }
|
|
5251
|
+
set event(map) { this.on(map); }
|
|
5203
5252
|
constructor(data) {
|
|
5204
5253
|
this.innerId = create(LEAF);
|
|
5205
5254
|
this.reset(data);
|
|
5255
|
+
if (this.__bubbleMap)
|
|
5256
|
+
this.__emitLifeEvent(ChildEvent.CREATED);
|
|
5206
5257
|
}
|
|
5207
5258
|
reset(data) {
|
|
5259
|
+
if (this.leafer)
|
|
5260
|
+
this.leafer.forceRender(this.__world);
|
|
5208
5261
|
this.__world = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, x: 0, y: 0, width: 0, height: 0, scaleX: 1, scaleY: 1 };
|
|
5209
5262
|
if (data !== null)
|
|
5210
5263
|
this.__local = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, x: 0, y: 0, width: 0, height: 0 };
|
|
@@ -5226,12 +5279,12 @@ let Leaf = class Leaf {
|
|
|
5226
5279
|
waitParent(item, bind) {
|
|
5227
5280
|
if (bind)
|
|
5228
5281
|
item = item.bind(bind);
|
|
5229
|
-
this.parent ? item() :
|
|
5282
|
+
this.parent ? item() : this.on(ChildEvent.ADD, item, 'once');
|
|
5230
5283
|
}
|
|
5231
5284
|
waitLeafer(item, bind) {
|
|
5232
5285
|
if (bind)
|
|
5233
5286
|
item = item.bind(bind);
|
|
5234
|
-
this.leafer ? item() :
|
|
5287
|
+
this.leafer ? item() : this.on(ChildEvent.MOUNTED, item, 'once');
|
|
5235
5288
|
}
|
|
5236
5289
|
nextRender(item, bind, off) {
|
|
5237
5290
|
this.leafer ? this.leafer.nextRender(item, bind, off) : this.waitLeafer(() => this.leafer.nextRender(item, bind, off));
|
|
@@ -5240,18 +5293,21 @@ let Leaf = class Leaf {
|
|
|
5240
5293
|
this.nextRender(item, null, 'off');
|
|
5241
5294
|
}
|
|
5242
5295
|
__bindLeafer(leafer) {
|
|
5243
|
-
if (this.isLeafer)
|
|
5244
|
-
|
|
5245
|
-
leafer = this;
|
|
5246
|
-
}
|
|
5296
|
+
if (this.isLeafer && leafer !== null)
|
|
5297
|
+
leafer = this;
|
|
5247
5298
|
if (this.leafer && !leafer)
|
|
5248
5299
|
this.leafer.leafs--;
|
|
5249
5300
|
this.leafer = leafer;
|
|
5250
5301
|
if (leafer) {
|
|
5251
5302
|
leafer.leafs++;
|
|
5252
5303
|
this.__level = this.parent ? this.parent.__level + 1 : 1;
|
|
5253
|
-
if (this.
|
|
5254
|
-
|
|
5304
|
+
if (this.animation)
|
|
5305
|
+
this.__runAnimation('in');
|
|
5306
|
+
if (this.__bubbleMap)
|
|
5307
|
+
this.__emitLifeEvent(ChildEvent.MOUNTED);
|
|
5308
|
+
}
|
|
5309
|
+
else {
|
|
5310
|
+
this.__emitLifeEvent(ChildEvent.UNMOUNTED);
|
|
5255
5311
|
}
|
|
5256
5312
|
if (this.isBranch) {
|
|
5257
5313
|
const { children } = this;
|
|
@@ -5260,7 +5316,7 @@ let Leaf = class Leaf {
|
|
|
5260
5316
|
}
|
|
5261
5317
|
}
|
|
5262
5318
|
}
|
|
5263
|
-
set(_data) { }
|
|
5319
|
+
set(_data, _isTemp) { }
|
|
5264
5320
|
get(_name) { return undefined; }
|
|
5265
5321
|
setAttr(name, value) { this[name] = value; }
|
|
5266
5322
|
getAttr(name) { return this[name]; }
|
|
@@ -5285,6 +5341,7 @@ let Leaf = class Leaf {
|
|
|
5285
5341
|
findOne(_condition, _options) { return undefined; }
|
|
5286
5342
|
findId(_id) { return undefined; }
|
|
5287
5343
|
focus(_value) { }
|
|
5344
|
+
updateState() { }
|
|
5288
5345
|
updateLayout() {
|
|
5289
5346
|
this.__layout.update();
|
|
5290
5347
|
}
|
|
@@ -5392,11 +5449,24 @@ let Leaf = class Leaf {
|
|
|
5392
5449
|
if (relative)
|
|
5393
5450
|
relative.worldToInner(to ? to : inner, null, distance);
|
|
5394
5451
|
}
|
|
5452
|
+
getBoxPoint(world, relative, distance, change) {
|
|
5453
|
+
return this.getBoxPointByInner(this.getInnerPoint(world, relative, distance, change), null, null, true);
|
|
5454
|
+
}
|
|
5455
|
+
getBoxPointByInner(inner, _relative, _distance, change) {
|
|
5456
|
+
const point = change ? inner : Object.assign({}, inner), { x, y } = this.boxBounds;
|
|
5457
|
+
move(point, -x, -y);
|
|
5458
|
+
return point;
|
|
5459
|
+
}
|
|
5395
5460
|
getInnerPoint(world, relative, distance, change) {
|
|
5396
5461
|
const point = change ? world : {};
|
|
5397
5462
|
this.worldToInner(world, point, distance, relative);
|
|
5398
5463
|
return point;
|
|
5399
5464
|
}
|
|
5465
|
+
getInnerPointByBox(box, _relative, _distance, change) {
|
|
5466
|
+
const point = change ? box : Object.assign({}, box), { x, y } = this.boxBounds;
|
|
5467
|
+
move(point, x, y);
|
|
5468
|
+
return point;
|
|
5469
|
+
}
|
|
5400
5470
|
getInnerPointByLocal(local, _relative, distance, change) {
|
|
5401
5471
|
return this.getInnerPoint(local, this.parent, distance, change);
|
|
5402
5472
|
}
|
|
@@ -5408,20 +5478,23 @@ let Leaf = class Leaf {
|
|
|
5408
5478
|
getLocalPointByInner(inner, _relative, distance, change) {
|
|
5409
5479
|
return this.getWorldPoint(inner, this.parent, distance, change);
|
|
5410
5480
|
}
|
|
5481
|
+
getPagePoint(world, relative, distance, change) {
|
|
5482
|
+
const layer = this.leafer ? this.leafer.zoomLayer : this;
|
|
5483
|
+
return layer.getInnerPoint(world, relative, distance, change);
|
|
5484
|
+
}
|
|
5411
5485
|
getWorldPoint(inner, relative, distance, change) {
|
|
5412
5486
|
const point = change ? inner : {};
|
|
5413
5487
|
this.innerToWorld(inner, point, distance, relative);
|
|
5414
5488
|
return point;
|
|
5415
5489
|
}
|
|
5490
|
+
getWorldPointByBox(box, relative, distance, change) {
|
|
5491
|
+
return this.getWorldPoint(this.getInnerPointByBox(box, null, null, change), relative, distance, true);
|
|
5492
|
+
}
|
|
5416
5493
|
getWorldPointByLocal(local, relative, distance, change) {
|
|
5417
5494
|
const point = change ? local : {};
|
|
5418
5495
|
this.localToWorld(local, point, distance, relative);
|
|
5419
5496
|
return point;
|
|
5420
5497
|
}
|
|
5421
|
-
getPagePoint(world, relative, distance, change) {
|
|
5422
|
-
const layer = this.leafer ? this.leafer.zoomLayer : this;
|
|
5423
|
-
return layer.getInnerPoint(world, relative, distance, change);
|
|
5424
|
-
}
|
|
5425
5498
|
getWorldPointByPage(page, relative, distance, change) {
|
|
5426
5499
|
const layer = this.leafer ? this.leafer.zoomLayer : this;
|
|
5427
5500
|
return layer.getWorldPoint(page, relative, distance, change);
|
|
@@ -5490,6 +5563,17 @@ let Leaf = class Leaf {
|
|
|
5490
5563
|
__drawRenderPath(_canvas) { }
|
|
5491
5564
|
__updatePath() { }
|
|
5492
5565
|
__updateRenderPath() { }
|
|
5566
|
+
getMotionPathData() {
|
|
5567
|
+
return needPlugin('path');
|
|
5568
|
+
}
|
|
5569
|
+
getMotionPoint(_motionDistance) {
|
|
5570
|
+
return needPlugin('path');
|
|
5571
|
+
}
|
|
5572
|
+
getMotionTotal() {
|
|
5573
|
+
return 0;
|
|
5574
|
+
}
|
|
5575
|
+
__updateMotionPath() { }
|
|
5576
|
+
__runAnimation(_type, _complete) { }
|
|
5493
5577
|
__updateSortChildren() { }
|
|
5494
5578
|
add(_child, _index) { }
|
|
5495
5579
|
remove(_child, destroy) {
|
|
@@ -5515,6 +5599,10 @@ let Leaf = class Leaf {
|
|
|
5515
5599
|
fn = boundsType;
|
|
5516
5600
|
fn(defaultValue)(this.prototype, attrName);
|
|
5517
5601
|
}
|
|
5602
|
+
__emitLifeEvent(type) {
|
|
5603
|
+
if (this.hasEvent(type))
|
|
5604
|
+
this.emitEvent(new ChildEvent(type, this, this.parent));
|
|
5605
|
+
}
|
|
5518
5606
|
destroy() {
|
|
5519
5607
|
if (!this.destroyed) {
|
|
5520
5608
|
const { parent } = this;
|
|
@@ -5522,11 +5610,10 @@ let Leaf = class Leaf {
|
|
|
5522
5610
|
this.remove();
|
|
5523
5611
|
if (this.children)
|
|
5524
5612
|
this.removeAll(true);
|
|
5525
|
-
|
|
5526
|
-
this.emitEvent(new ChildEvent(ChildEvent.DESTROY, this, parent));
|
|
5613
|
+
this.__emitLifeEvent(ChildEvent.DESTROY);
|
|
5527
5614
|
this.__.destroy();
|
|
5528
5615
|
this.__layout.destroy();
|
|
5529
|
-
this.
|
|
5616
|
+
this.destroyEventer();
|
|
5530
5617
|
this.destroyed = true;
|
|
5531
5618
|
}
|
|
5532
5619
|
}
|
|
@@ -5592,8 +5679,8 @@ let Branch = class Branch extends Leaf {
|
|
|
5592
5679
|
this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1;
|
|
5593
5680
|
child.__layout.boxChanged || child.__layout.boxChange();
|
|
5594
5681
|
child.__layout.matrixChanged || child.__layout.matrixChange();
|
|
5595
|
-
if (child.
|
|
5596
|
-
|
|
5682
|
+
if (child.__bubbleMap)
|
|
5683
|
+
child.__emitLifeEvent(ChildEvent.ADD);
|
|
5597
5684
|
if (this.leafer) {
|
|
5598
5685
|
child.__bindLeafer(this.leafer);
|
|
5599
5686
|
if (this.leafer.created)
|
|
@@ -5606,16 +5693,10 @@ let Branch = class Branch extends Leaf {
|
|
|
5606
5693
|
}
|
|
5607
5694
|
remove(child, destroy) {
|
|
5608
5695
|
if (child) {
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
this.__.__childBranchNumber = (this.__.__childBranchNumber || 1) - 1;
|
|
5614
|
-
this.__preRemove();
|
|
5615
|
-
this.__realRemoveChild(child);
|
|
5616
|
-
if (destroy)
|
|
5617
|
-
child.destroy();
|
|
5618
|
-
}
|
|
5696
|
+
if (child.animationOut)
|
|
5697
|
+
child.__runAnimation('out', () => this.__remove(child, destroy));
|
|
5698
|
+
else
|
|
5699
|
+
this.__remove(child, destroy);
|
|
5619
5700
|
}
|
|
5620
5701
|
else if (child === undefined) {
|
|
5621
5702
|
super.remove(null, destroy);
|
|
@@ -5637,6 +5718,18 @@ let Branch = class Branch extends Leaf {
|
|
|
5637
5718
|
clear() {
|
|
5638
5719
|
this.removeAll(true);
|
|
5639
5720
|
}
|
|
5721
|
+
__remove(child, destroy) {
|
|
5722
|
+
const index = this.children.indexOf(child);
|
|
5723
|
+
if (index > -1) {
|
|
5724
|
+
this.children.splice(index, 1);
|
|
5725
|
+
if (child.isBranch)
|
|
5726
|
+
this.__.__childBranchNumber = (this.__.__childBranchNumber || 1) - 1;
|
|
5727
|
+
this.__preRemove();
|
|
5728
|
+
this.__realRemoveChild(child);
|
|
5729
|
+
if (destroy)
|
|
5730
|
+
child.destroy();
|
|
5731
|
+
}
|
|
5732
|
+
}
|
|
5640
5733
|
__preRemove() {
|
|
5641
5734
|
if (this.__hasMask)
|
|
5642
5735
|
this.__updateMask();
|
|
@@ -5646,6 +5739,7 @@ let Branch = class Branch extends Leaf {
|
|
|
5646
5739
|
this.__layout.affectChildrenSort && this.__layout.childrenSortChange();
|
|
5647
5740
|
}
|
|
5648
5741
|
__realRemoveChild(child) {
|
|
5742
|
+
child.__emitLifeEvent(ChildEvent.REMOVE);
|
|
5649
5743
|
child.parent = null;
|
|
5650
5744
|
if (this.leafer) {
|
|
5651
5745
|
child.__bindLeafer(null);
|
|
@@ -5658,8 +5752,6 @@ let Branch = class Branch extends Leaf {
|
|
|
5658
5752
|
}
|
|
5659
5753
|
__emitChildEvent(type, child) {
|
|
5660
5754
|
const event = new ChildEvent(type, child, this);
|
|
5661
|
-
if (child.hasEvent(type))
|
|
5662
|
-
child.emitEvent(event);
|
|
5663
5755
|
if (this.hasEvent(type) && !this.isLeafer)
|
|
5664
5756
|
this.emitEvent(event);
|
|
5665
5757
|
this.leafer.emitEvent(event);
|
|
@@ -5822,8 +5914,7 @@ class LeafLevelList {
|
|
|
5822
5914
|
}
|
|
5823
5915
|
}
|
|
5824
5916
|
|
|
5825
|
-
const version = "1.0.
|
|
5826
|
-
const inviteCode = {};
|
|
5917
|
+
const version = "1.0.3";
|
|
5827
5918
|
|
|
5828
5919
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
5829
5920
|
get allowBackgroundColor() { return true; }
|
|
@@ -6050,9 +6141,13 @@ function updateBounds(boundsList) {
|
|
|
6050
6141
|
});
|
|
6051
6142
|
}
|
|
6052
6143
|
function updateChange(updateList) {
|
|
6144
|
+
let layout;
|
|
6053
6145
|
updateList.list.forEach(leaf => {
|
|
6054
|
-
|
|
6146
|
+
layout = leaf.__layout;
|
|
6147
|
+
if (layout.opacityChanged)
|
|
6055
6148
|
updateAllWorldOpacity(leaf);
|
|
6149
|
+
if (layout.stateStyleChanged)
|
|
6150
|
+
setTimeout(() => layout.stateStyleChanged && leaf.updateState());
|
|
6056
6151
|
leaf.__updateChange();
|
|
6057
6152
|
});
|
|
6058
6153
|
}
|
|
@@ -6418,7 +6513,6 @@ class Renderer {
|
|
|
6418
6513
|
Platform.requestRender(() => {
|
|
6419
6514
|
this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - startTime)));
|
|
6420
6515
|
if (this.running) {
|
|
6421
|
-
this.target.emit(AnimateEvent.FRAME);
|
|
6422
6516
|
if (this.changed && this.canvas.view)
|
|
6423
6517
|
this.render();
|
|
6424
6518
|
this.target.emit(RenderEvent.NEXT);
|
|
@@ -6492,36 +6586,6 @@ Object.assign(Creator, {
|
|
|
6492
6586
|
});
|
|
6493
6587
|
Platform.layout = Layouter.fullLayout;
|
|
6494
6588
|
|
|
6495
|
-
const TextConvert = {};
|
|
6496
|
-
const ColorConvert = {};
|
|
6497
|
-
const PathArrow = {};
|
|
6498
|
-
const Paint = {};
|
|
6499
|
-
const PaintImage = {};
|
|
6500
|
-
const PaintGradient = {};
|
|
6501
|
-
const Effect = {};
|
|
6502
|
-
const Export = {};
|
|
6503
|
-
const State = {};
|
|
6504
|
-
|
|
6505
|
-
function stateType(defaultValue) {
|
|
6506
|
-
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
6507
|
-
set(value) {
|
|
6508
|
-
this.__setAttr(key, value);
|
|
6509
|
-
this.waitLeafer(() => { if (State.setStyle)
|
|
6510
|
-
State.setStyle(this, key + 'Style', value); });
|
|
6511
|
-
}
|
|
6512
|
-
}));
|
|
6513
|
-
}
|
|
6514
|
-
function arrowType(defaultValue) {
|
|
6515
|
-
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
6516
|
-
set(value) {
|
|
6517
|
-
if (this.__setAttr(key, value)) {
|
|
6518
|
-
const data = this.__;
|
|
6519
|
-
data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
|
|
6520
|
-
doStrokeType(this);
|
|
6521
|
-
}
|
|
6522
|
-
}
|
|
6523
|
-
}));
|
|
6524
|
-
}
|
|
6525
6589
|
function effectType(defaultValue) {
|
|
6526
6590
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
6527
6591
|
set(value) {
|
|
@@ -6556,10 +6620,33 @@ function zoomLayerType() {
|
|
|
6556
6620
|
};
|
|
6557
6621
|
}
|
|
6558
6622
|
|
|
6623
|
+
const TextConvert = {};
|
|
6624
|
+
const ColorConvert = {};
|
|
6625
|
+
const PathArrow = {};
|
|
6626
|
+
const Paint = {};
|
|
6627
|
+
const PaintImage = {};
|
|
6628
|
+
const PaintGradient = {};
|
|
6629
|
+
const Effect = {};
|
|
6630
|
+
const Export = {};
|
|
6631
|
+
const State = {
|
|
6632
|
+
setStyleName(_leaf, _styleName, _value) { return needPlugin('state'); },
|
|
6633
|
+
set(_leaf, _stateName) { return needPlugin('state'); }
|
|
6634
|
+
};
|
|
6635
|
+
const Transition = {
|
|
6636
|
+
list: {},
|
|
6637
|
+
register(attrName, fn) {
|
|
6638
|
+
Transition.list[attrName] = fn;
|
|
6639
|
+
},
|
|
6640
|
+
get(attrName) {
|
|
6641
|
+
return Transition.list[attrName];
|
|
6642
|
+
}
|
|
6643
|
+
};
|
|
6644
|
+
|
|
6559
6645
|
const { parse } = PathConvert;
|
|
6560
6646
|
const emptyPaint = {};
|
|
6561
6647
|
const debug$2 = Debug.get('UIData');
|
|
6562
6648
|
class UIData extends LeafData {
|
|
6649
|
+
get scale() { const { scaleX, scaleY } = this; return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX; }
|
|
6563
6650
|
get __strokeWidth() {
|
|
6564
6651
|
const { strokeWidth, strokeWidthFixed } = this;
|
|
6565
6652
|
if (strokeWidthFixed) {
|
|
@@ -6578,9 +6665,10 @@ class UIData extends LeafData {
|
|
|
6578
6665
|
get __autoSide() { return !this._width || !this._height; }
|
|
6579
6666
|
get __autoSize() { return !this._width && !this._height; }
|
|
6580
6667
|
setVisible(value) {
|
|
6581
|
-
if (this.__leaf.leafer)
|
|
6582
|
-
this.__leaf.leafer.watcher.hasVisible = true;
|
|
6583
6668
|
this._visible = value;
|
|
6669
|
+
const { leafer } = this.__leaf;
|
|
6670
|
+
if (leafer)
|
|
6671
|
+
leafer.watcher.hasVisible = true;
|
|
6584
6672
|
}
|
|
6585
6673
|
setWidth(value) {
|
|
6586
6674
|
if (value < 0) {
|
|
@@ -6771,7 +6859,7 @@ class ImageData extends RectData {
|
|
|
6771
6859
|
__setImageFill(value) {
|
|
6772
6860
|
if (this.__leaf.image)
|
|
6773
6861
|
this.__leaf.image = null;
|
|
6774
|
-
this.fill = value ? { type: 'image', mode: '
|
|
6862
|
+
this.fill = value ? { type: 'image', mode: 'stretch', url: value } : undefined;
|
|
6775
6863
|
}
|
|
6776
6864
|
__getData() {
|
|
6777
6865
|
const data = super.__getData();
|
|
@@ -6961,19 +7049,8 @@ var UI_1;
|
|
|
6961
7049
|
let UI = UI_1 = class UI extends Leaf {
|
|
6962
7050
|
get app() { return this.leafer && this.leafer.app; }
|
|
6963
7051
|
get isFrame() { return false; }
|
|
6964
|
-
set scale(value) {
|
|
6965
|
-
|
|
6966
|
-
this.scaleX = this.scaleY = value;
|
|
6967
|
-
}
|
|
6968
|
-
else {
|
|
6969
|
-
this.scaleX = value.x;
|
|
6970
|
-
this.scaleY = value.y;
|
|
6971
|
-
}
|
|
6972
|
-
}
|
|
6973
|
-
get scale() {
|
|
6974
|
-
const { scaleX, scaleY } = this;
|
|
6975
|
-
return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX;
|
|
6976
|
-
}
|
|
7052
|
+
set scale(value) { MathHelper.assignScale(this, value); }
|
|
7053
|
+
get scale() { return this.__.scale; }
|
|
6977
7054
|
get pen() {
|
|
6978
7055
|
const { path } = this.__;
|
|
6979
7056
|
pen.set(this.path = path || []);
|
|
@@ -6988,8 +7065,15 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
6988
7065
|
super(data);
|
|
6989
7066
|
}
|
|
6990
7067
|
reset(_data) { }
|
|
6991
|
-
set(data) {
|
|
6992
|
-
|
|
7068
|
+
set(data, isTemp) {
|
|
7069
|
+
if (isTemp) {
|
|
7070
|
+
this.lockNormalStyle = true;
|
|
7071
|
+
Object.assign(this, data);
|
|
7072
|
+
this.lockNormalStyle = false;
|
|
7073
|
+
}
|
|
7074
|
+
else {
|
|
7075
|
+
Object.assign(this, data);
|
|
7076
|
+
}
|
|
6993
7077
|
}
|
|
6994
7078
|
get(name) {
|
|
6995
7079
|
return typeof name === 'string' ? this.__.__getInput(name) : this.__.__getInputData(name);
|
|
@@ -7052,11 +7136,18 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7052
7136
|
drawer.rect(x, y, width, height);
|
|
7053
7137
|
}
|
|
7054
7138
|
}
|
|
7139
|
+
animate(_keyframe, _options, _type, _isTemp) {
|
|
7140
|
+
return needPlugin('animate');
|
|
7141
|
+
}
|
|
7142
|
+
killAnimate(_type) { }
|
|
7055
7143
|
export(filename, options) {
|
|
7056
7144
|
return Export.export(this, filename, options);
|
|
7057
7145
|
}
|
|
7058
|
-
clone() {
|
|
7059
|
-
|
|
7146
|
+
clone(newData) {
|
|
7147
|
+
const json = this.toJSON();
|
|
7148
|
+
if (newData)
|
|
7149
|
+
Object.assign(json, newData);
|
|
7150
|
+
return UI_1.one(json);
|
|
7060
7151
|
}
|
|
7061
7152
|
static one(data, x, y, width, height) {
|
|
7062
7153
|
return UICreator.get(data.tag || this.prototype.__tag, data, x, y, width, height);
|
|
@@ -7072,6 +7163,8 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7072
7163
|
static setEditInner(_editorName) { }
|
|
7073
7164
|
destroy() {
|
|
7074
7165
|
this.fill = this.stroke = null;
|
|
7166
|
+
if (this.__animate)
|
|
7167
|
+
this.killAnimate();
|
|
7075
7168
|
super.destroy();
|
|
7076
7169
|
}
|
|
7077
7170
|
};
|
|
@@ -7099,12 +7192,6 @@ __decorate([
|
|
|
7099
7192
|
__decorate([
|
|
7100
7193
|
visibleType(true)
|
|
7101
7194
|
], UI.prototype, "visible", void 0);
|
|
7102
|
-
__decorate([
|
|
7103
|
-
stateType(false)
|
|
7104
|
-
], UI.prototype, "selected", void 0);
|
|
7105
|
-
__decorate([
|
|
7106
|
-
stateType(false)
|
|
7107
|
-
], UI.prototype, "disabled", void 0);
|
|
7108
7195
|
__decorate([
|
|
7109
7196
|
surfaceType(false)
|
|
7110
7197
|
], UI.prototype, "locked", void 0);
|
|
@@ -7177,45 +7264,9 @@ __decorate([
|
|
|
7177
7264
|
__decorate([
|
|
7178
7265
|
pathType(true)
|
|
7179
7266
|
], UI.prototype, "closed", void 0);
|
|
7180
|
-
__decorate([
|
|
7181
|
-
autoLayoutType(false)
|
|
7182
|
-
], UI.prototype, "flow", void 0);
|
|
7183
7267
|
__decorate([
|
|
7184
7268
|
boundsType(0)
|
|
7185
7269
|
], UI.prototype, "padding", void 0);
|
|
7186
|
-
__decorate([
|
|
7187
|
-
boundsType(0)
|
|
7188
|
-
], UI.prototype, "gap", void 0);
|
|
7189
|
-
__decorate([
|
|
7190
|
-
boundsType('top-left')
|
|
7191
|
-
], UI.prototype, "flowAlign", void 0);
|
|
7192
|
-
__decorate([
|
|
7193
|
-
boundsType(false)
|
|
7194
|
-
], UI.prototype, "flowWrap", void 0);
|
|
7195
|
-
__decorate([
|
|
7196
|
-
boundsType('box')
|
|
7197
|
-
], UI.prototype, "itemBox", void 0);
|
|
7198
|
-
__decorate([
|
|
7199
|
-
boundsType(true)
|
|
7200
|
-
], UI.prototype, "inFlow", void 0);
|
|
7201
|
-
__decorate([
|
|
7202
|
-
boundsType()
|
|
7203
|
-
], UI.prototype, "autoWidth", void 0);
|
|
7204
|
-
__decorate([
|
|
7205
|
-
boundsType()
|
|
7206
|
-
], UI.prototype, "autoHeight", void 0);
|
|
7207
|
-
__decorate([
|
|
7208
|
-
boundsType()
|
|
7209
|
-
], UI.prototype, "lockRatio", void 0);
|
|
7210
|
-
__decorate([
|
|
7211
|
-
boundsType()
|
|
7212
|
-
], UI.prototype, "autoBox", void 0);
|
|
7213
|
-
__decorate([
|
|
7214
|
-
boundsType()
|
|
7215
|
-
], UI.prototype, "widthRange", void 0);
|
|
7216
|
-
__decorate([
|
|
7217
|
-
boundsType()
|
|
7218
|
-
], UI.prototype, "heightRange", void 0);
|
|
7219
7270
|
__decorate([
|
|
7220
7271
|
dataType(false)
|
|
7221
7272
|
], UI.prototype, "draggable", void 0);
|
|
@@ -7279,12 +7330,6 @@ __decorate([
|
|
|
7279
7330
|
__decorate([
|
|
7280
7331
|
strokeType(10)
|
|
7281
7332
|
], UI.prototype, "miterLimit", void 0);
|
|
7282
|
-
__decorate([
|
|
7283
|
-
arrowType('none')
|
|
7284
|
-
], UI.prototype, "startArrow", void 0);
|
|
7285
|
-
__decorate([
|
|
7286
|
-
arrowType('none')
|
|
7287
|
-
], UI.prototype, "endArrow", void 0);
|
|
7288
7333
|
__decorate([
|
|
7289
7334
|
pathType(0)
|
|
7290
7335
|
], UI.prototype, "cornerRadius", void 0);
|
|
@@ -7306,24 +7351,6 @@ __decorate([
|
|
|
7306
7351
|
__decorate([
|
|
7307
7352
|
effectType()
|
|
7308
7353
|
], UI.prototype, "grayscale", void 0);
|
|
7309
|
-
__decorate([
|
|
7310
|
-
dataType()
|
|
7311
|
-
], UI.prototype, "normalStyle", void 0);
|
|
7312
|
-
__decorate([
|
|
7313
|
-
dataType()
|
|
7314
|
-
], UI.prototype, "hoverStyle", void 0);
|
|
7315
|
-
__decorate([
|
|
7316
|
-
dataType()
|
|
7317
|
-
], UI.prototype, "pressStyle", void 0);
|
|
7318
|
-
__decorate([
|
|
7319
|
-
dataType()
|
|
7320
|
-
], UI.prototype, "focusStyle", void 0);
|
|
7321
|
-
__decorate([
|
|
7322
|
-
dataType()
|
|
7323
|
-
], UI.prototype, "selectedStyle", void 0);
|
|
7324
|
-
__decorate([
|
|
7325
|
-
dataType()
|
|
7326
|
-
], UI.prototype, "disabledStyle", void 0);
|
|
7327
7354
|
__decorate([
|
|
7328
7355
|
dataType({})
|
|
7329
7356
|
], UI.prototype, "data", void 0);
|
|
@@ -7350,7 +7377,7 @@ let Group = class Group extends UI {
|
|
|
7350
7377
|
if (!this.children)
|
|
7351
7378
|
this.children = [];
|
|
7352
7379
|
}
|
|
7353
|
-
set(data) {
|
|
7380
|
+
set(data, isTemp) {
|
|
7354
7381
|
if (data.children) {
|
|
7355
7382
|
const { children } = data;
|
|
7356
7383
|
delete data.children;
|
|
@@ -7360,7 +7387,7 @@ let Group = class Group extends UI {
|
|
|
7360
7387
|
else {
|
|
7361
7388
|
this.clear();
|
|
7362
7389
|
}
|
|
7363
|
-
super.set(data);
|
|
7390
|
+
super.set(data, isTemp);
|
|
7364
7391
|
let child;
|
|
7365
7392
|
children.forEach(childData => {
|
|
7366
7393
|
child = childData.__ ? childData : UICreator.get(childData.tag, childData);
|
|
@@ -7369,7 +7396,7 @@ let Group = class Group extends UI {
|
|
|
7369
7396
|
data.children = children;
|
|
7370
7397
|
}
|
|
7371
7398
|
else {
|
|
7372
|
-
super.set(data);
|
|
7399
|
+
super.set(data, isTemp);
|
|
7373
7400
|
}
|
|
7374
7401
|
}
|
|
7375
7402
|
toJSON(options) {
|
|
@@ -7696,7 +7723,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7696
7723
|
}
|
|
7697
7724
|
}
|
|
7698
7725
|
zoom(_zoomType, _padding, _fixedScale) {
|
|
7699
|
-
return
|
|
7726
|
+
return needPlugin('view');
|
|
7700
7727
|
}
|
|
7701
7728
|
getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
|
|
7702
7729
|
getValidScale(changeScale) { return changeScale; }
|
|
@@ -8219,19 +8246,18 @@ let Canvas = class Canvas extends Rect {
|
|
|
8219
8246
|
this.paint();
|
|
8220
8247
|
}
|
|
8221
8248
|
paint() {
|
|
8222
|
-
this.
|
|
8249
|
+
this.forceRender();
|
|
8223
8250
|
}
|
|
8224
8251
|
__drawAfterFill(canvas, _options) {
|
|
8225
|
-
const
|
|
8226
|
-
|
|
8227
|
-
if (this.__.cornerRadius || this.pathInputed) {
|
|
8252
|
+
const { width, height, cornerRadius } = this.__, { view } = this.canvas;
|
|
8253
|
+
if (cornerRadius || this.pathInputed) {
|
|
8228
8254
|
canvas.save();
|
|
8229
8255
|
canvas.clip();
|
|
8230
|
-
canvas.drawImage(
|
|
8256
|
+
canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
|
|
8231
8257
|
canvas.restore();
|
|
8232
8258
|
}
|
|
8233
8259
|
else {
|
|
8234
|
-
canvas.drawImage(
|
|
8260
|
+
canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
|
|
8235
8261
|
}
|
|
8236
8262
|
}
|
|
8237
8263
|
__updateSize() {
|
|
@@ -8870,6 +8896,8 @@ function getPatternData(paint, box, image) {
|
|
|
8870
8896
|
let { width, height } = image;
|
|
8871
8897
|
if (paint.padding)
|
|
8872
8898
|
box = tempBox.set(box).shrink(paint.padding);
|
|
8899
|
+
if (paint.mode === 'strench')
|
|
8900
|
+
paint.mode = 'stretch';
|
|
8873
8901
|
const { opacity, mode, align, offset, scale, size, rotation, repeat } = paint;
|
|
8874
8902
|
const sameBox = box.width === width && box.height === height;
|
|
8875
8903
|
const data = { mode };
|
|
@@ -8898,7 +8926,7 @@ function getPatternData(paint, box, image) {
|
|
|
8898
8926
|
if (offset)
|
|
8899
8927
|
x += offset.x, y += offset.y;
|
|
8900
8928
|
switch (mode) {
|
|
8901
|
-
case '
|
|
8929
|
+
case 'stretch':
|
|
8902
8930
|
if (!sameBox)
|
|
8903
8931
|
width = box.width, height = box.height;
|
|
8904
8932
|
break;
|
|
@@ -8925,7 +8953,7 @@ function getPatternData(paint, box, image) {
|
|
|
8925
8953
|
translate(data.transform, box.x, box.y);
|
|
8926
8954
|
}
|
|
8927
8955
|
}
|
|
8928
|
-
if (scaleX && mode !== '
|
|
8956
|
+
if (scaleX && mode !== 'stretch') {
|
|
8929
8957
|
data.scaleX = scaleX;
|
|
8930
8958
|
data.scaleY = scaleY;
|
|
8931
8959
|
}
|
|
@@ -9029,7 +9057,7 @@ const { get: get$1, scale, copy: copy$1 } = MatrixHelper;
|
|
|
9029
9057
|
const { ceil, abs: abs$1 } = Math;
|
|
9030
9058
|
function createPattern(ui, paint, pixelRatio) {
|
|
9031
9059
|
let { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
|
|
9032
|
-
const id = scaleX + '-' + scaleY;
|
|
9060
|
+
const id = scaleX + '-' + scaleY + '-' + pixelRatio;
|
|
9033
9061
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
9034
9062
|
scaleX = abs$1(scaleX);
|
|
9035
9063
|
scaleY = abs$1(scaleY);
|
|
@@ -9091,7 +9119,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
9091
9119
|
const { abs } = Math;
|
|
9092
9120
|
function checkImage(ui, canvas, paint, allowPaint) {
|
|
9093
9121
|
const { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
|
|
9094
|
-
|
|
9122
|
+
const { pixelRatio } = canvas;
|
|
9123
|
+
if (!paint.data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !Export.running)) {
|
|
9095
9124
|
return false;
|
|
9096
9125
|
}
|
|
9097
9126
|
else {
|
|
@@ -9099,8 +9128,8 @@ function checkImage(ui, canvas, paint, allowPaint) {
|
|
|
9099
9128
|
if (allowPaint) {
|
|
9100
9129
|
if (!data.repeat) {
|
|
9101
9130
|
let { width, height } = data;
|
|
9102
|
-
width *= abs(scaleX) *
|
|
9103
|
-
height *= abs(scaleY) *
|
|
9131
|
+
width *= abs(scaleX) * pixelRatio;
|
|
9132
|
+
height *= abs(scaleY) * pixelRatio;
|
|
9104
9133
|
if (data.scaleX) {
|
|
9105
9134
|
width *= data.scaleX;
|
|
9106
9135
|
height *= data.scaleY;
|
|
@@ -9126,14 +9155,14 @@ function checkImage(ui, canvas, paint, allowPaint) {
|
|
|
9126
9155
|
}
|
|
9127
9156
|
else {
|
|
9128
9157
|
if (!paint.style || paint.sync || Export.running) {
|
|
9129
|
-
createPattern(ui, paint,
|
|
9158
|
+
createPattern(ui, paint, pixelRatio);
|
|
9130
9159
|
}
|
|
9131
9160
|
else {
|
|
9132
9161
|
if (!paint.patternTask) {
|
|
9133
9162
|
paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
|
|
9134
9163
|
paint.patternTask = null;
|
|
9135
9164
|
if (canvas.bounds.hit(ui.__nowWorld))
|
|
9136
|
-
createPattern(ui, paint,
|
|
9165
|
+
createPattern(ui, paint, pixelRatio);
|
|
9137
9166
|
ui.forceUpdate('surface');
|
|
9138
9167
|
}), 300);
|
|
9139
9168
|
}
|
|
@@ -9197,14 +9226,16 @@ function linearGradient(paint, box) {
|
|
|
9197
9226
|
return data;
|
|
9198
9227
|
}
|
|
9199
9228
|
function applyStops(gradient, stops, opacity) {
|
|
9200
|
-
|
|
9201
|
-
|
|
9202
|
-
|
|
9203
|
-
|
|
9204
|
-
|
|
9205
|
-
|
|
9206
|
-
|
|
9207
|
-
|
|
9229
|
+
if (stops) {
|
|
9230
|
+
let stop;
|
|
9231
|
+
for (let i = 0, len = stops.length; i < len; i++) {
|
|
9232
|
+
stop = stops[i];
|
|
9233
|
+
if (typeof stop === 'string') {
|
|
9234
|
+
gradient.addColorStop(i / (len - 1), ColorConvert.string(stop, opacity));
|
|
9235
|
+
}
|
|
9236
|
+
else {
|
|
9237
|
+
gradient.addColorStop(stop.offset, ColorConvert.string(stop.color, opacity));
|
|
9238
|
+
}
|
|
9208
9239
|
}
|
|
9209
9240
|
}
|
|
9210
9241
|
}
|
|
@@ -9960,10 +9991,15 @@ const TextConvertModule = {
|
|
|
9960
9991
|
};
|
|
9961
9992
|
|
|
9962
9993
|
function string(color, opacity) {
|
|
9963
|
-
|
|
9964
|
-
|
|
9994
|
+
const doOpacity = typeof opacity === 'number' && opacity !== 1;
|
|
9995
|
+
if (typeof color === 'string') {
|
|
9996
|
+
if (doOpacity && ColorConvert.object)
|
|
9997
|
+
color = ColorConvert.object(color);
|
|
9998
|
+
else
|
|
9999
|
+
return color;
|
|
10000
|
+
}
|
|
9965
10001
|
let a = color.a === undefined ? 1 : color.a;
|
|
9966
|
-
if (
|
|
10002
|
+
if (doOpacity)
|
|
9967
10003
|
a *= opacity;
|
|
9968
10004
|
const rgb = color.r + ',' + color.g + ',' + color.b;
|
|
9969
10005
|
return a === 1 ? 'rgb(' + rgb + ')' : 'rgba(' + rgb + ',' + a + ')';
|
|
@@ -10170,4 +10206,4 @@ Object.assign(Export, ExportModule);
|
|
|
10170
10206
|
|
|
10171
10207
|
useCanvas();
|
|
10172
10208
|
|
|
10173
|
-
export { AlignHelper,
|
|
10209
|
+
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, 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, MyImage, 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, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, 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 };
|