leafer-ui 1.0.0-rc.3 → 1.0.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/web.esm.js +81 -42
- package/dist/web.esm.min.js +1 -1
- package/dist/web.js +267 -207
- package/dist/web.min.js +1 -1
- package/dist/web.module.js +268 -207
- package/dist/web.module.min.js +1 -1
- package/package.json +4 -4
package/dist/web.js
CHANGED
|
@@ -657,7 +657,7 @@ var LeaferUI = (function (exports) {
|
|
|
657
657
|
B.copyAndSpread(n, t, spreadX, spreadY);
|
|
658
658
|
return n;
|
|
659
659
|
},
|
|
660
|
-
spread(t, spreadX, spreadY) {
|
|
660
|
+
spread(t, spreadX, spreadY = spreadX) {
|
|
661
661
|
B.copyAndSpread(t, t, spreadX, spreadY);
|
|
662
662
|
},
|
|
663
663
|
ceil(t) {
|
|
@@ -798,8 +798,8 @@ var LeaferUI = (function (exports) {
|
|
|
798
798
|
getFitMatrix(put) {
|
|
799
799
|
return BoundsHelper.getFitMatrix(this, put);
|
|
800
800
|
}
|
|
801
|
-
spread(
|
|
802
|
-
BoundsHelper.spread(this,
|
|
801
|
+
spread(spreadX, spreadY) {
|
|
802
|
+
BoundsHelper.spread(this, spreadX, spreadY);
|
|
803
803
|
return this;
|
|
804
804
|
}
|
|
805
805
|
ceil() {
|
|
@@ -1381,6 +1381,8 @@ var LeaferUI = (function (exports) {
|
|
|
1381
1381
|
}
|
|
1382
1382
|
|
|
1383
1383
|
const FileHelper = {
|
|
1384
|
+
opacityTypes: ['png', 'webp', 'svg'],
|
|
1385
|
+
upperCaseTypeMap: {},
|
|
1384
1386
|
mineType(type) {
|
|
1385
1387
|
if (!type || type.startsWith('image'))
|
|
1386
1388
|
return type;
|
|
@@ -1393,6 +1395,7 @@ var LeaferUI = (function (exports) {
|
|
|
1393
1395
|
return l[l.length - 1];
|
|
1394
1396
|
}
|
|
1395
1397
|
};
|
|
1398
|
+
FileHelper.opacityTypes.forEach(type => FileHelper.upperCaseTypeMap[type] = type.toUpperCase());
|
|
1396
1399
|
|
|
1397
1400
|
/******************************************************************************
|
|
1398
1401
|
Copyright (c) Microsoft Corporation.
|
|
@@ -2333,7 +2336,7 @@ var LeaferUI = (function (exports) {
|
|
|
2333
2336
|
const centerX = fromX + halfX + rotationCos * cx - rotationSin * cy;
|
|
2334
2337
|
const centerY = fromY + halfY + rotationSin * cx + rotationCos * cy;
|
|
2335
2338
|
const anticlockwise = totalRadian < 0 ? 1 : 0;
|
|
2336
|
-
if (curveMode) {
|
|
2339
|
+
if (curveMode || Platform.name === 'node') {
|
|
2337
2340
|
ellipse$5(data, centerX, centerY, radiusX, radiusY, rotation, startRadian / OneRadian, endRadian / OneRadian, anticlockwise);
|
|
2338
2341
|
}
|
|
2339
2342
|
else {
|
|
@@ -3260,6 +3263,23 @@ var LeaferUI = (function (exports) {
|
|
|
3260
3263
|
list.length = 0;
|
|
3261
3264
|
}
|
|
3262
3265
|
},
|
|
3266
|
+
isPixel(config) {
|
|
3267
|
+
return FileHelper.opacityTypes.some(item => I$1.isFormat(item, config));
|
|
3268
|
+
},
|
|
3269
|
+
isFormat(format, config) {
|
|
3270
|
+
if (config.format === format)
|
|
3271
|
+
return true;
|
|
3272
|
+
const { url } = config;
|
|
3273
|
+
if (url.startsWith('data:')) {
|
|
3274
|
+
if (url.startsWith('data:' + FileHelper.mineType(format)))
|
|
3275
|
+
return true;
|
|
3276
|
+
}
|
|
3277
|
+
else {
|
|
3278
|
+
if (url.includes('.' + format) || url.includes('.' + FileHelper.upperCaseTypeMap[format]))
|
|
3279
|
+
return true;
|
|
3280
|
+
}
|
|
3281
|
+
return false;
|
|
3282
|
+
},
|
|
3263
3283
|
destroy() {
|
|
3264
3284
|
I$1.map = {};
|
|
3265
3285
|
}
|
|
@@ -3275,17 +3295,7 @@ var LeaferUI = (function (exports) {
|
|
|
3275
3295
|
this.waitComplete = [];
|
|
3276
3296
|
this.innerId = create$1(IMAGE);
|
|
3277
3297
|
this.config = config || { url: '' };
|
|
3278
|
-
|
|
3279
|
-
if (url.startsWith('data:')) {
|
|
3280
|
-
if (url.startsWith('data:image/svg'))
|
|
3281
|
-
this.isSVG = true;
|
|
3282
|
-
}
|
|
3283
|
-
else {
|
|
3284
|
-
if (url.includes('.svg'))
|
|
3285
|
-
this.isSVG = true;
|
|
3286
|
-
}
|
|
3287
|
-
if (this.config.format === 'svg')
|
|
3288
|
-
this.isSVG = true;
|
|
3298
|
+
this.isSVG = ImageManager.isFormat('svg', config);
|
|
3289
3299
|
}
|
|
3290
3300
|
load(onSuccess, onError) {
|
|
3291
3301
|
if (!this.loading) {
|
|
@@ -3358,13 +3368,19 @@ var LeaferUI = (function (exports) {
|
|
|
3358
3368
|
}
|
|
3359
3369
|
stopDefault() {
|
|
3360
3370
|
this.isStopDefault = true;
|
|
3371
|
+
if (this.origin)
|
|
3372
|
+
Platform.event.stopDefault(this.origin);
|
|
3361
3373
|
}
|
|
3362
3374
|
stopNow() {
|
|
3363
3375
|
this.isStopNow = true;
|
|
3364
3376
|
this.isStop = true;
|
|
3377
|
+
if (this.origin)
|
|
3378
|
+
Platform.event.stopNow(this.origin);
|
|
3365
3379
|
}
|
|
3366
3380
|
stop() {
|
|
3367
3381
|
this.isStop = true;
|
|
3382
|
+
if (this.origin)
|
|
3383
|
+
Platform.event.stop(this.origin);
|
|
3368
3384
|
}
|
|
3369
3385
|
}
|
|
3370
3386
|
|
|
@@ -3426,20 +3442,6 @@ var LeaferUI = (function (exports) {
|
|
|
3426
3442
|
}
|
|
3427
3443
|
ResizeEvent.RESIZE = 'resize';
|
|
3428
3444
|
|
|
3429
|
-
class TransformEvent extends Event {
|
|
3430
|
-
constructor(type, params) {
|
|
3431
|
-
super(type);
|
|
3432
|
-
if (params)
|
|
3433
|
-
Object.assign(this, params);
|
|
3434
|
-
}
|
|
3435
|
-
}
|
|
3436
|
-
TransformEvent.START = 'transform.start';
|
|
3437
|
-
TransformEvent.CHANGE = 'transform.change';
|
|
3438
|
-
TransformEvent.END = 'transform.end';
|
|
3439
|
-
TransformEvent.BEFORE_START = 'transform.before_start';
|
|
3440
|
-
TransformEvent.BEFORE_CHANGE = 'transform.before_change';
|
|
3441
|
-
TransformEvent.BEFORE_END = 'transform.before_end';
|
|
3442
|
-
|
|
3443
3445
|
class WatchEvent extends Event {
|
|
3444
3446
|
constructor(type, data) {
|
|
3445
3447
|
super(type);
|
|
@@ -3540,15 +3542,15 @@ var LeaferUI = (function (exports) {
|
|
|
3540
3542
|
this.bubbles = true;
|
|
3541
3543
|
Object.assign(this, params);
|
|
3542
3544
|
}
|
|
3543
|
-
getInner(
|
|
3544
|
-
if (!
|
|
3545
|
-
|
|
3546
|
-
return
|
|
3545
|
+
getInner(relative) {
|
|
3546
|
+
if (!relative)
|
|
3547
|
+
relative = this.current;
|
|
3548
|
+
return relative.getInnerPoint(this);
|
|
3547
3549
|
}
|
|
3548
|
-
getLocal(
|
|
3549
|
-
if (!
|
|
3550
|
-
|
|
3551
|
-
return
|
|
3550
|
+
getLocal(relative) {
|
|
3551
|
+
if (!relative)
|
|
3552
|
+
relative = this.current;
|
|
3553
|
+
return relative.getLocalPoint(this);
|
|
3552
3554
|
}
|
|
3553
3555
|
static changeName(oldName, newName) {
|
|
3554
3556
|
EventCreator.changeName(oldName, newName);
|
|
@@ -3595,7 +3597,7 @@ var LeaferUI = (function (exports) {
|
|
|
3595
3597
|
defineLeafAttr(target, key, defaultValue, {
|
|
3596
3598
|
set(value) {
|
|
3597
3599
|
this.__setAttr(key, value);
|
|
3598
|
-
this.__layout.
|
|
3600
|
+
this.__layout.matrixChanged || this.__layout.matrixChange();
|
|
3599
3601
|
}
|
|
3600
3602
|
});
|
|
3601
3603
|
};
|
|
@@ -3627,7 +3629,7 @@ var LeaferUI = (function (exports) {
|
|
|
3627
3629
|
this.__setAttr(key, value);
|
|
3628
3630
|
this.__layout.boxChanged || this.__layout.boxChange();
|
|
3629
3631
|
if (this.__.around)
|
|
3630
|
-
this.__layout.
|
|
3632
|
+
this.__layout.matrixChanged || this.__layout.matrixChange();
|
|
3631
3633
|
}
|
|
3632
3634
|
});
|
|
3633
3635
|
};
|
|
@@ -3863,29 +3865,36 @@ var LeaferUI = (function (exports) {
|
|
|
3863
3865
|
exports.PointerEvent.DOUBLE_CLICK = 'double_click';
|
|
3864
3866
|
exports.PointerEvent.LONG_PRESS = 'long_press';
|
|
3865
3867
|
exports.PointerEvent.LONG_TAP = 'long_tap';
|
|
3868
|
+
exports.PointerEvent.MENU = 'pointer.menu';
|
|
3866
3869
|
exports.PointerEvent = __decorate([
|
|
3867
3870
|
registerUIEvent()
|
|
3868
3871
|
], exports.PointerEvent);
|
|
3869
3872
|
|
|
3870
3873
|
const move = {};
|
|
3871
3874
|
exports.DragEvent = class DragEvent extends exports.PointerEvent {
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
+
static setList(data) {
|
|
3876
|
+
this.list = data instanceof LeafList ? data : new LeafList(data);
|
|
3877
|
+
}
|
|
3878
|
+
static setData(data) {
|
|
3879
|
+
this.data = data;
|
|
3880
|
+
}
|
|
3881
|
+
getInnerMove(relative, total) {
|
|
3882
|
+
if (!relative)
|
|
3883
|
+
relative = this.current;
|
|
3875
3884
|
this.assignMove(total);
|
|
3876
|
-
return
|
|
3885
|
+
return relative.getInnerPoint(move, null, true);
|
|
3877
3886
|
}
|
|
3878
|
-
getLocalMove(
|
|
3879
|
-
if (!
|
|
3880
|
-
|
|
3887
|
+
getLocalMove(relative, total) {
|
|
3888
|
+
if (!relative)
|
|
3889
|
+
relative = this.current;
|
|
3881
3890
|
this.assignMove(total);
|
|
3882
|
-
return
|
|
3891
|
+
return relative.getLocalPoint(move, null, true);
|
|
3883
3892
|
}
|
|
3884
|
-
getInnerTotal(
|
|
3885
|
-
return this.getInnerMove(
|
|
3893
|
+
getInnerTotal(relative) {
|
|
3894
|
+
return this.getInnerMove(relative, true);
|
|
3886
3895
|
}
|
|
3887
|
-
getLocalTotal(
|
|
3888
|
-
return this.getLocalMove(
|
|
3896
|
+
getLocalTotal(relative) {
|
|
3897
|
+
return this.getLocalMove(relative, true);
|
|
3889
3898
|
}
|
|
3890
3899
|
assignMove(total) {
|
|
3891
3900
|
move.x = total ? this.totalX : this.moveX;
|
|
@@ -3904,17 +3913,16 @@ var LeaferUI = (function (exports) {
|
|
|
3904
3913
|
registerUIEvent()
|
|
3905
3914
|
], exports.DragEvent);
|
|
3906
3915
|
|
|
3907
|
-
|
|
3908
|
-
exports.DropEvent = DropEvent_1 = class DropEvent extends exports.PointerEvent {
|
|
3916
|
+
exports.DropEvent = class DropEvent extends exports.PointerEvent {
|
|
3909
3917
|
static setList(data) {
|
|
3910
|
-
|
|
3918
|
+
exports.DragEvent.setList(data);
|
|
3911
3919
|
}
|
|
3912
3920
|
static setData(data) {
|
|
3913
|
-
|
|
3921
|
+
exports.DragEvent.setData(data);
|
|
3914
3922
|
}
|
|
3915
3923
|
};
|
|
3916
3924
|
exports.DropEvent.DROP = 'drop';
|
|
3917
|
-
exports.DropEvent =
|
|
3925
|
+
exports.DropEvent = __decorate([
|
|
3918
3926
|
registerUIEvent()
|
|
3919
3927
|
], exports.DropEvent);
|
|
3920
3928
|
|
|
@@ -4021,7 +4029,6 @@ var LeaferUI = (function (exports) {
|
|
|
4021
4029
|
this.moveEnd();
|
|
4022
4030
|
this.zoomEnd();
|
|
4023
4031
|
this.rotateEnd();
|
|
4024
|
-
this.transformMode = null;
|
|
4025
4032
|
}
|
|
4026
4033
|
moveEnd() {
|
|
4027
4034
|
if (this.moveData) {
|
|
@@ -4046,7 +4053,7 @@ var LeaferUI = (function (exports) {
|
|
|
4046
4053
|
}
|
|
4047
4054
|
}
|
|
4048
4055
|
|
|
4049
|
-
const { copy: copy$5,
|
|
4056
|
+
const { copy: copy$5, toInnerPoint: toInnerPoint$1, scaleOfOuter: scaleOfOuter$3, rotateOfOuter: rotateOfOuter$3, skewOfOuter } = MatrixHelper;
|
|
4050
4057
|
const matrix = {};
|
|
4051
4058
|
const LeafHelper = {
|
|
4052
4059
|
updateAllWorldMatrix(leaf) {
|
|
@@ -4089,63 +4096,41 @@ var LeaferUI = (function (exports) {
|
|
|
4089
4096
|
return true;
|
|
4090
4097
|
},
|
|
4091
4098
|
moveWorld(t, x, y) {
|
|
4092
|
-
t.__layout.checkUpdate();
|
|
4093
4099
|
const local = { x, y };
|
|
4094
4100
|
if (t.parent)
|
|
4095
|
-
toInnerPoint$1(t.parent.
|
|
4101
|
+
toInnerPoint$1(t.parent.worldTransform, local, local, true);
|
|
4096
4102
|
L.moveLocal(t, local.x, local.y);
|
|
4097
4103
|
},
|
|
4098
4104
|
moveLocal(t, x, y = 0) {
|
|
4099
4105
|
t.x += x;
|
|
4100
4106
|
t.y += y;
|
|
4101
4107
|
},
|
|
4102
|
-
zoomOfWorld(t, origin, scaleX, scaleY
|
|
4103
|
-
|
|
4104
|
-
const local = t.parent ? PointHelper.tempToInnerOf(origin, t.parent.__world) : origin;
|
|
4105
|
-
this.zoomOfLocal(t, local, scaleX, scaleY, moveLayer);
|
|
4108
|
+
zoomOfWorld(t, origin, scaleX, scaleY) {
|
|
4109
|
+
this.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY);
|
|
4106
4110
|
},
|
|
4107
|
-
zoomOfLocal(t, origin, scaleX, scaleY = scaleX
|
|
4111
|
+
zoomOfLocal(t, origin, scaleX, scaleY = scaleX) {
|
|
4108
4112
|
copy$5(matrix, t.__local);
|
|
4109
|
-
if (moveLayer)
|
|
4110
|
-
translate$2(matrix, moveLayer.x, moveLayer.y);
|
|
4111
4113
|
scaleOfOuter$3(matrix, origin, scaleX, scaleY);
|
|
4112
|
-
|
|
4113
|
-
moveLayer = t;
|
|
4114
|
-
moveLayer.x += matrix.e - t.__local.e;
|
|
4115
|
-
moveLayer.y += matrix.f - t.__local.f;
|
|
4114
|
+
moveByMatrix(t, matrix);
|
|
4116
4115
|
t.scaleX *= scaleX;
|
|
4117
4116
|
t.scaleY *= scaleY;
|
|
4118
4117
|
},
|
|
4119
|
-
rotateOfWorld(t, origin, angle
|
|
4120
|
-
|
|
4121
|
-
const local = t.parent ? PointHelper.tempToInnerOf(origin, t.parent.__world) : origin;
|
|
4122
|
-
this.rotateOfLocal(t, local, angle, moveLayer);
|
|
4118
|
+
rotateOfWorld(t, origin, angle) {
|
|
4119
|
+
this.rotateOfLocal(t, getTempLocal(t, origin), angle);
|
|
4123
4120
|
},
|
|
4124
|
-
rotateOfLocal(t, origin, angle
|
|
4121
|
+
rotateOfLocal(t, origin, angle) {
|
|
4125
4122
|
copy$5(matrix, t.__local);
|
|
4126
|
-
if (moveLayer)
|
|
4127
|
-
translate$2(matrix, moveLayer.x, moveLayer.y);
|
|
4128
4123
|
rotateOfOuter$3(matrix, origin, angle);
|
|
4129
|
-
|
|
4130
|
-
moveLayer = t;
|
|
4131
|
-
moveLayer.x += matrix.e - t.__local.e;
|
|
4132
|
-
moveLayer.y += matrix.f - t.__local.f;
|
|
4124
|
+
moveByMatrix(t, matrix);
|
|
4133
4125
|
t.rotation = MathHelper.formatRotation(t.rotation + angle);
|
|
4134
4126
|
},
|
|
4135
|
-
skewOfWorld(t, origin, skewX, skewY
|
|
4136
|
-
|
|
4137
|
-
const local = t.parent ? PointHelper.tempToInnerOf(origin, t.parent.__world) : origin;
|
|
4138
|
-
this.skewOfLocal(t, local, skewX, skewY, moveLayer);
|
|
4127
|
+
skewOfWorld(t, origin, skewX, skewY) {
|
|
4128
|
+
this.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY);
|
|
4139
4129
|
},
|
|
4140
|
-
skewOfLocal(t, origin, skewX, skewY
|
|
4130
|
+
skewOfLocal(t, origin, skewX, skewY) {
|
|
4141
4131
|
copy$5(matrix, t.__local);
|
|
4142
|
-
if (moveLayer)
|
|
4143
|
-
translate$2(matrix, moveLayer.x, moveLayer.y);
|
|
4144
4132
|
skewOfOuter(matrix, origin, skewX, skewY);
|
|
4145
|
-
|
|
4146
|
-
moveLayer = t;
|
|
4147
|
-
moveLayer.x = matrix.e - t.__local.e;
|
|
4148
|
-
moveLayer.y = matrix.f - t.__local.f;
|
|
4133
|
+
moveByMatrix(t, matrix);
|
|
4149
4134
|
t.skewX = MathHelper.formatSkew(t.skewX + skewX);
|
|
4150
4135
|
t.skewY = MathHelper.formatSkew(t.skewY + skewY);
|
|
4151
4136
|
},
|
|
@@ -4159,6 +4144,14 @@ var LeaferUI = (function (exports) {
|
|
|
4159
4144
|
};
|
|
4160
4145
|
const L = LeafHelper;
|
|
4161
4146
|
const { updateAllWorldMatrix: updateAllWorldMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity$1, updateAllChange: updateAllChange$1 } = L;
|
|
4147
|
+
function moveByMatrix(t, matrix) {
|
|
4148
|
+
t.x += matrix.e - t.__local.e;
|
|
4149
|
+
t.y += matrix.f - t.__local.f;
|
|
4150
|
+
}
|
|
4151
|
+
function getTempLocal(t, world) {
|
|
4152
|
+
t.__layout.checkUpdate();
|
|
4153
|
+
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
|
|
4154
|
+
}
|
|
4162
4155
|
|
|
4163
4156
|
const LeafBoundsHelper = {
|
|
4164
4157
|
worldBounds(target) {
|
|
@@ -4320,7 +4313,8 @@ var LeaferUI = (function (exports) {
|
|
|
4320
4313
|
};
|
|
4321
4314
|
const I = InteractionHelper;
|
|
4322
4315
|
|
|
4323
|
-
const
|
|
4316
|
+
const emptyList = new LeafList();
|
|
4317
|
+
const { getDragEventData, getDropEventData, getSwipeEventData } = InteractionHelper;
|
|
4324
4318
|
class Dragger {
|
|
4325
4319
|
constructor(interaction) {
|
|
4326
4320
|
this.interaction = interaction;
|
|
@@ -4328,8 +4322,8 @@ var LeaferUI = (function (exports) {
|
|
|
4328
4322
|
setDragData(data) {
|
|
4329
4323
|
this.dragData = getDragEventData(data, data, data);
|
|
4330
4324
|
}
|
|
4331
|
-
|
|
4332
|
-
return this.dragging ? exports.
|
|
4325
|
+
getList() {
|
|
4326
|
+
return this.dragging ? (exports.DragEvent.list || this.interaction.selector.list || this.dragableList || emptyList) : emptyList;
|
|
4333
4327
|
}
|
|
4334
4328
|
checkDrag(data, canDrag) {
|
|
4335
4329
|
const { interaction } = this;
|
|
@@ -4358,7 +4352,7 @@ var LeaferUI = (function (exports) {
|
|
|
4358
4352
|
interaction.emit(exports.MoveEvent.MOVE, this.dragData);
|
|
4359
4353
|
}
|
|
4360
4354
|
else if (this.dragging) {
|
|
4361
|
-
this.
|
|
4355
|
+
this.realDrag();
|
|
4362
4356
|
interaction.emit(exports.DragEvent.BEFORE_DRAG, this.dragData);
|
|
4363
4357
|
interaction.emit(exports.DragEvent.DRAG, this.dragData);
|
|
4364
4358
|
}
|
|
@@ -4369,9 +4363,6 @@ var LeaferUI = (function (exports) {
|
|
|
4369
4363
|
if (this.dragging) {
|
|
4370
4364
|
this.interaction.emit(exports.DragEvent.START, this.dragData);
|
|
4371
4365
|
this.getDragableList(this.dragData.path);
|
|
4372
|
-
this.dragList = filterPathByEventType(this.dragData.path, exports.DragEvent.DRAG);
|
|
4373
|
-
if (!this.dragList.length && this.dragableList)
|
|
4374
|
-
this.dragList.pushList(this.dragableList);
|
|
4375
4366
|
}
|
|
4376
4367
|
}
|
|
4377
4368
|
}
|
|
@@ -4380,16 +4371,17 @@ var LeaferUI = (function (exports) {
|
|
|
4380
4371
|
for (let i = 0, len = path.length; i < len; i++) {
|
|
4381
4372
|
leaf = path.list[i];
|
|
4382
4373
|
if (leaf.__.draggable && leaf.__.hitSelf) {
|
|
4383
|
-
this.dragableList =
|
|
4374
|
+
this.dragableList = new LeafList(leaf);
|
|
4384
4375
|
break;
|
|
4385
4376
|
}
|
|
4386
4377
|
}
|
|
4387
4378
|
}
|
|
4388
|
-
|
|
4379
|
+
realDrag() {
|
|
4389
4380
|
const { running } = this.interaction;
|
|
4390
|
-
|
|
4381
|
+
const list = this.getList();
|
|
4382
|
+
if (list.length && running) {
|
|
4391
4383
|
const { moveX, moveY } = this.dragData;
|
|
4392
|
-
|
|
4384
|
+
list.forEach(leaf => {
|
|
4393
4385
|
LeafHelper.moveWorld(leaf, moveX, moveY);
|
|
4394
4386
|
});
|
|
4395
4387
|
}
|
|
@@ -4446,20 +4438,14 @@ var LeaferUI = (function (exports) {
|
|
|
4446
4438
|
}
|
|
4447
4439
|
}
|
|
4448
4440
|
drop(data) {
|
|
4449
|
-
const dropData = getDropEventData(data, this.
|
|
4441
|
+
const dropData = getDropEventData(data, this.getList(), exports.DragEvent.data);
|
|
4450
4442
|
dropData.path = this.dragEnterPath;
|
|
4451
4443
|
this.interaction.emit(exports.DropEvent.DROP, dropData);
|
|
4452
4444
|
this.interaction.emit(exports.DragEvent.LEAVE, data, this.dragEnterPath);
|
|
4453
4445
|
}
|
|
4454
4446
|
dragReset() {
|
|
4455
|
-
exports.
|
|
4456
|
-
this.
|
|
4457
|
-
this.dragableList = null;
|
|
4458
|
-
this.dragData = null;
|
|
4459
|
-
this.dragOverPath = null;
|
|
4460
|
-
this.dragEnterPath = null;
|
|
4461
|
-
this.dragging = null;
|
|
4462
|
-
this.moving = null;
|
|
4447
|
+
exports.DragEvent.list = exports.DragEvent.data = this.dragableList = this.dragData = this.dragOverPath = this.dragEnterPath = null;
|
|
4448
|
+
this.dragging = this.moving = false;
|
|
4463
4449
|
}
|
|
4464
4450
|
checkDragOut(data) {
|
|
4465
4451
|
const { interaction } = this;
|
|
@@ -4594,7 +4580,8 @@ var LeaferUI = (function (exports) {
|
|
|
4594
4580
|
dragDistance: 2,
|
|
4595
4581
|
swipeDistance: 20,
|
|
4596
4582
|
ignoreMove: false
|
|
4597
|
-
}
|
|
4583
|
+
},
|
|
4584
|
+
cursor: {}
|
|
4598
4585
|
};
|
|
4599
4586
|
this.tapCount = 0;
|
|
4600
4587
|
this.downKeyMap = {};
|
|
@@ -4694,6 +4681,10 @@ var LeaferUI = (function (exports) {
|
|
|
4694
4681
|
this.zoom(getZoomEventData$1(center, scale, data));
|
|
4695
4682
|
this.move(getMoveEventData$1(center, move, data));
|
|
4696
4683
|
}
|
|
4684
|
+
menu(data) {
|
|
4685
|
+
this.findPath(data);
|
|
4686
|
+
this.emit(exports.PointerEvent.MENU, data);
|
|
4687
|
+
}
|
|
4697
4688
|
move(data) {
|
|
4698
4689
|
this.transformer.move(data);
|
|
4699
4690
|
}
|
|
@@ -4803,6 +4794,9 @@ var LeaferUI = (function (exports) {
|
|
|
4803
4794
|
data.path = find.path;
|
|
4804
4795
|
return find.path;
|
|
4805
4796
|
}
|
|
4797
|
+
isDrag(leaf) {
|
|
4798
|
+
return this.dragger.getList().has(leaf);
|
|
4799
|
+
}
|
|
4806
4800
|
updateDownData(data) {
|
|
4807
4801
|
if (!data)
|
|
4808
4802
|
data = this.downData;
|
|
@@ -4816,10 +4810,12 @@ var LeaferUI = (function (exports) {
|
|
|
4816
4810
|
data = this.hoverData;
|
|
4817
4811
|
if (!data)
|
|
4818
4812
|
return;
|
|
4819
|
-
this.findPath(data, { exclude: this.dragger.
|
|
4813
|
+
this.findPath(data, { exclude: this.dragger.getList(), name: exports.PointerEvent.MOVE });
|
|
4820
4814
|
this.hoverData = data;
|
|
4821
4815
|
}
|
|
4822
4816
|
updateCursor(data) {
|
|
4817
|
+
if (this.config.cursor.stop)
|
|
4818
|
+
return;
|
|
4823
4819
|
if (!data) {
|
|
4824
4820
|
this.updateHoverData();
|
|
4825
4821
|
data = this.hoverData;
|
|
@@ -4832,17 +4828,16 @@ var LeaferUI = (function (exports) {
|
|
|
4832
4828
|
}
|
|
4833
4829
|
else if (!data || this.dragger.dragging)
|
|
4834
4830
|
return;
|
|
4835
|
-
const path = data.path;
|
|
4836
4831
|
let leaf;
|
|
4832
|
+
let cursor;
|
|
4833
|
+
const { path } = data;
|
|
4837
4834
|
for (let i = 0, len = path.length; i < len; i++) {
|
|
4838
4835
|
leaf = path.list[i];
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
return;
|
|
4843
|
-
}
|
|
4836
|
+
cursor = leaf.cursor;
|
|
4837
|
+
if (cursor)
|
|
4838
|
+
break;
|
|
4844
4839
|
}
|
|
4845
|
-
this.setCursor(
|
|
4840
|
+
this.setCursor(cursor);
|
|
4846
4841
|
}
|
|
4847
4842
|
setCursor(cursor) {
|
|
4848
4843
|
this.cursor = cursor;
|
|
@@ -4935,7 +4930,7 @@ var LeaferUI = (function (exports) {
|
|
|
4935
4930
|
this.renderBounds = this.strokeBounds = this.boxBounds = { x: 0, y: 0, width: 0, height: 0 };
|
|
4936
4931
|
this.localRenderBounds = this.localStrokeBounds = leaf.__local;
|
|
4937
4932
|
this.boxChange();
|
|
4938
|
-
this.
|
|
4933
|
+
this.matrixChange();
|
|
4939
4934
|
}
|
|
4940
4935
|
checkUpdate(force) {
|
|
4941
4936
|
const { leafer } = this.leaf;
|
|
@@ -5062,11 +5057,6 @@ var LeaferUI = (function (exports) {
|
|
|
5062
5057
|
this.renderSpread || (this.renderSpread = 1);
|
|
5063
5058
|
this.boundsChanged = true;
|
|
5064
5059
|
}
|
|
5065
|
-
positionChange() {
|
|
5066
|
-
this.positionChanged = true;
|
|
5067
|
-
this.matrixChanged = true;
|
|
5068
|
-
this.localBoxChanged || this.localBoxChange();
|
|
5069
|
-
}
|
|
5070
5060
|
scaleChange() {
|
|
5071
5061
|
this.scaleChanged = true;
|
|
5072
5062
|
this._scaleOrRotationChange();
|
|
@@ -5078,6 +5068,9 @@ var LeaferUI = (function (exports) {
|
|
|
5078
5068
|
}
|
|
5079
5069
|
_scaleOrRotationChange() {
|
|
5080
5070
|
this.affectScaleOrRotation = true;
|
|
5071
|
+
this.matrixChange();
|
|
5072
|
+
}
|
|
5073
|
+
matrixChange() {
|
|
5081
5074
|
this.matrixChanged = true;
|
|
5082
5075
|
this.localBoxChanged || this.localBoxChange();
|
|
5083
5076
|
}
|
|
@@ -5220,10 +5213,11 @@ var LeaferUI = (function (exports) {
|
|
|
5220
5213
|
const LeafDataProxy = {
|
|
5221
5214
|
__setAttr(name, newValue) {
|
|
5222
5215
|
if (this.leafer && this.leafer.created) {
|
|
5223
|
-
|
|
5216
|
+
const oldValue = this.__.__getInput(name);
|
|
5217
|
+
if (typeof newValue === 'object' || oldValue !== newValue) {
|
|
5224
5218
|
this.__[name] = newValue;
|
|
5225
5219
|
const { CHANGE } = PropertyEvent;
|
|
5226
|
-
const event = new PropertyEvent(CHANGE, this, name,
|
|
5220
|
+
const event = new PropertyEvent(CHANGE, this, name, oldValue, newValue);
|
|
5227
5221
|
if (this.hasEvent(CHANGE) && !this.isLeafer)
|
|
5228
5222
|
this.emitEvent(event);
|
|
5229
5223
|
this.leafer.emitEvent(event);
|
|
@@ -5314,17 +5308,17 @@ var LeaferUI = (function (exports) {
|
|
|
5314
5308
|
}
|
|
5315
5309
|
}
|
|
5316
5310
|
}
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5311
|
+
const { x, y, around } = this.__;
|
|
5312
|
+
r.e = x;
|
|
5313
|
+
r.f = y;
|
|
5314
|
+
if (around) {
|
|
5315
|
+
const { width, height } = this.__;
|
|
5316
|
+
if (width && height) {
|
|
5322
5317
|
const origin = (around === 'center') ? defaultCenter : around;
|
|
5323
5318
|
const offsetX = width * origin.x, offsetY = height * origin.y;
|
|
5324
5319
|
r.e -= offsetX * r.a + offsetY * r.c;
|
|
5325
5320
|
r.f -= offsetX * r.b + offsetY * r.d;
|
|
5326
5321
|
}
|
|
5327
|
-
layout.positionChanged = false;
|
|
5328
5322
|
}
|
|
5329
5323
|
this.__layout.matrixChanged = false;
|
|
5330
5324
|
}
|
|
@@ -5419,7 +5413,7 @@ var LeaferUI = (function (exports) {
|
|
|
5419
5413
|
data.__naturalWidth = layout.boxBounds.width;
|
|
5420
5414
|
data.__naturalHeight = layout.boxBounds.height;
|
|
5421
5415
|
if (this.around) {
|
|
5422
|
-
layout.
|
|
5416
|
+
layout.matrixChanged = true;
|
|
5423
5417
|
this.__updateWorldMatrix();
|
|
5424
5418
|
}
|
|
5425
5419
|
},
|
|
@@ -5460,7 +5454,7 @@ var LeaferUI = (function (exports) {
|
|
|
5460
5454
|
const tempCanvas = canvas.getSameCanvas(true);
|
|
5461
5455
|
this.__draw(tempCanvas, options);
|
|
5462
5456
|
const blendMode = this.__.isEraser ? 'destination-out' : this.__.blendMode;
|
|
5463
|
-
if (
|
|
5457
|
+
if (this.__hasMirror || options.matrix) {
|
|
5464
5458
|
canvas.copyWorldByReset(tempCanvas, null, null, blendMode);
|
|
5465
5459
|
}
|
|
5466
5460
|
else {
|
|
@@ -5529,7 +5523,12 @@ var LeaferUI = (function (exports) {
|
|
|
5529
5523
|
this.__renderBranch(tempCanvas, options);
|
|
5530
5524
|
canvas.opacity = this.__worldOpacity;
|
|
5531
5525
|
const blendMode = this.__.isEraser ? 'destination-out' : this.__.blendMode;
|
|
5532
|
-
|
|
5526
|
+
if (this.__hasMirror || options.matrix) {
|
|
5527
|
+
canvas.copyWorld(tempCanvas, null, null, blendMode);
|
|
5528
|
+
}
|
|
5529
|
+
else {
|
|
5530
|
+
canvas.copyWorld(tempCanvas, this.__world, this.__world, blendMode);
|
|
5531
|
+
}
|
|
5533
5532
|
tempCanvas.recycle();
|
|
5534
5533
|
}
|
|
5535
5534
|
else {
|
|
@@ -5602,11 +5601,16 @@ var LeaferUI = (function (exports) {
|
|
|
5602
5601
|
get __ignoreHitWorld() { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren; }
|
|
5603
5602
|
constructor(data) {
|
|
5604
5603
|
this.innerId = create(LEAF);
|
|
5604
|
+
this.reset(data);
|
|
5605
|
+
}
|
|
5606
|
+
reset(data) {
|
|
5605
5607
|
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, rotation: 0, skewX: 0, skewY: 0 };
|
|
5606
5608
|
this.__local = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, x: 0, y: 0, width: 0, height: 0 };
|
|
5607
5609
|
this.__worldOpacity = 1;
|
|
5608
5610
|
this.__ = new this.__DataProcessor(this);
|
|
5609
5611
|
this.__layout = new this.__LayoutProcessor(this);
|
|
5612
|
+
if (this.__level)
|
|
5613
|
+
this.resetCustom();
|
|
5610
5614
|
if (data) {
|
|
5611
5615
|
if (data.children) {
|
|
5612
5616
|
this.set(data);
|
|
@@ -5616,6 +5620,10 @@ var LeaferUI = (function (exports) {
|
|
|
5616
5620
|
}
|
|
5617
5621
|
}
|
|
5618
5622
|
}
|
|
5623
|
+
resetCustom() {
|
|
5624
|
+
this.__hasMask = this.__hasEraser = null;
|
|
5625
|
+
this.forceUpdate();
|
|
5626
|
+
}
|
|
5619
5627
|
waitParent(item) {
|
|
5620
5628
|
this.parent ? item() : (this.__parentWait ? this.__parentWait.push(item) : this.__parentWait = [item]);
|
|
5621
5629
|
}
|
|
@@ -5630,8 +5638,11 @@ var LeaferUI = (function (exports) {
|
|
|
5630
5638
|
if (leafer !== null)
|
|
5631
5639
|
leafer = this;
|
|
5632
5640
|
}
|
|
5641
|
+
if (this.leafer && !leafer)
|
|
5642
|
+
this.leafer.leafs--;
|
|
5633
5643
|
this.leafer = leafer;
|
|
5634
5644
|
if (leafer) {
|
|
5645
|
+
leafer.leafs++;
|
|
5635
5646
|
this.__level = this.parent ? this.parent.__level + 1 : 1;
|
|
5636
5647
|
if (this.__leaferWait)
|
|
5637
5648
|
WaitHelper.run(this.__leaferWait);
|
|
@@ -5654,7 +5665,7 @@ var LeaferUI = (function (exports) {
|
|
|
5654
5665
|
__getAttr(_attrName) { return undefined; }
|
|
5655
5666
|
forceUpdate(attrName) {
|
|
5656
5667
|
if (attrName === undefined)
|
|
5657
|
-
attrName = '
|
|
5668
|
+
attrName = 'width';
|
|
5658
5669
|
else if (attrName === 'surface')
|
|
5659
5670
|
attrName = 'blendMode';
|
|
5660
5671
|
const value = this.__.__getInput(attrName);
|
|
@@ -5861,7 +5872,7 @@ var LeaferUI = (function (exports) {
|
|
|
5861
5872
|
index === undefined ? this.children.push(child) : this.children.splice(index, 0, child);
|
|
5862
5873
|
if (child.isBranch)
|
|
5863
5874
|
this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1;
|
|
5864
|
-
child.__layout.boundsChanged || child.__layout.
|
|
5875
|
+
child.__layout.boundsChanged || child.__layout.matrixChange();
|
|
5865
5876
|
if (child.__parentWait)
|
|
5866
5877
|
WaitHelper.run(child.__parentWait);
|
|
5867
5878
|
if (this.leafer) {
|
|
@@ -6080,7 +6091,7 @@ var LeaferUI = (function (exports) {
|
|
|
6080
6091
|
let layout;
|
|
6081
6092
|
updateList.list.forEach(leaf => {
|
|
6082
6093
|
layout = leaf.__layout;
|
|
6083
|
-
if (levelList.without(leaf) && !layout.
|
|
6094
|
+
if (levelList.without(leaf) && !layout.proxyZoom) {
|
|
6084
6095
|
if (layout.matrixChanged) {
|
|
6085
6096
|
updateAllWorldMatrix$1(leaf);
|
|
6086
6097
|
levelList.push(leaf);
|
|
@@ -6399,8 +6410,7 @@ var LeaferUI = (function (exports) {
|
|
|
6399
6410
|
const { canvas, updateBlocks: list } = this;
|
|
6400
6411
|
if (!list)
|
|
6401
6412
|
return debug$4.warn('PartRender: need update attr');
|
|
6402
|
-
|
|
6403
|
-
this.mergeBlocks();
|
|
6413
|
+
this.mergeBlocks();
|
|
6404
6414
|
list.forEach(block => { if (canvas.bounds.hit(block) && !block.isEmpty())
|
|
6405
6415
|
this.clipRender(block); });
|
|
6406
6416
|
}
|
|
@@ -6419,7 +6429,7 @@ var LeaferUI = (function (exports) {
|
|
|
6419
6429
|
canvas.clearWorld(bounds, true);
|
|
6420
6430
|
canvas.clipWorld(bounds, true);
|
|
6421
6431
|
}
|
|
6422
|
-
this.__render(bounds, realBounds);
|
|
6432
|
+
this.__render(bounds, includes, realBounds);
|
|
6423
6433
|
canvas.restore();
|
|
6424
6434
|
Run.end(t);
|
|
6425
6435
|
}
|
|
@@ -6428,12 +6438,12 @@ var LeaferUI = (function (exports) {
|
|
|
6428
6438
|
const { canvas } = this;
|
|
6429
6439
|
canvas.save();
|
|
6430
6440
|
canvas.clear();
|
|
6431
|
-
this.__render(canvas.bounds);
|
|
6441
|
+
this.__render(canvas.bounds, true);
|
|
6432
6442
|
canvas.restore();
|
|
6433
6443
|
Run.end(t);
|
|
6434
6444
|
}
|
|
6435
|
-
__render(bounds, realBounds) {
|
|
6436
|
-
const options =
|
|
6445
|
+
__render(bounds, includes, realBounds) {
|
|
6446
|
+
const options = bounds.includes(this.target.__world) ? { includes } : { bounds, includes };
|
|
6437
6447
|
if (this.needFill)
|
|
6438
6448
|
this.canvas.fillWorld(bounds, this.config.fill);
|
|
6439
6449
|
if (Debug.showRepaint)
|
|
@@ -7037,6 +7047,7 @@ var LeaferUI = (function (exports) {
|
|
|
7037
7047
|
'pointerdown': this.onPointerDown,
|
|
7038
7048
|
'mousedown': this.onMouseDown,
|
|
7039
7049
|
'touchstart': this.onTouchStart,
|
|
7050
|
+
'contextmenu': this.onContextMenu,
|
|
7040
7051
|
'wheel': this.onWheel,
|
|
7041
7052
|
'gesturestart': this.onGesturestart,
|
|
7042
7053
|
'gesturechange': this.onGesturechange,
|
|
@@ -7109,6 +7120,9 @@ var LeaferUI = (function (exports) {
|
|
|
7109
7120
|
onKeyUp(e) {
|
|
7110
7121
|
this.keyUp(KeyEventHelper.convert(e));
|
|
7111
7122
|
}
|
|
7123
|
+
onContextMenu(e) {
|
|
7124
|
+
this.menu(PointerEventHelper.convert(e, this.getLocal(e)));
|
|
7125
|
+
}
|
|
7112
7126
|
onScroll() {
|
|
7113
7127
|
this.canvas.updateClientBounds();
|
|
7114
7128
|
}
|
|
@@ -7313,6 +7327,11 @@ var LeaferUI = (function (exports) {
|
|
|
7313
7327
|
});
|
|
7314
7328
|
}
|
|
7315
7329
|
};
|
|
7330
|
+
Platform.event = {
|
|
7331
|
+
stopDefault(origin) { origin.preventDefault(); },
|
|
7332
|
+
stopNow(origin) { origin.stopImmediatePropagation(); },
|
|
7333
|
+
stop(origin) { origin.stopPropagation(); }
|
|
7334
|
+
};
|
|
7316
7335
|
Platform.canvas = Creator.canvas();
|
|
7317
7336
|
Platform.conicGradientSupport = !!Platform.canvas.context.createConicGradient;
|
|
7318
7337
|
}
|
|
@@ -7349,7 +7368,7 @@ var LeaferUI = (function (exports) {
|
|
|
7349
7368
|
function design(leafer) {
|
|
7350
7369
|
if (leafer.isApp)
|
|
7351
7370
|
return;
|
|
7352
|
-
leafer.__eventIds.push(leafer.on_(exports.MoveEvent.BEFORE_MOVE, (e) => { LeafHelper.moveWorld(leafer.
|
|
7371
|
+
leafer.__eventIds.push(leafer.on_(exports.MoveEvent.BEFORE_MOVE, (e) => { LeafHelper.moveWorld(leafer.zoomLayer, e.moveX, e.moveY); }), leafer.on_(exports.ZoomEvent.BEFORE_ZOOM, (e) => {
|
|
7353
7372
|
const { scaleX } = leafer.zoomLayer.__, { min, max } = leafer.config.zoom;
|
|
7354
7373
|
let { scale } = e;
|
|
7355
7374
|
if (scale * Math.abs(scaleX) < min)
|
|
@@ -7428,8 +7447,10 @@ var LeaferUI = (function (exports) {
|
|
|
7428
7447
|
if (typeof value === 'string' || !value) {
|
|
7429
7448
|
if (this.__isFills) {
|
|
7430
7449
|
this.__removeInput('fill');
|
|
7431
|
-
Paint.recycleImage(
|
|
7450
|
+
Paint.recycleImage('fill', this);
|
|
7432
7451
|
this.__isFills = false;
|
|
7452
|
+
if (this.__pixelFill)
|
|
7453
|
+
this.__pixelFill = false;
|
|
7433
7454
|
}
|
|
7434
7455
|
this._fill = value;
|
|
7435
7456
|
}
|
|
@@ -7444,8 +7465,10 @@ var LeaferUI = (function (exports) {
|
|
|
7444
7465
|
if (typeof value === 'string' || !value) {
|
|
7445
7466
|
if (this.__isStrokes) {
|
|
7446
7467
|
this.__removeInput('stroke');
|
|
7447
|
-
Paint.recycleImage(
|
|
7468
|
+
Paint.recycleImage('stroke', this);
|
|
7448
7469
|
this.__isStrokes = false;
|
|
7470
|
+
if (this.__pixelStroke)
|
|
7471
|
+
this.__pixelStroke = false;
|
|
7449
7472
|
}
|
|
7450
7473
|
this._stroke = value;
|
|
7451
7474
|
}
|
|
@@ -7696,11 +7719,11 @@ var LeaferUI = (function (exports) {
|
|
|
7696
7719
|
const { fill, stroke, __drawAfterFill } = this.__;
|
|
7697
7720
|
this.__drawRenderPath(canvas);
|
|
7698
7721
|
if (fill)
|
|
7699
|
-
Paint.fill(this, canvas
|
|
7722
|
+
Paint.fill(fill, this, canvas);
|
|
7700
7723
|
if (__drawAfterFill)
|
|
7701
7724
|
this.__drawAfterFill(canvas, options);
|
|
7702
7725
|
if (stroke)
|
|
7703
|
-
Paint.stroke(this, canvas,
|
|
7726
|
+
Paint.stroke(stroke, this, canvas, options);
|
|
7704
7727
|
},
|
|
7705
7728
|
__draw(canvas, options) {
|
|
7706
7729
|
if (this.__.__complex) {
|
|
@@ -7712,40 +7735,40 @@ var LeaferUI = (function (exports) {
|
|
|
7712
7735
|
if (shadow)
|
|
7713
7736
|
Effect.shadow(this, canvas, shape, options);
|
|
7714
7737
|
if (fill)
|
|
7715
|
-
this.__.__isFills ? Paint.fills(this, canvas
|
|
7738
|
+
this.__.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7716
7739
|
if (__drawAfterFill)
|
|
7717
7740
|
this.__drawAfterFill(canvas, options);
|
|
7718
7741
|
if (innerShadow)
|
|
7719
7742
|
Effect.innerShadow(this, canvas, shape, options);
|
|
7720
7743
|
if (stroke)
|
|
7721
|
-
this.__.__isStrokes ? Paint.strokes(this, canvas,
|
|
7744
|
+
this.__.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
|
|
7722
7745
|
if (shape.worldCanvas)
|
|
7723
7746
|
shape.worldCanvas.recycle();
|
|
7724
7747
|
shape.canvas.recycle();
|
|
7725
7748
|
}
|
|
7726
7749
|
else {
|
|
7727
7750
|
if (fill)
|
|
7728
|
-
this.__.__isFills ? Paint.fills(this, canvas
|
|
7751
|
+
this.__.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7729
7752
|
if (__drawAfterFill)
|
|
7730
7753
|
this.__drawAfterFill(canvas, options);
|
|
7731
7754
|
if (stroke)
|
|
7732
|
-
this.__.__isStrokes ? Paint.strokes(this, canvas,
|
|
7755
|
+
this.__.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
|
|
7733
7756
|
}
|
|
7734
7757
|
}
|
|
7735
7758
|
else {
|
|
7736
7759
|
this.__drawFast(canvas, options);
|
|
7737
7760
|
}
|
|
7738
7761
|
},
|
|
7739
|
-
__renderShape(canvas,
|
|
7762
|
+
__renderShape(canvas, renderOptions) {
|
|
7740
7763
|
if (!this.__worldOpacity)
|
|
7741
7764
|
return;
|
|
7742
|
-
canvas.setWorld(this.__world,
|
|
7765
|
+
canvas.setWorld(this.__world, renderOptions.matrix);
|
|
7743
7766
|
const { fill, stroke } = this.__;
|
|
7744
7767
|
this.__drawRenderPath(canvas);
|
|
7745
7768
|
if (fill)
|
|
7746
|
-
Paint.fill
|
|
7769
|
+
this.__.__pixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
|
|
7747
7770
|
if (stroke)
|
|
7748
|
-
Paint.stroke
|
|
7771
|
+
this.__.__pixelStroke ? Paint.strokes(stroke, this, canvas, renderOptions) : Paint.stroke('#000000', this, canvas, renderOptions);
|
|
7749
7772
|
}
|
|
7750
7773
|
};
|
|
7751
7774
|
|
|
@@ -7792,9 +7815,7 @@ var LeaferUI = (function (exports) {
|
|
|
7792
7815
|
const { scaleX, scaleY } = this;
|
|
7793
7816
|
return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX;
|
|
7794
7817
|
}
|
|
7795
|
-
|
|
7796
|
-
super(data);
|
|
7797
|
-
}
|
|
7818
|
+
reset(_data) { }
|
|
7798
7819
|
set(data) {
|
|
7799
7820
|
Object.assign(this, data);
|
|
7800
7821
|
}
|
|
@@ -7814,9 +7835,9 @@ var LeaferUI = (function (exports) {
|
|
|
7814
7835
|
if (this.__.__input) {
|
|
7815
7836
|
const { fill, stroke } = this.__.__input;
|
|
7816
7837
|
if (fill)
|
|
7817
|
-
Paint.compute(
|
|
7838
|
+
Paint.compute('fill', this);
|
|
7818
7839
|
if (stroke)
|
|
7819
|
-
Paint.compute(
|
|
7840
|
+
Paint.compute('stroke', this);
|
|
7820
7841
|
}
|
|
7821
7842
|
}
|
|
7822
7843
|
__updateRenderPath() {
|
|
@@ -7933,7 +7954,7 @@ var LeaferUI = (function (exports) {
|
|
|
7933
7954
|
hitType()
|
|
7934
7955
|
], exports.UI.prototype, "hitRadius", void 0);
|
|
7935
7956
|
__decorate([
|
|
7936
|
-
cursorType('
|
|
7957
|
+
cursorType('')
|
|
7937
7958
|
], exports.UI.prototype, "cursor", void 0);
|
|
7938
7959
|
__decorate([
|
|
7939
7960
|
surfaceType()
|
|
@@ -7983,6 +8004,9 @@ var LeaferUI = (function (exports) {
|
|
|
7983
8004
|
__decorate([
|
|
7984
8005
|
effectType()
|
|
7985
8006
|
], exports.UI.prototype, "grayscale", void 0);
|
|
8007
|
+
__decorate([
|
|
8008
|
+
rewrite(exports.Leaf.prototype.reset)
|
|
8009
|
+
], exports.UI.prototype, "reset", null);
|
|
7986
8010
|
__decorate([
|
|
7987
8011
|
rewrite(PathDrawer.drawPathByData)
|
|
7988
8012
|
], exports.UI.prototype, "__drawPathByData", null);
|
|
@@ -8020,8 +8044,12 @@ var LeaferUI = (function (exports) {
|
|
|
8020
8044
|
if (data.children) {
|
|
8021
8045
|
const { children } = data;
|
|
8022
8046
|
delete data.children;
|
|
8023
|
-
if (!this.children)
|
|
8047
|
+
if (!this.children) {
|
|
8024
8048
|
this.__setBranch();
|
|
8049
|
+
}
|
|
8050
|
+
else {
|
|
8051
|
+
this.removeAll(true);
|
|
8052
|
+
}
|
|
8025
8053
|
super.set(data);
|
|
8026
8054
|
let child;
|
|
8027
8055
|
children.forEach(childData => {
|
|
@@ -8222,8 +8250,10 @@ var LeaferUI = (function (exports) {
|
|
|
8222
8250
|
ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
|
|
8223
8251
|
moveTo$3(path, width, ry);
|
|
8224
8252
|
}
|
|
8225
|
-
ellipse(path, rx, ry, rx, ry, 0,
|
|
8253
|
+
ellipse(path, rx, ry, rx, ry, 0, 360, 0, true);
|
|
8226
8254
|
}
|
|
8255
|
+
if (Platform.name === 'node')
|
|
8256
|
+
this.__.path = PathConvert.toCanvasData(path, true);
|
|
8227
8257
|
}
|
|
8228
8258
|
else {
|
|
8229
8259
|
if (startAngle || endAngle) {
|
|
@@ -8744,10 +8774,10 @@ var LeaferUI = (function (exports) {
|
|
|
8744
8774
|
get __tag() { return 'Leafer'; }
|
|
8745
8775
|
get isApp() { return false; }
|
|
8746
8776
|
get app() { return this.parent || this; }
|
|
8777
|
+
get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
|
|
8747
8778
|
constructor(userConfig, data) {
|
|
8748
8779
|
super(data);
|
|
8749
8780
|
this.zoomLayer = this;
|
|
8750
|
-
this.moveLayer = this;
|
|
8751
8781
|
this.config = {
|
|
8752
8782
|
type: 'design',
|
|
8753
8783
|
start: true,
|
|
@@ -8763,6 +8793,7 @@ var LeaferUI = (function (exports) {
|
|
|
8763
8793
|
autoDistance: 2
|
|
8764
8794
|
}
|
|
8765
8795
|
};
|
|
8796
|
+
this.leafs = 0;
|
|
8766
8797
|
this.__eventIds = [];
|
|
8767
8798
|
this.__controllers = [];
|
|
8768
8799
|
this.__readyWait = [];
|
|
@@ -8876,9 +8907,8 @@ var LeaferUI = (function (exports) {
|
|
|
8876
8907
|
this.isLeafer = !!leafer;
|
|
8877
8908
|
this.__level = 1;
|
|
8878
8909
|
}
|
|
8879
|
-
setZoomLayer(zoomLayer
|
|
8910
|
+
setZoomLayer(zoomLayer) {
|
|
8880
8911
|
this.zoomLayer = zoomLayer;
|
|
8881
|
-
this.moveLayer = moveLayer || zoomLayer;
|
|
8882
8912
|
}
|
|
8883
8913
|
__checkAutoLayout(config) {
|
|
8884
8914
|
if (!config.width || !config.height) {
|
|
@@ -9386,17 +9416,20 @@ var LeaferUI = (function (exports) {
|
|
|
9386
9416
|
createPattern(ui, paint, canvas.pixelRatio);
|
|
9387
9417
|
}
|
|
9388
9418
|
else {
|
|
9389
|
-
|
|
9390
|
-
|
|
9391
|
-
|
|
9392
|
-
|
|
9419
|
+
if (!paint.patternTask) {
|
|
9420
|
+
paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
|
|
9421
|
+
paint.patternTask = null;
|
|
9422
|
+
if (canvas.bounds.hit(ui.__world) && createPattern(ui, paint, canvas.pixelRatio))
|
|
9423
|
+
ui.forceUpdate('surface');
|
|
9424
|
+
}), 300);
|
|
9425
|
+
}
|
|
9393
9426
|
}
|
|
9394
9427
|
return false;
|
|
9395
9428
|
}
|
|
9396
9429
|
}
|
|
9397
9430
|
}
|
|
9398
9431
|
|
|
9399
|
-
function recycleImage(
|
|
9432
|
+
function recycleImage(attrName, data) {
|
|
9400
9433
|
const paints = (attrName === 'fill' ? data._fill : data._stroke);
|
|
9401
9434
|
if (paints instanceof Array) {
|
|
9402
9435
|
let image, recycleMap, input, url;
|
|
@@ -9441,11 +9474,11 @@ var LeaferUI = (function (exports) {
|
|
|
9441
9474
|
}
|
|
9442
9475
|
}
|
|
9443
9476
|
|
|
9444
|
-
function fill(ui, canvas
|
|
9477
|
+
function fill(fill, ui, canvas) {
|
|
9445
9478
|
canvas.fillStyle = fill;
|
|
9446
9479
|
ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
|
|
9447
9480
|
}
|
|
9448
|
-
function fills(ui, canvas
|
|
9481
|
+
function fills(fills, ui, canvas) {
|
|
9449
9482
|
let item;
|
|
9450
9483
|
const { windingRule, __font } = ui.__;
|
|
9451
9484
|
for (let i = 0, len = fills.length; i < len; i++) {
|
|
@@ -9476,32 +9509,37 @@ var LeaferUI = (function (exports) {
|
|
|
9476
9509
|
}
|
|
9477
9510
|
}
|
|
9478
9511
|
|
|
9479
|
-
function strokeText(ui, canvas,
|
|
9512
|
+
function strokeText(stroke, ui, canvas, renderOptions) {
|
|
9480
9513
|
const { strokeAlign } = ui.__;
|
|
9481
9514
|
const isStrokes = typeof stroke !== 'string';
|
|
9482
9515
|
switch (strokeAlign) {
|
|
9483
9516
|
case 'center':
|
|
9484
9517
|
canvas.setStroke(isStrokes ? undefined : stroke, ui.__.strokeWidth, ui.__);
|
|
9485
|
-
isStrokes ? drawStrokesStyle(
|
|
9518
|
+
isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
9486
9519
|
break;
|
|
9487
9520
|
case 'inside':
|
|
9488
|
-
drawAlignStroke(
|
|
9521
|
+
drawAlignStroke('inside', stroke, isStrokes, ui, canvas, renderOptions);
|
|
9489
9522
|
break;
|
|
9490
9523
|
case 'outside':
|
|
9491
|
-
drawAlignStroke(
|
|
9524
|
+
drawAlignStroke('outside', stroke, isStrokes, ui, canvas, renderOptions);
|
|
9492
9525
|
break;
|
|
9493
9526
|
}
|
|
9494
9527
|
}
|
|
9495
|
-
function drawAlignStroke(
|
|
9528
|
+
function drawAlignStroke(align, stroke, isStrokes, ui, canvas, renderOptions) {
|
|
9496
9529
|
const { strokeWidth, __font } = ui.__;
|
|
9497
9530
|
const out = canvas.getSameCanvas(true);
|
|
9498
9531
|
out.setStroke(isStrokes ? undefined : stroke, strokeWidth * 2, ui.__);
|
|
9499
9532
|
out.font = __font;
|
|
9500
|
-
isStrokes ? drawStrokesStyle(
|
|
9533
|
+
isStrokes ? drawStrokesStyle(stroke, true, ui, out) : drawTextStroke(ui, out);
|
|
9501
9534
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
9502
9535
|
fillText(ui, out);
|
|
9503
9536
|
out.blendMode = 'normal';
|
|
9504
|
-
|
|
9537
|
+
if (ui.__hasMirror || renderOptions.matrix) {
|
|
9538
|
+
canvas.copyWorldByReset(out);
|
|
9539
|
+
}
|
|
9540
|
+
else {
|
|
9541
|
+
canvas.copyWorldToInner(out, ui.__world, ui.__layout.renderBounds);
|
|
9542
|
+
}
|
|
9505
9543
|
out.recycle();
|
|
9506
9544
|
}
|
|
9507
9545
|
function drawTextStroke(ui, canvas) {
|
|
@@ -9521,7 +9559,7 @@ var LeaferUI = (function (exports) {
|
|
|
9521
9559
|
canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
9522
9560
|
}
|
|
9523
9561
|
}
|
|
9524
|
-
function drawStrokesStyle(
|
|
9562
|
+
function drawStrokesStyle(strokes, isText, ui, canvas) {
|
|
9525
9563
|
let item;
|
|
9526
9564
|
for (let i = 0, len = strokes.length; i < len; i++) {
|
|
9527
9565
|
item = strokes[i];
|
|
@@ -9541,13 +9579,13 @@ var LeaferUI = (function (exports) {
|
|
|
9541
9579
|
}
|
|
9542
9580
|
}
|
|
9543
9581
|
|
|
9544
|
-
function stroke(ui, canvas,
|
|
9582
|
+
function stroke(stroke, ui, canvas, renderOptions) {
|
|
9545
9583
|
const options = ui.__;
|
|
9546
9584
|
const { strokeWidth, strokeAlign, __font } = options;
|
|
9547
9585
|
if (!strokeWidth)
|
|
9548
9586
|
return;
|
|
9549
9587
|
if (__font) {
|
|
9550
|
-
strokeText(ui, canvas,
|
|
9588
|
+
strokeText(stroke, ui, canvas, renderOptions);
|
|
9551
9589
|
}
|
|
9552
9590
|
else {
|
|
9553
9591
|
switch (strokeAlign) {
|
|
@@ -9569,31 +9607,36 @@ var LeaferUI = (function (exports) {
|
|
|
9569
9607
|
out.stroke();
|
|
9570
9608
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
9571
9609
|
out.clearWorld(ui.__layout.renderBounds);
|
|
9572
|
-
|
|
9610
|
+
if (ui.__hasMirror || renderOptions.matrix) {
|
|
9611
|
+
canvas.copyWorldByReset(out);
|
|
9612
|
+
}
|
|
9613
|
+
else {
|
|
9614
|
+
canvas.copyWorldToInner(out, ui.__world, ui.__layout.renderBounds);
|
|
9615
|
+
}
|
|
9573
9616
|
out.recycle();
|
|
9574
9617
|
break;
|
|
9575
9618
|
}
|
|
9576
9619
|
}
|
|
9577
9620
|
}
|
|
9578
|
-
function strokes(ui, canvas,
|
|
9621
|
+
function strokes(strokes, ui, canvas, renderOptions) {
|
|
9579
9622
|
const options = ui.__;
|
|
9580
9623
|
const { strokeWidth, strokeAlign, __font } = options;
|
|
9581
9624
|
if (!strokeWidth)
|
|
9582
9625
|
return;
|
|
9583
9626
|
if (__font) {
|
|
9584
|
-
strokeText(ui, canvas,
|
|
9627
|
+
strokeText(strokes, ui, canvas, renderOptions);
|
|
9585
9628
|
}
|
|
9586
9629
|
else {
|
|
9587
9630
|
switch (strokeAlign) {
|
|
9588
9631
|
case 'center':
|
|
9589
9632
|
canvas.setStroke(undefined, strokeWidth, options);
|
|
9590
|
-
drawStrokesStyle(
|
|
9633
|
+
drawStrokesStyle(strokes, false, ui, canvas);
|
|
9591
9634
|
break;
|
|
9592
9635
|
case 'inside':
|
|
9593
9636
|
canvas.save();
|
|
9594
9637
|
canvas.setStroke(undefined, strokeWidth * 2, options);
|
|
9595
9638
|
options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
|
|
9596
|
-
drawStrokesStyle(
|
|
9639
|
+
drawStrokesStyle(strokes, false, ui, canvas);
|
|
9597
9640
|
canvas.restore();
|
|
9598
9641
|
break;
|
|
9599
9642
|
case 'outside':
|
|
@@ -9601,10 +9644,15 @@ var LeaferUI = (function (exports) {
|
|
|
9601
9644
|
const out = canvas.getSameCanvas(true);
|
|
9602
9645
|
ui.__drawRenderPath(out);
|
|
9603
9646
|
out.setStroke(undefined, strokeWidth * 2, ui.__);
|
|
9604
|
-
drawStrokesStyle(
|
|
9647
|
+
drawStrokesStyle(strokes, false, ui, out);
|
|
9605
9648
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
9606
9649
|
out.clearWorld(renderBounds);
|
|
9607
|
-
|
|
9650
|
+
if (ui.__hasMirror || renderOptions.matrix) {
|
|
9651
|
+
canvas.copyWorldByReset(out);
|
|
9652
|
+
}
|
|
9653
|
+
else {
|
|
9654
|
+
canvas.copyWorldToInner(out, ui.__world, renderBounds);
|
|
9655
|
+
}
|
|
9608
9656
|
out.recycle();
|
|
9609
9657
|
break;
|
|
9610
9658
|
}
|
|
@@ -9736,21 +9784,34 @@ var LeaferUI = (function (exports) {
|
|
|
9736
9784
|
}
|
|
9737
9785
|
|
|
9738
9786
|
let recycleMap;
|
|
9739
|
-
function compute(
|
|
9787
|
+
function compute(attrName, ui) {
|
|
9740
9788
|
const value = [];
|
|
9789
|
+
const data = ui.__;
|
|
9741
9790
|
let item;
|
|
9742
|
-
let paints =
|
|
9791
|
+
let paints = data.__input[attrName];
|
|
9743
9792
|
if (!(paints instanceof Array))
|
|
9744
9793
|
paints = [paints];
|
|
9745
|
-
recycleMap = recycleImage(
|
|
9794
|
+
recycleMap = recycleImage(attrName, data);
|
|
9746
9795
|
for (let i = 0, len = paints.length; i < len; i++) {
|
|
9747
|
-
item = getLeafPaint(
|
|
9796
|
+
item = getLeafPaint(attrName, paints[i], ui);
|
|
9748
9797
|
if (item)
|
|
9749
9798
|
value.push(item);
|
|
9750
9799
|
}
|
|
9751
|
-
|
|
9800
|
+
data['_' + attrName] = value.length ? value : undefined;
|
|
9801
|
+
let isPixel;
|
|
9802
|
+
if (paints.length === 1) {
|
|
9803
|
+
const paint = paints[0];
|
|
9804
|
+
if (paint.type === 'image')
|
|
9805
|
+
isPixel = ImageManager.isPixel(paint);
|
|
9806
|
+
}
|
|
9807
|
+
if (attrName === 'fill') {
|
|
9808
|
+
data.__pixelFill = isPixel;
|
|
9809
|
+
}
|
|
9810
|
+
else {
|
|
9811
|
+
data.__pixelStroke = isPixel;
|
|
9812
|
+
}
|
|
9752
9813
|
}
|
|
9753
|
-
function getLeafPaint(
|
|
9814
|
+
function getLeafPaint(attrName, paint, ui) {
|
|
9754
9815
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
|
9755
9816
|
return undefined;
|
|
9756
9817
|
const { boxBounds } = ui.__layout;
|
|
@@ -9788,7 +9849,7 @@ var LeaferUI = (function (exports) {
|
|
|
9788
9849
|
const { copy, toOffsetOutBounds: toOffsetOutBounds$1 } = BoundsHelper;
|
|
9789
9850
|
const tempBounds = {};
|
|
9790
9851
|
const offsetOutBounds$1 = {};
|
|
9791
|
-
function shadow(ui, current, shape,
|
|
9852
|
+
function shadow(ui, current, shape, renderOptions) {
|
|
9792
9853
|
let copyBounds, spreadScale;
|
|
9793
9854
|
const { __world, __layout } = ui;
|
|
9794
9855
|
const { shadow } = ui.__;
|
|
@@ -9810,7 +9871,7 @@ var LeaferUI = (function (exports) {
|
|
|
9810
9871
|
}
|
|
9811
9872
|
worldCanvas ? other.copyWorld(worldCanvas, __world, __world, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
|
|
9812
9873
|
}
|
|
9813
|
-
if (ui.__hasMirror) {
|
|
9874
|
+
if (ui.__hasMirror || renderOptions.matrix) {
|
|
9814
9875
|
current.copyWorldByReset(other, copyBounds, __world, item.blendMode);
|
|
9815
9876
|
}
|
|
9816
9877
|
else {
|
|
@@ -9850,7 +9911,7 @@ var LeaferUI = (function (exports) {
|
|
|
9850
9911
|
|
|
9851
9912
|
const { toOffsetOutBounds } = BoundsHelper;
|
|
9852
9913
|
const offsetOutBounds = {};
|
|
9853
|
-
function innerShadow(ui, current, shape,
|
|
9914
|
+
function innerShadow(ui, current, shape, renderOptions) {
|
|
9854
9915
|
let copyBounds, spreadScale;
|
|
9855
9916
|
const { __world, __layout: __layout } = ui;
|
|
9856
9917
|
const { innerShadow } = ui.__;
|
|
@@ -9874,7 +9935,7 @@ var LeaferUI = (function (exports) {
|
|
|
9874
9935
|
copyBounds = bounds;
|
|
9875
9936
|
}
|
|
9876
9937
|
other.fillWorld(copyBounds, item.color, 'source-in');
|
|
9877
|
-
if (ui.__hasMirror) {
|
|
9938
|
+
if (ui.__hasMirror || renderOptions.matrix) {
|
|
9878
9939
|
current.copyWorldByReset(other, copyBounds, __world, item.blendMode);
|
|
9879
9940
|
}
|
|
9880
9941
|
else {
|
|
@@ -10489,7 +10550,6 @@ var LeaferUI = (function (exports) {
|
|
|
10489
10550
|
exports.TaskItem = TaskItem;
|
|
10490
10551
|
exports.TaskProcessor = TaskProcessor;
|
|
10491
10552
|
exports.TextConvert = TextConvert$1;
|
|
10492
|
-
exports.TransformEvent = TransformEvent;
|
|
10493
10553
|
exports.TwoPointBounds = TwoPointBounds;
|
|
10494
10554
|
exports.TwoPointBoundsHelper = TwoPointBoundsHelper;
|
|
10495
10555
|
exports.UIBounds = UIBounds;
|