leafer-draw 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web.cjs +2 -1
- package/dist/web.esm.js +2 -1
- package/dist/web.esm.min.js +1 -1
- package/dist/web.js +31 -21
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.module.js +31 -21
- package/dist/web.module.min.js +1 -1
- package/package.json +2 -2
package/dist/web.module.js
CHANGED
|
@@ -2047,11 +2047,11 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2047
2047
|
toBlob(_type, _quality) { return undefined; }
|
|
2048
2048
|
toDataURL(_type, _quality) { return undefined; }
|
|
2049
2049
|
saveAs(_filename, _quality) { return undefined; }
|
|
2050
|
-
resize(size) {
|
|
2050
|
+
resize(size, safeResize = true) {
|
|
2051
2051
|
if (this.isSameSize(size))
|
|
2052
2052
|
return;
|
|
2053
2053
|
let takeCanvas;
|
|
2054
|
-
if (this.context && !this.unreal && this.width) {
|
|
2054
|
+
if (this.context && !this.unreal && safeResize && this.width) {
|
|
2055
2055
|
takeCanvas = this.getSameCanvas();
|
|
2056
2056
|
takeCanvas.copyWorld(this);
|
|
2057
2057
|
}
|
|
@@ -4253,18 +4253,21 @@ const LeafHelper = {
|
|
|
4253
4253
|
L.setTransform(t, matrix, resize);
|
|
4254
4254
|
},
|
|
4255
4255
|
setTransform(t, transform, resize) {
|
|
4256
|
-
const
|
|
4256
|
+
const data = t.__, originPoint = data.origin && L.getInnerOrigin(t, data.origin);
|
|
4257
|
+
const layout = getLayout(transform, originPoint, data.around && L.getInnerOrigin(t, data.around));
|
|
4257
4258
|
if (resize) {
|
|
4258
|
-
const scaleX = layout.scaleX / t.scaleX;
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4259
|
+
const scaleX = layout.scaleX / t.scaleX, scaleY = layout.scaleY / t.scaleY;
|
|
4260
|
+
delete layout.scaleX, delete layout.scaleY;
|
|
4261
|
+
if (originPoint) {
|
|
4262
|
+
BoundsHelper.scale(t.boxBounds, Math.abs(scaleX), Math.abs(scaleY));
|
|
4263
|
+
const changedPoint = L.getInnerOrigin(t, data.origin);
|
|
4264
|
+
PointHelper.move(layout, originPoint.x - changedPoint.x, originPoint.y - changedPoint.y);
|
|
4265
|
+
}
|
|
4262
4266
|
t.set(layout);
|
|
4263
|
-
t.scaleResize(scaleX, scaleY,
|
|
4267
|
+
t.scaleResize(scaleX, scaleY, false);
|
|
4264
4268
|
}
|
|
4265
|
-
else
|
|
4269
|
+
else
|
|
4266
4270
|
t.set(layout);
|
|
4267
|
-
}
|
|
4268
4271
|
},
|
|
4269
4272
|
getFlipTransform(t, axis) {
|
|
4270
4273
|
const m = getMatrixData();
|
|
@@ -4947,14 +4950,15 @@ class Eventer {
|
|
|
4947
4950
|
if (list) {
|
|
4948
4951
|
let item;
|
|
4949
4952
|
for (let i = 0, len = list.length; i < len; i++) {
|
|
4950
|
-
item = list[i]
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4953
|
+
if (item = list[i]) {
|
|
4954
|
+
item.listener(event);
|
|
4955
|
+
if (item.once) {
|
|
4956
|
+
this.off(type, item.listener, capture);
|
|
4957
|
+
i--, len--;
|
|
4958
|
+
}
|
|
4959
|
+
if (event && event.isStopNow)
|
|
4960
|
+
break;
|
|
4955
4961
|
}
|
|
4956
|
-
if (event && event.isStopNow)
|
|
4957
|
-
break;
|
|
4958
4962
|
}
|
|
4959
4963
|
}
|
|
4960
4964
|
this.syncEventer && this.syncEventer.emitEvent(event, capture);
|
|
@@ -6001,7 +6005,7 @@ class LeafLevelList {
|
|
|
6001
6005
|
}
|
|
6002
6006
|
}
|
|
6003
6007
|
|
|
6004
|
-
const version = "1.2.
|
|
6008
|
+
const version = "1.2.2";
|
|
6005
6009
|
|
|
6006
6010
|
const debug$5 = Debug.get('LeaferCanvas');
|
|
6007
6011
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -6093,7 +6097,8 @@ class LeaferCanvas extends LeaferCanvasBase {
|
|
|
6093
6097
|
this.view.height = Math.ceil(height * pixelRatio);
|
|
6094
6098
|
}
|
|
6095
6099
|
updateClientBounds() {
|
|
6096
|
-
|
|
6100
|
+
if (this.view.parentElement)
|
|
6101
|
+
this.clientBounds = this.view.getBoundingClientRect();
|
|
6097
6102
|
}
|
|
6098
6103
|
startAutoLayout(autoBounds, listener) {
|
|
6099
6104
|
this.resizeListener = listener;
|
|
@@ -7923,6 +7928,8 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7923
7928
|
this.requestRender();
|
|
7924
7929
|
}
|
|
7925
7930
|
}
|
|
7931
|
+
else
|
|
7932
|
+
this.requestRender();
|
|
7926
7933
|
}
|
|
7927
7934
|
__checkViewCompleted(emit = true) {
|
|
7928
7935
|
this.nextRender(() => {
|
|
@@ -8488,10 +8495,10 @@ let Canvas = class Canvas extends Rect {
|
|
|
8488
8495
|
__updateSize() {
|
|
8489
8496
|
const { canvas } = this;
|
|
8490
8497
|
if (canvas) {
|
|
8491
|
-
const { smooth } = this.__;
|
|
8498
|
+
const { smooth, safeResize } = this.__;
|
|
8499
|
+
canvas.resize(this.__, safeResize);
|
|
8492
8500
|
if (canvas.smooth !== smooth)
|
|
8493
8501
|
canvas.smooth = smooth;
|
|
8494
|
-
canvas.resize(this.__);
|
|
8495
8502
|
}
|
|
8496
8503
|
}
|
|
8497
8504
|
destroy() {
|
|
@@ -8517,6 +8524,9 @@ __decorate([
|
|
|
8517
8524
|
__decorate([
|
|
8518
8525
|
resizeType(true)
|
|
8519
8526
|
], Canvas.prototype, "smooth", void 0);
|
|
8527
|
+
__decorate([
|
|
8528
|
+
dataType(false)
|
|
8529
|
+
], Canvas.prototype, "safeResize", void 0);
|
|
8520
8530
|
__decorate([
|
|
8521
8531
|
resizeType()
|
|
8522
8532
|
], Canvas.prototype, "contextSettings", void 0);
|