microboard-temp 0.4.94 → 0.4.96

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.
@@ -21474,6 +21474,7 @@ class BaseItem extends Mbr {
21474
21474
  onRemoveCallbacks = [];
21475
21475
  shouldUseCustomRender = false;
21476
21476
  shouldRenderOutsideViewRect = true;
21477
+ shouldUseRelativeAlignment = true;
21477
21478
  itemType = "";
21478
21479
  constructor(board, id = "", defaultItemData, isGroupItem) {
21479
21480
  super();
@@ -45714,10 +45715,10 @@ class AlignmentHelper {
45714
45715
  }
45715
45716
  };
45716
45717
  nearbyItems.forEach((item) => {
45717
- if (item === movingItem || item.itemType === "Comment") {
45718
+ if (item === movingItem || item.itemType === "Comment" || item instanceof BaseItem && !item.shouldUseRelativeAlignment) {
45718
45719
  return;
45719
45720
  }
45720
- const itemMbr = item.itemType === "Shape" ? item.getPath().getMbr() : item.getMbr();
45721
+ const itemMbr = item.getPathMbr();
45721
45722
  const centerXMoving = (movingMBR.left + movingMBR.right) / 2;
45722
45723
  const centerXItem = (itemMbr.left + itemMbr.right) / 2;
45723
45724
  const centerYMoving = (movingMBR.top + movingMBR.bottom) / 2;
@@ -47862,14 +47863,14 @@ class Card extends BaseItem {
47862
47863
  this.imageToRender = this.face;
47863
47864
  }
47864
47865
  }
47865
- render(context, left) {
47866
+ render(context, left, top) {
47866
47867
  if (this.transformationRenderBlock) {
47867
47868
  return;
47868
47869
  }
47869
47870
  const ctx = context.ctx;
47870
47871
  if (this.imageToRender && this.imageToRender.complete) {
47871
47872
  ctx.save();
47872
- ctx.drawImage(this.imageToRender, left ? left : this.left, this.top, CARD_DIMENSIONS.width, CARD_DIMENSIONS.height);
47873
+ ctx.drawImage(this.imageToRender, typeof left === "number" ? left : this.left, typeof top === "number" ? top : this.top, CARD_DIMENSIONS.width, CARD_DIMENSIONS.height);
47873
47874
  ctx.restore();
47874
47875
  }
47875
47876
  }
@@ -47956,6 +47957,7 @@ class Deck extends BaseItem {
47956
47957
  });
47957
47958
  this.board.items.index.remove(foundItem);
47958
47959
  foundItem.parent = this.getId();
47960
+ foundItem.shouldUseRelativeAlignment = false;
47959
47961
  this.index?.insert(foundItem);
47960
47962
  }
47961
47963
  }
@@ -47980,6 +47982,7 @@ class Deck extends BaseItem {
47980
47982
  });
47981
47983
  this.index?.remove(foundItem);
47982
47984
  foundItem.parent = "Board";
47985
+ foundItem.shouldUseRelativeAlignment = true;
47983
47986
  this.board.items.index.insert(foundItem);
47984
47987
  }
47985
47988
  }
@@ -48074,7 +48077,7 @@ class Deck extends BaseItem {
48074
48077
  return;
48075
48078
  const tempContext = { ...context, ctx: tempCtx };
48076
48079
  this.index?.list().forEach((item, index2) => {
48077
- item.render(tempContext, index2 * 2);
48080
+ item.render(tempContext, index2 * 2, 0);
48078
48081
  });
48079
48082
  this.cachedCanvas = tempCanvas;
48080
48083
  }
package/dist/cjs/index.js CHANGED
@@ -21474,6 +21474,7 @@ class BaseItem extends Mbr {
21474
21474
  onRemoveCallbacks = [];
21475
21475
  shouldUseCustomRender = false;
21476
21476
  shouldRenderOutsideViewRect = true;
21477
+ shouldUseRelativeAlignment = true;
21477
21478
  itemType = "";
21478
21479
  constructor(board, id = "", defaultItemData, isGroupItem) {
21479
21480
  super();
@@ -45714,10 +45715,10 @@ class AlignmentHelper {
45714
45715
  }
45715
45716
  };
45716
45717
  nearbyItems.forEach((item) => {
45717
- if (item === movingItem || item.itemType === "Comment") {
45718
+ if (item === movingItem || item.itemType === "Comment" || item instanceof BaseItem && !item.shouldUseRelativeAlignment) {
45718
45719
  return;
45719
45720
  }
45720
- const itemMbr = item.itemType === "Shape" ? item.getPath().getMbr() : item.getMbr();
45721
+ const itemMbr = item.getPathMbr();
45721
45722
  const centerXMoving = (movingMBR.left + movingMBR.right) / 2;
45722
45723
  const centerXItem = (itemMbr.left + itemMbr.right) / 2;
45723
45724
  const centerYMoving = (movingMBR.top + movingMBR.bottom) / 2;
@@ -47862,14 +47863,14 @@ class Card extends BaseItem {
47862
47863
  this.imageToRender = this.face;
47863
47864
  }
47864
47865
  }
47865
- render(context, left) {
47866
+ render(context, left, top) {
47866
47867
  if (this.transformationRenderBlock) {
47867
47868
  return;
47868
47869
  }
47869
47870
  const ctx = context.ctx;
47870
47871
  if (this.imageToRender && this.imageToRender.complete) {
47871
47872
  ctx.save();
47872
- ctx.drawImage(this.imageToRender, left ? left : this.left, this.top, CARD_DIMENSIONS.width, CARD_DIMENSIONS.height);
47873
+ ctx.drawImage(this.imageToRender, typeof left === "number" ? left : this.left, typeof top === "number" ? top : this.top, CARD_DIMENSIONS.width, CARD_DIMENSIONS.height);
47873
47874
  ctx.restore();
47874
47875
  }
47875
47876
  }
@@ -47956,6 +47957,7 @@ class Deck extends BaseItem {
47956
47957
  });
47957
47958
  this.board.items.index.remove(foundItem);
47958
47959
  foundItem.parent = this.getId();
47960
+ foundItem.shouldUseRelativeAlignment = false;
47959
47961
  this.index?.insert(foundItem);
47960
47962
  }
47961
47963
  }
@@ -47980,6 +47982,7 @@ class Deck extends BaseItem {
47980
47982
  });
47981
47983
  this.index?.remove(foundItem);
47982
47984
  foundItem.parent = "Board";
47985
+ foundItem.shouldUseRelativeAlignment = true;
47983
47986
  this.board.items.index.insert(foundItem);
47984
47987
  }
47985
47988
  }
@@ -48074,7 +48077,7 @@ class Deck extends BaseItem {
48074
48077
  return;
48075
48078
  const tempContext = { ...context, ctx: tempCtx };
48076
48079
  this.index?.list().forEach((item, index2) => {
48077
- item.render(tempContext, index2 * 2);
48080
+ item.render(tempContext, index2 * 2, 0);
48078
48081
  });
48079
48082
  this.cachedCanvas = tempCanvas;
48080
48083
  }
package/dist/cjs/node.js CHANGED
@@ -23946,6 +23946,7 @@ class BaseItem extends Mbr {
23946
23946
  onRemoveCallbacks = [];
23947
23947
  shouldUseCustomRender = false;
23948
23948
  shouldRenderOutsideViewRect = true;
23949
+ shouldUseRelativeAlignment = true;
23949
23950
  itemType = "";
23950
23951
  constructor(board, id = "", defaultItemData, isGroupItem) {
23951
23952
  super();
@@ -48187,10 +48188,10 @@ class AlignmentHelper {
48187
48188
  }
48188
48189
  };
48189
48190
  nearbyItems.forEach((item) => {
48190
- if (item === movingItem || item.itemType === "Comment") {
48191
+ if (item === movingItem || item.itemType === "Comment" || item instanceof BaseItem && !item.shouldUseRelativeAlignment) {
48191
48192
  return;
48192
48193
  }
48193
- const itemMbr = item.itemType === "Shape" ? item.getPath().getMbr() : item.getMbr();
48194
+ const itemMbr = item.getPathMbr();
48194
48195
  const centerXMoving = (movingMBR.left + movingMBR.right) / 2;
48195
48196
  const centerXItem = (itemMbr.left + itemMbr.right) / 2;
48196
48197
  const centerYMoving = (movingMBR.top + movingMBR.bottom) / 2;
@@ -50335,14 +50336,14 @@ class Card extends BaseItem {
50335
50336
  this.imageToRender = this.face;
50336
50337
  }
50337
50338
  }
50338
- render(context, left) {
50339
+ render(context, left, top) {
50339
50340
  if (this.transformationRenderBlock) {
50340
50341
  return;
50341
50342
  }
50342
50343
  const ctx = context.ctx;
50343
50344
  if (this.imageToRender && this.imageToRender.complete) {
50344
50345
  ctx.save();
50345
- ctx.drawImage(this.imageToRender, left ? left : this.left, this.top, CARD_DIMENSIONS.width, CARD_DIMENSIONS.height);
50346
+ ctx.drawImage(this.imageToRender, typeof left === "number" ? left : this.left, typeof top === "number" ? top : this.top, CARD_DIMENSIONS.width, CARD_DIMENSIONS.height);
50346
50347
  ctx.restore();
50347
50348
  }
50348
50349
  }
@@ -50429,6 +50430,7 @@ class Deck extends BaseItem {
50429
50430
  });
50430
50431
  this.board.items.index.remove(foundItem);
50431
50432
  foundItem.parent = this.getId();
50433
+ foundItem.shouldUseRelativeAlignment = false;
50432
50434
  this.index?.insert(foundItem);
50433
50435
  }
50434
50436
  }
@@ -50453,6 +50455,7 @@ class Deck extends BaseItem {
50453
50455
  });
50454
50456
  this.index?.remove(foundItem);
50455
50457
  foundItem.parent = "Board";
50458
+ foundItem.shouldUseRelativeAlignment = true;
50456
50459
  this.board.items.index.insert(foundItem);
50457
50460
  }
50458
50461
  }
@@ -50547,7 +50550,7 @@ class Deck extends BaseItem {
50547
50550
  return;
50548
50551
  const tempContext = { ...context, ctx: tempCtx };
50549
50552
  this.index?.list().forEach((item, index2) => {
50550
- item.render(tempContext, index2 * 2);
50553
+ item.render(tempContext, index2 * 2, 0);
50551
50554
  });
50552
50555
  this.cachedCanvas = tempCanvas;
50553
50556
  }
@@ -21323,6 +21323,7 @@ class BaseItem extends Mbr {
21323
21323
  onRemoveCallbacks = [];
21324
21324
  shouldUseCustomRender = false;
21325
21325
  shouldRenderOutsideViewRect = true;
21326
+ shouldUseRelativeAlignment = true;
21326
21327
  itemType = "";
21327
21328
  constructor(board, id = "", defaultItemData, isGroupItem) {
21328
21329
  super();
@@ -45563,10 +45564,10 @@ class AlignmentHelper {
45563
45564
  }
45564
45565
  };
45565
45566
  nearbyItems.forEach((item) => {
45566
- if (item === movingItem || item.itemType === "Comment") {
45567
+ if (item === movingItem || item.itemType === "Comment" || item instanceof BaseItem && !item.shouldUseRelativeAlignment) {
45567
45568
  return;
45568
45569
  }
45569
- const itemMbr = item.itemType === "Shape" ? item.getPath().getMbr() : item.getMbr();
45570
+ const itemMbr = item.getPathMbr();
45570
45571
  const centerXMoving = (movingMBR.left + movingMBR.right) / 2;
45571
45572
  const centerXItem = (itemMbr.left + itemMbr.right) / 2;
45572
45573
  const centerYMoving = (movingMBR.top + movingMBR.bottom) / 2;
@@ -47711,14 +47712,14 @@ class Card extends BaseItem {
47711
47712
  this.imageToRender = this.face;
47712
47713
  }
47713
47714
  }
47714
- render(context, left) {
47715
+ render(context, left, top) {
47715
47716
  if (this.transformationRenderBlock) {
47716
47717
  return;
47717
47718
  }
47718
47719
  const ctx = context.ctx;
47719
47720
  if (this.imageToRender && this.imageToRender.complete) {
47720
47721
  ctx.save();
47721
- ctx.drawImage(this.imageToRender, left ? left : this.left, this.top, CARD_DIMENSIONS.width, CARD_DIMENSIONS.height);
47722
+ ctx.drawImage(this.imageToRender, typeof left === "number" ? left : this.left, typeof top === "number" ? top : this.top, CARD_DIMENSIONS.width, CARD_DIMENSIONS.height);
47722
47723
  ctx.restore();
47723
47724
  }
47724
47725
  }
@@ -47805,6 +47806,7 @@ class Deck extends BaseItem {
47805
47806
  });
47806
47807
  this.board.items.index.remove(foundItem);
47807
47808
  foundItem.parent = this.getId();
47809
+ foundItem.shouldUseRelativeAlignment = false;
47808
47810
  this.index?.insert(foundItem);
47809
47811
  }
47810
47812
  }
@@ -47829,6 +47831,7 @@ class Deck extends BaseItem {
47829
47831
  });
47830
47832
  this.index?.remove(foundItem);
47831
47833
  foundItem.parent = "Board";
47834
+ foundItem.shouldUseRelativeAlignment = true;
47832
47835
  this.board.items.index.insert(foundItem);
47833
47836
  }
47834
47837
  }
@@ -47923,7 +47926,7 @@ class Deck extends BaseItem {
47923
47926
  return;
47924
47927
  const tempContext = { ...context, ctx: tempCtx };
47925
47928
  this.index?.list().forEach((item, index2) => {
47926
- item.render(tempContext, index2 * 2);
47929
+ item.render(tempContext, index2 * 2, 0);
47927
47930
  });
47928
47931
  this.cachedCanvas = tempCanvas;
47929
47932
  }
package/dist/esm/index.js CHANGED
@@ -21316,6 +21316,7 @@ class BaseItem extends Mbr {
21316
21316
  onRemoveCallbacks = [];
21317
21317
  shouldUseCustomRender = false;
21318
21318
  shouldRenderOutsideViewRect = true;
21319
+ shouldUseRelativeAlignment = true;
21319
21320
  itemType = "";
21320
21321
  constructor(board, id = "", defaultItemData, isGroupItem) {
21321
21322
  super();
@@ -45556,10 +45557,10 @@ class AlignmentHelper {
45556
45557
  }
45557
45558
  };
45558
45559
  nearbyItems.forEach((item) => {
45559
- if (item === movingItem || item.itemType === "Comment") {
45560
+ if (item === movingItem || item.itemType === "Comment" || item instanceof BaseItem && !item.shouldUseRelativeAlignment) {
45560
45561
  return;
45561
45562
  }
45562
- const itemMbr = item.itemType === "Shape" ? item.getPath().getMbr() : item.getMbr();
45563
+ const itemMbr = item.getPathMbr();
45563
45564
  const centerXMoving = (movingMBR.left + movingMBR.right) / 2;
45564
45565
  const centerXItem = (itemMbr.left + itemMbr.right) / 2;
45565
45566
  const centerYMoving = (movingMBR.top + movingMBR.bottom) / 2;
@@ -47704,14 +47705,14 @@ class Card extends BaseItem {
47704
47705
  this.imageToRender = this.face;
47705
47706
  }
47706
47707
  }
47707
- render(context, left) {
47708
+ render(context, left, top) {
47708
47709
  if (this.transformationRenderBlock) {
47709
47710
  return;
47710
47711
  }
47711
47712
  const ctx = context.ctx;
47712
47713
  if (this.imageToRender && this.imageToRender.complete) {
47713
47714
  ctx.save();
47714
- ctx.drawImage(this.imageToRender, left ? left : this.left, this.top, CARD_DIMENSIONS.width, CARD_DIMENSIONS.height);
47715
+ ctx.drawImage(this.imageToRender, typeof left === "number" ? left : this.left, typeof top === "number" ? top : this.top, CARD_DIMENSIONS.width, CARD_DIMENSIONS.height);
47715
47716
  ctx.restore();
47716
47717
  }
47717
47718
  }
@@ -47798,6 +47799,7 @@ class Deck extends BaseItem {
47798
47799
  });
47799
47800
  this.board.items.index.remove(foundItem);
47800
47801
  foundItem.parent = this.getId();
47802
+ foundItem.shouldUseRelativeAlignment = false;
47801
47803
  this.index?.insert(foundItem);
47802
47804
  }
47803
47805
  }
@@ -47822,6 +47824,7 @@ class Deck extends BaseItem {
47822
47824
  });
47823
47825
  this.index?.remove(foundItem);
47824
47826
  foundItem.parent = "Board";
47827
+ foundItem.shouldUseRelativeAlignment = true;
47825
47828
  this.board.items.index.insert(foundItem);
47826
47829
  }
47827
47830
  }
@@ -47916,7 +47919,7 @@ class Deck extends BaseItem {
47916
47919
  return;
47917
47920
  const tempContext = { ...context, ctx: tempCtx };
47918
47921
  this.index?.list().forEach((item, index2) => {
47919
- item.render(tempContext, index2 * 2);
47922
+ item.render(tempContext, index2 * 2, 0);
47920
47923
  });
47921
47924
  this.cachedCanvas = tempCanvas;
47922
47925
  }
package/dist/esm/node.js CHANGED
@@ -23783,6 +23783,7 @@ class BaseItem extends Mbr {
23783
23783
  onRemoveCallbacks = [];
23784
23784
  shouldUseCustomRender = false;
23785
23785
  shouldRenderOutsideViewRect = true;
23786
+ shouldUseRelativeAlignment = true;
23786
23787
  itemType = "";
23787
23788
  constructor(board, id = "", defaultItemData, isGroupItem) {
23788
23789
  super();
@@ -48024,10 +48025,10 @@ class AlignmentHelper {
48024
48025
  }
48025
48026
  };
48026
48027
  nearbyItems.forEach((item) => {
48027
- if (item === movingItem || item.itemType === "Comment") {
48028
+ if (item === movingItem || item.itemType === "Comment" || item instanceof BaseItem && !item.shouldUseRelativeAlignment) {
48028
48029
  return;
48029
48030
  }
48030
- const itemMbr = item.itemType === "Shape" ? item.getPath().getMbr() : item.getMbr();
48031
+ const itemMbr = item.getPathMbr();
48031
48032
  const centerXMoving = (movingMBR.left + movingMBR.right) / 2;
48032
48033
  const centerXItem = (itemMbr.left + itemMbr.right) / 2;
48033
48034
  const centerYMoving = (movingMBR.top + movingMBR.bottom) / 2;
@@ -50172,14 +50173,14 @@ class Card extends BaseItem {
50172
50173
  this.imageToRender = this.face;
50173
50174
  }
50174
50175
  }
50175
- render(context, left) {
50176
+ render(context, left, top) {
50176
50177
  if (this.transformationRenderBlock) {
50177
50178
  return;
50178
50179
  }
50179
50180
  const ctx = context.ctx;
50180
50181
  if (this.imageToRender && this.imageToRender.complete) {
50181
50182
  ctx.save();
50182
- ctx.drawImage(this.imageToRender, left ? left : this.left, this.top, CARD_DIMENSIONS.width, CARD_DIMENSIONS.height);
50183
+ ctx.drawImage(this.imageToRender, typeof left === "number" ? left : this.left, typeof top === "number" ? top : this.top, CARD_DIMENSIONS.width, CARD_DIMENSIONS.height);
50183
50184
  ctx.restore();
50184
50185
  }
50185
50186
  }
@@ -50266,6 +50267,7 @@ class Deck extends BaseItem {
50266
50267
  });
50267
50268
  this.board.items.index.remove(foundItem);
50268
50269
  foundItem.parent = this.getId();
50270
+ foundItem.shouldUseRelativeAlignment = false;
50269
50271
  this.index?.insert(foundItem);
50270
50272
  }
50271
50273
  }
@@ -50290,6 +50292,7 @@ class Deck extends BaseItem {
50290
50292
  });
50291
50293
  this.index?.remove(foundItem);
50292
50294
  foundItem.parent = "Board";
50295
+ foundItem.shouldUseRelativeAlignment = true;
50293
50296
  this.board.items.index.insert(foundItem);
50294
50297
  }
50295
50298
  }
@@ -50384,7 +50387,7 @@ class Deck extends BaseItem {
50384
50387
  return;
50385
50388
  const tempContext = { ...context, ctx: tempCtx };
50386
50389
  this.index?.list().forEach((item, index2) => {
50387
- item.render(tempContext, index2 * 2);
50390
+ item.render(tempContext, index2 * 2, 0);
50388
50391
  });
50389
50392
  this.cachedCanvas = tempCanvas;
50390
50393
  }
@@ -36,6 +36,7 @@ export declare class BaseItem extends Mbr implements Geometry {
36
36
  onRemoveCallbacks: (() => void)[];
37
37
  shouldUseCustomRender: boolean;
38
38
  shouldRenderOutsideViewRect: boolean;
39
+ shouldUseRelativeAlignment: boolean;
39
40
  itemType: string;
40
41
  constructor(board: Board, id?: string, defaultItemData?: BaseItemData | undefined, isGroupItem?: boolean);
41
42
  getId(): string;
@@ -26,7 +26,7 @@ export declare class Card extends BaseItem {
26
26
  });
27
27
  createImages(): void;
28
28
  updateImageToRender(): void;
29
- render(context: DrawingContext, left?: number): void;
29
+ render(context: DrawingContext, left?: number, top?: number): void;
30
30
  updateMbr(): void;
31
31
  getPath(): Path | Paths;
32
32
  deserialize(data: SerializedItemData): this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.4.94",
3
+ "version": "0.4.96",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",