microboard-temp 0.5.28 → 0.5.29

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);
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);
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);
@@ -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);
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);
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.5.28",
3
+ "version": "0.5.29",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",