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.
@@ -36449,14 +36449,13 @@ function getControlPoint(data, findItem2) {
36449
36449
  }
36450
36450
  }
36451
36451
  function toRelativePoint(point5, item) {
36452
- const matrix = item.transformation?.matrix || new Matrix2;
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?.matrix.copy() || new Matrix2;
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 startScaleX = this.matrix.scaleX;
49457
- const startScaleY = this.matrix.scaleY;
49458
- const startTranslateX = this.matrix.translateX;
49459
- const startTranslateY = this.matrix.translateY;
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 targetScaleX = startScaleX * scale;
49463
- const targetScaleY = startScaleY * scale;
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 = targetTranslateX;
49473
- this.matrix.translateY = targetTranslateY;
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: targetTranslateX,
49481
- translateY: targetTranslateY,
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 matrix = item.transformation?.matrix || new Matrix2;
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?.matrix.copy() || new Matrix2;
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 startScaleX = this.matrix.scaleX;
49457
- const startScaleY = this.matrix.scaleY;
49458
- const startTranslateX = this.matrix.translateX;
49459
- const startTranslateY = this.matrix.translateY;
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 targetScaleX = startScaleX * scale;
49463
- const targetScaleY = startScaleY * scale;
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 = targetTranslateX;
49473
- this.matrix.translateY = targetTranslateY;
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: targetTranslateX,
49481
- translateY: targetTranslateY,
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 matrix = item.transformation?.matrix || new Matrix2;
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?.matrix.copy() || new Matrix2;
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 startScaleX = this.matrix.scaleX;
51930
- const startScaleY = this.matrix.scaleY;
51931
- const startTranslateX = this.matrix.translateX;
51932
- const startTranslateY = this.matrix.translateY;
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 targetScaleX = startScaleX * scale;
51936
- const targetScaleY = startScaleY * scale;
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 = targetTranslateX;
51946
- this.matrix.translateY = targetTranslateY;
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: targetTranslateX,
51954
- translateY: targetTranslateY,
51951
+ translateX: finalTranslateX,
51952
+ translateY: finalTranslateY,
51955
51953
  scaleX: finalScaleX,
51956
51954
  scaleY: finalScaleY
51957
51955
  });
@@ -36295,14 +36295,13 @@ function getControlPoint(data, findItem2) {
36295
36295
  }
36296
36296
  }
36297
36297
  function toRelativePoint(point5, item) {
36298
- const matrix = item.transformation?.matrix || new Matrix2;
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?.matrix.copy() || new Matrix2;
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 startScaleX = this.matrix.scaleX;
49303
- const startScaleY = this.matrix.scaleY;
49304
- const startTranslateX = this.matrix.translateX;
49305
- const startTranslateY = this.matrix.translateY;
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 targetScaleX = startScaleX * scale;
49309
- const targetScaleY = startScaleY * scale;
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 = targetTranslateX;
49319
- this.matrix.translateY = targetTranslateY;
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: targetTranslateX,
49327
- translateY: targetTranslateY,
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 matrix = item.transformation?.matrix || new Matrix2;
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?.matrix.copy() || new Matrix2;
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 startScaleX = this.matrix.scaleX;
49296
- const startScaleY = this.matrix.scaleY;
49297
- const startTranslateX = this.matrix.translateX;
49298
- const startTranslateY = this.matrix.translateY;
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 targetScaleX = startScaleX * scale;
49302
- const targetScaleY = startScaleY * scale;
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 = targetTranslateX;
49312
- this.matrix.translateY = targetTranslateY;
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: targetTranslateX,
49320
- translateY: targetTranslateY,
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 matrix = item.transformation?.matrix || new Matrix2;
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?.matrix.copy() || new Matrix2;
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 startScaleX = this.matrix.scaleX;
51764
- const startScaleY = this.matrix.scaleY;
51765
- const startTranslateX = this.matrix.translateX;
51766
- const startTranslateY = this.matrix.translateY;
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 targetScaleX = startScaleX * scale;
51770
- const targetScaleY = startScaleY * scale;
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 = targetTranslateX;
51780
- this.matrix.translateY = targetTranslateY;
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: targetTranslateX,
51788
- translateY: targetTranslateY,
51785
+ translateX: finalTranslateX,
51786
+ translateY: finalTranslateY,
51789
51787
  scaleX: finalScaleX,
51790
51788
  scaleY: finalScaleY
51791
51789
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.6.3",
3
+ "version": "0.6.5",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",