microboard-temp 0.5.140 → 0.5.142

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.
@@ -21946,15 +21946,19 @@ class RichText extends BaseItem {
21946
21946
  });
21947
21947
  this.transformation.subject.subscribe((tr, op) => {
21948
21948
  this.prevMbr = this.getMbr();
21949
- if (op.method === "translateTo" || op.method === "translateBy" || op.method === "transformMany") {
21950
- this.transformCanvas();
21951
- } else if (op.method === "scaleTo" || op.method === "scaleBy" || op.method === "scaleByTranslateBy") {
21952
- this.setAINodeShirkWidth();
21953
- if (!this.isInShape) {
21954
- this.transformCanvas();
21949
+ if (op.method === "applyMatrix") {
21950
+ if (op.matrix.scaleX !== 1 || op.matrix.scaleY !== 1) {
21951
+ this.setAINodeShirkWidth();
21952
+ if (!this.isInShape) {
21953
+ this.transformCanvas();
21954
+ } else {
21955
+ this.updateElement();
21956
+ }
21955
21957
  } else {
21956
- this.updateElement();
21958
+ this.transformCanvas();
21957
21959
  }
21960
+ } else if (op.method === "transformMany") {
21961
+ this.transformCanvas();
21958
21962
  } else if (op.method === "deserialize") {
21959
21963
  this.setAINodeShirkWidth();
21960
21964
  this.updateElement();
@@ -35896,23 +35900,24 @@ class AINode extends BaseItem {
35896
35900
  this.linkTo = new LinkTo(this.id, this.board.events);
35897
35901
  this.text = new RichText(this.board, new Mbr, this.id, this.transformation, this.linkTo, " ", false, false, "AINode");
35898
35902
  this.transformation.subject.subscribe((_subject, op) => {
35899
- if (op.method === "translateTo" || op.method === "translateBy") {
35900
- this.text.transformCanvas();
35903
+ if (op.method === "applyMatrix") {
35904
+ if (op.matrix.scaleX !== 1 || op.matrix.scaleY !== 1) {
35905
+ this.prevMbr = this.path?.getMbr();
35906
+ this.text.handleInshapeScale();
35907
+ } else {
35908
+ this.text.transformCanvas();
35909
+ }
35901
35910
  } else if (op.method === "transformMany") {
35902
35911
  const currItemOp = op.items[this.getId()];
35903
35912
  this.prevMbr = this.path?.getMbr();
35904
- if (currItemOp.method === "translateBy" || currItemOp.method === "translateTo" || currItemOp.method === "scaleByTranslateBy" && currItemOp.scale.x === 1 && currItemOp.scale.y === 1) {
35913
+ if (currItemOp.method === "applyMatrix" && currItemOp.matrix.scaleX === 1 && currItemOp.matrix.scaleY === 1) {
35905
35914
  this.text.transformCanvas();
35906
35915
  } else {
35907
35916
  this.text.handleInshapeScale();
35908
35917
  }
35909
35918
  } else {
35910
35919
  this.prevMbr = this.path?.getMbr();
35911
- if (op.method === "scaleByTranslateBy") {
35912
- this.text.handleInshapeScale();
35913
- } else {
35914
- this.text.updateElement();
35915
- }
35920
+ this.text.updateElement();
35916
35921
  }
35917
35922
  this.transformPath();
35918
35923
  this.subject.publish(this);
@@ -39417,7 +39422,7 @@ class Shape extends BaseItem {
39417
39422
  this.transformation.subject.subscribe((_subject, op) => {
39418
39423
  this.transformPath();
39419
39424
  this.updateMbr();
39420
- if (op.method === "translateTo" || op.method === "translateBy") {
39425
+ if (op.method === "applyMatrix" && op.matrix.scaleX === 1 && op.matrix.scaleY === 1) {
39421
39426
  this.text.transformCanvas();
39422
39427
  } else {
39423
39428
  this.text.updateElement();
@@ -39944,21 +39949,21 @@ class Sticker extends BaseItem {
39944
39949
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, " ", false, true, this.itemType);
39945
39950
  this.transformation.subject.subscribe((_subject, op) => {
39946
39951
  this.transformPath();
39947
- if (op.method === "scaleBy") {
39948
- this.text.updateElement();
39949
- } else if (op.method === "scaleByTranslateBy") {
39950
- if (this.text.isAutosize()) {
39951
- this.text.scaleAutoSizeScale(Math.min(op.scale.x, op.scale.y));
39952
- this.text.recoordinate();
39953
- this.text.transformCanvas();
39954
- } else {
39955
- this.text.handleInshapeScale();
39952
+ if (op.method === "applyMatrix") {
39953
+ if (op.matrix.scaleX !== 1 || op.matrix.scaleY !== 1) {
39954
+ if (this.text.isAutosize()) {
39955
+ this.text.scaleAutoSizeScale(Math.min(op.matrix.scaleX, op.matrix.scaleY));
39956
+ this.text.recoordinate();
39957
+ this.text.transformCanvas();
39958
+ } else {
39959
+ this.text.handleInshapeScale();
39960
+ }
39956
39961
  }
39957
39962
  } else if (op.method === "transformMany") {
39958
39963
  const transformOp = op.items[this.id];
39959
- if (transformOp.method === "scaleByTranslateBy") {
39964
+ if (transformOp.method === "applyMatrix" && (transformOp.matrix.scaleX !== 1 || transformOp.matrix.scaleY !== 1)) {
39960
39965
  if (this.text.isAutosize()) {
39961
- this.text.scaleAutoSizeScale(Math.min(transformOp.scale.x, transformOp.scale.y));
39966
+ this.text.scaleAutoSizeScale(Math.min(transformOp.matrix.scaleX, transformOp.matrix.scaleY));
39962
39967
  this.text.recoordinate();
39963
39968
  this.text.transformCanvas();
39964
39969
  } else {
@@ -46199,10 +46204,8 @@ class AlignmentHelper {
46199
46204
  transformMap[id] = {
46200
46205
  class: "Transformation",
46201
46206
  item: [id],
46202
- method: "translateBy",
46203
- x,
46204
- y,
46205
- timeStamp
46207
+ method: "applyMatrix",
46208
+ matrix: { translateX: x, translateY: y, scaleX: 1, scaleY: 1, shearX: 0, shearY: 0 }
46206
46209
  };
46207
46210
  this.board.selection.transformMany(transformMap, timeStamp);
46208
46211
  }
@@ -48053,7 +48056,7 @@ class Card extends BaseItem {
48053
48056
  this.board.bringToFront(this);
48054
48057
  }, 1000);
48055
48058
  this.transformation.subject.subscribe((_, op) => {
48056
- if (this.parent === "Board" && op.method === "translateBy") {
48059
+ if (this.parent === "Board" && op.method === "applyMatrix" && op.matrix.scaleX === 1 && op.matrix.scaleY === 1) {
48057
48060
  this.throttledBringToFront();
48058
48061
  }
48059
48062
  this.updateMbr();
package/dist/cjs/index.js CHANGED
@@ -21946,15 +21946,19 @@ class RichText extends BaseItem {
21946
21946
  });
21947
21947
  this.transformation.subject.subscribe((tr, op) => {
21948
21948
  this.prevMbr = this.getMbr();
21949
- if (op.method === "translateTo" || op.method === "translateBy" || op.method === "transformMany") {
21950
- this.transformCanvas();
21951
- } else if (op.method === "scaleTo" || op.method === "scaleBy" || op.method === "scaleByTranslateBy") {
21952
- this.setAINodeShirkWidth();
21953
- if (!this.isInShape) {
21954
- this.transformCanvas();
21949
+ if (op.method === "applyMatrix") {
21950
+ if (op.matrix.scaleX !== 1 || op.matrix.scaleY !== 1) {
21951
+ this.setAINodeShirkWidth();
21952
+ if (!this.isInShape) {
21953
+ this.transformCanvas();
21954
+ } else {
21955
+ this.updateElement();
21956
+ }
21955
21957
  } else {
21956
- this.updateElement();
21958
+ this.transformCanvas();
21957
21959
  }
21960
+ } else if (op.method === "transformMany") {
21961
+ this.transformCanvas();
21958
21962
  } else if (op.method === "deserialize") {
21959
21963
  this.setAINodeShirkWidth();
21960
21964
  this.updateElement();
@@ -35896,23 +35900,24 @@ class AINode extends BaseItem {
35896
35900
  this.linkTo = new LinkTo(this.id, this.board.events);
35897
35901
  this.text = new RichText(this.board, new Mbr, this.id, this.transformation, this.linkTo, " ", false, false, "AINode");
35898
35902
  this.transformation.subject.subscribe((_subject, op) => {
35899
- if (op.method === "translateTo" || op.method === "translateBy") {
35900
- this.text.transformCanvas();
35903
+ if (op.method === "applyMatrix") {
35904
+ if (op.matrix.scaleX !== 1 || op.matrix.scaleY !== 1) {
35905
+ this.prevMbr = this.path?.getMbr();
35906
+ this.text.handleInshapeScale();
35907
+ } else {
35908
+ this.text.transformCanvas();
35909
+ }
35901
35910
  } else if (op.method === "transformMany") {
35902
35911
  const currItemOp = op.items[this.getId()];
35903
35912
  this.prevMbr = this.path?.getMbr();
35904
- if (currItemOp.method === "translateBy" || currItemOp.method === "translateTo" || currItemOp.method === "scaleByTranslateBy" && currItemOp.scale.x === 1 && currItemOp.scale.y === 1) {
35913
+ if (currItemOp.method === "applyMatrix" && currItemOp.matrix.scaleX === 1 && currItemOp.matrix.scaleY === 1) {
35905
35914
  this.text.transformCanvas();
35906
35915
  } else {
35907
35916
  this.text.handleInshapeScale();
35908
35917
  }
35909
35918
  } else {
35910
35919
  this.prevMbr = this.path?.getMbr();
35911
- if (op.method === "scaleByTranslateBy") {
35912
- this.text.handleInshapeScale();
35913
- } else {
35914
- this.text.updateElement();
35915
- }
35920
+ this.text.updateElement();
35916
35921
  }
35917
35922
  this.transformPath();
35918
35923
  this.subject.publish(this);
@@ -39417,7 +39422,7 @@ class Shape extends BaseItem {
39417
39422
  this.transformation.subject.subscribe((_subject, op) => {
39418
39423
  this.transformPath();
39419
39424
  this.updateMbr();
39420
- if (op.method === "translateTo" || op.method === "translateBy") {
39425
+ if (op.method === "applyMatrix" && op.matrix.scaleX === 1 && op.matrix.scaleY === 1) {
39421
39426
  this.text.transformCanvas();
39422
39427
  } else {
39423
39428
  this.text.updateElement();
@@ -39944,21 +39949,21 @@ class Sticker extends BaseItem {
39944
39949
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, " ", false, true, this.itemType);
39945
39950
  this.transformation.subject.subscribe((_subject, op) => {
39946
39951
  this.transformPath();
39947
- if (op.method === "scaleBy") {
39948
- this.text.updateElement();
39949
- } else if (op.method === "scaleByTranslateBy") {
39950
- if (this.text.isAutosize()) {
39951
- this.text.scaleAutoSizeScale(Math.min(op.scale.x, op.scale.y));
39952
- this.text.recoordinate();
39953
- this.text.transformCanvas();
39954
- } else {
39955
- this.text.handleInshapeScale();
39952
+ if (op.method === "applyMatrix") {
39953
+ if (op.matrix.scaleX !== 1 || op.matrix.scaleY !== 1) {
39954
+ if (this.text.isAutosize()) {
39955
+ this.text.scaleAutoSizeScale(Math.min(op.matrix.scaleX, op.matrix.scaleY));
39956
+ this.text.recoordinate();
39957
+ this.text.transformCanvas();
39958
+ } else {
39959
+ this.text.handleInshapeScale();
39960
+ }
39956
39961
  }
39957
39962
  } else if (op.method === "transformMany") {
39958
39963
  const transformOp = op.items[this.id];
39959
- if (transformOp.method === "scaleByTranslateBy") {
39964
+ if (transformOp.method === "applyMatrix" && (transformOp.matrix.scaleX !== 1 || transformOp.matrix.scaleY !== 1)) {
39960
39965
  if (this.text.isAutosize()) {
39961
- this.text.scaleAutoSizeScale(Math.min(transformOp.scale.x, transformOp.scale.y));
39966
+ this.text.scaleAutoSizeScale(Math.min(transformOp.matrix.scaleX, transformOp.matrix.scaleY));
39962
39967
  this.text.recoordinate();
39963
39968
  this.text.transformCanvas();
39964
39969
  } else {
@@ -46199,10 +46204,8 @@ class AlignmentHelper {
46199
46204
  transformMap[id] = {
46200
46205
  class: "Transformation",
46201
46206
  item: [id],
46202
- method: "translateBy",
46203
- x,
46204
- y,
46205
- timeStamp
46207
+ method: "applyMatrix",
46208
+ matrix: { translateX: x, translateY: y, scaleX: 1, scaleY: 1, shearX: 0, shearY: 0 }
46206
46209
  };
46207
46210
  this.board.selection.transformMany(transformMap, timeStamp);
46208
46211
  }
@@ -48053,7 +48056,7 @@ class Card extends BaseItem {
48053
48056
  this.board.bringToFront(this);
48054
48057
  }, 1000);
48055
48058
  this.transformation.subject.subscribe((_, op) => {
48056
- if (this.parent === "Board" && op.method === "translateBy") {
48059
+ if (this.parent === "Board" && op.method === "applyMatrix" && op.matrix.scaleX === 1 && op.matrix.scaleY === 1) {
48057
48060
  this.throttledBringToFront();
48058
48061
  }
48059
48062
  this.updateMbr();
package/dist/cjs/node.js CHANGED
@@ -24418,15 +24418,19 @@ class RichText extends BaseItem {
24418
24418
  });
24419
24419
  this.transformation.subject.subscribe((tr, op) => {
24420
24420
  this.prevMbr = this.getMbr();
24421
- if (op.method === "translateTo" || op.method === "translateBy" || op.method === "transformMany") {
24422
- this.transformCanvas();
24423
- } else if (op.method === "scaleTo" || op.method === "scaleBy" || op.method === "scaleByTranslateBy") {
24424
- this.setAINodeShirkWidth();
24425
- if (!this.isInShape) {
24426
- this.transformCanvas();
24421
+ if (op.method === "applyMatrix") {
24422
+ if (op.matrix.scaleX !== 1 || op.matrix.scaleY !== 1) {
24423
+ this.setAINodeShirkWidth();
24424
+ if (!this.isInShape) {
24425
+ this.transformCanvas();
24426
+ } else {
24427
+ this.updateElement();
24428
+ }
24427
24429
  } else {
24428
- this.updateElement();
24430
+ this.transformCanvas();
24429
24431
  }
24432
+ } else if (op.method === "transformMany") {
24433
+ this.transformCanvas();
24430
24434
  } else if (op.method === "deserialize") {
24431
24435
  this.setAINodeShirkWidth();
24432
24436
  this.updateElement();
@@ -38369,23 +38373,24 @@ class AINode extends BaseItem {
38369
38373
  this.linkTo = new LinkTo(this.id, this.board.events);
38370
38374
  this.text = new RichText(this.board, new Mbr, this.id, this.transformation, this.linkTo, " ", false, false, "AINode");
38371
38375
  this.transformation.subject.subscribe((_subject, op) => {
38372
- if (op.method === "translateTo" || op.method === "translateBy") {
38373
- this.text.transformCanvas();
38376
+ if (op.method === "applyMatrix") {
38377
+ if (op.matrix.scaleX !== 1 || op.matrix.scaleY !== 1) {
38378
+ this.prevMbr = this.path?.getMbr();
38379
+ this.text.handleInshapeScale();
38380
+ } else {
38381
+ this.text.transformCanvas();
38382
+ }
38374
38383
  } else if (op.method === "transformMany") {
38375
38384
  const currItemOp = op.items[this.getId()];
38376
38385
  this.prevMbr = this.path?.getMbr();
38377
- if (currItemOp.method === "translateBy" || currItemOp.method === "translateTo" || currItemOp.method === "scaleByTranslateBy" && currItemOp.scale.x === 1 && currItemOp.scale.y === 1) {
38386
+ if (currItemOp.method === "applyMatrix" && currItemOp.matrix.scaleX === 1 && currItemOp.matrix.scaleY === 1) {
38378
38387
  this.text.transformCanvas();
38379
38388
  } else {
38380
38389
  this.text.handleInshapeScale();
38381
38390
  }
38382
38391
  } else {
38383
38392
  this.prevMbr = this.path?.getMbr();
38384
- if (op.method === "scaleByTranslateBy") {
38385
- this.text.handleInshapeScale();
38386
- } else {
38387
- this.text.updateElement();
38388
- }
38393
+ this.text.updateElement();
38389
38394
  }
38390
38395
  this.transformPath();
38391
38396
  this.subject.publish(this);
@@ -41890,7 +41895,7 @@ class Shape extends BaseItem {
41890
41895
  this.transformation.subject.subscribe((_subject, op) => {
41891
41896
  this.transformPath();
41892
41897
  this.updateMbr();
41893
- if (op.method === "translateTo" || op.method === "translateBy") {
41898
+ if (op.method === "applyMatrix" && op.matrix.scaleX === 1 && op.matrix.scaleY === 1) {
41894
41899
  this.text.transformCanvas();
41895
41900
  } else {
41896
41901
  this.text.updateElement();
@@ -42417,21 +42422,21 @@ class Sticker extends BaseItem {
42417
42422
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, " ", false, true, this.itemType);
42418
42423
  this.transformation.subject.subscribe((_subject, op) => {
42419
42424
  this.transformPath();
42420
- if (op.method === "scaleBy") {
42421
- this.text.updateElement();
42422
- } else if (op.method === "scaleByTranslateBy") {
42423
- if (this.text.isAutosize()) {
42424
- this.text.scaleAutoSizeScale(Math.min(op.scale.x, op.scale.y));
42425
- this.text.recoordinate();
42426
- this.text.transformCanvas();
42427
- } else {
42428
- this.text.handleInshapeScale();
42425
+ if (op.method === "applyMatrix") {
42426
+ if (op.matrix.scaleX !== 1 || op.matrix.scaleY !== 1) {
42427
+ if (this.text.isAutosize()) {
42428
+ this.text.scaleAutoSizeScale(Math.min(op.matrix.scaleX, op.matrix.scaleY));
42429
+ this.text.recoordinate();
42430
+ this.text.transformCanvas();
42431
+ } else {
42432
+ this.text.handleInshapeScale();
42433
+ }
42429
42434
  }
42430
42435
  } else if (op.method === "transformMany") {
42431
42436
  const transformOp = op.items[this.id];
42432
- if (transformOp.method === "scaleByTranslateBy") {
42437
+ if (transformOp.method === "applyMatrix" && (transformOp.matrix.scaleX !== 1 || transformOp.matrix.scaleY !== 1)) {
42433
42438
  if (this.text.isAutosize()) {
42434
- this.text.scaleAutoSizeScale(Math.min(transformOp.scale.x, transformOp.scale.y));
42439
+ this.text.scaleAutoSizeScale(Math.min(transformOp.matrix.scaleX, transformOp.matrix.scaleY));
42435
42440
  this.text.recoordinate();
42436
42441
  this.text.transformCanvas();
42437
42442
  } else {
@@ -48672,10 +48677,8 @@ class AlignmentHelper {
48672
48677
  transformMap[id] = {
48673
48678
  class: "Transformation",
48674
48679
  item: [id],
48675
- method: "translateBy",
48676
- x,
48677
- y,
48678
- timeStamp
48680
+ method: "applyMatrix",
48681
+ matrix: { translateX: x, translateY: y, scaleX: 1, scaleY: 1, shearX: 0, shearY: 0 }
48679
48682
  };
48680
48683
  this.board.selection.transformMany(transformMap, timeStamp);
48681
48684
  }
@@ -50526,7 +50529,7 @@ class Card extends BaseItem {
50526
50529
  this.board.bringToFront(this);
50527
50530
  }, 1000);
50528
50531
  this.transformation.subject.subscribe((_, op) => {
50529
- if (this.parent === "Board" && op.method === "translateBy") {
50532
+ if (this.parent === "Board" && op.method === "applyMatrix" && op.matrix.scaleX === 1 && op.matrix.scaleY === 1) {
50530
50533
  this.throttledBringToFront();
50531
50534
  }
50532
50535
  this.updateMbr();
@@ -21789,15 +21789,19 @@ class RichText extends BaseItem {
21789
21789
  });
21790
21790
  this.transformation.subject.subscribe((tr, op) => {
21791
21791
  this.prevMbr = this.getMbr();
21792
- if (op.method === "translateTo" || op.method === "translateBy" || op.method === "transformMany") {
21793
- this.transformCanvas();
21794
- } else if (op.method === "scaleTo" || op.method === "scaleBy" || op.method === "scaleByTranslateBy") {
21795
- this.setAINodeShirkWidth();
21796
- if (!this.isInShape) {
21797
- this.transformCanvas();
21792
+ if (op.method === "applyMatrix") {
21793
+ if (op.matrix.scaleX !== 1 || op.matrix.scaleY !== 1) {
21794
+ this.setAINodeShirkWidth();
21795
+ if (!this.isInShape) {
21796
+ this.transformCanvas();
21797
+ } else {
21798
+ this.updateElement();
21799
+ }
21798
21800
  } else {
21799
- this.updateElement();
21801
+ this.transformCanvas();
21800
21802
  }
21803
+ } else if (op.method === "transformMany") {
21804
+ this.transformCanvas();
21801
21805
  } else if (op.method === "deserialize") {
21802
21806
  this.setAINodeShirkWidth();
21803
21807
  this.updateElement();
@@ -35739,23 +35743,24 @@ class AINode extends BaseItem {
35739
35743
  this.linkTo = new LinkTo(this.id, this.board.events);
35740
35744
  this.text = new RichText(this.board, new Mbr, this.id, this.transformation, this.linkTo, " ", false, false, "AINode");
35741
35745
  this.transformation.subject.subscribe((_subject, op) => {
35742
- if (op.method === "translateTo" || op.method === "translateBy") {
35743
- this.text.transformCanvas();
35746
+ if (op.method === "applyMatrix") {
35747
+ if (op.matrix.scaleX !== 1 || op.matrix.scaleY !== 1) {
35748
+ this.prevMbr = this.path?.getMbr();
35749
+ this.text.handleInshapeScale();
35750
+ } else {
35751
+ this.text.transformCanvas();
35752
+ }
35744
35753
  } else if (op.method === "transformMany") {
35745
35754
  const currItemOp = op.items[this.getId()];
35746
35755
  this.prevMbr = this.path?.getMbr();
35747
- if (currItemOp.method === "translateBy" || currItemOp.method === "translateTo" || currItemOp.method === "scaleByTranslateBy" && currItemOp.scale.x === 1 && currItemOp.scale.y === 1) {
35756
+ if (currItemOp.method === "applyMatrix" && currItemOp.matrix.scaleX === 1 && currItemOp.matrix.scaleY === 1) {
35748
35757
  this.text.transformCanvas();
35749
35758
  } else {
35750
35759
  this.text.handleInshapeScale();
35751
35760
  }
35752
35761
  } else {
35753
35762
  this.prevMbr = this.path?.getMbr();
35754
- if (op.method === "scaleByTranslateBy") {
35755
- this.text.handleInshapeScale();
35756
- } else {
35757
- this.text.updateElement();
35758
- }
35763
+ this.text.updateElement();
35759
35764
  }
35760
35765
  this.transformPath();
35761
35766
  this.subject.publish(this);
@@ -39260,7 +39265,7 @@ class Shape extends BaseItem {
39260
39265
  this.transformation.subject.subscribe((_subject, op) => {
39261
39266
  this.transformPath();
39262
39267
  this.updateMbr();
39263
- if (op.method === "translateTo" || op.method === "translateBy") {
39268
+ if (op.method === "applyMatrix" && op.matrix.scaleX === 1 && op.matrix.scaleY === 1) {
39264
39269
  this.text.transformCanvas();
39265
39270
  } else {
39266
39271
  this.text.updateElement();
@@ -39787,21 +39792,21 @@ class Sticker extends BaseItem {
39787
39792
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, " ", false, true, this.itemType);
39788
39793
  this.transformation.subject.subscribe((_subject, op) => {
39789
39794
  this.transformPath();
39790
- if (op.method === "scaleBy") {
39791
- this.text.updateElement();
39792
- } else if (op.method === "scaleByTranslateBy") {
39793
- if (this.text.isAutosize()) {
39794
- this.text.scaleAutoSizeScale(Math.min(op.scale.x, op.scale.y));
39795
- this.text.recoordinate();
39796
- this.text.transformCanvas();
39797
- } else {
39798
- this.text.handleInshapeScale();
39795
+ if (op.method === "applyMatrix") {
39796
+ if (op.matrix.scaleX !== 1 || op.matrix.scaleY !== 1) {
39797
+ if (this.text.isAutosize()) {
39798
+ this.text.scaleAutoSizeScale(Math.min(op.matrix.scaleX, op.matrix.scaleY));
39799
+ this.text.recoordinate();
39800
+ this.text.transformCanvas();
39801
+ } else {
39802
+ this.text.handleInshapeScale();
39803
+ }
39799
39804
  }
39800
39805
  } else if (op.method === "transformMany") {
39801
39806
  const transformOp = op.items[this.id];
39802
- if (transformOp.method === "scaleByTranslateBy") {
39807
+ if (transformOp.method === "applyMatrix" && (transformOp.matrix.scaleX !== 1 || transformOp.matrix.scaleY !== 1)) {
39803
39808
  if (this.text.isAutosize()) {
39804
- this.text.scaleAutoSizeScale(Math.min(transformOp.scale.x, transformOp.scale.y));
39809
+ this.text.scaleAutoSizeScale(Math.min(transformOp.matrix.scaleX, transformOp.matrix.scaleY));
39805
39810
  this.text.recoordinate();
39806
39811
  this.text.transformCanvas();
39807
39812
  } else {
@@ -46042,10 +46047,8 @@ class AlignmentHelper {
46042
46047
  transformMap[id] = {
46043
46048
  class: "Transformation",
46044
46049
  item: [id],
46045
- method: "translateBy",
46046
- x,
46047
- y,
46048
- timeStamp
46050
+ method: "applyMatrix",
46051
+ matrix: { translateX: x, translateY: y, scaleX: 1, scaleY: 1, shearX: 0, shearY: 0 }
46049
46052
  };
46050
46053
  this.board.selection.transformMany(transformMap, timeStamp);
46051
46054
  }
@@ -47896,7 +47899,7 @@ class Card extends BaseItem {
47896
47899
  this.board.bringToFront(this);
47897
47900
  }, 1000);
47898
47901
  this.transformation.subject.subscribe((_, op) => {
47899
- if (this.parent === "Board" && op.method === "translateBy") {
47902
+ if (this.parent === "Board" && op.method === "applyMatrix" && op.matrix.scaleX === 1 && op.matrix.scaleY === 1) {
47900
47903
  this.throttledBringToFront();
47901
47904
  }
47902
47905
  this.updateMbr();
package/dist/esm/index.js CHANGED
@@ -21782,15 +21782,19 @@ class RichText extends BaseItem {
21782
21782
  });
21783
21783
  this.transformation.subject.subscribe((tr, op) => {
21784
21784
  this.prevMbr = this.getMbr();
21785
- if (op.method === "translateTo" || op.method === "translateBy" || op.method === "transformMany") {
21786
- this.transformCanvas();
21787
- } else if (op.method === "scaleTo" || op.method === "scaleBy" || op.method === "scaleByTranslateBy") {
21788
- this.setAINodeShirkWidth();
21789
- if (!this.isInShape) {
21790
- this.transformCanvas();
21785
+ if (op.method === "applyMatrix") {
21786
+ if (op.matrix.scaleX !== 1 || op.matrix.scaleY !== 1) {
21787
+ this.setAINodeShirkWidth();
21788
+ if (!this.isInShape) {
21789
+ this.transformCanvas();
21790
+ } else {
21791
+ this.updateElement();
21792
+ }
21791
21793
  } else {
21792
- this.updateElement();
21794
+ this.transformCanvas();
21793
21795
  }
21796
+ } else if (op.method === "transformMany") {
21797
+ this.transformCanvas();
21794
21798
  } else if (op.method === "deserialize") {
21795
21799
  this.setAINodeShirkWidth();
21796
21800
  this.updateElement();
@@ -35732,23 +35736,24 @@ class AINode extends BaseItem {
35732
35736
  this.linkTo = new LinkTo(this.id, this.board.events);
35733
35737
  this.text = new RichText(this.board, new Mbr, this.id, this.transformation, this.linkTo, " ", false, false, "AINode");
35734
35738
  this.transformation.subject.subscribe((_subject, op) => {
35735
- if (op.method === "translateTo" || op.method === "translateBy") {
35736
- this.text.transformCanvas();
35739
+ if (op.method === "applyMatrix") {
35740
+ if (op.matrix.scaleX !== 1 || op.matrix.scaleY !== 1) {
35741
+ this.prevMbr = this.path?.getMbr();
35742
+ this.text.handleInshapeScale();
35743
+ } else {
35744
+ this.text.transformCanvas();
35745
+ }
35737
35746
  } else if (op.method === "transformMany") {
35738
35747
  const currItemOp = op.items[this.getId()];
35739
35748
  this.prevMbr = this.path?.getMbr();
35740
- if (currItemOp.method === "translateBy" || currItemOp.method === "translateTo" || currItemOp.method === "scaleByTranslateBy" && currItemOp.scale.x === 1 && currItemOp.scale.y === 1) {
35749
+ if (currItemOp.method === "applyMatrix" && currItemOp.matrix.scaleX === 1 && currItemOp.matrix.scaleY === 1) {
35741
35750
  this.text.transformCanvas();
35742
35751
  } else {
35743
35752
  this.text.handleInshapeScale();
35744
35753
  }
35745
35754
  } else {
35746
35755
  this.prevMbr = this.path?.getMbr();
35747
- if (op.method === "scaleByTranslateBy") {
35748
- this.text.handleInshapeScale();
35749
- } else {
35750
- this.text.updateElement();
35751
- }
35756
+ this.text.updateElement();
35752
35757
  }
35753
35758
  this.transformPath();
35754
35759
  this.subject.publish(this);
@@ -39253,7 +39258,7 @@ class Shape extends BaseItem {
39253
39258
  this.transformation.subject.subscribe((_subject, op) => {
39254
39259
  this.transformPath();
39255
39260
  this.updateMbr();
39256
- if (op.method === "translateTo" || op.method === "translateBy") {
39261
+ if (op.method === "applyMatrix" && op.matrix.scaleX === 1 && op.matrix.scaleY === 1) {
39257
39262
  this.text.transformCanvas();
39258
39263
  } else {
39259
39264
  this.text.updateElement();
@@ -39780,21 +39785,21 @@ class Sticker extends BaseItem {
39780
39785
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, " ", false, true, this.itemType);
39781
39786
  this.transformation.subject.subscribe((_subject, op) => {
39782
39787
  this.transformPath();
39783
- if (op.method === "scaleBy") {
39784
- this.text.updateElement();
39785
- } else if (op.method === "scaleByTranslateBy") {
39786
- if (this.text.isAutosize()) {
39787
- this.text.scaleAutoSizeScale(Math.min(op.scale.x, op.scale.y));
39788
- this.text.recoordinate();
39789
- this.text.transformCanvas();
39790
- } else {
39791
- this.text.handleInshapeScale();
39788
+ if (op.method === "applyMatrix") {
39789
+ if (op.matrix.scaleX !== 1 || op.matrix.scaleY !== 1) {
39790
+ if (this.text.isAutosize()) {
39791
+ this.text.scaleAutoSizeScale(Math.min(op.matrix.scaleX, op.matrix.scaleY));
39792
+ this.text.recoordinate();
39793
+ this.text.transformCanvas();
39794
+ } else {
39795
+ this.text.handleInshapeScale();
39796
+ }
39792
39797
  }
39793
39798
  } else if (op.method === "transformMany") {
39794
39799
  const transformOp = op.items[this.id];
39795
- if (transformOp.method === "scaleByTranslateBy") {
39800
+ if (transformOp.method === "applyMatrix" && (transformOp.matrix.scaleX !== 1 || transformOp.matrix.scaleY !== 1)) {
39796
39801
  if (this.text.isAutosize()) {
39797
- this.text.scaleAutoSizeScale(Math.min(transformOp.scale.x, transformOp.scale.y));
39802
+ this.text.scaleAutoSizeScale(Math.min(transformOp.matrix.scaleX, transformOp.matrix.scaleY));
39798
39803
  this.text.recoordinate();
39799
39804
  this.text.transformCanvas();
39800
39805
  } else {
@@ -46035,10 +46040,8 @@ class AlignmentHelper {
46035
46040
  transformMap[id] = {
46036
46041
  class: "Transformation",
46037
46042
  item: [id],
46038
- method: "translateBy",
46039
- x,
46040
- y,
46041
- timeStamp
46043
+ method: "applyMatrix",
46044
+ matrix: { translateX: x, translateY: y, scaleX: 1, scaleY: 1, shearX: 0, shearY: 0 }
46042
46045
  };
46043
46046
  this.board.selection.transformMany(transformMap, timeStamp);
46044
46047
  }
@@ -47889,7 +47892,7 @@ class Card extends BaseItem {
47889
47892
  this.board.bringToFront(this);
47890
47893
  }, 1000);
47891
47894
  this.transformation.subject.subscribe((_, op) => {
47892
- if (this.parent === "Board" && op.method === "translateBy") {
47895
+ if (this.parent === "Board" && op.method === "applyMatrix" && op.matrix.scaleX === 1 && op.matrix.scaleY === 1) {
47893
47896
  this.throttledBringToFront();
47894
47897
  }
47895
47898
  this.updateMbr();
package/dist/esm/node.js CHANGED
@@ -24249,15 +24249,19 @@ class RichText extends BaseItem {
24249
24249
  });
24250
24250
  this.transformation.subject.subscribe((tr, op) => {
24251
24251
  this.prevMbr = this.getMbr();
24252
- if (op.method === "translateTo" || op.method === "translateBy" || op.method === "transformMany") {
24253
- this.transformCanvas();
24254
- } else if (op.method === "scaleTo" || op.method === "scaleBy" || op.method === "scaleByTranslateBy") {
24255
- this.setAINodeShirkWidth();
24256
- if (!this.isInShape) {
24257
- this.transformCanvas();
24252
+ if (op.method === "applyMatrix") {
24253
+ if (op.matrix.scaleX !== 1 || op.matrix.scaleY !== 1) {
24254
+ this.setAINodeShirkWidth();
24255
+ if (!this.isInShape) {
24256
+ this.transformCanvas();
24257
+ } else {
24258
+ this.updateElement();
24259
+ }
24258
24260
  } else {
24259
- this.updateElement();
24261
+ this.transformCanvas();
24260
24262
  }
24263
+ } else if (op.method === "transformMany") {
24264
+ this.transformCanvas();
24261
24265
  } else if (op.method === "deserialize") {
24262
24266
  this.setAINodeShirkWidth();
24263
24267
  this.updateElement();
@@ -38200,23 +38204,24 @@ class AINode extends BaseItem {
38200
38204
  this.linkTo = new LinkTo(this.id, this.board.events);
38201
38205
  this.text = new RichText(this.board, new Mbr, this.id, this.transformation, this.linkTo, " ", false, false, "AINode");
38202
38206
  this.transformation.subject.subscribe((_subject, op) => {
38203
- if (op.method === "translateTo" || op.method === "translateBy") {
38204
- this.text.transformCanvas();
38207
+ if (op.method === "applyMatrix") {
38208
+ if (op.matrix.scaleX !== 1 || op.matrix.scaleY !== 1) {
38209
+ this.prevMbr = this.path?.getMbr();
38210
+ this.text.handleInshapeScale();
38211
+ } else {
38212
+ this.text.transformCanvas();
38213
+ }
38205
38214
  } else if (op.method === "transformMany") {
38206
38215
  const currItemOp = op.items[this.getId()];
38207
38216
  this.prevMbr = this.path?.getMbr();
38208
- if (currItemOp.method === "translateBy" || currItemOp.method === "translateTo" || currItemOp.method === "scaleByTranslateBy" && currItemOp.scale.x === 1 && currItemOp.scale.y === 1) {
38217
+ if (currItemOp.method === "applyMatrix" && currItemOp.matrix.scaleX === 1 && currItemOp.matrix.scaleY === 1) {
38209
38218
  this.text.transformCanvas();
38210
38219
  } else {
38211
38220
  this.text.handleInshapeScale();
38212
38221
  }
38213
38222
  } else {
38214
38223
  this.prevMbr = this.path?.getMbr();
38215
- if (op.method === "scaleByTranslateBy") {
38216
- this.text.handleInshapeScale();
38217
- } else {
38218
- this.text.updateElement();
38219
- }
38224
+ this.text.updateElement();
38220
38225
  }
38221
38226
  this.transformPath();
38222
38227
  this.subject.publish(this);
@@ -41721,7 +41726,7 @@ class Shape extends BaseItem {
41721
41726
  this.transformation.subject.subscribe((_subject, op) => {
41722
41727
  this.transformPath();
41723
41728
  this.updateMbr();
41724
- if (op.method === "translateTo" || op.method === "translateBy") {
41729
+ if (op.method === "applyMatrix" && op.matrix.scaleX === 1 && op.matrix.scaleY === 1) {
41725
41730
  this.text.transformCanvas();
41726
41731
  } else {
41727
41732
  this.text.updateElement();
@@ -42248,21 +42253,21 @@ class Sticker extends BaseItem {
42248
42253
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, " ", false, true, this.itemType);
42249
42254
  this.transformation.subject.subscribe((_subject, op) => {
42250
42255
  this.transformPath();
42251
- if (op.method === "scaleBy") {
42252
- this.text.updateElement();
42253
- } else if (op.method === "scaleByTranslateBy") {
42254
- if (this.text.isAutosize()) {
42255
- this.text.scaleAutoSizeScale(Math.min(op.scale.x, op.scale.y));
42256
- this.text.recoordinate();
42257
- this.text.transformCanvas();
42258
- } else {
42259
- this.text.handleInshapeScale();
42256
+ if (op.method === "applyMatrix") {
42257
+ if (op.matrix.scaleX !== 1 || op.matrix.scaleY !== 1) {
42258
+ if (this.text.isAutosize()) {
42259
+ this.text.scaleAutoSizeScale(Math.min(op.matrix.scaleX, op.matrix.scaleY));
42260
+ this.text.recoordinate();
42261
+ this.text.transformCanvas();
42262
+ } else {
42263
+ this.text.handleInshapeScale();
42264
+ }
42260
42265
  }
42261
42266
  } else if (op.method === "transformMany") {
42262
42267
  const transformOp = op.items[this.id];
42263
- if (transformOp.method === "scaleByTranslateBy") {
42268
+ if (transformOp.method === "applyMatrix" && (transformOp.matrix.scaleX !== 1 || transformOp.matrix.scaleY !== 1)) {
42264
42269
  if (this.text.isAutosize()) {
42265
- this.text.scaleAutoSizeScale(Math.min(transformOp.scale.x, transformOp.scale.y));
42270
+ this.text.scaleAutoSizeScale(Math.min(transformOp.matrix.scaleX, transformOp.matrix.scaleY));
42266
42271
  this.text.recoordinate();
42267
42272
  this.text.transformCanvas();
42268
42273
  } else {
@@ -48503,10 +48508,8 @@ class AlignmentHelper {
48503
48508
  transformMap[id] = {
48504
48509
  class: "Transformation",
48505
48510
  item: [id],
48506
- method: "translateBy",
48507
- x,
48508
- y,
48509
- timeStamp
48511
+ method: "applyMatrix",
48512
+ matrix: { translateX: x, translateY: y, scaleX: 1, scaleY: 1, shearX: 0, shearY: 0 }
48510
48513
  };
48511
48514
  this.board.selection.transformMany(transformMap, timeStamp);
48512
48515
  }
@@ -50357,7 +50360,7 @@ class Card extends BaseItem {
50357
50360
  this.board.bringToFront(this);
50358
50361
  }, 1000);
50359
50362
  this.transformation.subject.subscribe((_, op) => {
50360
- if (this.parent === "Board" && op.method === "translateBy") {
50363
+ if (this.parent === "Board" && op.method === "applyMatrix" && op.matrix.scaleX === 1 && op.matrix.scaleY === 1) {
50361
50364
  this.throttledBringToFront();
50362
50365
  }
50363
50366
  this.updateMbr();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.5.140",
3
+ "version": "0.5.142",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",