microboard-ui-temp 0.1.8 → 0.1.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.
Files changed (2) hide show
  1. package/dist/index.js +22 -8
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -215914,7 +215914,8 @@ var conf = {
215914
215914
  FALLBACK_LNG: "en",
215915
215915
  cursorsMap,
215916
215916
  DECK_HORIZONTAL_OFFSET: 2,
215917
- DECK_VERTICAL_OFFSET: 0
215917
+ DECK_VERTICAL_OFFSET: 0,
215918
+ CARD_DIMENSIONS: { width: 250, height: 400 }
215918
215919
  };
215919
215920
  initDefaultI18N();
215920
215921
 
@@ -229984,6 +229985,7 @@ class BaseItem extends Mbr {
229984
229985
  shouldUseRelativeAlignment = true;
229985
229986
  enableResize = true;
229986
229987
  itemType = "";
229988
+ children = [];
229987
229989
  constructor(board, id = "", defaultItemData, isGroupItem) {
229988
229990
  super();
229989
229991
  this.defaultItemData = defaultItemData;
@@ -230001,6 +230003,9 @@ class BaseItem extends Mbr {
230001
230003
  this.linkTo = new LinkTo(this.id, board.events);
230002
230004
  this.transformation = new Transformation(this.id, board.events);
230003
230005
  }
230006
+ updateChildrenIds() {
230007
+ this.children = this.index?.items.listAll().map((item) => item.getId()) || [];
230008
+ }
230004
230009
  getId() {
230005
230010
  return this.id;
230006
230011
  }
@@ -230086,6 +230091,7 @@ class BaseItem extends Mbr {
230086
230091
  }
230087
230092
  }
230088
230093
  });
230094
+ this.updateChildrenIds();
230089
230095
  this.updateMbr();
230090
230096
  this.subject.publish(this);
230091
230097
  }
@@ -230103,6 +230109,7 @@ class BaseItem extends Mbr {
230103
230109
  }
230104
230110
  }
230105
230111
  });
230112
+ this.updateChildrenIds();
230106
230113
  this.updateMbr();
230107
230114
  this.subject.publish(this);
230108
230115
  }
@@ -255857,7 +255864,6 @@ var defaultCardData = {
255857
255864
  faceUrl: "",
255858
255865
  backsideUrl: ""
255859
255866
  };
255860
- var CARD_DIMENSIONS = { width: 250, height: 400 };
255861
255867
 
255862
255868
  class Card extends BaseItem {
255863
255869
  subject = new Subject;
@@ -255918,7 +255924,7 @@ class Card extends BaseItem {
255918
255924
  const ctx = context.ctx;
255919
255925
  if (this.imageToRender && this.imageToRender.complete) {
255920
255926
  ctx.save();
255921
- ctx.drawImage(this.imageToRender, typeof left === "number" ? left : this.left, typeof top === "number" ? top : this.top, CARD_DIMENSIONS.width, CARD_DIMENSIONS.height);
255927
+ ctx.drawImage(this.imageToRender, typeof left === "number" ? left : this.left, typeof top === "number" ? top : this.top, conf.CARD_DIMENSIONS.width, conf.CARD_DIMENSIONS.height);
255922
255928
  ctx.restore();
255923
255929
  }
255924
255930
  }
@@ -255926,8 +255932,8 @@ class Card extends BaseItem {
255926
255932
  const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
255927
255933
  this.left = translateX;
255928
255934
  this.top = translateY;
255929
- this.right = this.left + CARD_DIMENSIONS.width * scaleX;
255930
- this.bottom = this.top + CARD_DIMENSIONS.height * scaleY;
255935
+ this.right = this.left + conf.CARD_DIMENSIONS.width * scaleX;
255936
+ this.bottom = this.top + conf.CARD_DIMENSIONS.height * scaleY;
255931
255937
  }
255932
255938
  getPath() {
255933
255939
  return new Path2(this.getMbr().getLines());
@@ -255977,6 +255983,7 @@ class Deck extends BaseItem {
255977
255983
  cachedCanvas = null;
255978
255984
  isCacheDirty = true;
255979
255985
  enableResize = false;
255986
+ path = new Path2;
255980
255987
  constructor(board, id = "") {
255981
255988
  super(board, id, defaultDeckData, true);
255982
255989
  this.index.getUnderPoint = () => [];
@@ -256010,6 +256017,7 @@ class Deck extends BaseItem {
256010
256017
  }
256011
256018
  }
256012
256019
  });
256020
+ this.updateChildrenIds();
256013
256021
  this.updateMbr();
256014
256022
  this.subject.publish(this);
256015
256023
  }
@@ -256028,6 +256036,7 @@ class Deck extends BaseItem {
256028
256036
  }
256029
256037
  }
256030
256038
  });
256039
+ this.updateChildrenIds();
256031
256040
  this.updateMbr();
256032
256041
  this.subject.publish(this);
256033
256042
  }
@@ -256077,14 +256086,18 @@ class Deck extends BaseItem {
256077
256086
  updateMbr() {
256078
256087
  const { translateX, translateY } = this.transformation.matrix;
256079
256088
  const items = this.index.list();
256080
- const itemsMbr = items[0]?.getMbr().combine(items.slice(1).map((item) => item.getMbr()));
256089
+ const itemsMbr = items[0].getMbr().combine(items.slice(1).map((item) => item.getMbr()));
256081
256090
  this.left = translateX;
256082
256091
  this.top = translateY;
256083
- this.right = translateX + (itemsMbr?.getWidth() || 0);
256084
- this.bottom = translateY + (itemsMbr?.getHeight() || 0);
256092
+ this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1));
256093
+ this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height - conf.DECK_VERTICAL_OFFSET * ((this.children.length || 1) - 1));
256094
+ this.path = new Path2(this.getMbr().getLines(), true, "#FFFFFF");
256085
256095
  }
256086
256096
  deserialize(data) {
256087
256097
  super.deserialize(data);
256098
+ if (data.children) {
256099
+ this.children = data.children;
256100
+ }
256088
256101
  this.updateMbr();
256089
256102
  this.subject.publish(this);
256090
256103
  return this;
@@ -256096,6 +256109,7 @@ class Deck extends BaseItem {
256096
256109
  const ctx = context.ctx;
256097
256110
  if (this.isCacheDirty || !this.cachedCanvas) {
256098
256111
  this.updateCache(context);
256112
+ this.path.render(context);
256099
256113
  }
256100
256114
  if (this.cachedCanvas && this.cachedCanvas.width && this.cachedCanvas.height) {
256101
256115
  ctx.save();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-ui-temp",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "type": "module",
@@ -51,7 +51,7 @@
51
51
  "i18next-browser-languagedetector": "^8.2.0",
52
52
  "js-cookie": "^3.0.5",
53
53
  "jwt-decode": "^4.0.0",
54
- "microboard-temp": "^0.4.103",
54
+ "microboard-temp": "^0.4.104",
55
55
  "nanoid": "^5.1.5",
56
56
  "prop-types": "^15.8.1",
57
57
  "react-hot-toast": "2.4.1",