microboard-temp 0.5.28 → 0.5.30

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.
@@ -42121,10 +42121,22 @@ class ImageItem extends BaseItem {
42121
42121
  };
42122
42122
  updateMbr() {
42123
42123
  const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
42124
- this.left = translateX;
42125
- this.top = translateY;
42126
- this.right = this.left + this.image.width * scaleX;
42127
- this.bottom = this.top + this.image.height * scaleY;
42124
+ const rotation = this.transformation.getRotation();
42125
+ const width2 = this.image.width * scaleX;
42126
+ const height2 = this.image.height * scaleY;
42127
+ if (rotation % 180 === 0) {
42128
+ this.left = translateX;
42129
+ this.top = translateY;
42130
+ this.right = this.left + width2;
42131
+ this.bottom = this.top + height2;
42132
+ } else {
42133
+ const centerX = translateX + width2 / 2;
42134
+ const centerY = translateY + height2 / 2;
42135
+ this.left = centerX - height2 / 2;
42136
+ this.top = centerY - width2 / 2;
42137
+ this.right = this.left + height2;
42138
+ this.bottom = this.top + width2;
42139
+ }
42128
42140
  }
42129
42141
  doOnceBeforeOnLoad = (callback) => {
42130
42142
  this.loadCallbacks.push(callback);
@@ -48146,8 +48158,8 @@ class Deck extends BaseItem {
48146
48158
  const itemsMbr = items[0]?.getMbr().combine(items.slice(1).map((item) => item.getMbr()));
48147
48159
  this.left = translateX;
48148
48160
  this.top = translateY;
48149
- this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1));
48150
- this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height - conf.DECK_VERTICAL_OFFSET * ((this.children.length || 1) - 1));
48161
+ this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1)));
48162
+ this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height + (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET * ((this.children.length || 1) - 1) : 0));
48151
48163
  this.path = new Path(this.getMbr().getLines(), true, "#FFFFFF");
48152
48164
  }
48153
48165
  deserialize(data) {
@@ -48214,7 +48226,7 @@ class Deck extends BaseItem {
48214
48226
  return;
48215
48227
  const tempContext = { ...context, ctx: tempCtx };
48216
48228
  cards.forEach((_, index2) => {
48217
- topCard.render(tempContext, index2 * conf.DECK_HORIZONTAL_OFFSET, index2 * conf.DECK_VERTICAL_OFFSET);
48229
+ topCard.render(tempContext, this.isPerpendicular ? 0 : index2 * conf.DECK_HORIZONTAL_OFFSET, this.isPerpendicular ? index2 * conf.DECK_VERTICAL_OFFSET : 0);
48218
48230
  });
48219
48231
  this.cachedCanvas = tempCanvas;
48220
48232
  this.isCacheDirty = false;
package/dist/cjs/index.js CHANGED
@@ -42121,10 +42121,22 @@ class ImageItem extends BaseItem {
42121
42121
  };
42122
42122
  updateMbr() {
42123
42123
  const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
42124
- this.left = translateX;
42125
- this.top = translateY;
42126
- this.right = this.left + this.image.width * scaleX;
42127
- this.bottom = this.top + this.image.height * scaleY;
42124
+ const rotation = this.transformation.getRotation();
42125
+ const width2 = this.image.width * scaleX;
42126
+ const height2 = this.image.height * scaleY;
42127
+ if (rotation % 180 === 0) {
42128
+ this.left = translateX;
42129
+ this.top = translateY;
42130
+ this.right = this.left + width2;
42131
+ this.bottom = this.top + height2;
42132
+ } else {
42133
+ const centerX = translateX + width2 / 2;
42134
+ const centerY = translateY + height2 / 2;
42135
+ this.left = centerX - height2 / 2;
42136
+ this.top = centerY - width2 / 2;
42137
+ this.right = this.left + height2;
42138
+ this.bottom = this.top + width2;
42139
+ }
42128
42140
  }
42129
42141
  doOnceBeforeOnLoad = (callback) => {
42130
42142
  this.loadCallbacks.push(callback);
@@ -48146,8 +48158,8 @@ class Deck extends BaseItem {
48146
48158
  const itemsMbr = items[0]?.getMbr().combine(items.slice(1).map((item) => item.getMbr()));
48147
48159
  this.left = translateX;
48148
48160
  this.top = translateY;
48149
- this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1));
48150
- this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height - conf.DECK_VERTICAL_OFFSET * ((this.children.length || 1) - 1));
48161
+ this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1)));
48162
+ this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height + (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET * ((this.children.length || 1) - 1) : 0));
48151
48163
  this.path = new Path(this.getMbr().getLines(), true, "#FFFFFF");
48152
48164
  }
48153
48165
  deserialize(data) {
@@ -48214,7 +48226,7 @@ class Deck extends BaseItem {
48214
48226
  return;
48215
48227
  const tempContext = { ...context, ctx: tempCtx };
48216
48228
  cards.forEach((_, index2) => {
48217
- topCard.render(tempContext, index2 * conf.DECK_HORIZONTAL_OFFSET, index2 * conf.DECK_VERTICAL_OFFSET);
48229
+ topCard.render(tempContext, this.isPerpendicular ? 0 : index2 * conf.DECK_HORIZONTAL_OFFSET, this.isPerpendicular ? index2 * conf.DECK_VERTICAL_OFFSET : 0);
48218
48230
  });
48219
48231
  this.cachedCanvas = tempCanvas;
48220
48232
  this.isCacheDirty = false;
package/dist/cjs/node.js CHANGED
@@ -44594,10 +44594,22 @@ class ImageItem extends BaseItem {
44594
44594
  };
44595
44595
  updateMbr() {
44596
44596
  const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
44597
- this.left = translateX;
44598
- this.top = translateY;
44599
- this.right = this.left + this.image.width * scaleX;
44600
- this.bottom = this.top + this.image.height * scaleY;
44597
+ const rotation = this.transformation.getRotation();
44598
+ const width2 = this.image.width * scaleX;
44599
+ const height2 = this.image.height * scaleY;
44600
+ if (rotation % 180 === 0) {
44601
+ this.left = translateX;
44602
+ this.top = translateY;
44603
+ this.right = this.left + width2;
44604
+ this.bottom = this.top + height2;
44605
+ } else {
44606
+ const centerX = translateX + width2 / 2;
44607
+ const centerY = translateY + height2 / 2;
44608
+ this.left = centerX - height2 / 2;
44609
+ this.top = centerY - width2 / 2;
44610
+ this.right = this.left + height2;
44611
+ this.bottom = this.top + width2;
44612
+ }
44601
44613
  }
44602
44614
  doOnceBeforeOnLoad = (callback) => {
44603
44615
  this.loadCallbacks.push(callback);
@@ -50619,8 +50631,8 @@ class Deck extends BaseItem {
50619
50631
  const itemsMbr = items[0]?.getMbr().combine(items.slice(1).map((item) => item.getMbr()));
50620
50632
  this.left = translateX;
50621
50633
  this.top = translateY;
50622
- this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1));
50623
- this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height - conf.DECK_VERTICAL_OFFSET * ((this.children.length || 1) - 1));
50634
+ this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1)));
50635
+ this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height + (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET * ((this.children.length || 1) - 1) : 0));
50624
50636
  this.path = new Path(this.getMbr().getLines(), true, "#FFFFFF");
50625
50637
  }
50626
50638
  deserialize(data) {
@@ -50687,7 +50699,7 @@ class Deck extends BaseItem {
50687
50699
  return;
50688
50700
  const tempContext = { ...context, ctx: tempCtx };
50689
50701
  cards.forEach((_, index2) => {
50690
- topCard.render(tempContext, index2 * conf.DECK_HORIZONTAL_OFFSET, index2 * conf.DECK_VERTICAL_OFFSET);
50702
+ topCard.render(tempContext, this.isPerpendicular ? 0 : index2 * conf.DECK_HORIZONTAL_OFFSET, this.isPerpendicular ? index2 * conf.DECK_VERTICAL_OFFSET : 0);
50691
50703
  });
50692
50704
  this.cachedCanvas = tempCanvas;
50693
50705
  this.isCacheDirty = false;
@@ -41967,10 +41967,22 @@ class ImageItem extends BaseItem {
41967
41967
  };
41968
41968
  updateMbr() {
41969
41969
  const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
41970
- this.left = translateX;
41971
- this.top = translateY;
41972
- this.right = this.left + this.image.width * scaleX;
41973
- this.bottom = this.top + this.image.height * scaleY;
41970
+ const rotation = this.transformation.getRotation();
41971
+ const width2 = this.image.width * scaleX;
41972
+ const height2 = this.image.height * scaleY;
41973
+ if (rotation % 180 === 0) {
41974
+ this.left = translateX;
41975
+ this.top = translateY;
41976
+ this.right = this.left + width2;
41977
+ this.bottom = this.top + height2;
41978
+ } else {
41979
+ const centerX = translateX + width2 / 2;
41980
+ const centerY = translateY + height2 / 2;
41981
+ this.left = centerX - height2 / 2;
41982
+ this.top = centerY - width2 / 2;
41983
+ this.right = this.left + height2;
41984
+ this.bottom = this.top + width2;
41985
+ }
41974
41986
  }
41975
41987
  doOnceBeforeOnLoad = (callback) => {
41976
41988
  this.loadCallbacks.push(callback);
@@ -47992,8 +48004,8 @@ class Deck extends BaseItem {
47992
48004
  const itemsMbr = items[0]?.getMbr().combine(items.slice(1).map((item) => item.getMbr()));
47993
48005
  this.left = translateX;
47994
48006
  this.top = translateY;
47995
- this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1));
47996
- this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height - conf.DECK_VERTICAL_OFFSET * ((this.children.length || 1) - 1));
48007
+ this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1)));
48008
+ this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height + (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET * ((this.children.length || 1) - 1) : 0));
47997
48009
  this.path = new Path(this.getMbr().getLines(), true, "#FFFFFF");
47998
48010
  }
47999
48011
  deserialize(data) {
@@ -48060,7 +48072,7 @@ class Deck extends BaseItem {
48060
48072
  return;
48061
48073
  const tempContext = { ...context, ctx: tempCtx };
48062
48074
  cards.forEach((_, index2) => {
48063
- topCard.render(tempContext, index2 * conf.DECK_HORIZONTAL_OFFSET, index2 * conf.DECK_VERTICAL_OFFSET);
48075
+ topCard.render(tempContext, this.isPerpendicular ? 0 : index2 * conf.DECK_HORIZONTAL_OFFSET, this.isPerpendicular ? index2 * conf.DECK_VERTICAL_OFFSET : 0);
48064
48076
  });
48065
48077
  this.cachedCanvas = tempCanvas;
48066
48078
  this.isCacheDirty = false;
package/dist/esm/index.js CHANGED
@@ -41960,10 +41960,22 @@ class ImageItem extends BaseItem {
41960
41960
  };
41961
41961
  updateMbr() {
41962
41962
  const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
41963
- this.left = translateX;
41964
- this.top = translateY;
41965
- this.right = this.left + this.image.width * scaleX;
41966
- this.bottom = this.top + this.image.height * scaleY;
41963
+ const rotation = this.transformation.getRotation();
41964
+ const width2 = this.image.width * scaleX;
41965
+ const height2 = this.image.height * scaleY;
41966
+ if (rotation % 180 === 0) {
41967
+ this.left = translateX;
41968
+ this.top = translateY;
41969
+ this.right = this.left + width2;
41970
+ this.bottom = this.top + height2;
41971
+ } else {
41972
+ const centerX = translateX + width2 / 2;
41973
+ const centerY = translateY + height2 / 2;
41974
+ this.left = centerX - height2 / 2;
41975
+ this.top = centerY - width2 / 2;
41976
+ this.right = this.left + height2;
41977
+ this.bottom = this.top + width2;
41978
+ }
41967
41979
  }
41968
41980
  doOnceBeforeOnLoad = (callback) => {
41969
41981
  this.loadCallbacks.push(callback);
@@ -47985,8 +47997,8 @@ class Deck extends BaseItem {
47985
47997
  const itemsMbr = items[0]?.getMbr().combine(items.slice(1).map((item) => item.getMbr()));
47986
47998
  this.left = translateX;
47987
47999
  this.top = translateY;
47988
- this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1));
47989
- this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height - conf.DECK_VERTICAL_OFFSET * ((this.children.length || 1) - 1));
48000
+ this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1)));
48001
+ this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height + (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET * ((this.children.length || 1) - 1) : 0));
47990
48002
  this.path = new Path(this.getMbr().getLines(), true, "#FFFFFF");
47991
48003
  }
47992
48004
  deserialize(data) {
@@ -48053,7 +48065,7 @@ class Deck extends BaseItem {
48053
48065
  return;
48054
48066
  const tempContext = { ...context, ctx: tempCtx };
48055
48067
  cards.forEach((_, index2) => {
48056
- topCard.render(tempContext, index2 * conf.DECK_HORIZONTAL_OFFSET, index2 * conf.DECK_VERTICAL_OFFSET);
48068
+ topCard.render(tempContext, this.isPerpendicular ? 0 : index2 * conf.DECK_HORIZONTAL_OFFSET, this.isPerpendicular ? index2 * conf.DECK_VERTICAL_OFFSET : 0);
48057
48069
  });
48058
48070
  this.cachedCanvas = tempCanvas;
48059
48071
  this.isCacheDirty = false;
package/dist/esm/node.js CHANGED
@@ -44428,10 +44428,22 @@ class ImageItem extends BaseItem {
44428
44428
  };
44429
44429
  updateMbr() {
44430
44430
  const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
44431
- this.left = translateX;
44432
- this.top = translateY;
44433
- this.right = this.left + this.image.width * scaleX;
44434
- this.bottom = this.top + this.image.height * scaleY;
44431
+ const rotation = this.transformation.getRotation();
44432
+ const width2 = this.image.width * scaleX;
44433
+ const height2 = this.image.height * scaleY;
44434
+ if (rotation % 180 === 0) {
44435
+ this.left = translateX;
44436
+ this.top = translateY;
44437
+ this.right = this.left + width2;
44438
+ this.bottom = this.top + height2;
44439
+ } else {
44440
+ const centerX = translateX + width2 / 2;
44441
+ const centerY = translateY + height2 / 2;
44442
+ this.left = centerX - height2 / 2;
44443
+ this.top = centerY - width2 / 2;
44444
+ this.right = this.left + height2;
44445
+ this.bottom = this.top + width2;
44446
+ }
44435
44447
  }
44436
44448
  doOnceBeforeOnLoad = (callback) => {
44437
44449
  this.loadCallbacks.push(callback);
@@ -50453,8 +50465,8 @@ class Deck extends BaseItem {
50453
50465
  const itemsMbr = items[0]?.getMbr().combine(items.slice(1).map((item) => item.getMbr()));
50454
50466
  this.left = translateX;
50455
50467
  this.top = translateY;
50456
- this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1));
50457
- this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height - conf.DECK_VERTICAL_OFFSET * ((this.children.length || 1) - 1));
50468
+ this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1)));
50469
+ this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height + (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET * ((this.children.length || 1) - 1) : 0));
50458
50470
  this.path = new Path(this.getMbr().getLines(), true, "#FFFFFF");
50459
50471
  }
50460
50472
  deserialize(data) {
@@ -50521,7 +50533,7 @@ class Deck extends BaseItem {
50521
50533
  return;
50522
50534
  const tempContext = { ...context, ctx: tempCtx };
50523
50535
  cards.forEach((_, index2) => {
50524
- topCard.render(tempContext, index2 * conf.DECK_HORIZONTAL_OFFSET, index2 * conf.DECK_VERTICAL_OFFSET);
50536
+ topCard.render(tempContext, this.isPerpendicular ? 0 : index2 * conf.DECK_HORIZONTAL_OFFSET, this.isPerpendicular ? index2 * conf.DECK_VERTICAL_OFFSET : 0);
50525
50537
  });
50526
50538
  this.cachedCanvas = tempCanvas;
50527
50539
  this.isCacheDirty = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.5.28",
3
+ "version": "0.5.30",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",