leafer-draw 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/web.cjs +34 -21
- package/dist/web.esm.js +35 -22
- package/dist/web.esm.min.js +1 -1
- package/dist/web.js +385 -349
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.module.js +382 -346
- package/dist/web.module.min.js +1 -1
- package/package.json +2 -2
package/dist/web.js
CHANGED
|
@@ -122,11 +122,18 @@ var LeaferUI = (function (exports) {
|
|
|
122
122
|
scaleData.scaleX = (typeof size === 'number' ? size : size.width) / originSize.width;
|
|
123
123
|
scaleData.scaleY = (typeof size === 'number' ? size : size.height) / originSize.height;
|
|
124
124
|
}
|
|
125
|
-
else if (scale)
|
|
126
|
-
scaleData
|
|
127
|
-
scaleData.scaleY = typeof scale === 'number' ? scale : scale.y;
|
|
128
|
-
}
|
|
125
|
+
else if (scale)
|
|
126
|
+
MathHelper.assignScale(scaleData, scale);
|
|
129
127
|
return scaleData;
|
|
128
|
+
},
|
|
129
|
+
assignScale(scaleData, scale) {
|
|
130
|
+
if (typeof scale === 'number') {
|
|
131
|
+
scaleData.scaleX = scaleData.scaleY = scale;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
scaleData.scaleX = scale.x;
|
|
135
|
+
scaleData.scaleY = scale.y;
|
|
136
|
+
}
|
|
130
137
|
}
|
|
131
138
|
};
|
|
132
139
|
const OneRadian = PI$4 / 180;
|
|
@@ -1258,7 +1265,6 @@ var LeaferUI = (function (exports) {
|
|
|
1258
1265
|
tempPoint: {},
|
|
1259
1266
|
get: get$4,
|
|
1260
1267
|
toPoint(around, bounds, to, onlySize, pointBounds) {
|
|
1261
|
-
to || (to = {});
|
|
1262
1268
|
const point = get$4(around);
|
|
1263
1269
|
to.x = point.x;
|
|
1264
1270
|
to.y = point.y;
|
|
@@ -1393,6 +1399,10 @@ var LeaferUI = (function (exports) {
|
|
|
1393
1399
|
};
|
|
1394
1400
|
const R = Run;
|
|
1395
1401
|
|
|
1402
|
+
function needPlugin(name) {
|
|
1403
|
+
console.error('need plugin: @leafer-in/' + name);
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1396
1406
|
const debug$d = Debug.get('UICreator');
|
|
1397
1407
|
const UICreator = {
|
|
1398
1408
|
list: {},
|
|
@@ -1655,6 +1665,9 @@ var LeaferUI = (function (exports) {
|
|
|
1655
1665
|
Answer[Answer["YesAndSkip"] = 3] = "YesAndSkip";
|
|
1656
1666
|
})(exports.Answer || (exports.Answer = {}));
|
|
1657
1667
|
const emptyData = {};
|
|
1668
|
+
function isNull(value) {
|
|
1669
|
+
return value === undefined || value === null;
|
|
1670
|
+
}
|
|
1658
1671
|
|
|
1659
1672
|
/******************************************************************************
|
|
1660
1673
|
Copyright (c) Microsoft Corporation.
|
|
@@ -2420,7 +2433,7 @@ var LeaferUI = (function (exports) {
|
|
|
2420
2433
|
let startY = y = rotationSin * radiusX * startCos + rotationCos * radiusY * startSin;
|
|
2421
2434
|
let fromX = cx + x, fromY = cy + y;
|
|
2422
2435
|
if (data)
|
|
2423
|
-
data.push(L$6, fromX, fromY);
|
|
2436
|
+
data.push(data.length ? L$6 : M$5, fromX, fromY);
|
|
2424
2437
|
if (setPointBounds)
|
|
2425
2438
|
setPoint$2(setPointBounds, fromX, fromY);
|
|
2426
2439
|
if (setStartPoint)
|
|
@@ -3089,8 +3102,7 @@ var LeaferUI = (function (exports) {
|
|
|
3089
3102
|
toTwoPointBounds(data, setPointBounds) {
|
|
3090
3103
|
if (!data || !data.length)
|
|
3091
3104
|
return setPoint$1(setPointBounds, 0, 0);
|
|
3092
|
-
let command;
|
|
3093
|
-
let i = 0, x = 0, y = 0, x1, y1, toX, toY;
|
|
3105
|
+
let i = 0, x = 0, y = 0, x1, y1, toX, toY, command;
|
|
3094
3106
|
const len = data.length;
|
|
3095
3107
|
while (i < len) {
|
|
3096
3108
|
command = data[i];
|
|
@@ -3746,7 +3758,7 @@ var LeaferUI = (function (exports) {
|
|
|
3746
3758
|
set(value) {
|
|
3747
3759
|
if (this.__setAttr(key, value)) {
|
|
3748
3760
|
this.__layout.matrixChanged || this.__layout.matrixChange();
|
|
3749
|
-
this.__hasAutoLayout = !!
|
|
3761
|
+
this.__hasAutoLayout = !!(this.origin || this.around || this.flow);
|
|
3750
3762
|
if (!this.__local)
|
|
3751
3763
|
this.__layout.createLocal();
|
|
3752
3764
|
}
|
|
@@ -3839,14 +3851,25 @@ var LeaferUI = (function (exports) {
|
|
|
3839
3851
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3840
3852
|
set(value) {
|
|
3841
3853
|
const oldValue = this.visible;
|
|
3842
|
-
if (
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3854
|
+
if (oldValue === true && value === 0) {
|
|
3855
|
+
if (this.animationOut)
|
|
3856
|
+
return this.__runAnimation('out', () => doVisible(this, key, value, oldValue));
|
|
3857
|
+
}
|
|
3858
|
+
else if (oldValue === 0 && value === true) {
|
|
3859
|
+
if (this.animation)
|
|
3860
|
+
this.__runAnimation('in');
|
|
3846
3861
|
}
|
|
3862
|
+
doVisible(this, key, value, oldValue);
|
|
3847
3863
|
}
|
|
3848
3864
|
}));
|
|
3849
3865
|
}
|
|
3866
|
+
function doVisible(leaf, key, value, oldValue) {
|
|
3867
|
+
if (leaf.__setAttr(key, value)) {
|
|
3868
|
+
leaf.__layout.opacityChanged || leaf.__layout.opacityChange();
|
|
3869
|
+
if (oldValue === 0 || value === 0)
|
|
3870
|
+
doBoundsType(leaf);
|
|
3871
|
+
}
|
|
3872
|
+
}
|
|
3850
3873
|
function sortType(defaultValue) {
|
|
3851
3874
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3852
3875
|
set(value) {
|
|
@@ -3930,7 +3953,16 @@ var LeaferUI = (function (exports) {
|
|
|
3930
3953
|
if (defaultValue === undefined) {
|
|
3931
3954
|
property.get = function () { return this[computedKey]; };
|
|
3932
3955
|
}
|
|
3933
|
-
else if (
|
|
3956
|
+
else if (typeof defaultValue === 'object') {
|
|
3957
|
+
const { clone } = DataHelper;
|
|
3958
|
+
property.get = function () {
|
|
3959
|
+
let v = this[computedKey];
|
|
3960
|
+
if (v === undefined)
|
|
3961
|
+
this[computedKey] = v = clone(defaultValue);
|
|
3962
|
+
return v;
|
|
3963
|
+
};
|
|
3964
|
+
}
|
|
3965
|
+
if (key === 'width') {
|
|
3934
3966
|
property.get = function () {
|
|
3935
3967
|
const v = this[computedKey];
|
|
3936
3968
|
if (v === undefined) {
|
|
@@ -4597,144 +4629,6 @@ var LeaferUI = (function (exports) {
|
|
|
4597
4629
|
destroy() { }
|
|
4598
4630
|
}
|
|
4599
4631
|
|
|
4600
|
-
const empty = {};
|
|
4601
|
-
const LeafEventer = {
|
|
4602
|
-
on(type, listener, options) {
|
|
4603
|
-
let capture, once;
|
|
4604
|
-
if (options) {
|
|
4605
|
-
if (options === 'once') {
|
|
4606
|
-
once = true;
|
|
4607
|
-
}
|
|
4608
|
-
else if (typeof options === 'boolean') {
|
|
4609
|
-
capture = options;
|
|
4610
|
-
}
|
|
4611
|
-
else {
|
|
4612
|
-
capture = options.capture;
|
|
4613
|
-
once = options.once;
|
|
4614
|
-
}
|
|
4615
|
-
}
|
|
4616
|
-
let events;
|
|
4617
|
-
const map = __getListenerMap(this, capture, true);
|
|
4618
|
-
const typeList = typeof type === 'string' ? type.split(' ') : type;
|
|
4619
|
-
const item = once ? { listener, once } : { listener };
|
|
4620
|
-
typeList.forEach(type => {
|
|
4621
|
-
if (type) {
|
|
4622
|
-
events = map[type];
|
|
4623
|
-
if (events) {
|
|
4624
|
-
if (events.findIndex(item => item.listener === listener) === -1)
|
|
4625
|
-
events.push(item);
|
|
4626
|
-
}
|
|
4627
|
-
else {
|
|
4628
|
-
map[type] = [item];
|
|
4629
|
-
}
|
|
4630
|
-
}
|
|
4631
|
-
});
|
|
4632
|
-
},
|
|
4633
|
-
off(type, listener, options) {
|
|
4634
|
-
if (type) {
|
|
4635
|
-
const typeList = typeof type === 'string' ? type.split(' ') : type;
|
|
4636
|
-
if (listener) {
|
|
4637
|
-
let capture;
|
|
4638
|
-
if (options)
|
|
4639
|
-
capture = typeof options === 'boolean' ? options : (options === 'once' ? false : options.capture);
|
|
4640
|
-
let events, index;
|
|
4641
|
-
const map = __getListenerMap(this, capture);
|
|
4642
|
-
typeList.forEach(type => {
|
|
4643
|
-
if (type) {
|
|
4644
|
-
events = map[type];
|
|
4645
|
-
if (events) {
|
|
4646
|
-
index = events.findIndex(item => item.listener === listener);
|
|
4647
|
-
if (index > -1)
|
|
4648
|
-
events.splice(index, 1);
|
|
4649
|
-
if (!events.length)
|
|
4650
|
-
delete map[type];
|
|
4651
|
-
}
|
|
4652
|
-
}
|
|
4653
|
-
});
|
|
4654
|
-
}
|
|
4655
|
-
else {
|
|
4656
|
-
const { __bubbleMap: b, __captureMap: c } = this;
|
|
4657
|
-
typeList.forEach(type => {
|
|
4658
|
-
if (b)
|
|
4659
|
-
delete b[type];
|
|
4660
|
-
if (c)
|
|
4661
|
-
delete c[type];
|
|
4662
|
-
});
|
|
4663
|
-
}
|
|
4664
|
-
}
|
|
4665
|
-
else {
|
|
4666
|
-
this.__bubbleMap = this.__captureMap = undefined;
|
|
4667
|
-
}
|
|
4668
|
-
},
|
|
4669
|
-
on_(type, listener, bind, options) {
|
|
4670
|
-
if (bind)
|
|
4671
|
-
listener = listener.bind(bind);
|
|
4672
|
-
this.on(type, listener, options);
|
|
4673
|
-
return { type, current: this, listener, options };
|
|
4674
|
-
},
|
|
4675
|
-
off_(id) {
|
|
4676
|
-
if (!id)
|
|
4677
|
-
return;
|
|
4678
|
-
const list = id instanceof Array ? id : [id];
|
|
4679
|
-
list.forEach(item => item.current.off(item.type, item.listener, item.options));
|
|
4680
|
-
list.length = 0;
|
|
4681
|
-
},
|
|
4682
|
-
once(type, listener, capture) {
|
|
4683
|
-
this.on(type, listener, { once: true, capture });
|
|
4684
|
-
},
|
|
4685
|
-
emit(type, event, capture) {
|
|
4686
|
-
if (!event && EventCreator.has(type))
|
|
4687
|
-
event = EventCreator.get(type, { type, target: this, current: this });
|
|
4688
|
-
const map = __getListenerMap(this, capture);
|
|
4689
|
-
const list = map[type];
|
|
4690
|
-
if (list) {
|
|
4691
|
-
let item;
|
|
4692
|
-
for (let i = 0, len = list.length; i < len; i++) {
|
|
4693
|
-
item = list[i];
|
|
4694
|
-
item.listener(event);
|
|
4695
|
-
if (item.once) {
|
|
4696
|
-
this.off(type, item.listener, capture);
|
|
4697
|
-
i--, len--;
|
|
4698
|
-
}
|
|
4699
|
-
if (event && event.isStopNow)
|
|
4700
|
-
break;
|
|
4701
|
-
}
|
|
4702
|
-
}
|
|
4703
|
-
this.syncEventer && this.syncEventer.emitEvent(event, capture);
|
|
4704
|
-
},
|
|
4705
|
-
emitEvent(event, capture) {
|
|
4706
|
-
event.current = this;
|
|
4707
|
-
this.emit(event.type, event, capture);
|
|
4708
|
-
},
|
|
4709
|
-
hasEvent(type, capture) {
|
|
4710
|
-
if (this.syncEventer && this.syncEventer.hasEvent(type, capture))
|
|
4711
|
-
return true;
|
|
4712
|
-
const { __bubbleMap: b, __captureMap: c } = this;
|
|
4713
|
-
const hasB = b && b[type], hasC = c && c[type];
|
|
4714
|
-
return !!(capture === undefined ? (hasB || hasC) : (capture ? hasC : hasB));
|
|
4715
|
-
},
|
|
4716
|
-
};
|
|
4717
|
-
function __getListenerMap(eventer, capture, create) {
|
|
4718
|
-
if (capture) {
|
|
4719
|
-
const { __captureMap: c } = eventer;
|
|
4720
|
-
if (c) {
|
|
4721
|
-
return c;
|
|
4722
|
-
}
|
|
4723
|
-
else {
|
|
4724
|
-
return create ? eventer.__captureMap = {} : empty;
|
|
4725
|
-
}
|
|
4726
|
-
}
|
|
4727
|
-
else {
|
|
4728
|
-
const { __bubbleMap: b } = eventer;
|
|
4729
|
-
if (b) {
|
|
4730
|
-
return b;
|
|
4731
|
-
}
|
|
4732
|
-
else {
|
|
4733
|
-
return create ? eventer.__bubbleMap = {} : empty;
|
|
4734
|
-
}
|
|
4735
|
-
}
|
|
4736
|
-
}
|
|
4737
|
-
|
|
4738
4632
|
class Event {
|
|
4739
4633
|
constructor(type, target) {
|
|
4740
4634
|
this.bubbles = false;
|
|
@@ -4769,7 +4663,10 @@ var LeaferUI = (function (exports) {
|
|
|
4769
4663
|
}
|
|
4770
4664
|
ChildEvent.ADD = 'child.add';
|
|
4771
4665
|
ChildEvent.REMOVE = 'child.remove';
|
|
4772
|
-
ChildEvent.
|
|
4666
|
+
ChildEvent.CREATED = 'created';
|
|
4667
|
+
ChildEvent.MOUNTED = 'mounted';
|
|
4668
|
+
ChildEvent.UNMOUNTED = 'unmounted';
|
|
4669
|
+
ChildEvent.DESTROY = 'destroy';
|
|
4773
4670
|
|
|
4774
4671
|
class PropertyEvent extends Event {
|
|
4775
4672
|
constructor(type, target, attrName, oldValue, newValue) {
|
|
@@ -4847,10 +4744,6 @@ var LeaferUI = (function (exports) {
|
|
|
4847
4744
|
LayoutEvent.AGAIN = 'layout.again';
|
|
4848
4745
|
LayoutEvent.END = 'layout.end';
|
|
4849
4746
|
|
|
4850
|
-
class AnimateEvent extends Event {
|
|
4851
|
-
}
|
|
4852
|
-
AnimateEvent.FRAME = 'animate.frame';
|
|
4853
|
-
|
|
4854
4747
|
class RenderEvent extends Event {
|
|
4855
4748
|
constructor(type, times, bounds, options) {
|
|
4856
4749
|
super(type);
|
|
@@ -4883,6 +4776,157 @@ var LeaferUI = (function (exports) {
|
|
|
4883
4776
|
LeaferEvent.RESTART = 'leafer.restart';
|
|
4884
4777
|
LeaferEvent.END = 'leafer.end';
|
|
4885
4778
|
|
|
4779
|
+
const empty = {};
|
|
4780
|
+
class Eventer {
|
|
4781
|
+
set event(map) { this.on(map); }
|
|
4782
|
+
on(type, listener, options) {
|
|
4783
|
+
if (!listener) {
|
|
4784
|
+
let event, map = type;
|
|
4785
|
+
for (let key in map)
|
|
4786
|
+
event = map[key], event instanceof Array ? this.on(key, event[0], event[1]) : this.on(key, event);
|
|
4787
|
+
return;
|
|
4788
|
+
}
|
|
4789
|
+
let capture, once;
|
|
4790
|
+
if (options) {
|
|
4791
|
+
if (options === 'once') {
|
|
4792
|
+
once = true;
|
|
4793
|
+
}
|
|
4794
|
+
else if (typeof options === 'boolean') {
|
|
4795
|
+
capture = options;
|
|
4796
|
+
}
|
|
4797
|
+
else {
|
|
4798
|
+
capture = options.capture;
|
|
4799
|
+
once = options.once;
|
|
4800
|
+
}
|
|
4801
|
+
}
|
|
4802
|
+
let events;
|
|
4803
|
+
const map = __getListenerMap(this, capture, true);
|
|
4804
|
+
const typeList = typeof type === 'string' ? type.split(' ') : type;
|
|
4805
|
+
const item = once ? { listener, once } : { listener };
|
|
4806
|
+
typeList.forEach(type => {
|
|
4807
|
+
if (type) {
|
|
4808
|
+
events = map[type];
|
|
4809
|
+
if (events) {
|
|
4810
|
+
if (events.findIndex(item => item.listener === listener) === -1)
|
|
4811
|
+
events.push(item);
|
|
4812
|
+
}
|
|
4813
|
+
else {
|
|
4814
|
+
map[type] = [item];
|
|
4815
|
+
}
|
|
4816
|
+
}
|
|
4817
|
+
});
|
|
4818
|
+
}
|
|
4819
|
+
off(type, listener, options) {
|
|
4820
|
+
if (type) {
|
|
4821
|
+
const typeList = typeof type === 'string' ? type.split(' ') : type;
|
|
4822
|
+
if (listener) {
|
|
4823
|
+
let capture;
|
|
4824
|
+
if (options)
|
|
4825
|
+
capture = typeof options === 'boolean' ? options : (options === 'once' ? false : options.capture);
|
|
4826
|
+
let events, index;
|
|
4827
|
+
const map = __getListenerMap(this, capture);
|
|
4828
|
+
typeList.forEach(type => {
|
|
4829
|
+
if (type) {
|
|
4830
|
+
events = map[type];
|
|
4831
|
+
if (events) {
|
|
4832
|
+
index = events.findIndex(item => item.listener === listener);
|
|
4833
|
+
if (index > -1)
|
|
4834
|
+
events.splice(index, 1);
|
|
4835
|
+
if (!events.length)
|
|
4836
|
+
delete map[type];
|
|
4837
|
+
}
|
|
4838
|
+
}
|
|
4839
|
+
});
|
|
4840
|
+
}
|
|
4841
|
+
else {
|
|
4842
|
+
const { __bubbleMap: b, __captureMap: c } = this;
|
|
4843
|
+
typeList.forEach(type => {
|
|
4844
|
+
if (b)
|
|
4845
|
+
delete b[type];
|
|
4846
|
+
if (c)
|
|
4847
|
+
delete c[type];
|
|
4848
|
+
});
|
|
4849
|
+
}
|
|
4850
|
+
}
|
|
4851
|
+
else {
|
|
4852
|
+
this.__bubbleMap = this.__captureMap = undefined;
|
|
4853
|
+
}
|
|
4854
|
+
}
|
|
4855
|
+
on_(type, listener, bind, options) {
|
|
4856
|
+
if (bind)
|
|
4857
|
+
listener = listener.bind(bind);
|
|
4858
|
+
this.on(type, listener, options);
|
|
4859
|
+
return { type, current: this, listener, options };
|
|
4860
|
+
}
|
|
4861
|
+
off_(id) {
|
|
4862
|
+
if (!id)
|
|
4863
|
+
return;
|
|
4864
|
+
const list = id instanceof Array ? id : [id];
|
|
4865
|
+
list.forEach(item => item.current.off(item.type, item.listener, item.options));
|
|
4866
|
+
list.length = 0;
|
|
4867
|
+
}
|
|
4868
|
+
once(type, listener, capture) {
|
|
4869
|
+
this.on(type, listener, { once: true, capture });
|
|
4870
|
+
}
|
|
4871
|
+
emit(type, event, capture) {
|
|
4872
|
+
if (!event && EventCreator.has(type))
|
|
4873
|
+
event = EventCreator.get(type, { type, target: this, current: this });
|
|
4874
|
+
const map = __getListenerMap(this, capture);
|
|
4875
|
+
const list = map[type];
|
|
4876
|
+
if (list) {
|
|
4877
|
+
let item;
|
|
4878
|
+
for (let i = 0, len = list.length; i < len; i++) {
|
|
4879
|
+
item = list[i];
|
|
4880
|
+
item.listener(event);
|
|
4881
|
+
if (item.once) {
|
|
4882
|
+
this.off(type, item.listener, capture);
|
|
4883
|
+
i--, len--;
|
|
4884
|
+
}
|
|
4885
|
+
if (event && event.isStopNow)
|
|
4886
|
+
break;
|
|
4887
|
+
}
|
|
4888
|
+
}
|
|
4889
|
+
this.syncEventer && this.syncEventer.emitEvent(event, capture);
|
|
4890
|
+
}
|
|
4891
|
+
emitEvent(event, capture) {
|
|
4892
|
+
event.current = this;
|
|
4893
|
+
this.emit(event.type, event, capture);
|
|
4894
|
+
}
|
|
4895
|
+
hasEvent(type, capture) {
|
|
4896
|
+
if (this.syncEventer && this.syncEventer.hasEvent(type, capture))
|
|
4897
|
+
return true;
|
|
4898
|
+
const { __bubbleMap: b, __captureMap: c } = this;
|
|
4899
|
+
const hasB = b && b[type], hasC = c && c[type];
|
|
4900
|
+
return !!(capture === undefined ? (hasB || hasC) : (capture ? hasC : hasB));
|
|
4901
|
+
}
|
|
4902
|
+
destroy() {
|
|
4903
|
+
this.__captureMap = this.__bubbleMap = this.syncEventer = null;
|
|
4904
|
+
}
|
|
4905
|
+
}
|
|
4906
|
+
function __getListenerMap(eventer, capture, create) {
|
|
4907
|
+
if (capture) {
|
|
4908
|
+
const { __captureMap: c } = eventer;
|
|
4909
|
+
if (c) {
|
|
4910
|
+
return c;
|
|
4911
|
+
}
|
|
4912
|
+
else {
|
|
4913
|
+
return create ? eventer.__captureMap = {} : empty;
|
|
4914
|
+
}
|
|
4915
|
+
}
|
|
4916
|
+
else {
|
|
4917
|
+
const { __bubbleMap: b } = eventer;
|
|
4918
|
+
if (b) {
|
|
4919
|
+
return b;
|
|
4920
|
+
}
|
|
4921
|
+
else {
|
|
4922
|
+
return create ? eventer.__bubbleMap = {} : empty;
|
|
4923
|
+
}
|
|
4924
|
+
}
|
|
4925
|
+
}
|
|
4926
|
+
|
|
4927
|
+
const { on, on_, off, off_, once, emit: emit$1, emitEvent, hasEvent, destroy } = Eventer.prototype;
|
|
4928
|
+
const LeafEventer = { on, on_, off, off_, once, emit: emit$1, emitEvent, hasEvent, destroyEventer: destroy };
|
|
4929
|
+
|
|
4886
4930
|
const { isFinite } = Number;
|
|
4887
4931
|
const debug$6 = Debug.get('setAttr');
|
|
4888
4932
|
const LeafDataProxy = {
|
|
@@ -4894,9 +4938,7 @@ var LeaferUI = (function (exports) {
|
|
|
4894
4938
|
newValue = undefined;
|
|
4895
4939
|
}
|
|
4896
4940
|
if (typeof newValue === 'object' || oldValue !== newValue) {
|
|
4897
|
-
this.
|
|
4898
|
-
if (this.__proxyData)
|
|
4899
|
-
this.setProxyAttr(name, newValue);
|
|
4941
|
+
this.__realSetAttr(name, newValue);
|
|
4900
4942
|
const { CHANGE } = PropertyEvent;
|
|
4901
4943
|
const event = new PropertyEvent(CHANGE, this, name, oldValue, newValue);
|
|
4902
4944
|
if (this.isLeafer) {
|
|
@@ -4914,12 +4956,18 @@ var LeaferUI = (function (exports) {
|
|
|
4914
4956
|
}
|
|
4915
4957
|
}
|
|
4916
4958
|
else {
|
|
4917
|
-
this.
|
|
4918
|
-
if (this.__proxyData)
|
|
4919
|
-
this.setProxyAttr(name, newValue);
|
|
4959
|
+
this.__realSetAttr(name, newValue);
|
|
4920
4960
|
return true;
|
|
4921
4961
|
}
|
|
4922
4962
|
},
|
|
4963
|
+
__realSetAttr(name, newValue) {
|
|
4964
|
+
const data = this.__;
|
|
4965
|
+
data[name] = newValue;
|
|
4966
|
+
if (this.__proxyData)
|
|
4967
|
+
this.setProxyAttr(name, newValue);
|
|
4968
|
+
if (data.normalStyle)
|
|
4969
|
+
this.lockNormalStyle || data.normalStyle[name] === undefined || (data.normalStyle[name] = newValue);
|
|
4970
|
+
},
|
|
4923
4971
|
__getAttr(name) {
|
|
4924
4972
|
if (this.__proxyData)
|
|
4925
4973
|
return this.getProxyAttr(name);
|
|
@@ -5022,6 +5070,8 @@ var LeaferUI = (function (exports) {
|
|
|
5022
5070
|
layout.boundsChanged = false;
|
|
5023
5071
|
},
|
|
5024
5072
|
__updateLocalBoxBounds() {
|
|
5073
|
+
if (this.__hasMotionPath)
|
|
5074
|
+
this.__updateMotionPath();
|
|
5025
5075
|
if (this.__hasAutoLayout)
|
|
5026
5076
|
this.__updateAutoLayout();
|
|
5027
5077
|
toOuterOf$1(this.__layout.boxBounds, this.__local, this.__local);
|
|
@@ -5174,7 +5224,7 @@ var LeaferUI = (function (exports) {
|
|
|
5174
5224
|
const { LEAF, create } = IncrementId;
|
|
5175
5225
|
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
|
|
5176
5226
|
const { toOuterOf } = BoundsHelper;
|
|
5177
|
-
const { copy: copy$3 } = PointHelper;
|
|
5227
|
+
const { copy: copy$3, move } = PointHelper;
|
|
5178
5228
|
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
|
|
5179
5229
|
exports.Leaf = class Leaf {
|
|
5180
5230
|
get tag() { return this.__tag; }
|
|
@@ -5201,13 +5251,16 @@ var LeaferUI = (function (exports) {
|
|
|
5201
5251
|
get __ignoreHitWorld() { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren; }
|
|
5202
5252
|
get __inLazyBounds() { const { leafer } = this; return leafer && leafer.created && leafer.lazyBounds.hit(this.__world); }
|
|
5203
5253
|
get pathInputed() { return this.__.__pathInputed; }
|
|
5204
|
-
set event(map) {
|
|
5205
|
-
event = map[key], event instanceof Array ? this.on(key, event[0], event[1]) : this.on(key, event); }
|
|
5254
|
+
set event(map) { this.on(map); }
|
|
5206
5255
|
constructor(data) {
|
|
5207
5256
|
this.innerId = create(LEAF);
|
|
5208
5257
|
this.reset(data);
|
|
5258
|
+
if (this.__bubbleMap)
|
|
5259
|
+
this.__emitLifeEvent(ChildEvent.CREATED);
|
|
5209
5260
|
}
|
|
5210
5261
|
reset(data) {
|
|
5262
|
+
if (this.leafer)
|
|
5263
|
+
this.leafer.forceRender(this.__world);
|
|
5211
5264
|
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 };
|
|
5212
5265
|
if (data !== null)
|
|
5213
5266
|
this.__local = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, x: 0, y: 0, width: 0, height: 0 };
|
|
@@ -5229,12 +5282,12 @@ var LeaferUI = (function (exports) {
|
|
|
5229
5282
|
waitParent(item, bind) {
|
|
5230
5283
|
if (bind)
|
|
5231
5284
|
item = item.bind(bind);
|
|
5232
|
-
this.parent ? item() :
|
|
5285
|
+
this.parent ? item() : this.on(ChildEvent.ADD, item, 'once');
|
|
5233
5286
|
}
|
|
5234
5287
|
waitLeafer(item, bind) {
|
|
5235
5288
|
if (bind)
|
|
5236
5289
|
item = item.bind(bind);
|
|
5237
|
-
this.leafer ? item() :
|
|
5290
|
+
this.leafer ? item() : this.on(ChildEvent.MOUNTED, item, 'once');
|
|
5238
5291
|
}
|
|
5239
5292
|
nextRender(item, bind, off) {
|
|
5240
5293
|
this.leafer ? this.leafer.nextRender(item, bind, off) : this.waitLeafer(() => this.leafer.nextRender(item, bind, off));
|
|
@@ -5243,18 +5296,21 @@ var LeaferUI = (function (exports) {
|
|
|
5243
5296
|
this.nextRender(item, null, 'off');
|
|
5244
5297
|
}
|
|
5245
5298
|
__bindLeafer(leafer) {
|
|
5246
|
-
if (this.isLeafer)
|
|
5247
|
-
|
|
5248
|
-
leafer = this;
|
|
5249
|
-
}
|
|
5299
|
+
if (this.isLeafer && leafer !== null)
|
|
5300
|
+
leafer = this;
|
|
5250
5301
|
if (this.leafer && !leafer)
|
|
5251
5302
|
this.leafer.leafs--;
|
|
5252
5303
|
this.leafer = leafer;
|
|
5253
5304
|
if (leafer) {
|
|
5254
5305
|
leafer.leafs++;
|
|
5255
5306
|
this.__level = this.parent ? this.parent.__level + 1 : 1;
|
|
5256
|
-
if (this.
|
|
5257
|
-
|
|
5307
|
+
if (this.animation)
|
|
5308
|
+
this.__runAnimation('in');
|
|
5309
|
+
if (this.__bubbleMap)
|
|
5310
|
+
this.__emitLifeEvent(ChildEvent.MOUNTED);
|
|
5311
|
+
}
|
|
5312
|
+
else {
|
|
5313
|
+
this.__emitLifeEvent(ChildEvent.UNMOUNTED);
|
|
5258
5314
|
}
|
|
5259
5315
|
if (this.isBranch) {
|
|
5260
5316
|
const { children } = this;
|
|
@@ -5263,7 +5319,7 @@ var LeaferUI = (function (exports) {
|
|
|
5263
5319
|
}
|
|
5264
5320
|
}
|
|
5265
5321
|
}
|
|
5266
|
-
set(_data) { }
|
|
5322
|
+
set(_data, _isTemp) { }
|
|
5267
5323
|
get(_name) { return undefined; }
|
|
5268
5324
|
setAttr(name, value) { this[name] = value; }
|
|
5269
5325
|
getAttr(name) { return this[name]; }
|
|
@@ -5288,6 +5344,7 @@ var LeaferUI = (function (exports) {
|
|
|
5288
5344
|
findOne(_condition, _options) { return undefined; }
|
|
5289
5345
|
findId(_id) { return undefined; }
|
|
5290
5346
|
focus(_value) { }
|
|
5347
|
+
updateState() { }
|
|
5291
5348
|
updateLayout() {
|
|
5292
5349
|
this.__layout.update();
|
|
5293
5350
|
}
|
|
@@ -5395,11 +5452,24 @@ var LeaferUI = (function (exports) {
|
|
|
5395
5452
|
if (relative)
|
|
5396
5453
|
relative.worldToInner(to ? to : inner, null, distance);
|
|
5397
5454
|
}
|
|
5455
|
+
getBoxPoint(world, relative, distance, change) {
|
|
5456
|
+
return this.getBoxPointByInner(this.getInnerPoint(world, relative, distance, change), null, null, true);
|
|
5457
|
+
}
|
|
5458
|
+
getBoxPointByInner(inner, _relative, _distance, change) {
|
|
5459
|
+
const point = change ? inner : Object.assign({}, inner), { x, y } = this.boxBounds;
|
|
5460
|
+
move(point, -x, -y);
|
|
5461
|
+
return point;
|
|
5462
|
+
}
|
|
5398
5463
|
getInnerPoint(world, relative, distance, change) {
|
|
5399
5464
|
const point = change ? world : {};
|
|
5400
5465
|
this.worldToInner(world, point, distance, relative);
|
|
5401
5466
|
return point;
|
|
5402
5467
|
}
|
|
5468
|
+
getInnerPointByBox(box, _relative, _distance, change) {
|
|
5469
|
+
const point = change ? box : Object.assign({}, box), { x, y } = this.boxBounds;
|
|
5470
|
+
move(point, x, y);
|
|
5471
|
+
return point;
|
|
5472
|
+
}
|
|
5403
5473
|
getInnerPointByLocal(local, _relative, distance, change) {
|
|
5404
5474
|
return this.getInnerPoint(local, this.parent, distance, change);
|
|
5405
5475
|
}
|
|
@@ -5411,20 +5481,23 @@ var LeaferUI = (function (exports) {
|
|
|
5411
5481
|
getLocalPointByInner(inner, _relative, distance, change) {
|
|
5412
5482
|
return this.getWorldPoint(inner, this.parent, distance, change);
|
|
5413
5483
|
}
|
|
5484
|
+
getPagePoint(world, relative, distance, change) {
|
|
5485
|
+
const layer = this.leafer ? this.leafer.zoomLayer : this;
|
|
5486
|
+
return layer.getInnerPoint(world, relative, distance, change);
|
|
5487
|
+
}
|
|
5414
5488
|
getWorldPoint(inner, relative, distance, change) {
|
|
5415
5489
|
const point = change ? inner : {};
|
|
5416
5490
|
this.innerToWorld(inner, point, distance, relative);
|
|
5417
5491
|
return point;
|
|
5418
5492
|
}
|
|
5493
|
+
getWorldPointByBox(box, relative, distance, change) {
|
|
5494
|
+
return this.getWorldPoint(this.getInnerPointByBox(box, null, null, change), relative, distance, true);
|
|
5495
|
+
}
|
|
5419
5496
|
getWorldPointByLocal(local, relative, distance, change) {
|
|
5420
5497
|
const point = change ? local : {};
|
|
5421
5498
|
this.localToWorld(local, point, distance, relative);
|
|
5422
5499
|
return point;
|
|
5423
5500
|
}
|
|
5424
|
-
getPagePoint(world, relative, distance, change) {
|
|
5425
|
-
const layer = this.leafer ? this.leafer.zoomLayer : this;
|
|
5426
|
-
return layer.getInnerPoint(world, relative, distance, change);
|
|
5427
|
-
}
|
|
5428
5501
|
getWorldPointByPage(page, relative, distance, change) {
|
|
5429
5502
|
const layer = this.leafer ? this.leafer.zoomLayer : this;
|
|
5430
5503
|
return layer.getWorldPoint(page, relative, distance, change);
|
|
@@ -5493,6 +5566,17 @@ var LeaferUI = (function (exports) {
|
|
|
5493
5566
|
__drawRenderPath(_canvas) { }
|
|
5494
5567
|
__updatePath() { }
|
|
5495
5568
|
__updateRenderPath() { }
|
|
5569
|
+
getMotionPathData() {
|
|
5570
|
+
return needPlugin('path');
|
|
5571
|
+
}
|
|
5572
|
+
getMotionPoint(_motionDistance) {
|
|
5573
|
+
return needPlugin('path');
|
|
5574
|
+
}
|
|
5575
|
+
getMotionTotal() {
|
|
5576
|
+
return 0;
|
|
5577
|
+
}
|
|
5578
|
+
__updateMotionPath() { }
|
|
5579
|
+
__runAnimation(_type, _complete) { }
|
|
5496
5580
|
__updateSortChildren() { }
|
|
5497
5581
|
add(_child, _index) { }
|
|
5498
5582
|
remove(_child, destroy) {
|
|
@@ -5518,6 +5602,10 @@ var LeaferUI = (function (exports) {
|
|
|
5518
5602
|
fn = boundsType;
|
|
5519
5603
|
fn(defaultValue)(this.prototype, attrName);
|
|
5520
5604
|
}
|
|
5605
|
+
__emitLifeEvent(type) {
|
|
5606
|
+
if (this.hasEvent(type))
|
|
5607
|
+
this.emitEvent(new ChildEvent(type, this, this.parent));
|
|
5608
|
+
}
|
|
5521
5609
|
destroy() {
|
|
5522
5610
|
if (!this.destroyed) {
|
|
5523
5611
|
const { parent } = this;
|
|
@@ -5525,11 +5613,10 @@ var LeaferUI = (function (exports) {
|
|
|
5525
5613
|
this.remove();
|
|
5526
5614
|
if (this.children)
|
|
5527
5615
|
this.removeAll(true);
|
|
5528
|
-
|
|
5529
|
-
this.emitEvent(new ChildEvent(ChildEvent.DESTROY, this, parent));
|
|
5616
|
+
this.__emitLifeEvent(ChildEvent.DESTROY);
|
|
5530
5617
|
this.__.destroy();
|
|
5531
5618
|
this.__layout.destroy();
|
|
5532
|
-
this.
|
|
5619
|
+
this.destroyEventer();
|
|
5533
5620
|
this.destroyed = true;
|
|
5534
5621
|
}
|
|
5535
5622
|
}
|
|
@@ -5595,8 +5682,8 @@ var LeaferUI = (function (exports) {
|
|
|
5595
5682
|
this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1;
|
|
5596
5683
|
child.__layout.boxChanged || child.__layout.boxChange();
|
|
5597
5684
|
child.__layout.matrixChanged || child.__layout.matrixChange();
|
|
5598
|
-
if (child.
|
|
5599
|
-
|
|
5685
|
+
if (child.__bubbleMap)
|
|
5686
|
+
child.__emitLifeEvent(ChildEvent.ADD);
|
|
5600
5687
|
if (this.leafer) {
|
|
5601
5688
|
child.__bindLeafer(this.leafer);
|
|
5602
5689
|
if (this.leafer.created)
|
|
@@ -5609,16 +5696,10 @@ var LeaferUI = (function (exports) {
|
|
|
5609
5696
|
}
|
|
5610
5697
|
remove(child, destroy) {
|
|
5611
5698
|
if (child) {
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
this.__.__childBranchNumber = (this.__.__childBranchNumber || 1) - 1;
|
|
5617
|
-
this.__preRemove();
|
|
5618
|
-
this.__realRemoveChild(child);
|
|
5619
|
-
if (destroy)
|
|
5620
|
-
child.destroy();
|
|
5621
|
-
}
|
|
5699
|
+
if (child.animationOut)
|
|
5700
|
+
child.__runAnimation('out', () => this.__remove(child, destroy));
|
|
5701
|
+
else
|
|
5702
|
+
this.__remove(child, destroy);
|
|
5622
5703
|
}
|
|
5623
5704
|
else if (child === undefined) {
|
|
5624
5705
|
super.remove(null, destroy);
|
|
@@ -5640,6 +5721,18 @@ var LeaferUI = (function (exports) {
|
|
|
5640
5721
|
clear() {
|
|
5641
5722
|
this.removeAll(true);
|
|
5642
5723
|
}
|
|
5724
|
+
__remove(child, destroy) {
|
|
5725
|
+
const index = this.children.indexOf(child);
|
|
5726
|
+
if (index > -1) {
|
|
5727
|
+
this.children.splice(index, 1);
|
|
5728
|
+
if (child.isBranch)
|
|
5729
|
+
this.__.__childBranchNumber = (this.__.__childBranchNumber || 1) - 1;
|
|
5730
|
+
this.__preRemove();
|
|
5731
|
+
this.__realRemoveChild(child);
|
|
5732
|
+
if (destroy)
|
|
5733
|
+
child.destroy();
|
|
5734
|
+
}
|
|
5735
|
+
}
|
|
5643
5736
|
__preRemove() {
|
|
5644
5737
|
if (this.__hasMask)
|
|
5645
5738
|
this.__updateMask();
|
|
@@ -5649,6 +5742,7 @@ var LeaferUI = (function (exports) {
|
|
|
5649
5742
|
this.__layout.affectChildrenSort && this.__layout.childrenSortChange();
|
|
5650
5743
|
}
|
|
5651
5744
|
__realRemoveChild(child) {
|
|
5745
|
+
child.__emitLifeEvent(ChildEvent.REMOVE);
|
|
5652
5746
|
child.parent = null;
|
|
5653
5747
|
if (this.leafer) {
|
|
5654
5748
|
child.__bindLeafer(null);
|
|
@@ -5661,8 +5755,6 @@ var LeaferUI = (function (exports) {
|
|
|
5661
5755
|
}
|
|
5662
5756
|
__emitChildEvent(type, child) {
|
|
5663
5757
|
const event = new ChildEvent(type, child, this);
|
|
5664
|
-
if (child.hasEvent(type))
|
|
5665
|
-
child.emitEvent(event);
|
|
5666
5758
|
if (this.hasEvent(type) && !this.isLeafer)
|
|
5667
5759
|
this.emitEvent(event);
|
|
5668
5760
|
this.leafer.emitEvent(event);
|
|
@@ -5825,8 +5917,7 @@ var LeaferUI = (function (exports) {
|
|
|
5825
5917
|
}
|
|
5826
5918
|
}
|
|
5827
5919
|
|
|
5828
|
-
const version = "1.0.
|
|
5829
|
-
const inviteCode = {};
|
|
5920
|
+
const version = "1.0.3";
|
|
5830
5921
|
|
|
5831
5922
|
const debug$5 = Debug.get('LeaferCanvas');
|
|
5832
5923
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -6226,9 +6317,13 @@ var LeaferUI = (function (exports) {
|
|
|
6226
6317
|
});
|
|
6227
6318
|
}
|
|
6228
6319
|
function updateChange(updateList) {
|
|
6320
|
+
let layout;
|
|
6229
6321
|
updateList.list.forEach(leaf => {
|
|
6230
|
-
|
|
6322
|
+
layout = leaf.__layout;
|
|
6323
|
+
if (layout.opacityChanged)
|
|
6231
6324
|
updateAllWorldOpacity(leaf);
|
|
6325
|
+
if (layout.stateStyleChanged)
|
|
6326
|
+
setTimeout(() => layout.stateStyleChanged && leaf.updateState());
|
|
6232
6327
|
leaf.__updateChange();
|
|
6233
6328
|
});
|
|
6234
6329
|
}
|
|
@@ -6594,7 +6689,6 @@ var LeaferUI = (function (exports) {
|
|
|
6594
6689
|
Platform.requestRender(() => {
|
|
6595
6690
|
this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - startTime)));
|
|
6596
6691
|
if (this.running) {
|
|
6597
|
-
this.target.emit(AnimateEvent.FRAME);
|
|
6598
6692
|
if (this.changed && this.canvas.view)
|
|
6599
6693
|
this.render();
|
|
6600
6694
|
this.target.emit(RenderEvent.NEXT);
|
|
@@ -6668,36 +6762,6 @@ var LeaferUI = (function (exports) {
|
|
|
6668
6762
|
});
|
|
6669
6763
|
Platform.layout = Layouter.fullLayout;
|
|
6670
6764
|
|
|
6671
|
-
const TextConvert = {};
|
|
6672
|
-
const ColorConvert = {};
|
|
6673
|
-
const PathArrow = {};
|
|
6674
|
-
const Paint = {};
|
|
6675
|
-
const PaintImage = {};
|
|
6676
|
-
const PaintGradient = {};
|
|
6677
|
-
const Effect = {};
|
|
6678
|
-
const Export = {};
|
|
6679
|
-
const State = {};
|
|
6680
|
-
|
|
6681
|
-
function stateType(defaultValue) {
|
|
6682
|
-
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
6683
|
-
set(value) {
|
|
6684
|
-
this.__setAttr(key, value);
|
|
6685
|
-
this.waitLeafer(() => { if (State.setStyle)
|
|
6686
|
-
State.setStyle(this, key + 'Style', value); });
|
|
6687
|
-
}
|
|
6688
|
-
}));
|
|
6689
|
-
}
|
|
6690
|
-
function arrowType(defaultValue) {
|
|
6691
|
-
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
6692
|
-
set(value) {
|
|
6693
|
-
if (this.__setAttr(key, value)) {
|
|
6694
|
-
const data = this.__;
|
|
6695
|
-
data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
|
|
6696
|
-
doStrokeType(this);
|
|
6697
|
-
}
|
|
6698
|
-
}
|
|
6699
|
-
}));
|
|
6700
|
-
}
|
|
6701
6765
|
function effectType(defaultValue) {
|
|
6702
6766
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
6703
6767
|
set(value) {
|
|
@@ -6732,10 +6796,33 @@ var LeaferUI = (function (exports) {
|
|
|
6732
6796
|
};
|
|
6733
6797
|
}
|
|
6734
6798
|
|
|
6799
|
+
const TextConvert = {};
|
|
6800
|
+
const ColorConvert = {};
|
|
6801
|
+
const PathArrow = {};
|
|
6802
|
+
const Paint = {};
|
|
6803
|
+
const PaintImage = {};
|
|
6804
|
+
const PaintGradient = {};
|
|
6805
|
+
const Effect = {};
|
|
6806
|
+
const Export = {};
|
|
6807
|
+
const State = {
|
|
6808
|
+
setStyleName(_leaf, _styleName, _value) { return needPlugin('state'); },
|
|
6809
|
+
set(_leaf, _stateName) { return needPlugin('state'); }
|
|
6810
|
+
};
|
|
6811
|
+
const Transition = {
|
|
6812
|
+
list: {},
|
|
6813
|
+
register(attrName, fn) {
|
|
6814
|
+
Transition.list[attrName] = fn;
|
|
6815
|
+
},
|
|
6816
|
+
get(attrName) {
|
|
6817
|
+
return Transition.list[attrName];
|
|
6818
|
+
}
|
|
6819
|
+
};
|
|
6820
|
+
|
|
6735
6821
|
const { parse } = PathConvert;
|
|
6736
6822
|
const emptyPaint = {};
|
|
6737
6823
|
const debug$2 = Debug.get('UIData');
|
|
6738
6824
|
class UIData extends LeafData {
|
|
6825
|
+
get scale() { const { scaleX, scaleY } = this; return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX; }
|
|
6739
6826
|
get __strokeWidth() {
|
|
6740
6827
|
const { strokeWidth, strokeWidthFixed } = this;
|
|
6741
6828
|
if (strokeWidthFixed) {
|
|
@@ -6754,9 +6841,10 @@ var LeaferUI = (function (exports) {
|
|
|
6754
6841
|
get __autoSide() { return !this._width || !this._height; }
|
|
6755
6842
|
get __autoSize() { return !this._width && !this._height; }
|
|
6756
6843
|
setVisible(value) {
|
|
6757
|
-
if (this.__leaf.leafer)
|
|
6758
|
-
this.__leaf.leafer.watcher.hasVisible = true;
|
|
6759
6844
|
this._visible = value;
|
|
6845
|
+
const { leafer } = this.__leaf;
|
|
6846
|
+
if (leafer)
|
|
6847
|
+
leafer.watcher.hasVisible = true;
|
|
6760
6848
|
}
|
|
6761
6849
|
setWidth(value) {
|
|
6762
6850
|
if (value < 0) {
|
|
@@ -6947,7 +7035,7 @@ var LeaferUI = (function (exports) {
|
|
|
6947
7035
|
__setImageFill(value) {
|
|
6948
7036
|
if (this.__leaf.image)
|
|
6949
7037
|
this.__leaf.image = null;
|
|
6950
|
-
this.fill = value ? { type: 'image', mode: '
|
|
7038
|
+
this.fill = value ? { type: 'image', mode: 'stretch', url: value } : undefined;
|
|
6951
7039
|
}
|
|
6952
7040
|
__getData() {
|
|
6953
7041
|
const data = super.__getData();
|
|
@@ -7137,19 +7225,8 @@ var LeaferUI = (function (exports) {
|
|
|
7137
7225
|
exports.UI = UI_1 = class UI extends exports.Leaf {
|
|
7138
7226
|
get app() { return this.leafer && this.leafer.app; }
|
|
7139
7227
|
get isFrame() { return false; }
|
|
7140
|
-
set scale(value) {
|
|
7141
|
-
|
|
7142
|
-
this.scaleX = this.scaleY = value;
|
|
7143
|
-
}
|
|
7144
|
-
else {
|
|
7145
|
-
this.scaleX = value.x;
|
|
7146
|
-
this.scaleY = value.y;
|
|
7147
|
-
}
|
|
7148
|
-
}
|
|
7149
|
-
get scale() {
|
|
7150
|
-
const { scaleX, scaleY } = this;
|
|
7151
|
-
return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX;
|
|
7152
|
-
}
|
|
7228
|
+
set scale(value) { MathHelper.assignScale(this, value); }
|
|
7229
|
+
get scale() { return this.__.scale; }
|
|
7153
7230
|
get pen() {
|
|
7154
7231
|
const { path } = this.__;
|
|
7155
7232
|
pen.set(this.path = path || []);
|
|
@@ -7164,8 +7241,15 @@ var LeaferUI = (function (exports) {
|
|
|
7164
7241
|
super(data);
|
|
7165
7242
|
}
|
|
7166
7243
|
reset(_data) { }
|
|
7167
|
-
set(data) {
|
|
7168
|
-
|
|
7244
|
+
set(data, isTemp) {
|
|
7245
|
+
if (isTemp) {
|
|
7246
|
+
this.lockNormalStyle = true;
|
|
7247
|
+
Object.assign(this, data);
|
|
7248
|
+
this.lockNormalStyle = false;
|
|
7249
|
+
}
|
|
7250
|
+
else {
|
|
7251
|
+
Object.assign(this, data);
|
|
7252
|
+
}
|
|
7169
7253
|
}
|
|
7170
7254
|
get(name) {
|
|
7171
7255
|
return typeof name === 'string' ? this.__.__getInput(name) : this.__.__getInputData(name);
|
|
@@ -7228,11 +7312,18 @@ var LeaferUI = (function (exports) {
|
|
|
7228
7312
|
drawer.rect(x, y, width, height);
|
|
7229
7313
|
}
|
|
7230
7314
|
}
|
|
7315
|
+
animate(_keyframe, _options, _type, _isTemp) {
|
|
7316
|
+
return needPlugin('animate');
|
|
7317
|
+
}
|
|
7318
|
+
killAnimate(_type) { }
|
|
7231
7319
|
export(filename, options) {
|
|
7232
7320
|
return Export.export(this, filename, options);
|
|
7233
7321
|
}
|
|
7234
|
-
clone() {
|
|
7235
|
-
|
|
7322
|
+
clone(newData) {
|
|
7323
|
+
const json = this.toJSON();
|
|
7324
|
+
if (newData)
|
|
7325
|
+
Object.assign(json, newData);
|
|
7326
|
+
return UI_1.one(json);
|
|
7236
7327
|
}
|
|
7237
7328
|
static one(data, x, y, width, height) {
|
|
7238
7329
|
return UICreator.get(data.tag || this.prototype.__tag, data, x, y, width, height);
|
|
@@ -7248,6 +7339,8 @@ var LeaferUI = (function (exports) {
|
|
|
7248
7339
|
static setEditInner(_editorName) { }
|
|
7249
7340
|
destroy() {
|
|
7250
7341
|
this.fill = this.stroke = null;
|
|
7342
|
+
if (this.__animate)
|
|
7343
|
+
this.killAnimate();
|
|
7251
7344
|
super.destroy();
|
|
7252
7345
|
}
|
|
7253
7346
|
};
|
|
@@ -7275,12 +7368,6 @@ var LeaferUI = (function (exports) {
|
|
|
7275
7368
|
__decorate([
|
|
7276
7369
|
visibleType(true)
|
|
7277
7370
|
], exports.UI.prototype, "visible", void 0);
|
|
7278
|
-
__decorate([
|
|
7279
|
-
stateType(false)
|
|
7280
|
-
], exports.UI.prototype, "selected", void 0);
|
|
7281
|
-
__decorate([
|
|
7282
|
-
stateType(false)
|
|
7283
|
-
], exports.UI.prototype, "disabled", void 0);
|
|
7284
7371
|
__decorate([
|
|
7285
7372
|
surfaceType(false)
|
|
7286
7373
|
], exports.UI.prototype, "locked", void 0);
|
|
@@ -7353,45 +7440,9 @@ var LeaferUI = (function (exports) {
|
|
|
7353
7440
|
__decorate([
|
|
7354
7441
|
pathType(true)
|
|
7355
7442
|
], exports.UI.prototype, "closed", void 0);
|
|
7356
|
-
__decorate([
|
|
7357
|
-
autoLayoutType(false)
|
|
7358
|
-
], exports.UI.prototype, "flow", void 0);
|
|
7359
7443
|
__decorate([
|
|
7360
7444
|
boundsType(0)
|
|
7361
7445
|
], exports.UI.prototype, "padding", void 0);
|
|
7362
|
-
__decorate([
|
|
7363
|
-
boundsType(0)
|
|
7364
|
-
], exports.UI.prototype, "gap", void 0);
|
|
7365
|
-
__decorate([
|
|
7366
|
-
boundsType('top-left')
|
|
7367
|
-
], exports.UI.prototype, "flowAlign", void 0);
|
|
7368
|
-
__decorate([
|
|
7369
|
-
boundsType(false)
|
|
7370
|
-
], exports.UI.prototype, "flowWrap", void 0);
|
|
7371
|
-
__decorate([
|
|
7372
|
-
boundsType('box')
|
|
7373
|
-
], exports.UI.prototype, "itemBox", void 0);
|
|
7374
|
-
__decorate([
|
|
7375
|
-
boundsType(true)
|
|
7376
|
-
], exports.UI.prototype, "inFlow", void 0);
|
|
7377
|
-
__decorate([
|
|
7378
|
-
boundsType()
|
|
7379
|
-
], exports.UI.prototype, "autoWidth", void 0);
|
|
7380
|
-
__decorate([
|
|
7381
|
-
boundsType()
|
|
7382
|
-
], exports.UI.prototype, "autoHeight", void 0);
|
|
7383
|
-
__decorate([
|
|
7384
|
-
boundsType()
|
|
7385
|
-
], exports.UI.prototype, "lockRatio", void 0);
|
|
7386
|
-
__decorate([
|
|
7387
|
-
boundsType()
|
|
7388
|
-
], exports.UI.prototype, "autoBox", void 0);
|
|
7389
|
-
__decorate([
|
|
7390
|
-
boundsType()
|
|
7391
|
-
], exports.UI.prototype, "widthRange", void 0);
|
|
7392
|
-
__decorate([
|
|
7393
|
-
boundsType()
|
|
7394
|
-
], exports.UI.prototype, "heightRange", void 0);
|
|
7395
7446
|
__decorate([
|
|
7396
7447
|
dataType(false)
|
|
7397
7448
|
], exports.UI.prototype, "draggable", void 0);
|
|
@@ -7455,12 +7506,6 @@ var LeaferUI = (function (exports) {
|
|
|
7455
7506
|
__decorate([
|
|
7456
7507
|
strokeType(10)
|
|
7457
7508
|
], exports.UI.prototype, "miterLimit", void 0);
|
|
7458
|
-
__decorate([
|
|
7459
|
-
arrowType('none')
|
|
7460
|
-
], exports.UI.prototype, "startArrow", void 0);
|
|
7461
|
-
__decorate([
|
|
7462
|
-
arrowType('none')
|
|
7463
|
-
], exports.UI.prototype, "endArrow", void 0);
|
|
7464
7509
|
__decorate([
|
|
7465
7510
|
pathType(0)
|
|
7466
7511
|
], exports.UI.prototype, "cornerRadius", void 0);
|
|
@@ -7482,24 +7527,6 @@ var LeaferUI = (function (exports) {
|
|
|
7482
7527
|
__decorate([
|
|
7483
7528
|
effectType()
|
|
7484
7529
|
], exports.UI.prototype, "grayscale", void 0);
|
|
7485
|
-
__decorate([
|
|
7486
|
-
dataType()
|
|
7487
|
-
], exports.UI.prototype, "normalStyle", void 0);
|
|
7488
|
-
__decorate([
|
|
7489
|
-
dataType()
|
|
7490
|
-
], exports.UI.prototype, "hoverStyle", void 0);
|
|
7491
|
-
__decorate([
|
|
7492
|
-
dataType()
|
|
7493
|
-
], exports.UI.prototype, "pressStyle", void 0);
|
|
7494
|
-
__decorate([
|
|
7495
|
-
dataType()
|
|
7496
|
-
], exports.UI.prototype, "focusStyle", void 0);
|
|
7497
|
-
__decorate([
|
|
7498
|
-
dataType()
|
|
7499
|
-
], exports.UI.prototype, "selectedStyle", void 0);
|
|
7500
|
-
__decorate([
|
|
7501
|
-
dataType()
|
|
7502
|
-
], exports.UI.prototype, "disabledStyle", void 0);
|
|
7503
7530
|
__decorate([
|
|
7504
7531
|
dataType({})
|
|
7505
7532
|
], exports.UI.prototype, "data", void 0);
|
|
@@ -7526,7 +7553,7 @@ var LeaferUI = (function (exports) {
|
|
|
7526
7553
|
if (!this.children)
|
|
7527
7554
|
this.children = [];
|
|
7528
7555
|
}
|
|
7529
|
-
set(data) {
|
|
7556
|
+
set(data, isTemp) {
|
|
7530
7557
|
if (data.children) {
|
|
7531
7558
|
const { children } = data;
|
|
7532
7559
|
delete data.children;
|
|
@@ -7536,7 +7563,7 @@ var LeaferUI = (function (exports) {
|
|
|
7536
7563
|
else {
|
|
7537
7564
|
this.clear();
|
|
7538
7565
|
}
|
|
7539
|
-
super.set(data);
|
|
7566
|
+
super.set(data, isTemp);
|
|
7540
7567
|
let child;
|
|
7541
7568
|
children.forEach(childData => {
|
|
7542
7569
|
child = childData.__ ? childData : UICreator.get(childData.tag, childData);
|
|
@@ -7545,7 +7572,7 @@ var LeaferUI = (function (exports) {
|
|
|
7545
7572
|
data.children = children;
|
|
7546
7573
|
}
|
|
7547
7574
|
else {
|
|
7548
|
-
super.set(data);
|
|
7575
|
+
super.set(data, isTemp);
|
|
7549
7576
|
}
|
|
7550
7577
|
}
|
|
7551
7578
|
toJSON(options) {
|
|
@@ -7872,7 +7899,7 @@ var LeaferUI = (function (exports) {
|
|
|
7872
7899
|
}
|
|
7873
7900
|
}
|
|
7874
7901
|
zoom(_zoomType, _padding, _fixedScale) {
|
|
7875
|
-
return
|
|
7902
|
+
return needPlugin('view');
|
|
7876
7903
|
}
|
|
7877
7904
|
getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
|
|
7878
7905
|
getValidScale(changeScale) { return changeScale; }
|
|
@@ -8395,19 +8422,18 @@ var LeaferUI = (function (exports) {
|
|
|
8395
8422
|
this.paint();
|
|
8396
8423
|
}
|
|
8397
8424
|
paint() {
|
|
8398
|
-
this.
|
|
8425
|
+
this.forceRender();
|
|
8399
8426
|
}
|
|
8400
8427
|
__drawAfterFill(canvas, _options) {
|
|
8401
|
-
const
|
|
8402
|
-
|
|
8403
|
-
if (this.__.cornerRadius || this.pathInputed) {
|
|
8428
|
+
const { width, height, cornerRadius } = this.__, { view } = this.canvas;
|
|
8429
|
+
if (cornerRadius || this.pathInputed) {
|
|
8404
8430
|
canvas.save();
|
|
8405
8431
|
canvas.clip();
|
|
8406
|
-
canvas.drawImage(
|
|
8432
|
+
canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
|
|
8407
8433
|
canvas.restore();
|
|
8408
8434
|
}
|
|
8409
8435
|
else {
|
|
8410
|
-
canvas.drawImage(
|
|
8436
|
+
canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
|
|
8411
8437
|
}
|
|
8412
8438
|
}
|
|
8413
8439
|
__updateSize() {
|
|
@@ -9046,6 +9072,8 @@ var LeaferUI = (function (exports) {
|
|
|
9046
9072
|
let { width, height } = image;
|
|
9047
9073
|
if (paint.padding)
|
|
9048
9074
|
box = tempBox.set(box).shrink(paint.padding);
|
|
9075
|
+
if (paint.mode === 'strench')
|
|
9076
|
+
paint.mode = 'stretch';
|
|
9049
9077
|
const { opacity, mode, align, offset, scale, size, rotation, repeat } = paint;
|
|
9050
9078
|
const sameBox = box.width === width && box.height === height;
|
|
9051
9079
|
const data = { mode };
|
|
@@ -9074,7 +9102,7 @@ var LeaferUI = (function (exports) {
|
|
|
9074
9102
|
if (offset)
|
|
9075
9103
|
x += offset.x, y += offset.y;
|
|
9076
9104
|
switch (mode) {
|
|
9077
|
-
case '
|
|
9105
|
+
case 'stretch':
|
|
9078
9106
|
if (!sameBox)
|
|
9079
9107
|
width = box.width, height = box.height;
|
|
9080
9108
|
break;
|
|
@@ -9101,7 +9129,7 @@ var LeaferUI = (function (exports) {
|
|
|
9101
9129
|
translate(data.transform, box.x, box.y);
|
|
9102
9130
|
}
|
|
9103
9131
|
}
|
|
9104
|
-
if (scaleX && mode !== '
|
|
9132
|
+
if (scaleX && mode !== 'stretch') {
|
|
9105
9133
|
data.scaleX = scaleX;
|
|
9106
9134
|
data.scaleY = scaleY;
|
|
9107
9135
|
}
|
|
@@ -9205,7 +9233,7 @@ var LeaferUI = (function (exports) {
|
|
|
9205
9233
|
const { ceil, abs: abs$1 } = Math;
|
|
9206
9234
|
function createPattern(ui, paint, pixelRatio) {
|
|
9207
9235
|
let { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
|
|
9208
|
-
const id = scaleX + '-' + scaleY;
|
|
9236
|
+
const id = scaleX + '-' + scaleY + '-' + pixelRatio;
|
|
9209
9237
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
9210
9238
|
scaleX = abs$1(scaleX);
|
|
9211
9239
|
scaleY = abs$1(scaleY);
|
|
@@ -9267,7 +9295,8 @@ var LeaferUI = (function (exports) {
|
|
|
9267
9295
|
const { abs } = Math;
|
|
9268
9296
|
function checkImage(ui, canvas, paint, allowPaint) {
|
|
9269
9297
|
const { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
|
|
9270
|
-
|
|
9298
|
+
const { pixelRatio } = canvas;
|
|
9299
|
+
if (!paint.data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !Export.running)) {
|
|
9271
9300
|
return false;
|
|
9272
9301
|
}
|
|
9273
9302
|
else {
|
|
@@ -9275,8 +9304,8 @@ var LeaferUI = (function (exports) {
|
|
|
9275
9304
|
if (allowPaint) {
|
|
9276
9305
|
if (!data.repeat) {
|
|
9277
9306
|
let { width, height } = data;
|
|
9278
|
-
width *= abs(scaleX) *
|
|
9279
|
-
height *= abs(scaleY) *
|
|
9307
|
+
width *= abs(scaleX) * pixelRatio;
|
|
9308
|
+
height *= abs(scaleY) * pixelRatio;
|
|
9280
9309
|
if (data.scaleX) {
|
|
9281
9310
|
width *= data.scaleX;
|
|
9282
9311
|
height *= data.scaleY;
|
|
@@ -9302,14 +9331,14 @@ var LeaferUI = (function (exports) {
|
|
|
9302
9331
|
}
|
|
9303
9332
|
else {
|
|
9304
9333
|
if (!paint.style || paint.sync || Export.running) {
|
|
9305
|
-
createPattern(ui, paint,
|
|
9334
|
+
createPattern(ui, paint, pixelRatio);
|
|
9306
9335
|
}
|
|
9307
9336
|
else {
|
|
9308
9337
|
if (!paint.patternTask) {
|
|
9309
9338
|
paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
|
|
9310
9339
|
paint.patternTask = null;
|
|
9311
9340
|
if (canvas.bounds.hit(ui.__nowWorld))
|
|
9312
|
-
createPattern(ui, paint,
|
|
9341
|
+
createPattern(ui, paint, pixelRatio);
|
|
9313
9342
|
ui.forceUpdate('surface');
|
|
9314
9343
|
}), 300);
|
|
9315
9344
|
}
|
|
@@ -9373,14 +9402,16 @@ var LeaferUI = (function (exports) {
|
|
|
9373
9402
|
return data;
|
|
9374
9403
|
}
|
|
9375
9404
|
function applyStops(gradient, stops, opacity) {
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
|
|
9382
|
-
|
|
9383
|
-
|
|
9405
|
+
if (stops) {
|
|
9406
|
+
let stop;
|
|
9407
|
+
for (let i = 0, len = stops.length; i < len; i++) {
|
|
9408
|
+
stop = stops[i];
|
|
9409
|
+
if (typeof stop === 'string') {
|
|
9410
|
+
gradient.addColorStop(i / (len - 1), ColorConvert.string(stop, opacity));
|
|
9411
|
+
}
|
|
9412
|
+
else {
|
|
9413
|
+
gradient.addColorStop(stop.offset, ColorConvert.string(stop.color, opacity));
|
|
9414
|
+
}
|
|
9384
9415
|
}
|
|
9385
9416
|
}
|
|
9386
9417
|
}
|
|
@@ -10136,10 +10167,15 @@ var LeaferUI = (function (exports) {
|
|
|
10136
10167
|
};
|
|
10137
10168
|
|
|
10138
10169
|
function string(color, opacity) {
|
|
10139
|
-
|
|
10140
|
-
|
|
10170
|
+
const doOpacity = typeof opacity === 'number' && opacity !== 1;
|
|
10171
|
+
if (typeof color === 'string') {
|
|
10172
|
+
if (doOpacity && ColorConvert.object)
|
|
10173
|
+
color = ColorConvert.object(color);
|
|
10174
|
+
else
|
|
10175
|
+
return color;
|
|
10176
|
+
}
|
|
10141
10177
|
let a = color.a === undefined ? 1 : color.a;
|
|
10142
|
-
if (
|
|
10178
|
+
if (doOpacity)
|
|
10143
10179
|
a *= opacity;
|
|
10144
10180
|
const rgb = color.r + ',' + color.g + ',' + color.b;
|
|
10145
10181
|
return a === 1 ? 'rgb(' + rgb + ')' : 'rgba(' + rgb + ',' + a + ')';
|
|
@@ -10347,7 +10383,6 @@ var LeaferUI = (function (exports) {
|
|
|
10347
10383
|
useCanvas();
|
|
10348
10384
|
|
|
10349
10385
|
exports.AlignHelper = AlignHelper;
|
|
10350
|
-
exports.AnimateEvent = AnimateEvent;
|
|
10351
10386
|
exports.AroundHelper = AroundHelper;
|
|
10352
10387
|
exports.AutoBounds = AutoBounds;
|
|
10353
10388
|
exports.BezierHelper = BezierHelper;
|
|
@@ -10368,6 +10403,7 @@ var LeaferUI = (function (exports) {
|
|
|
10368
10403
|
exports.EllipseHelper = EllipseHelper;
|
|
10369
10404
|
exports.Event = Event;
|
|
10370
10405
|
exports.EventCreator = EventCreator;
|
|
10406
|
+
exports.Eventer = Eventer;
|
|
10371
10407
|
exports.Export = Export;
|
|
10372
10408
|
exports.FileHelper = FileHelper;
|
|
10373
10409
|
exports.FrameData = FrameData;
|
|
@@ -10438,6 +10474,7 @@ var LeaferUI = (function (exports) {
|
|
|
10438
10474
|
exports.TaskProcessor = TaskProcessor;
|
|
10439
10475
|
exports.TextConvert = TextConvert;
|
|
10440
10476
|
exports.TextData = TextData;
|
|
10477
|
+
exports.Transition = Transition;
|
|
10441
10478
|
exports.TwoPointBoundsHelper = TwoPointBoundsHelper;
|
|
10442
10479
|
exports.UIBounds = UIBounds;
|
|
10443
10480
|
exports.UICreator = UICreator;
|
|
@@ -10449,7 +10486,6 @@ var LeaferUI = (function (exports) {
|
|
|
10449
10486
|
exports.Watcher = Watcher;
|
|
10450
10487
|
exports.affectRenderBoundsType = affectRenderBoundsType;
|
|
10451
10488
|
exports.affectStrokeBoundsType = affectStrokeBoundsType;
|
|
10452
|
-
exports.arrowType = arrowType;
|
|
10453
10489
|
exports.attr = attr;
|
|
10454
10490
|
exports.autoLayoutType = autoLayoutType;
|
|
10455
10491
|
exports.boundsType = boundsType;
|
|
@@ -10472,10 +10508,11 @@ var LeaferUI = (function (exports) {
|
|
|
10472
10508
|
exports.getMatrixData = getMatrixData;
|
|
10473
10509
|
exports.getPointData = getPointData;
|
|
10474
10510
|
exports.hitType = hitType;
|
|
10475
|
-
exports.
|
|
10511
|
+
exports.isNull = isNull;
|
|
10476
10512
|
exports.layoutProcessor = layoutProcessor;
|
|
10477
10513
|
exports.maskType = maskType;
|
|
10478
10514
|
exports.naturalBoundsType = naturalBoundsType;
|
|
10515
|
+
exports.needPlugin = needPlugin;
|
|
10479
10516
|
exports.opacityType = opacityType;
|
|
10480
10517
|
exports.pathInputType = pathInputType;
|
|
10481
10518
|
exports.pathType = pathType;
|
|
@@ -10489,7 +10526,6 @@ var LeaferUI = (function (exports) {
|
|
|
10489
10526
|
exports.rotationType = rotationType;
|
|
10490
10527
|
exports.scaleType = scaleType;
|
|
10491
10528
|
exports.sortType = sortType;
|
|
10492
|
-
exports.stateType = stateType;
|
|
10493
10529
|
exports.strokeType = strokeType;
|
|
10494
10530
|
exports.surfaceType = surfaceType;
|
|
10495
10531
|
exports.tempBounds = tempBounds$1;
|