microboard-temp 0.5.39 → 0.5.40

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.
@@ -47893,6 +47893,9 @@ class Card extends BaseItem {
47893
47893
  });
47894
47894
  this.updateMbr();
47895
47895
  }
47896
+ getDimensions() {
47897
+ return this.dimensions;
47898
+ }
47896
47899
  createImages() {
47897
47900
  this.face = conf.documentFactory.createElement("img");
47898
47901
  this.backside = conf.documentFactory.createElement("img");
@@ -48102,7 +48105,9 @@ class Deck extends BaseItem {
48102
48105
  childIds.forEach((childId) => {
48103
48106
  const foundItem = this.board.items.getById(childId);
48104
48107
  if (this.parent !== childId && this.getId() !== childId) {
48105
- const canAddItem = !this.index?.getById(childId) && foundItem instanceof Card && (typeof this.isPerpendicular === "undefined" || this.isPerpendicular === foundItem.getIsRotatedPerpendicular());
48108
+ const firstCard = this.getFirstCard();
48109
+ const firstCardDimensions = firstCard?.getDimensions();
48110
+ const canAddItem = !this.index?.getById(childId) && foundItem instanceof Card && (typeof this.isPerpendicular === "undefined" || this.isPerpendicular === foundItem.getIsRotatedPerpendicular()) && (!firstCardDimensions || firstCardDimensions.width === foundItem.getDimensions().width && firstCardDimensions.height === foundItem.getDimensions().height);
48106
48111
  if (canAddItem) {
48107
48112
  this.isPerpendicular = foundItem.getIsRotatedPerpendicular();
48108
48113
  foundItem.transformation.apply({
@@ -48112,6 +48117,19 @@ class Deck extends BaseItem {
48112
48117
  x: this.left + (this.index?.list().length || 0) * (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET),
48113
48118
  y: this.top + (this.index?.list().length || 0) * (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET : 0)
48114
48119
  });
48120
+ if (firstCard) {
48121
+ const { scaleX, scaleY } = foundItem.transformation.matrix;
48122
+ const { scaleX: targetScaleX, scaleY: targetScaleY } = firstCard.transformation.matrix;
48123
+ if (scaleX !== targetScaleX || scaleY !== targetScaleY) {
48124
+ foundItem.transformation.apply({
48125
+ class: "Transformation",
48126
+ method: "scaleTo",
48127
+ item: [this.id],
48128
+ x: targetScaleX,
48129
+ y: targetScaleY
48130
+ });
48131
+ }
48132
+ }
48115
48133
  this.board.selection.remove(foundItem);
48116
48134
  this.board.items.index.remove(foundItem);
48117
48135
  foundItem.parent = this.getId();
@@ -48276,6 +48294,9 @@ class Deck extends BaseItem {
48276
48294
  this.isCacheDirty = false;
48277
48295
  this.updateMbr();
48278
48296
  }
48297
+ getFirstCard() {
48298
+ return this.index?.list()[0];
48299
+ }
48279
48300
  }
48280
48301
  registerItem({
48281
48302
  item: Deck,
package/dist/cjs/index.js CHANGED
@@ -47893,6 +47893,9 @@ class Card extends BaseItem {
47893
47893
  });
47894
47894
  this.updateMbr();
47895
47895
  }
47896
+ getDimensions() {
47897
+ return this.dimensions;
47898
+ }
47896
47899
  createImages() {
47897
47900
  this.face = conf.documentFactory.createElement("img");
47898
47901
  this.backside = conf.documentFactory.createElement("img");
@@ -48102,7 +48105,9 @@ class Deck extends BaseItem {
48102
48105
  childIds.forEach((childId) => {
48103
48106
  const foundItem = this.board.items.getById(childId);
48104
48107
  if (this.parent !== childId && this.getId() !== childId) {
48105
- const canAddItem = !this.index?.getById(childId) && foundItem instanceof Card && (typeof this.isPerpendicular === "undefined" || this.isPerpendicular === foundItem.getIsRotatedPerpendicular());
48108
+ const firstCard = this.getFirstCard();
48109
+ const firstCardDimensions = firstCard?.getDimensions();
48110
+ const canAddItem = !this.index?.getById(childId) && foundItem instanceof Card && (typeof this.isPerpendicular === "undefined" || this.isPerpendicular === foundItem.getIsRotatedPerpendicular()) && (!firstCardDimensions || firstCardDimensions.width === foundItem.getDimensions().width && firstCardDimensions.height === foundItem.getDimensions().height);
48106
48111
  if (canAddItem) {
48107
48112
  this.isPerpendicular = foundItem.getIsRotatedPerpendicular();
48108
48113
  foundItem.transformation.apply({
@@ -48112,6 +48117,19 @@ class Deck extends BaseItem {
48112
48117
  x: this.left + (this.index?.list().length || 0) * (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET),
48113
48118
  y: this.top + (this.index?.list().length || 0) * (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET : 0)
48114
48119
  });
48120
+ if (firstCard) {
48121
+ const { scaleX, scaleY } = foundItem.transformation.matrix;
48122
+ const { scaleX: targetScaleX, scaleY: targetScaleY } = firstCard.transformation.matrix;
48123
+ if (scaleX !== targetScaleX || scaleY !== targetScaleY) {
48124
+ foundItem.transformation.apply({
48125
+ class: "Transformation",
48126
+ method: "scaleTo",
48127
+ item: [this.id],
48128
+ x: targetScaleX,
48129
+ y: targetScaleY
48130
+ });
48131
+ }
48132
+ }
48115
48133
  this.board.selection.remove(foundItem);
48116
48134
  this.board.items.index.remove(foundItem);
48117
48135
  foundItem.parent = this.getId();
@@ -48276,6 +48294,9 @@ class Deck extends BaseItem {
48276
48294
  this.isCacheDirty = false;
48277
48295
  this.updateMbr();
48278
48296
  }
48297
+ getFirstCard() {
48298
+ return this.index?.list()[0];
48299
+ }
48279
48300
  }
48280
48301
  registerItem({
48281
48302
  item: Deck,
package/dist/cjs/node.js CHANGED
@@ -50366,6 +50366,9 @@ class Card extends BaseItem {
50366
50366
  });
50367
50367
  this.updateMbr();
50368
50368
  }
50369
+ getDimensions() {
50370
+ return this.dimensions;
50371
+ }
50369
50372
  createImages() {
50370
50373
  this.face = conf.documentFactory.createElement("img");
50371
50374
  this.backside = conf.documentFactory.createElement("img");
@@ -50575,7 +50578,9 @@ class Deck extends BaseItem {
50575
50578
  childIds.forEach((childId) => {
50576
50579
  const foundItem = this.board.items.getById(childId);
50577
50580
  if (this.parent !== childId && this.getId() !== childId) {
50578
- const canAddItem = !this.index?.getById(childId) && foundItem instanceof Card && (typeof this.isPerpendicular === "undefined" || this.isPerpendicular === foundItem.getIsRotatedPerpendicular());
50581
+ const firstCard = this.getFirstCard();
50582
+ const firstCardDimensions = firstCard?.getDimensions();
50583
+ const canAddItem = !this.index?.getById(childId) && foundItem instanceof Card && (typeof this.isPerpendicular === "undefined" || this.isPerpendicular === foundItem.getIsRotatedPerpendicular()) && (!firstCardDimensions || firstCardDimensions.width === foundItem.getDimensions().width && firstCardDimensions.height === foundItem.getDimensions().height);
50579
50584
  if (canAddItem) {
50580
50585
  this.isPerpendicular = foundItem.getIsRotatedPerpendicular();
50581
50586
  foundItem.transformation.apply({
@@ -50585,6 +50590,19 @@ class Deck extends BaseItem {
50585
50590
  x: this.left + (this.index?.list().length || 0) * (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET),
50586
50591
  y: this.top + (this.index?.list().length || 0) * (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET : 0)
50587
50592
  });
50593
+ if (firstCard) {
50594
+ const { scaleX, scaleY } = foundItem.transformation.matrix;
50595
+ const { scaleX: targetScaleX, scaleY: targetScaleY } = firstCard.transformation.matrix;
50596
+ if (scaleX !== targetScaleX || scaleY !== targetScaleY) {
50597
+ foundItem.transformation.apply({
50598
+ class: "Transformation",
50599
+ method: "scaleTo",
50600
+ item: [this.id],
50601
+ x: targetScaleX,
50602
+ y: targetScaleY
50603
+ });
50604
+ }
50605
+ }
50588
50606
  this.board.selection.remove(foundItem);
50589
50607
  this.board.items.index.remove(foundItem);
50590
50608
  foundItem.parent = this.getId();
@@ -50749,6 +50767,9 @@ class Deck extends BaseItem {
50749
50767
  this.isCacheDirty = false;
50750
50768
  this.updateMbr();
50751
50769
  }
50770
+ getFirstCard() {
50771
+ return this.index?.list()[0];
50772
+ }
50752
50773
  }
50753
50774
  registerItem({
50754
50775
  item: Deck,
@@ -47739,6 +47739,9 @@ class Card extends BaseItem {
47739
47739
  });
47740
47740
  this.updateMbr();
47741
47741
  }
47742
+ getDimensions() {
47743
+ return this.dimensions;
47744
+ }
47742
47745
  createImages() {
47743
47746
  this.face = conf.documentFactory.createElement("img");
47744
47747
  this.backside = conf.documentFactory.createElement("img");
@@ -47948,7 +47951,9 @@ class Deck extends BaseItem {
47948
47951
  childIds.forEach((childId) => {
47949
47952
  const foundItem = this.board.items.getById(childId);
47950
47953
  if (this.parent !== childId && this.getId() !== childId) {
47951
- const canAddItem = !this.index?.getById(childId) && foundItem instanceof Card && (typeof this.isPerpendicular === "undefined" || this.isPerpendicular === foundItem.getIsRotatedPerpendicular());
47954
+ const firstCard = this.getFirstCard();
47955
+ const firstCardDimensions = firstCard?.getDimensions();
47956
+ const canAddItem = !this.index?.getById(childId) && foundItem instanceof Card && (typeof this.isPerpendicular === "undefined" || this.isPerpendicular === foundItem.getIsRotatedPerpendicular()) && (!firstCardDimensions || firstCardDimensions.width === foundItem.getDimensions().width && firstCardDimensions.height === foundItem.getDimensions().height);
47952
47957
  if (canAddItem) {
47953
47958
  this.isPerpendicular = foundItem.getIsRotatedPerpendicular();
47954
47959
  foundItem.transformation.apply({
@@ -47958,6 +47963,19 @@ class Deck extends BaseItem {
47958
47963
  x: this.left + (this.index?.list().length || 0) * (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET),
47959
47964
  y: this.top + (this.index?.list().length || 0) * (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET : 0)
47960
47965
  });
47966
+ if (firstCard) {
47967
+ const { scaleX, scaleY } = foundItem.transformation.matrix;
47968
+ const { scaleX: targetScaleX, scaleY: targetScaleY } = firstCard.transformation.matrix;
47969
+ if (scaleX !== targetScaleX || scaleY !== targetScaleY) {
47970
+ foundItem.transformation.apply({
47971
+ class: "Transformation",
47972
+ method: "scaleTo",
47973
+ item: [this.id],
47974
+ x: targetScaleX,
47975
+ y: targetScaleY
47976
+ });
47977
+ }
47978
+ }
47961
47979
  this.board.selection.remove(foundItem);
47962
47980
  this.board.items.index.remove(foundItem);
47963
47981
  foundItem.parent = this.getId();
@@ -48122,6 +48140,9 @@ class Deck extends BaseItem {
48122
48140
  this.isCacheDirty = false;
48123
48141
  this.updateMbr();
48124
48142
  }
48143
+ getFirstCard() {
48144
+ return this.index?.list()[0];
48145
+ }
48125
48146
  }
48126
48147
  registerItem({
48127
48148
  item: Deck,
package/dist/esm/index.js CHANGED
@@ -47732,6 +47732,9 @@ class Card extends BaseItem {
47732
47732
  });
47733
47733
  this.updateMbr();
47734
47734
  }
47735
+ getDimensions() {
47736
+ return this.dimensions;
47737
+ }
47735
47738
  createImages() {
47736
47739
  this.face = conf.documentFactory.createElement("img");
47737
47740
  this.backside = conf.documentFactory.createElement("img");
@@ -47941,7 +47944,9 @@ class Deck extends BaseItem {
47941
47944
  childIds.forEach((childId) => {
47942
47945
  const foundItem = this.board.items.getById(childId);
47943
47946
  if (this.parent !== childId && this.getId() !== childId) {
47944
- const canAddItem = !this.index?.getById(childId) && foundItem instanceof Card && (typeof this.isPerpendicular === "undefined" || this.isPerpendicular === foundItem.getIsRotatedPerpendicular());
47947
+ const firstCard = this.getFirstCard();
47948
+ const firstCardDimensions = firstCard?.getDimensions();
47949
+ const canAddItem = !this.index?.getById(childId) && foundItem instanceof Card && (typeof this.isPerpendicular === "undefined" || this.isPerpendicular === foundItem.getIsRotatedPerpendicular()) && (!firstCardDimensions || firstCardDimensions.width === foundItem.getDimensions().width && firstCardDimensions.height === foundItem.getDimensions().height);
47945
47950
  if (canAddItem) {
47946
47951
  this.isPerpendicular = foundItem.getIsRotatedPerpendicular();
47947
47952
  foundItem.transformation.apply({
@@ -47951,6 +47956,19 @@ class Deck extends BaseItem {
47951
47956
  x: this.left + (this.index?.list().length || 0) * (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET),
47952
47957
  y: this.top + (this.index?.list().length || 0) * (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET : 0)
47953
47958
  });
47959
+ if (firstCard) {
47960
+ const { scaleX, scaleY } = foundItem.transformation.matrix;
47961
+ const { scaleX: targetScaleX, scaleY: targetScaleY } = firstCard.transformation.matrix;
47962
+ if (scaleX !== targetScaleX || scaleY !== targetScaleY) {
47963
+ foundItem.transformation.apply({
47964
+ class: "Transformation",
47965
+ method: "scaleTo",
47966
+ item: [this.id],
47967
+ x: targetScaleX,
47968
+ y: targetScaleY
47969
+ });
47970
+ }
47971
+ }
47954
47972
  this.board.selection.remove(foundItem);
47955
47973
  this.board.items.index.remove(foundItem);
47956
47974
  foundItem.parent = this.getId();
@@ -48115,6 +48133,9 @@ class Deck extends BaseItem {
48115
48133
  this.isCacheDirty = false;
48116
48134
  this.updateMbr();
48117
48135
  }
48136
+ getFirstCard() {
48137
+ return this.index?.list()[0];
48138
+ }
48118
48139
  }
48119
48140
  registerItem({
48120
48141
  item: Deck,
package/dist/esm/node.js CHANGED
@@ -50200,6 +50200,9 @@ class Card extends BaseItem {
50200
50200
  });
50201
50201
  this.updateMbr();
50202
50202
  }
50203
+ getDimensions() {
50204
+ return this.dimensions;
50205
+ }
50203
50206
  createImages() {
50204
50207
  this.face = conf.documentFactory.createElement("img");
50205
50208
  this.backside = conf.documentFactory.createElement("img");
@@ -50409,7 +50412,9 @@ class Deck extends BaseItem {
50409
50412
  childIds.forEach((childId) => {
50410
50413
  const foundItem = this.board.items.getById(childId);
50411
50414
  if (this.parent !== childId && this.getId() !== childId) {
50412
- const canAddItem = !this.index?.getById(childId) && foundItem instanceof Card && (typeof this.isPerpendicular === "undefined" || this.isPerpendicular === foundItem.getIsRotatedPerpendicular());
50415
+ const firstCard = this.getFirstCard();
50416
+ const firstCardDimensions = firstCard?.getDimensions();
50417
+ const canAddItem = !this.index?.getById(childId) && foundItem instanceof Card && (typeof this.isPerpendicular === "undefined" || this.isPerpendicular === foundItem.getIsRotatedPerpendicular()) && (!firstCardDimensions || firstCardDimensions.width === foundItem.getDimensions().width && firstCardDimensions.height === foundItem.getDimensions().height);
50413
50418
  if (canAddItem) {
50414
50419
  this.isPerpendicular = foundItem.getIsRotatedPerpendicular();
50415
50420
  foundItem.transformation.apply({
@@ -50419,6 +50424,19 @@ class Deck extends BaseItem {
50419
50424
  x: this.left + (this.index?.list().length || 0) * (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET),
50420
50425
  y: this.top + (this.index?.list().length || 0) * (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET : 0)
50421
50426
  });
50427
+ if (firstCard) {
50428
+ const { scaleX, scaleY } = foundItem.transformation.matrix;
50429
+ const { scaleX: targetScaleX, scaleY: targetScaleY } = firstCard.transformation.matrix;
50430
+ if (scaleX !== targetScaleX || scaleY !== targetScaleY) {
50431
+ foundItem.transformation.apply({
50432
+ class: "Transformation",
50433
+ method: "scaleTo",
50434
+ item: [this.id],
50435
+ x: targetScaleX,
50436
+ y: targetScaleY
50437
+ });
50438
+ }
50439
+ }
50422
50440
  this.board.selection.remove(foundItem);
50423
50441
  this.board.items.index.remove(foundItem);
50424
50442
  foundItem.parent = this.getId();
@@ -50583,6 +50601,9 @@ class Deck extends BaseItem {
50583
50601
  this.isCacheDirty = false;
50584
50602
  this.updateMbr();
50585
50603
  }
50604
+ getFirstCard() {
50605
+ return this.index?.list()[0];
50606
+ }
50586
50607
  }
50587
50608
  registerItem({
50588
50609
  item: Deck,
@@ -29,6 +29,10 @@ export declare class Card extends BaseItem {
29
29
  width: number;
30
30
  height: number;
31
31
  });
32
+ getDimensions(): {
33
+ width: number;
34
+ height: number;
35
+ };
32
36
  createImages(): void;
33
37
  updateImageToRender(): void;
34
38
  getImage(): HTMLImageElement | null;
@@ -31,5 +31,6 @@ export declare class Deck extends BaseItem {
31
31
  render(context: DrawingContext): void;
32
32
  renderHTML(documentFactory: DocumentFactory): HTMLElement;
33
33
  private updateCache;
34
+ getFirstCard(): Card | undefined;
34
35
  }
35
36
  export declare function createDeck(event?: KeyboardEvent, board?: Board): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.5.39",
3
+ "version": "0.5.40",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",