microboard-temp 0.6.3 → 0.6.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/cjs/browser.js +15 -17
- package/dist/cjs/index.js +15 -17
- package/dist/cjs/node.js +15 -17
- package/dist/esm/browser.js +15 -17
- package/dist/esm/index.js +15 -17
- package/dist/esm/node.js +15 -17
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -36449,14 +36449,13 @@ function getControlPoint(data, findItem2) {
|
|
|
36449
36449
|
}
|
|
36450
36450
|
}
|
|
36451
36451
|
function toRelativePoint(point5, item) {
|
|
36452
|
-
const
|
|
36453
|
-
const inverse = matrix.getInverse();
|
|
36452
|
+
const inverse = item.transformation ? item.transformation.getInverse().toMatrix() : new Matrix2;
|
|
36454
36453
|
point5 = point5.copy();
|
|
36455
36454
|
point5.transform(inverse);
|
|
36456
36455
|
return point5;
|
|
36457
36456
|
}
|
|
36458
36457
|
function fromRelativePoint(relativePoint, item, edge) {
|
|
36459
|
-
const matrix = item.transformation?.
|
|
36458
|
+
const matrix = item.transformation?.toMatrix() ?? new Matrix2;
|
|
36460
36459
|
const point5 = relativePoint.copy();
|
|
36461
36460
|
point5.transform(matrix);
|
|
36462
36461
|
if (item instanceof RichText || item instanceof AINode) {
|
|
@@ -49453,32 +49452,31 @@ class Camera {
|
|
|
49453
49452
|
this.zoomRelativeToPointBy(scale, this.pointer.x, this.pointer.y);
|
|
49454
49453
|
}
|
|
49455
49454
|
zoomRelativeToPointBy(scale, x, y, duration = 400) {
|
|
49456
|
-
const
|
|
49457
|
-
const
|
|
49458
|
-
const
|
|
49459
|
-
const
|
|
49455
|
+
const base3 = this.localAnimationTarget ?? this.matrix;
|
|
49456
|
+
const startScaleX = base3.scaleX;
|
|
49457
|
+
const startScaleY = base3.scaleY;
|
|
49458
|
+
const startTranslateX = base3.translateX;
|
|
49459
|
+
const startTranslateY = base3.translateY;
|
|
49460
49460
|
const boardPointX = (x - startTranslateX) / startScaleX;
|
|
49461
49461
|
const boardPointY = (y - startTranslateY) / startScaleY;
|
|
49462
|
-
const
|
|
49463
|
-
const
|
|
49464
|
-
const targetTranslateX = x - boardPointX * targetScaleX;
|
|
49465
|
-
const targetTranslateY = y - boardPointY * targetScaleY;
|
|
49466
|
-
const finalScaleX = this.limitScale(targetScaleX);
|
|
49467
|
-
const finalScaleY = this.limitScale(targetScaleY);
|
|
49462
|
+
const finalScaleX = this.limitScale(startScaleX * scale);
|
|
49463
|
+
const finalScaleY = this.limitScale(startScaleY * scale);
|
|
49468
49464
|
if (finalScaleX === startScaleX && finalScaleY === startScaleY) {
|
|
49469
49465
|
return;
|
|
49470
49466
|
}
|
|
49467
|
+
const finalTranslateX = x - boardPointX * finalScaleX;
|
|
49468
|
+
const finalTranslateY = y - boardPointY * finalScaleY;
|
|
49471
49469
|
if (duration === 0) {
|
|
49472
|
-
this.matrix.translateX =
|
|
49473
|
-
this.matrix.translateY =
|
|
49470
|
+
this.matrix.translateX = finalTranslateX;
|
|
49471
|
+
this.matrix.translateY = finalTranslateY;
|
|
49474
49472
|
this.matrix.scaleX = finalScaleX;
|
|
49475
49473
|
this.matrix.scaleY = finalScaleY;
|
|
49476
49474
|
this.subject.publish(this);
|
|
49477
49475
|
return;
|
|
49478
49476
|
}
|
|
49479
49477
|
this.animateLocalToTarget({
|
|
49480
|
-
translateX:
|
|
49481
|
-
translateY:
|
|
49478
|
+
translateX: finalTranslateX,
|
|
49479
|
+
translateY: finalTranslateY,
|
|
49482
49480
|
scaleX: finalScaleX,
|
|
49483
49481
|
scaleY: finalScaleY
|
|
49484
49482
|
});
|
package/dist/cjs/index.js
CHANGED
|
@@ -36449,14 +36449,13 @@ function getControlPoint(data, findItem2) {
|
|
|
36449
36449
|
}
|
|
36450
36450
|
}
|
|
36451
36451
|
function toRelativePoint(point5, item) {
|
|
36452
|
-
const
|
|
36453
|
-
const inverse = matrix.getInverse();
|
|
36452
|
+
const inverse = item.transformation ? item.transformation.getInverse().toMatrix() : new Matrix2;
|
|
36454
36453
|
point5 = point5.copy();
|
|
36455
36454
|
point5.transform(inverse);
|
|
36456
36455
|
return point5;
|
|
36457
36456
|
}
|
|
36458
36457
|
function fromRelativePoint(relativePoint, item, edge) {
|
|
36459
|
-
const matrix = item.transformation?.
|
|
36458
|
+
const matrix = item.transformation?.toMatrix() ?? new Matrix2;
|
|
36460
36459
|
const point5 = relativePoint.copy();
|
|
36461
36460
|
point5.transform(matrix);
|
|
36462
36461
|
if (item instanceof RichText || item instanceof AINode) {
|
|
@@ -49453,32 +49452,31 @@ class Camera {
|
|
|
49453
49452
|
this.zoomRelativeToPointBy(scale, this.pointer.x, this.pointer.y);
|
|
49454
49453
|
}
|
|
49455
49454
|
zoomRelativeToPointBy(scale, x, y, duration = 400) {
|
|
49456
|
-
const
|
|
49457
|
-
const
|
|
49458
|
-
const
|
|
49459
|
-
const
|
|
49455
|
+
const base3 = this.localAnimationTarget ?? this.matrix;
|
|
49456
|
+
const startScaleX = base3.scaleX;
|
|
49457
|
+
const startScaleY = base3.scaleY;
|
|
49458
|
+
const startTranslateX = base3.translateX;
|
|
49459
|
+
const startTranslateY = base3.translateY;
|
|
49460
49460
|
const boardPointX = (x - startTranslateX) / startScaleX;
|
|
49461
49461
|
const boardPointY = (y - startTranslateY) / startScaleY;
|
|
49462
|
-
const
|
|
49463
|
-
const
|
|
49464
|
-
const targetTranslateX = x - boardPointX * targetScaleX;
|
|
49465
|
-
const targetTranslateY = y - boardPointY * targetScaleY;
|
|
49466
|
-
const finalScaleX = this.limitScale(targetScaleX);
|
|
49467
|
-
const finalScaleY = this.limitScale(targetScaleY);
|
|
49462
|
+
const finalScaleX = this.limitScale(startScaleX * scale);
|
|
49463
|
+
const finalScaleY = this.limitScale(startScaleY * scale);
|
|
49468
49464
|
if (finalScaleX === startScaleX && finalScaleY === startScaleY) {
|
|
49469
49465
|
return;
|
|
49470
49466
|
}
|
|
49467
|
+
const finalTranslateX = x - boardPointX * finalScaleX;
|
|
49468
|
+
const finalTranslateY = y - boardPointY * finalScaleY;
|
|
49471
49469
|
if (duration === 0) {
|
|
49472
|
-
this.matrix.translateX =
|
|
49473
|
-
this.matrix.translateY =
|
|
49470
|
+
this.matrix.translateX = finalTranslateX;
|
|
49471
|
+
this.matrix.translateY = finalTranslateY;
|
|
49474
49472
|
this.matrix.scaleX = finalScaleX;
|
|
49475
49473
|
this.matrix.scaleY = finalScaleY;
|
|
49476
49474
|
this.subject.publish(this);
|
|
49477
49475
|
return;
|
|
49478
49476
|
}
|
|
49479
49477
|
this.animateLocalToTarget({
|
|
49480
|
-
translateX:
|
|
49481
|
-
translateY:
|
|
49478
|
+
translateX: finalTranslateX,
|
|
49479
|
+
translateY: finalTranslateY,
|
|
49482
49480
|
scaleX: finalScaleX,
|
|
49483
49481
|
scaleY: finalScaleY
|
|
49484
49482
|
});
|
package/dist/cjs/node.js
CHANGED
|
@@ -38922,14 +38922,13 @@ function getControlPoint(data, findItem2) {
|
|
|
38922
38922
|
}
|
|
38923
38923
|
}
|
|
38924
38924
|
function toRelativePoint(point5, item) {
|
|
38925
|
-
const
|
|
38926
|
-
const inverse = matrix.getInverse();
|
|
38925
|
+
const inverse = item.transformation ? item.transformation.getInverse().toMatrix() : new Matrix2;
|
|
38927
38926
|
point5 = point5.copy();
|
|
38928
38927
|
point5.transform(inverse);
|
|
38929
38928
|
return point5;
|
|
38930
38929
|
}
|
|
38931
38930
|
function fromRelativePoint(relativePoint, item, edge) {
|
|
38932
|
-
const matrix = item.transformation?.
|
|
38931
|
+
const matrix = item.transformation?.toMatrix() ?? new Matrix2;
|
|
38933
38932
|
const point5 = relativePoint.copy();
|
|
38934
38933
|
point5.transform(matrix);
|
|
38935
38934
|
if (item instanceof RichText || item instanceof AINode) {
|
|
@@ -51926,32 +51925,31 @@ class Camera {
|
|
|
51926
51925
|
this.zoomRelativeToPointBy(scale, this.pointer.x, this.pointer.y);
|
|
51927
51926
|
}
|
|
51928
51927
|
zoomRelativeToPointBy(scale, x, y, duration = 400) {
|
|
51929
|
-
const
|
|
51930
|
-
const
|
|
51931
|
-
const
|
|
51932
|
-
const
|
|
51928
|
+
const base3 = this.localAnimationTarget ?? this.matrix;
|
|
51929
|
+
const startScaleX = base3.scaleX;
|
|
51930
|
+
const startScaleY = base3.scaleY;
|
|
51931
|
+
const startTranslateX = base3.translateX;
|
|
51932
|
+
const startTranslateY = base3.translateY;
|
|
51933
51933
|
const boardPointX = (x - startTranslateX) / startScaleX;
|
|
51934
51934
|
const boardPointY = (y - startTranslateY) / startScaleY;
|
|
51935
|
-
const
|
|
51936
|
-
const
|
|
51937
|
-
const targetTranslateX = x - boardPointX * targetScaleX;
|
|
51938
|
-
const targetTranslateY = y - boardPointY * targetScaleY;
|
|
51939
|
-
const finalScaleX = this.limitScale(targetScaleX);
|
|
51940
|
-
const finalScaleY = this.limitScale(targetScaleY);
|
|
51935
|
+
const finalScaleX = this.limitScale(startScaleX * scale);
|
|
51936
|
+
const finalScaleY = this.limitScale(startScaleY * scale);
|
|
51941
51937
|
if (finalScaleX === startScaleX && finalScaleY === startScaleY) {
|
|
51942
51938
|
return;
|
|
51943
51939
|
}
|
|
51940
|
+
const finalTranslateX = x - boardPointX * finalScaleX;
|
|
51941
|
+
const finalTranslateY = y - boardPointY * finalScaleY;
|
|
51944
51942
|
if (duration === 0) {
|
|
51945
|
-
this.matrix.translateX =
|
|
51946
|
-
this.matrix.translateY =
|
|
51943
|
+
this.matrix.translateX = finalTranslateX;
|
|
51944
|
+
this.matrix.translateY = finalTranslateY;
|
|
51947
51945
|
this.matrix.scaleX = finalScaleX;
|
|
51948
51946
|
this.matrix.scaleY = finalScaleY;
|
|
51949
51947
|
this.subject.publish(this);
|
|
51950
51948
|
return;
|
|
51951
51949
|
}
|
|
51952
51950
|
this.animateLocalToTarget({
|
|
51953
|
-
translateX:
|
|
51954
|
-
translateY:
|
|
51951
|
+
translateX: finalTranslateX,
|
|
51952
|
+
translateY: finalTranslateY,
|
|
51955
51953
|
scaleX: finalScaleX,
|
|
51956
51954
|
scaleY: finalScaleY
|
|
51957
51955
|
});
|
package/dist/esm/browser.js
CHANGED
|
@@ -36295,14 +36295,13 @@ function getControlPoint(data, findItem2) {
|
|
|
36295
36295
|
}
|
|
36296
36296
|
}
|
|
36297
36297
|
function toRelativePoint(point5, item) {
|
|
36298
|
-
const
|
|
36299
|
-
const inverse = matrix.getInverse();
|
|
36298
|
+
const inverse = item.transformation ? item.transformation.getInverse().toMatrix() : new Matrix2;
|
|
36300
36299
|
point5 = point5.copy();
|
|
36301
36300
|
point5.transform(inverse);
|
|
36302
36301
|
return point5;
|
|
36303
36302
|
}
|
|
36304
36303
|
function fromRelativePoint(relativePoint, item, edge) {
|
|
36305
|
-
const matrix = item.transformation?.
|
|
36304
|
+
const matrix = item.transformation?.toMatrix() ?? new Matrix2;
|
|
36306
36305
|
const point5 = relativePoint.copy();
|
|
36307
36306
|
point5.transform(matrix);
|
|
36308
36307
|
if (item instanceof RichText || item instanceof AINode) {
|
|
@@ -49299,32 +49298,31 @@ class Camera {
|
|
|
49299
49298
|
this.zoomRelativeToPointBy(scale, this.pointer.x, this.pointer.y);
|
|
49300
49299
|
}
|
|
49301
49300
|
zoomRelativeToPointBy(scale, x, y, duration = 400) {
|
|
49302
|
-
const
|
|
49303
|
-
const
|
|
49304
|
-
const
|
|
49305
|
-
const
|
|
49301
|
+
const base3 = this.localAnimationTarget ?? this.matrix;
|
|
49302
|
+
const startScaleX = base3.scaleX;
|
|
49303
|
+
const startScaleY = base3.scaleY;
|
|
49304
|
+
const startTranslateX = base3.translateX;
|
|
49305
|
+
const startTranslateY = base3.translateY;
|
|
49306
49306
|
const boardPointX = (x - startTranslateX) / startScaleX;
|
|
49307
49307
|
const boardPointY = (y - startTranslateY) / startScaleY;
|
|
49308
|
-
const
|
|
49309
|
-
const
|
|
49310
|
-
const targetTranslateX = x - boardPointX * targetScaleX;
|
|
49311
|
-
const targetTranslateY = y - boardPointY * targetScaleY;
|
|
49312
|
-
const finalScaleX = this.limitScale(targetScaleX);
|
|
49313
|
-
const finalScaleY = this.limitScale(targetScaleY);
|
|
49308
|
+
const finalScaleX = this.limitScale(startScaleX * scale);
|
|
49309
|
+
const finalScaleY = this.limitScale(startScaleY * scale);
|
|
49314
49310
|
if (finalScaleX === startScaleX && finalScaleY === startScaleY) {
|
|
49315
49311
|
return;
|
|
49316
49312
|
}
|
|
49313
|
+
const finalTranslateX = x - boardPointX * finalScaleX;
|
|
49314
|
+
const finalTranslateY = y - boardPointY * finalScaleY;
|
|
49317
49315
|
if (duration === 0) {
|
|
49318
|
-
this.matrix.translateX =
|
|
49319
|
-
this.matrix.translateY =
|
|
49316
|
+
this.matrix.translateX = finalTranslateX;
|
|
49317
|
+
this.matrix.translateY = finalTranslateY;
|
|
49320
49318
|
this.matrix.scaleX = finalScaleX;
|
|
49321
49319
|
this.matrix.scaleY = finalScaleY;
|
|
49322
49320
|
this.subject.publish(this);
|
|
49323
49321
|
return;
|
|
49324
49322
|
}
|
|
49325
49323
|
this.animateLocalToTarget({
|
|
49326
|
-
translateX:
|
|
49327
|
-
translateY:
|
|
49324
|
+
translateX: finalTranslateX,
|
|
49325
|
+
translateY: finalTranslateY,
|
|
49328
49326
|
scaleX: finalScaleX,
|
|
49329
49327
|
scaleY: finalScaleY
|
|
49330
49328
|
});
|
package/dist/esm/index.js
CHANGED
|
@@ -36288,14 +36288,13 @@ function getControlPoint(data, findItem2) {
|
|
|
36288
36288
|
}
|
|
36289
36289
|
}
|
|
36290
36290
|
function toRelativePoint(point5, item) {
|
|
36291
|
-
const
|
|
36292
|
-
const inverse = matrix.getInverse();
|
|
36291
|
+
const inverse = item.transformation ? item.transformation.getInverse().toMatrix() : new Matrix2;
|
|
36293
36292
|
point5 = point5.copy();
|
|
36294
36293
|
point5.transform(inverse);
|
|
36295
36294
|
return point5;
|
|
36296
36295
|
}
|
|
36297
36296
|
function fromRelativePoint(relativePoint, item, edge) {
|
|
36298
|
-
const matrix = item.transformation?.
|
|
36297
|
+
const matrix = item.transformation?.toMatrix() ?? new Matrix2;
|
|
36299
36298
|
const point5 = relativePoint.copy();
|
|
36300
36299
|
point5.transform(matrix);
|
|
36301
36300
|
if (item instanceof RichText || item instanceof AINode) {
|
|
@@ -49292,32 +49291,31 @@ class Camera {
|
|
|
49292
49291
|
this.zoomRelativeToPointBy(scale, this.pointer.x, this.pointer.y);
|
|
49293
49292
|
}
|
|
49294
49293
|
zoomRelativeToPointBy(scale, x, y, duration = 400) {
|
|
49295
|
-
const
|
|
49296
|
-
const
|
|
49297
|
-
const
|
|
49298
|
-
const
|
|
49294
|
+
const base3 = this.localAnimationTarget ?? this.matrix;
|
|
49295
|
+
const startScaleX = base3.scaleX;
|
|
49296
|
+
const startScaleY = base3.scaleY;
|
|
49297
|
+
const startTranslateX = base3.translateX;
|
|
49298
|
+
const startTranslateY = base3.translateY;
|
|
49299
49299
|
const boardPointX = (x - startTranslateX) / startScaleX;
|
|
49300
49300
|
const boardPointY = (y - startTranslateY) / startScaleY;
|
|
49301
|
-
const
|
|
49302
|
-
const
|
|
49303
|
-
const targetTranslateX = x - boardPointX * targetScaleX;
|
|
49304
|
-
const targetTranslateY = y - boardPointY * targetScaleY;
|
|
49305
|
-
const finalScaleX = this.limitScale(targetScaleX);
|
|
49306
|
-
const finalScaleY = this.limitScale(targetScaleY);
|
|
49301
|
+
const finalScaleX = this.limitScale(startScaleX * scale);
|
|
49302
|
+
const finalScaleY = this.limitScale(startScaleY * scale);
|
|
49307
49303
|
if (finalScaleX === startScaleX && finalScaleY === startScaleY) {
|
|
49308
49304
|
return;
|
|
49309
49305
|
}
|
|
49306
|
+
const finalTranslateX = x - boardPointX * finalScaleX;
|
|
49307
|
+
const finalTranslateY = y - boardPointY * finalScaleY;
|
|
49310
49308
|
if (duration === 0) {
|
|
49311
|
-
this.matrix.translateX =
|
|
49312
|
-
this.matrix.translateY =
|
|
49309
|
+
this.matrix.translateX = finalTranslateX;
|
|
49310
|
+
this.matrix.translateY = finalTranslateY;
|
|
49313
49311
|
this.matrix.scaleX = finalScaleX;
|
|
49314
49312
|
this.matrix.scaleY = finalScaleY;
|
|
49315
49313
|
this.subject.publish(this);
|
|
49316
49314
|
return;
|
|
49317
49315
|
}
|
|
49318
49316
|
this.animateLocalToTarget({
|
|
49319
|
-
translateX:
|
|
49320
|
-
translateY:
|
|
49317
|
+
translateX: finalTranslateX,
|
|
49318
|
+
translateY: finalTranslateY,
|
|
49321
49319
|
scaleX: finalScaleX,
|
|
49322
49320
|
scaleY: finalScaleY
|
|
49323
49321
|
});
|
package/dist/esm/node.js
CHANGED
|
@@ -38756,14 +38756,13 @@ function getControlPoint(data, findItem2) {
|
|
|
38756
38756
|
}
|
|
38757
38757
|
}
|
|
38758
38758
|
function toRelativePoint(point5, item) {
|
|
38759
|
-
const
|
|
38760
|
-
const inverse = matrix.getInverse();
|
|
38759
|
+
const inverse = item.transformation ? item.transformation.getInverse().toMatrix() : new Matrix2;
|
|
38761
38760
|
point5 = point5.copy();
|
|
38762
38761
|
point5.transform(inverse);
|
|
38763
38762
|
return point5;
|
|
38764
38763
|
}
|
|
38765
38764
|
function fromRelativePoint(relativePoint, item, edge) {
|
|
38766
|
-
const matrix = item.transformation?.
|
|
38765
|
+
const matrix = item.transformation?.toMatrix() ?? new Matrix2;
|
|
38767
38766
|
const point5 = relativePoint.copy();
|
|
38768
38767
|
point5.transform(matrix);
|
|
38769
38768
|
if (item instanceof RichText || item instanceof AINode) {
|
|
@@ -51760,32 +51759,31 @@ class Camera {
|
|
|
51760
51759
|
this.zoomRelativeToPointBy(scale, this.pointer.x, this.pointer.y);
|
|
51761
51760
|
}
|
|
51762
51761
|
zoomRelativeToPointBy(scale, x, y, duration = 400) {
|
|
51763
|
-
const
|
|
51764
|
-
const
|
|
51765
|
-
const
|
|
51766
|
-
const
|
|
51762
|
+
const base3 = this.localAnimationTarget ?? this.matrix;
|
|
51763
|
+
const startScaleX = base3.scaleX;
|
|
51764
|
+
const startScaleY = base3.scaleY;
|
|
51765
|
+
const startTranslateX = base3.translateX;
|
|
51766
|
+
const startTranslateY = base3.translateY;
|
|
51767
51767
|
const boardPointX = (x - startTranslateX) / startScaleX;
|
|
51768
51768
|
const boardPointY = (y - startTranslateY) / startScaleY;
|
|
51769
|
-
const
|
|
51770
|
-
const
|
|
51771
|
-
const targetTranslateX = x - boardPointX * targetScaleX;
|
|
51772
|
-
const targetTranslateY = y - boardPointY * targetScaleY;
|
|
51773
|
-
const finalScaleX = this.limitScale(targetScaleX);
|
|
51774
|
-
const finalScaleY = this.limitScale(targetScaleY);
|
|
51769
|
+
const finalScaleX = this.limitScale(startScaleX * scale);
|
|
51770
|
+
const finalScaleY = this.limitScale(startScaleY * scale);
|
|
51775
51771
|
if (finalScaleX === startScaleX && finalScaleY === startScaleY) {
|
|
51776
51772
|
return;
|
|
51777
51773
|
}
|
|
51774
|
+
const finalTranslateX = x - boardPointX * finalScaleX;
|
|
51775
|
+
const finalTranslateY = y - boardPointY * finalScaleY;
|
|
51778
51776
|
if (duration === 0) {
|
|
51779
|
-
this.matrix.translateX =
|
|
51780
|
-
this.matrix.translateY =
|
|
51777
|
+
this.matrix.translateX = finalTranslateX;
|
|
51778
|
+
this.matrix.translateY = finalTranslateY;
|
|
51781
51779
|
this.matrix.scaleX = finalScaleX;
|
|
51782
51780
|
this.matrix.scaleY = finalScaleY;
|
|
51783
51781
|
this.subject.publish(this);
|
|
51784
51782
|
return;
|
|
51785
51783
|
}
|
|
51786
51784
|
this.animateLocalToTarget({
|
|
51787
|
-
translateX:
|
|
51788
|
-
translateY:
|
|
51785
|
+
translateX: finalTranslateX,
|
|
51786
|
+
translateY: finalTranslateY,
|
|
51789
51787
|
scaleX: finalScaleX,
|
|
51790
51788
|
scaleY: finalScaleY
|
|
51791
51789
|
});
|