@leafer-draw/worker 2.1.4 → 2.1.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/dist/worker.cjs +1 -1
- package/dist/worker.esm.js +1 -1
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +12 -185
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +12 -186
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +7 -7
package/dist/worker.module.js
CHANGED
|
@@ -260,7 +260,7 @@ const IncrementId = {
|
|
|
260
260
|
RUNTIME: "runtime",
|
|
261
261
|
LEAF: "leaf",
|
|
262
262
|
TASK: "task",
|
|
263
|
-
|
|
263
|
+
CANVAS: "canvas",
|
|
264
264
|
IMAGE: "image",
|
|
265
265
|
types: {},
|
|
266
266
|
create(typeName) {
|
|
@@ -914,7 +914,7 @@ const PointHelper = {
|
|
|
914
914
|
return quick ? t.x === point.x && t.y === point.y : float$1(t.x) === float$1(point.x) && float$1(t.y) === float$1(point.y);
|
|
915
915
|
},
|
|
916
916
|
reset(t) {
|
|
917
|
-
|
|
917
|
+
t.x = t.y = 0;
|
|
918
918
|
}
|
|
919
919
|
};
|
|
920
920
|
|
|
@@ -1123,6 +1123,7 @@ class Matrix {
|
|
|
1123
1123
|
}
|
|
1124
1124
|
reset() {
|
|
1125
1125
|
MatrixHelper.reset(this);
|
|
1126
|
+
return this;
|
|
1126
1127
|
}
|
|
1127
1128
|
}
|
|
1128
1129
|
|
|
@@ -2346,7 +2347,7 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2346
2347
|
this.worldTransform = {};
|
|
2347
2348
|
if (!config) config = minSize;
|
|
2348
2349
|
this.manager = manager;
|
|
2349
|
-
this.innerId = IncrementId.create(IncrementId.
|
|
2350
|
+
this.innerId = IncrementId.create(IncrementId.CANVAS);
|
|
2350
2351
|
const {width: width, height: height, pixelRatio: pixelRatio} = config;
|
|
2351
2352
|
this.autoLayout = !width || !height;
|
|
2352
2353
|
this.size.pixelRatio = pixelRatio || Platform.devicePixelRatio;
|
|
@@ -2496,6 +2497,7 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2496
2497
|
}
|
|
2497
2498
|
useGrayscaleAlpha(bounds) {
|
|
2498
2499
|
this.setTempPixelBounds(bounds, true, true);
|
|
2500
|
+
if (!tempPixelBounds.width || !tempPixelBounds.height) return;
|
|
2499
2501
|
let alpha, pixel;
|
|
2500
2502
|
const {context: context} = this, imageData = context.getImageData(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height), {data: data} = imageData;
|
|
2501
2503
|
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
@@ -5519,6 +5521,7 @@ class LeafLayout {
|
|
|
5519
5521
|
this.renderChanged = true;
|
|
5520
5522
|
this.renderSpread || (this.renderSpread = 1);
|
|
5521
5523
|
this.boundsChanged = true;
|
|
5524
|
+
this.hitCanvasChanged = true;
|
|
5522
5525
|
}
|
|
5523
5526
|
scaleChange() {
|
|
5524
5527
|
this.scaleChanged = true;
|
|
@@ -6459,10 +6462,6 @@ let Leaf = class Leaf {
|
|
|
6459
6462
|
}
|
|
6460
6463
|
}
|
|
6461
6464
|
}
|
|
6462
|
-
set(_data, _isTemp) {}
|
|
6463
|
-
get(_name) {
|
|
6464
|
-
return undefined;
|
|
6465
|
-
}
|
|
6466
6465
|
setAttr(name, value) {
|
|
6467
6466
|
this[name] = value;
|
|
6468
6467
|
}
|
|
@@ -6479,37 +6478,10 @@ let Leaf = class Leaf {
|
|
|
6479
6478
|
toString(options) {
|
|
6480
6479
|
return JSON.stringify(this.toJSON(options));
|
|
6481
6480
|
}
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
__SVG(_data) {}
|
|
6486
|
-
toHTML() {
|
|
6487
|
-
return undefined;
|
|
6488
|
-
}
|
|
6489
|
-
__setAttr(_attrName, _newValue) {
|
|
6490
|
-
return true;
|
|
6491
|
-
}
|
|
6492
|
-
__getAttr(_attrName) {
|
|
6493
|
-
return undefined;
|
|
6494
|
-
}
|
|
6495
|
-
setProxyAttr(_attrName, _newValue) {}
|
|
6496
|
-
getProxyAttr(_attrName) {
|
|
6497
|
-
return undefined;
|
|
6498
|
-
}
|
|
6499
|
-
find(_condition, _options) {
|
|
6500
|
-
return undefined;
|
|
6501
|
-
}
|
|
6502
|
-
findTag(_tag) {
|
|
6503
|
-
return undefined;
|
|
6504
|
-
}
|
|
6505
|
-
findOne(_condition, _options) {
|
|
6506
|
-
return undefined;
|
|
6507
|
-
}
|
|
6508
|
-
findId(_id) {
|
|
6509
|
-
return undefined;
|
|
6481
|
+
scaleResize(scaleX, scaleY = scaleX, _noResize, _boundsType) {
|
|
6482
|
+
this.scaleX *= scaleX;
|
|
6483
|
+
this.scaleY *= scaleY;
|
|
6510
6484
|
}
|
|
6511
|
-
focus(_value) {}
|
|
6512
|
-
updateState() {}
|
|
6513
6485
|
updateLayout() {
|
|
6514
6486
|
this.__layout.update();
|
|
6515
6487
|
}
|
|
@@ -6525,27 +6497,6 @@ let Leaf = class Leaf {
|
|
|
6525
6497
|
__extraUpdate() {
|
|
6526
6498
|
if (this.leaferIsReady) this.leafer.layouter.addExtra(this);
|
|
6527
6499
|
}
|
|
6528
|
-
__updateWorldMatrix() {}
|
|
6529
|
-
__updateLocalMatrix() {}
|
|
6530
|
-
__updateWorldBounds() {}
|
|
6531
|
-
__updateLocalBounds() {}
|
|
6532
|
-
__updateLocalBoxBounds() {}
|
|
6533
|
-
__updateLocalStrokeBounds() {}
|
|
6534
|
-
__updateLocalRenderBounds() {}
|
|
6535
|
-
__updateBoxBounds(_secondLayout, _bounds) {}
|
|
6536
|
-
__updateContentBounds() {}
|
|
6537
|
-
__updateStrokeBounds(_bounds) {}
|
|
6538
|
-
__updateRenderBounds(_bounds) {}
|
|
6539
|
-
__updateAutoLayout() {}
|
|
6540
|
-
__updateFlowLayout() {}
|
|
6541
|
-
__updateNaturalSize() {}
|
|
6542
|
-
__updateStrokeSpread() {
|
|
6543
|
-
return 0;
|
|
6544
|
-
}
|
|
6545
|
-
__updateRenderSpread() {
|
|
6546
|
-
return 0;
|
|
6547
|
-
}
|
|
6548
|
-
__onUpdateSize() {}
|
|
6549
6500
|
__updateEraser(value) {
|
|
6550
6501
|
this.__hasEraser = value ? true : this.children.some(item => item.__.eraser);
|
|
6551
6502
|
}
|
|
@@ -6559,7 +6510,6 @@ let Leaf = class Leaf {
|
|
|
6559
6510
|
__updateMask(_value) {
|
|
6560
6511
|
this.__hasMask = this.children.some(item => item.__.mask && item.__.visible && item.__.opacity);
|
|
6561
6512
|
}
|
|
6562
|
-
__renderMask(_canvas, _options) {}
|
|
6563
6513
|
__getNowWorld(options) {
|
|
6564
6514
|
if (options.matrix) {
|
|
6565
6515
|
if (!this.__cameraWorld) this.__cameraWorld = {};
|
|
@@ -6715,76 +6665,12 @@ let Leaf = class Leaf {
|
|
|
6715
6665
|
flip(axis, transition) {
|
|
6716
6666
|
transform(this, getFlipTransform(this, axis), false, transition);
|
|
6717
6667
|
}
|
|
6718
|
-
scaleResize(scaleX, scaleY = scaleX, _noResize, _boundsType) {
|
|
6719
|
-
this.scaleX *= scaleX;
|
|
6720
|
-
this.scaleY *= scaleY;
|
|
6721
|
-
}
|
|
6722
|
-
__scaleResize(_scaleX, _scaleY) {}
|
|
6723
|
-
resizeWidth(_width) {}
|
|
6724
|
-
resizeHeight(_height) {}
|
|
6725
|
-
hit(_world, _hitRadius) {
|
|
6726
|
-
return true;
|
|
6727
|
-
}
|
|
6728
|
-
__hitWorld(_point, _forceHitFill) {
|
|
6729
|
-
return true;
|
|
6730
|
-
}
|
|
6731
|
-
__hit(_local, _forceHitFill) {
|
|
6732
|
-
return true;
|
|
6733
|
-
}
|
|
6734
|
-
__hitFill(_inner) {
|
|
6735
|
-
return true;
|
|
6736
|
-
}
|
|
6737
|
-
__hitStroke(_inner, _strokeWidth) {
|
|
6738
|
-
return true;
|
|
6739
|
-
}
|
|
6740
|
-
__hitPixel(_inner) {
|
|
6741
|
-
return true;
|
|
6742
|
-
}
|
|
6743
|
-
__drawHitPath(_canvas) {}
|
|
6744
|
-
__updateHitCanvas() {}
|
|
6745
|
-
__render(_canvas, _options) {}
|
|
6746
|
-
__drawFast(_canvas, _options) {}
|
|
6747
|
-
__draw(_canvas, _options, _originCanvas) {}
|
|
6748
|
-
__clip(_canvas, _options) {}
|
|
6749
|
-
__renderShape(_canvas, _options) {}
|
|
6750
|
-
__drawShape(_canvas, _options) {}
|
|
6751
|
-
__updateWorldOpacity() {}
|
|
6752
|
-
__updateChange() {}
|
|
6753
|
-
__drawPath(_canvas) {}
|
|
6754
|
-
__drawRenderPath(_canvas) {}
|
|
6755
|
-
__updatePath() {}
|
|
6756
|
-
__updateRenderPath(_updateCache) {}
|
|
6757
|
-
getMotionPathData() {
|
|
6758
|
-
return Plugin.need("path");
|
|
6759
|
-
}
|
|
6760
|
-
getMotionPoint(_motionDistance) {
|
|
6761
|
-
return Plugin.need("path");
|
|
6762
|
-
}
|
|
6763
|
-
getMotionTotal() {
|
|
6764
|
-
return 0;
|
|
6765
|
-
}
|
|
6766
|
-
__updateMotionPath() {}
|
|
6767
|
-
__runAnimation(_type, _complete) {}
|
|
6768
|
-
__updateSortChildren() {}
|
|
6769
|
-
add(_child, _index) {}
|
|
6770
6668
|
remove(_child, destroy) {
|
|
6771
6669
|
if (this.parent) this.parent.remove(this, destroy);
|
|
6772
6670
|
}
|
|
6773
6671
|
dropTo(parent, index, resize) {
|
|
6774
6672
|
drop(this, parent, index, resize);
|
|
6775
6673
|
}
|
|
6776
|
-
on(_type, _listener, _options) {}
|
|
6777
|
-
off(_type, _listener, _options) {}
|
|
6778
|
-
on_(_type, _listener, _bind, _options) {
|
|
6779
|
-
return undefined;
|
|
6780
|
-
}
|
|
6781
|
-
off_(_id) {}
|
|
6782
|
-
once(_type, _listener, _captureOrBind, _capture) {}
|
|
6783
|
-
emit(_type, _event, _capture) {}
|
|
6784
|
-
emitEvent(_event, _capture) {}
|
|
6785
|
-
hasEvent(_type, _capture) {
|
|
6786
|
-
return false;
|
|
6787
|
-
}
|
|
6788
6674
|
static changeAttr(attrName, defaultValue, fn) {
|
|
6789
6675
|
fn ? this.addAttr(attrName, defaultValue, fn) : defineDataProcessor(this.prototype, attrName, defaultValue);
|
|
6790
6676
|
}
|
|
@@ -7090,7 +6976,7 @@ class LeafLevelList {
|
|
|
7090
6976
|
}
|
|
7091
6977
|
}
|
|
7092
6978
|
|
|
7093
|
-
const version = "2.1.
|
|
6979
|
+
const version = "2.1.5";
|
|
7094
6980
|
|
|
7095
6981
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
7096
6982
|
get allowBackgroundColor() {
|
|
@@ -8377,17 +8263,12 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8377
8263
|
if (!path) this.__drawPathByBox(pen);
|
|
8378
8264
|
return pen;
|
|
8379
8265
|
}
|
|
8380
|
-
reset(_data) {}
|
|
8381
8266
|
set(data, _transition) {
|
|
8382
8267
|
if (data) Object.assign(this, data);
|
|
8383
8268
|
}
|
|
8384
8269
|
get(name) {
|
|
8385
8270
|
return isString(name) ? this.__.__getInput(name) : this.__.__getInputData(name);
|
|
8386
8271
|
}
|
|
8387
|
-
createProxyData() {
|
|
8388
|
-
return undefined;
|
|
8389
|
-
}
|
|
8390
|
-
clearProxyData() {}
|
|
8391
8272
|
find(_condition, _options) {
|
|
8392
8273
|
return Plugin.need("find");
|
|
8393
8274
|
}
|
|
@@ -8425,6 +8306,7 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8425
8306
|
data.lazy && !this.__inLazyBounds && !Export.running ? data.__needComputePaint = true : data.__computePaint();
|
|
8426
8307
|
}
|
|
8427
8308
|
}
|
|
8309
|
+
__updatePath() {}
|
|
8428
8310
|
__updateRenderPath(updateCache) {
|
|
8429
8311
|
const data = this.__;
|
|
8430
8312
|
if (data.path) {
|
|
@@ -8460,7 +8342,6 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8460
8342
|
this.set(keyframe);
|
|
8461
8343
|
return Plugin.need("animate");
|
|
8462
8344
|
}
|
|
8463
|
-
killAnimate(_type, _nextStyle) {}
|
|
8464
8345
|
export(_filename, _options) {
|
|
8465
8346
|
return Plugin.need("export");
|
|
8466
8347
|
}
|
|
@@ -8636,8 +8517,6 @@ __decorate([ dataType(100) ], UI.prototype, "placeholderDelay", void 0);
|
|
|
8636
8517
|
|
|
8637
8518
|
__decorate([ dataType({}) ], UI.prototype, "data", void 0);
|
|
8638
8519
|
|
|
8639
|
-
__decorate([ rewrite(Leaf.prototype.reset) ], UI.prototype, "reset", null);
|
|
8640
|
-
|
|
8641
8520
|
UI = UI_1 = __decorate([ useModule(UIBounds), useModule(UIRender), rewriteAble() ], UI);
|
|
8642
8521
|
|
|
8643
8522
|
let Group = class Group extends UI {
|
|
@@ -8674,9 +8553,6 @@ let Group = class Group extends UI {
|
|
|
8674
8553
|
}
|
|
8675
8554
|
return data;
|
|
8676
8555
|
}
|
|
8677
|
-
pick(_hitPoint, _options) {
|
|
8678
|
-
return undefined;
|
|
8679
|
-
}
|
|
8680
8556
|
addAt(child, index) {
|
|
8681
8557
|
this.add(child, index);
|
|
8682
8558
|
}
|
|
@@ -8686,11 +8562,6 @@ let Group = class Group extends UI {
|
|
|
8686
8562
|
addBefore(child, before) {
|
|
8687
8563
|
this.add(child, this.children.indexOf(before));
|
|
8688
8564
|
}
|
|
8689
|
-
add(_child, _index) {}
|
|
8690
|
-
addMany(..._children) {}
|
|
8691
|
-
remove(_child, _destroy) {}
|
|
8692
|
-
removeAll(_destroy) {}
|
|
8693
|
-
clear() {}
|
|
8694
8565
|
};
|
|
8695
8566
|
|
|
8696
8567
|
__decorate([ dataProcessor(GroupData) ], Group.prototype, "__", void 0);
|
|
@@ -9664,51 +9535,6 @@ let Pen = class Pen extends Group {
|
|
|
9664
9535
|
this.add(path);
|
|
9665
9536
|
return this;
|
|
9666
9537
|
}
|
|
9667
|
-
beginPath() {
|
|
9668
|
-
return this;
|
|
9669
|
-
}
|
|
9670
|
-
moveTo(_x, _y) {
|
|
9671
|
-
return this;
|
|
9672
|
-
}
|
|
9673
|
-
lineTo(_x, _y) {
|
|
9674
|
-
return this;
|
|
9675
|
-
}
|
|
9676
|
-
bezierCurveTo(_x1, _y1, _x2, _y2, _x, _y) {
|
|
9677
|
-
return this;
|
|
9678
|
-
}
|
|
9679
|
-
quadraticCurveTo(_x1, _y1, _x, _y) {
|
|
9680
|
-
return this;
|
|
9681
|
-
}
|
|
9682
|
-
closePath() {
|
|
9683
|
-
return this;
|
|
9684
|
-
}
|
|
9685
|
-
rect(_x, _y, _width, _height) {
|
|
9686
|
-
return this;
|
|
9687
|
-
}
|
|
9688
|
-
roundRect(_x, _y, _width, _height, _cornerRadius) {
|
|
9689
|
-
return this;
|
|
9690
|
-
}
|
|
9691
|
-
ellipse(_x, _y, _radiusX, _radiusY, _rotation, _startAngle, _endAngle, _anticlockwise) {
|
|
9692
|
-
return this;
|
|
9693
|
-
}
|
|
9694
|
-
arc(_x, _y, _radius, _startAngle, _endAngle, _anticlockwise) {
|
|
9695
|
-
return this;
|
|
9696
|
-
}
|
|
9697
|
-
arcTo(_x1, _y1, _x2, _y2, _radius) {
|
|
9698
|
-
return this;
|
|
9699
|
-
}
|
|
9700
|
-
drawEllipse(_x, _y, _radiusX, _radiusY, _rotation, _startAngle, _endAngle, _anticlockwise) {
|
|
9701
|
-
return this;
|
|
9702
|
-
}
|
|
9703
|
-
drawArc(_x, _y, _radius, _startAngle, _endAngle, _anticlockwise) {
|
|
9704
|
-
return this;
|
|
9705
|
-
}
|
|
9706
|
-
drawPoints(_points, _curve, _close) {
|
|
9707
|
-
return this;
|
|
9708
|
-
}
|
|
9709
|
-
clearPath() {
|
|
9710
|
-
return this;
|
|
9711
|
-
}
|
|
9712
9538
|
paint() {
|
|
9713
9539
|
const {pathElement: pathElement} = this;
|
|
9714
9540
|
if (!pathElement.__layout.boxChanged) pathElement.forceUpdate("path");
|
|
@@ -10174,7 +10000,7 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
|
|
|
10174
10000
|
needUpdate = false;
|
|
10175
10001
|
}
|
|
10176
10002
|
}
|
|
10177
|
-
if (paint.mode === "brush") PaintImage.brush(leafPaint, ui);
|
|
10003
|
+
if (paint.mode === "brush") PaintImage.brush(leafPaint, ui, attrName);
|
|
10178
10004
|
if (!leafPaint.data) {
|
|
10179
10005
|
PaintImage.createData(leafPaint, image, paint, boxBounds);
|
|
10180
10006
|
const {transform: transform} = leafPaint.data, {opacity: opacity} = paint;
|