microboard-temp 0.11.7 → 0.11.9

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.
@@ -22380,7 +22380,7 @@ class RichText extends BaseItem {
22380
22380
  }
22381
22381
  getMaxWidth() {
22382
22382
  if (this.autoSize) {
22383
- return this.editor.maxWidth;
22383
+ return this.editor.maxWidth || this.getTransformedContainer().getWidth();
22384
22384
  }
22385
22385
  if (this.isContainerSet) {
22386
22386
  return this.getTransformedContainer().getWidth();
@@ -22412,13 +22412,26 @@ class RichText extends BaseItem {
22412
22412
  left = container.left;
22413
22413
  top = container.top;
22414
22414
  }
22415
+ const point3 = new Point(left, top);
22416
+ if (this.worldMatrixGetter) {
22417
+ this.worldMatrixGetter().apply(point3);
22418
+ } else if (this.isInShape) {
22419
+ const item = this.board.items.getById(this.id);
22420
+ if (item) {
22421
+ item.getParentWorldMatrix().apply(point3);
22422
+ } else {
22423
+ this.getParentWorldMatrix().apply(point3);
22424
+ }
22425
+ } else {
22426
+ this.getParentWorldMatrix().apply(point3);
22427
+ }
22415
22428
  return {
22416
- point: new Point(left, top),
22429
+ point: point3,
22417
22430
  width,
22418
22431
  height,
22419
22432
  maxWidth: maxWidth ? maxWidth + 1 : undefined,
22420
22433
  maxHeight,
22421
- textScale: this.isInShape ? 1 : this.getScale()
22434
+ textScale: this.getScale()
22422
22435
  };
22423
22436
  }
22424
22437
  transformCanvas() {
@@ -40477,7 +40490,6 @@ class Sticker extends BaseItem {
40477
40490
  this.linkTo = new LinkTo(this.id, this.board.events);
40478
40491
  this.transformation = new Transformation(this.id, this.board.events);
40479
40492
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, " ", false, true, this.itemType);
40480
- this.text.worldMatrixGetter = () => this.getWorldMatrix();
40481
40493
  this.transformation.subject.subscribe((_subject, op) => {
40482
40494
  this.transformPath();
40483
40495
  if (op.method === "applyMatrix") {
@@ -53413,18 +53425,19 @@ class BoardSelection {
53413
53425
  }
53414
53426
  }
53415
53427
  setTextToEdit(item) {
53416
- if (this.textToEdit) {
53428
+ const text5 = item?.getRichText();
53429
+ if (this.textToEdit && this.textToEdit !== text5) {
53417
53430
  this.textToEdit.updateElement();
53418
53431
  this.textToEdit.enableRender();
53419
53432
  }
53420
- if (!(item && item.getRichText())) {
53433
+ if (!text5) {
53421
53434
  this.textToEdit = undefined;
53422
53435
  return;
53423
53436
  }
53424
- const text5 = item.getRichText();
53425
- if (!text5) {
53437
+ if (this.textToEdit === text5) {
53426
53438
  return;
53427
53439
  }
53440
+ this.textToEdit = text5;
53428
53441
  if (text5.isEmpty()) {
53429
53442
  const textColor = tempStorage.getFontColor(item.itemType);
53430
53443
  const textSize = tempStorage.getFontSize(item.itemType);
@@ -53458,7 +53471,6 @@ class BoardSelection {
53458
53471
  this.setVerticalAlignment(verticalAlignment);
53459
53472
  }
53460
53473
  }
53461
- this.textToEdit = text5;
53462
53474
  text5.editor.selectWholeText();
53463
53475
  this.textToEdit.disableRender();
53464
53476
  this.board.items.subject.publish(this.board.items);
package/dist/cjs/index.js CHANGED
@@ -22380,7 +22380,7 @@ class RichText extends BaseItem {
22380
22380
  }
22381
22381
  getMaxWidth() {
22382
22382
  if (this.autoSize) {
22383
- return this.editor.maxWidth;
22383
+ return this.editor.maxWidth || this.getTransformedContainer().getWidth();
22384
22384
  }
22385
22385
  if (this.isContainerSet) {
22386
22386
  return this.getTransformedContainer().getWidth();
@@ -22412,13 +22412,26 @@ class RichText extends BaseItem {
22412
22412
  left = container.left;
22413
22413
  top = container.top;
22414
22414
  }
22415
+ const point3 = new Point(left, top);
22416
+ if (this.worldMatrixGetter) {
22417
+ this.worldMatrixGetter().apply(point3);
22418
+ } else if (this.isInShape) {
22419
+ const item = this.board.items.getById(this.id);
22420
+ if (item) {
22421
+ item.getParentWorldMatrix().apply(point3);
22422
+ } else {
22423
+ this.getParentWorldMatrix().apply(point3);
22424
+ }
22425
+ } else {
22426
+ this.getParentWorldMatrix().apply(point3);
22427
+ }
22415
22428
  return {
22416
- point: new Point(left, top),
22429
+ point: point3,
22417
22430
  width,
22418
22431
  height,
22419
22432
  maxWidth: maxWidth ? maxWidth + 1 : undefined,
22420
22433
  maxHeight,
22421
- textScale: this.isInShape ? 1 : this.getScale()
22434
+ textScale: this.getScale()
22422
22435
  };
22423
22436
  }
22424
22437
  transformCanvas() {
@@ -40477,7 +40490,6 @@ class Sticker extends BaseItem {
40477
40490
  this.linkTo = new LinkTo(this.id, this.board.events);
40478
40491
  this.transformation = new Transformation(this.id, this.board.events);
40479
40492
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, " ", false, true, this.itemType);
40480
- this.text.worldMatrixGetter = () => this.getWorldMatrix();
40481
40493
  this.transformation.subject.subscribe((_subject, op) => {
40482
40494
  this.transformPath();
40483
40495
  if (op.method === "applyMatrix") {
@@ -53413,18 +53425,19 @@ class BoardSelection {
53413
53425
  }
53414
53426
  }
53415
53427
  setTextToEdit(item) {
53416
- if (this.textToEdit) {
53428
+ const text5 = item?.getRichText();
53429
+ if (this.textToEdit && this.textToEdit !== text5) {
53417
53430
  this.textToEdit.updateElement();
53418
53431
  this.textToEdit.enableRender();
53419
53432
  }
53420
- if (!(item && item.getRichText())) {
53433
+ if (!text5) {
53421
53434
  this.textToEdit = undefined;
53422
53435
  return;
53423
53436
  }
53424
- const text5 = item.getRichText();
53425
- if (!text5) {
53437
+ if (this.textToEdit === text5) {
53426
53438
  return;
53427
53439
  }
53440
+ this.textToEdit = text5;
53428
53441
  if (text5.isEmpty()) {
53429
53442
  const textColor = tempStorage.getFontColor(item.itemType);
53430
53443
  const textSize = tempStorage.getFontSize(item.itemType);
@@ -53458,7 +53471,6 @@ class BoardSelection {
53458
53471
  this.setVerticalAlignment(verticalAlignment);
53459
53472
  }
53460
53473
  }
53461
- this.textToEdit = text5;
53462
53474
  text5.editor.selectWholeText();
53463
53475
  this.textToEdit.disableRender();
53464
53476
  this.board.items.subject.publish(this.board.items);
package/dist/cjs/node.js CHANGED
@@ -24852,7 +24852,7 @@ class RichText extends BaseItem {
24852
24852
  }
24853
24853
  getMaxWidth() {
24854
24854
  if (this.autoSize) {
24855
- return this.editor.maxWidth;
24855
+ return this.editor.maxWidth || this.getTransformedContainer().getWidth();
24856
24856
  }
24857
24857
  if (this.isContainerSet) {
24858
24858
  return this.getTransformedContainer().getWidth();
@@ -24884,13 +24884,26 @@ class RichText extends BaseItem {
24884
24884
  left = container.left;
24885
24885
  top = container.top;
24886
24886
  }
24887
+ const point3 = new Point(left, top);
24888
+ if (this.worldMatrixGetter) {
24889
+ this.worldMatrixGetter().apply(point3);
24890
+ } else if (this.isInShape) {
24891
+ const item = this.board.items.getById(this.id);
24892
+ if (item) {
24893
+ item.getParentWorldMatrix().apply(point3);
24894
+ } else {
24895
+ this.getParentWorldMatrix().apply(point3);
24896
+ }
24897
+ } else {
24898
+ this.getParentWorldMatrix().apply(point3);
24899
+ }
24887
24900
  return {
24888
- point: new Point(left, top),
24901
+ point: point3,
24889
24902
  width,
24890
24903
  height,
24891
24904
  maxWidth: maxWidth ? maxWidth + 1 : undefined,
24892
24905
  maxHeight,
24893
- textScale: this.isInShape ? 1 : this.getScale()
24906
+ textScale: this.getScale()
24894
24907
  };
24895
24908
  }
24896
24909
  transformCanvas() {
@@ -42950,7 +42963,6 @@ class Sticker extends BaseItem {
42950
42963
  this.linkTo = new LinkTo(this.id, this.board.events);
42951
42964
  this.transformation = new Transformation(this.id, this.board.events);
42952
42965
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, " ", false, true, this.itemType);
42953
- this.text.worldMatrixGetter = () => this.getWorldMatrix();
42954
42966
  this.transformation.subject.subscribe((_subject, op) => {
42955
42967
  this.transformPath();
42956
42968
  if (op.method === "applyMatrix") {
@@ -55886,18 +55898,19 @@ class BoardSelection {
55886
55898
  }
55887
55899
  }
55888
55900
  setTextToEdit(item) {
55889
- if (this.textToEdit) {
55901
+ const text5 = item?.getRichText();
55902
+ if (this.textToEdit && this.textToEdit !== text5) {
55890
55903
  this.textToEdit.updateElement();
55891
55904
  this.textToEdit.enableRender();
55892
55905
  }
55893
- if (!(item && item.getRichText())) {
55906
+ if (!text5) {
55894
55907
  this.textToEdit = undefined;
55895
55908
  return;
55896
55909
  }
55897
- const text5 = item.getRichText();
55898
- if (!text5) {
55910
+ if (this.textToEdit === text5) {
55899
55911
  return;
55900
55912
  }
55913
+ this.textToEdit = text5;
55901
55914
  if (text5.isEmpty()) {
55902
55915
  const textColor = tempStorage.getFontColor(item.itemType);
55903
55916
  const textSize = tempStorage.getFontSize(item.itemType);
@@ -55931,7 +55944,6 @@ class BoardSelection {
55931
55944
  this.setVerticalAlignment(verticalAlignment);
55932
55945
  }
55933
55946
  }
55934
- this.textToEdit = text5;
55935
55947
  text5.editor.selectWholeText();
55936
55948
  this.textToEdit.disableRender();
55937
55949
  this.board.items.subject.publish(this.board.items);
@@ -22209,7 +22209,7 @@ class RichText extends BaseItem {
22209
22209
  }
22210
22210
  getMaxWidth() {
22211
22211
  if (this.autoSize) {
22212
- return this.editor.maxWidth;
22212
+ return this.editor.maxWidth || this.getTransformedContainer().getWidth();
22213
22213
  }
22214
22214
  if (this.isContainerSet) {
22215
22215
  return this.getTransformedContainer().getWidth();
@@ -22241,13 +22241,26 @@ class RichText extends BaseItem {
22241
22241
  left = container.left;
22242
22242
  top = container.top;
22243
22243
  }
22244
+ const point3 = new Point(left, top);
22245
+ if (this.worldMatrixGetter) {
22246
+ this.worldMatrixGetter().apply(point3);
22247
+ } else if (this.isInShape) {
22248
+ const item = this.board.items.getById(this.id);
22249
+ if (item) {
22250
+ item.getParentWorldMatrix().apply(point3);
22251
+ } else {
22252
+ this.getParentWorldMatrix().apply(point3);
22253
+ }
22254
+ } else {
22255
+ this.getParentWorldMatrix().apply(point3);
22256
+ }
22244
22257
  return {
22245
- point: new Point(left, top),
22258
+ point: point3,
22246
22259
  width,
22247
22260
  height,
22248
22261
  maxWidth: maxWidth ? maxWidth + 1 : undefined,
22249
22262
  maxHeight,
22250
- textScale: this.isInShape ? 1 : this.getScale()
22263
+ textScale: this.getScale()
22251
22264
  };
22252
22265
  }
22253
22266
  transformCanvas() {
@@ -40306,7 +40319,6 @@ class Sticker extends BaseItem {
40306
40319
  this.linkTo = new LinkTo(this.id, this.board.events);
40307
40320
  this.transformation = new Transformation(this.id, this.board.events);
40308
40321
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, " ", false, true, this.itemType);
40309
- this.text.worldMatrixGetter = () => this.getWorldMatrix();
40310
40322
  this.transformation.subject.subscribe((_subject, op) => {
40311
40323
  this.transformPath();
40312
40324
  if (op.method === "applyMatrix") {
@@ -53242,18 +53254,19 @@ class BoardSelection {
53242
53254
  }
53243
53255
  }
53244
53256
  setTextToEdit(item) {
53245
- if (this.textToEdit) {
53257
+ const text5 = item?.getRichText();
53258
+ if (this.textToEdit && this.textToEdit !== text5) {
53246
53259
  this.textToEdit.updateElement();
53247
53260
  this.textToEdit.enableRender();
53248
53261
  }
53249
- if (!(item && item.getRichText())) {
53262
+ if (!text5) {
53250
53263
  this.textToEdit = undefined;
53251
53264
  return;
53252
53265
  }
53253
- const text5 = item.getRichText();
53254
- if (!text5) {
53266
+ if (this.textToEdit === text5) {
53255
53267
  return;
53256
53268
  }
53269
+ this.textToEdit = text5;
53257
53270
  if (text5.isEmpty()) {
53258
53271
  const textColor = tempStorage.getFontColor(item.itemType);
53259
53272
  const textSize = tempStorage.getFontSize(item.itemType);
@@ -53287,7 +53300,6 @@ class BoardSelection {
53287
53300
  this.setVerticalAlignment(verticalAlignment);
53288
53301
  }
53289
53302
  }
53290
- this.textToEdit = text5;
53291
53303
  text5.editor.selectWholeText();
53292
53304
  this.textToEdit.disableRender();
53293
53305
  this.board.items.subject.publish(this.board.items);
package/dist/esm/index.js CHANGED
@@ -22202,7 +22202,7 @@ class RichText extends BaseItem {
22202
22202
  }
22203
22203
  getMaxWidth() {
22204
22204
  if (this.autoSize) {
22205
- return this.editor.maxWidth;
22205
+ return this.editor.maxWidth || this.getTransformedContainer().getWidth();
22206
22206
  }
22207
22207
  if (this.isContainerSet) {
22208
22208
  return this.getTransformedContainer().getWidth();
@@ -22234,13 +22234,26 @@ class RichText extends BaseItem {
22234
22234
  left = container.left;
22235
22235
  top = container.top;
22236
22236
  }
22237
+ const point3 = new Point(left, top);
22238
+ if (this.worldMatrixGetter) {
22239
+ this.worldMatrixGetter().apply(point3);
22240
+ } else if (this.isInShape) {
22241
+ const item = this.board.items.getById(this.id);
22242
+ if (item) {
22243
+ item.getParentWorldMatrix().apply(point3);
22244
+ } else {
22245
+ this.getParentWorldMatrix().apply(point3);
22246
+ }
22247
+ } else {
22248
+ this.getParentWorldMatrix().apply(point3);
22249
+ }
22237
22250
  return {
22238
- point: new Point(left, top),
22251
+ point: point3,
22239
22252
  width,
22240
22253
  height,
22241
22254
  maxWidth: maxWidth ? maxWidth + 1 : undefined,
22242
22255
  maxHeight,
22243
- textScale: this.isInShape ? 1 : this.getScale()
22256
+ textScale: this.getScale()
22244
22257
  };
22245
22258
  }
22246
22259
  transformCanvas() {
@@ -40299,7 +40312,6 @@ class Sticker extends BaseItem {
40299
40312
  this.linkTo = new LinkTo(this.id, this.board.events);
40300
40313
  this.transformation = new Transformation(this.id, this.board.events);
40301
40314
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, " ", false, true, this.itemType);
40302
- this.text.worldMatrixGetter = () => this.getWorldMatrix();
40303
40315
  this.transformation.subject.subscribe((_subject, op) => {
40304
40316
  this.transformPath();
40305
40317
  if (op.method === "applyMatrix") {
@@ -53235,18 +53247,19 @@ class BoardSelection {
53235
53247
  }
53236
53248
  }
53237
53249
  setTextToEdit(item) {
53238
- if (this.textToEdit) {
53250
+ const text5 = item?.getRichText();
53251
+ if (this.textToEdit && this.textToEdit !== text5) {
53239
53252
  this.textToEdit.updateElement();
53240
53253
  this.textToEdit.enableRender();
53241
53254
  }
53242
- if (!(item && item.getRichText())) {
53255
+ if (!text5) {
53243
53256
  this.textToEdit = undefined;
53244
53257
  return;
53245
53258
  }
53246
- const text5 = item.getRichText();
53247
- if (!text5) {
53259
+ if (this.textToEdit === text5) {
53248
53260
  return;
53249
53261
  }
53262
+ this.textToEdit = text5;
53250
53263
  if (text5.isEmpty()) {
53251
53264
  const textColor = tempStorage.getFontColor(item.itemType);
53252
53265
  const textSize = tempStorage.getFontSize(item.itemType);
@@ -53280,7 +53293,6 @@ class BoardSelection {
53280
53293
  this.setVerticalAlignment(verticalAlignment);
53281
53294
  }
53282
53295
  }
53283
- this.textToEdit = text5;
53284
53296
  text5.editor.selectWholeText();
53285
53297
  this.textToEdit.disableRender();
53286
53298
  this.board.items.subject.publish(this.board.items);
package/dist/esm/node.js CHANGED
@@ -24669,7 +24669,7 @@ class RichText extends BaseItem {
24669
24669
  }
24670
24670
  getMaxWidth() {
24671
24671
  if (this.autoSize) {
24672
- return this.editor.maxWidth;
24672
+ return this.editor.maxWidth || this.getTransformedContainer().getWidth();
24673
24673
  }
24674
24674
  if (this.isContainerSet) {
24675
24675
  return this.getTransformedContainer().getWidth();
@@ -24701,13 +24701,26 @@ class RichText extends BaseItem {
24701
24701
  left = container.left;
24702
24702
  top = container.top;
24703
24703
  }
24704
+ const point3 = new Point(left, top);
24705
+ if (this.worldMatrixGetter) {
24706
+ this.worldMatrixGetter().apply(point3);
24707
+ } else if (this.isInShape) {
24708
+ const item = this.board.items.getById(this.id);
24709
+ if (item) {
24710
+ item.getParentWorldMatrix().apply(point3);
24711
+ } else {
24712
+ this.getParentWorldMatrix().apply(point3);
24713
+ }
24714
+ } else {
24715
+ this.getParentWorldMatrix().apply(point3);
24716
+ }
24704
24717
  return {
24705
- point: new Point(left, top),
24718
+ point: point3,
24706
24719
  width,
24707
24720
  height,
24708
24721
  maxWidth: maxWidth ? maxWidth + 1 : undefined,
24709
24722
  maxHeight,
24710
- textScale: this.isInShape ? 1 : this.getScale()
24723
+ textScale: this.getScale()
24711
24724
  };
24712
24725
  }
24713
24726
  transformCanvas() {
@@ -42767,7 +42780,6 @@ class Sticker extends BaseItem {
42767
42780
  this.linkTo = new LinkTo(this.id, this.board.events);
42768
42781
  this.transformation = new Transformation(this.id, this.board.events);
42769
42782
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, " ", false, true, this.itemType);
42770
- this.text.worldMatrixGetter = () => this.getWorldMatrix();
42771
42783
  this.transformation.subject.subscribe((_subject, op) => {
42772
42784
  this.transformPath();
42773
42785
  if (op.method === "applyMatrix") {
@@ -55703,18 +55715,19 @@ class BoardSelection {
55703
55715
  }
55704
55716
  }
55705
55717
  setTextToEdit(item) {
55706
- if (this.textToEdit) {
55718
+ const text5 = item?.getRichText();
55719
+ if (this.textToEdit && this.textToEdit !== text5) {
55707
55720
  this.textToEdit.updateElement();
55708
55721
  this.textToEdit.enableRender();
55709
55722
  }
55710
- if (!(item && item.getRichText())) {
55723
+ if (!text5) {
55711
55724
  this.textToEdit = undefined;
55712
55725
  return;
55713
55726
  }
55714
- const text5 = item.getRichText();
55715
- if (!text5) {
55727
+ if (this.textToEdit === text5) {
55716
55728
  return;
55717
55729
  }
55730
+ this.textToEdit = text5;
55718
55731
  if (text5.isEmpty()) {
55719
55732
  const textColor = tempStorage.getFontColor(item.itemType);
55720
55733
  const textSize = tempStorage.getFontSize(item.itemType);
@@ -55748,7 +55761,6 @@ class BoardSelection {
55748
55761
  this.setVerticalAlignment(verticalAlignment);
55749
55762
  }
55750
55763
  }
55751
- this.textToEdit = text5;
55752
55764
  text5.editor.selectWholeText();
55753
55765
  this.textToEdit.disableRender();
55754
55766
  this.board.items.subject.publish(this.board.items);
@@ -73,7 +73,6 @@ export declare class RichText extends BaseItem {
73
73
  getTextWidth(): number;
74
74
  getMaxWidth(): number | undefined;
75
75
  getMaxHeight(): number | undefined;
76
- /** Get text dimensions for text editor */
77
76
  getDimensions(): {
78
77
  point: Point;
79
78
  width: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.11.7",
3
+ "version": "0.11.9",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",