microboard-temp 0.4.78 → 0.4.80

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.
@@ -47923,22 +47923,11 @@ var defaultDeckData = {
47923
47923
  class Deck extends BaseItem {
47924
47924
  subject = new Subject;
47925
47925
  shouldUseCustomRender = false;
47926
- constructor(board, id = "", defaultData2, cards) {
47926
+ constructor(board, id = "") {
47927
47927
  super(board, id, defaultDeckData, true);
47928
47928
  this.index.getUnderPoint = () => [];
47929
47929
  this.index.getEnclosed = () => [];
47930
47930
  this.index.getEnclosedOrCrossed = () => [];
47931
- if (cards) {
47932
- this.transformation.apply({
47933
- class: "Transformation",
47934
- method: "translateTo",
47935
- item: [this.id],
47936
- x: cards[0].left,
47937
- y: cards[0].top
47938
- });
47939
- this.updateMbr();
47940
- this.applyAddChildren(cards.map((card) => card.getId()));
47941
- }
47942
47931
  this.transformation.subject.subscribe(() => {
47943
47932
  this.updateMbr();
47944
47933
  this.subject.publish(this);
@@ -48026,8 +48015,8 @@ class Deck extends BaseItem {
48026
48015
  const j = Math.floor(Math.random() * (i + 1));
48027
48016
  [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
48028
48017
  }
48029
- this.index.clear();
48030
- shuffled.forEach((card) => this.index.insert(card));
48018
+ this.removeChildItems(this.index.list());
48019
+ this.addChildItems(shuffled);
48031
48020
  }
48032
48021
  apply(op) {
48033
48022
  super.apply(op);
@@ -48035,11 +48024,12 @@ class Deck extends BaseItem {
48035
48024
  }
48036
48025
  updateMbr() {
48037
48026
  const { translateX, translateY } = this.transformation.matrix;
48038
- const indexMbr = this.index.getMbr();
48027
+ const items = this.index.list();
48028
+ const itemsMbr = items[0].getMbr().combine(items.slice(1).map((item) => item.getMbr()));
48039
48029
  this.left = translateX;
48040
48030
  this.top = translateY;
48041
- this.right = translateX + indexMbr.getWidth();
48042
- this.bottom = translateY + indexMbr.getHeight();
48031
+ this.right = translateX + itemsMbr.getWidth();
48032
+ this.bottom = translateY + itemsMbr.getHeight();
48043
48033
  }
48044
48034
  deserialize(data) {
48045
48035
  super.deserialize(data);
package/dist/cjs/index.js CHANGED
@@ -47923,22 +47923,11 @@ var defaultDeckData = {
47923
47923
  class Deck extends BaseItem {
47924
47924
  subject = new Subject;
47925
47925
  shouldUseCustomRender = false;
47926
- constructor(board, id = "", defaultData2, cards) {
47926
+ constructor(board, id = "") {
47927
47927
  super(board, id, defaultDeckData, true);
47928
47928
  this.index.getUnderPoint = () => [];
47929
47929
  this.index.getEnclosed = () => [];
47930
47930
  this.index.getEnclosedOrCrossed = () => [];
47931
- if (cards) {
47932
- this.transformation.apply({
47933
- class: "Transformation",
47934
- method: "translateTo",
47935
- item: [this.id],
47936
- x: cards[0].left,
47937
- y: cards[0].top
47938
- });
47939
- this.updateMbr();
47940
- this.applyAddChildren(cards.map((card) => card.getId()));
47941
- }
47942
47931
  this.transformation.subject.subscribe(() => {
47943
47932
  this.updateMbr();
47944
47933
  this.subject.publish(this);
@@ -48026,8 +48015,8 @@ class Deck extends BaseItem {
48026
48015
  const j = Math.floor(Math.random() * (i + 1));
48027
48016
  [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
48028
48017
  }
48029
- this.index.clear();
48030
- shuffled.forEach((card) => this.index.insert(card));
48018
+ this.removeChildItems(this.index.list());
48019
+ this.addChildItems(shuffled);
48031
48020
  }
48032
48021
  apply(op) {
48033
48022
  super.apply(op);
@@ -48035,11 +48024,12 @@ class Deck extends BaseItem {
48035
48024
  }
48036
48025
  updateMbr() {
48037
48026
  const { translateX, translateY } = this.transformation.matrix;
48038
- const indexMbr = this.index.getMbr();
48027
+ const items = this.index.list();
48028
+ const itemsMbr = items[0].getMbr().combine(items.slice(1).map((item) => item.getMbr()));
48039
48029
  this.left = translateX;
48040
48030
  this.top = translateY;
48041
- this.right = translateX + indexMbr.getWidth();
48042
- this.bottom = translateY + indexMbr.getHeight();
48031
+ this.right = translateX + itemsMbr.getWidth();
48032
+ this.bottom = translateY + itemsMbr.getHeight();
48043
48033
  }
48044
48034
  deserialize(data) {
48045
48035
  super.deserialize(data);
package/dist/cjs/node.js CHANGED
@@ -50396,22 +50396,11 @@ var defaultDeckData = {
50396
50396
  class Deck extends BaseItem {
50397
50397
  subject = new Subject;
50398
50398
  shouldUseCustomRender = false;
50399
- constructor(board, id = "", defaultData2, cards) {
50399
+ constructor(board, id = "") {
50400
50400
  super(board, id, defaultDeckData, true);
50401
50401
  this.index.getUnderPoint = () => [];
50402
50402
  this.index.getEnclosed = () => [];
50403
50403
  this.index.getEnclosedOrCrossed = () => [];
50404
- if (cards) {
50405
- this.transformation.apply({
50406
- class: "Transformation",
50407
- method: "translateTo",
50408
- item: [this.id],
50409
- x: cards[0].left,
50410
- y: cards[0].top
50411
- });
50412
- this.updateMbr();
50413
- this.applyAddChildren(cards.map((card) => card.getId()));
50414
- }
50415
50404
  this.transformation.subject.subscribe(() => {
50416
50405
  this.updateMbr();
50417
50406
  this.subject.publish(this);
@@ -50499,8 +50488,8 @@ class Deck extends BaseItem {
50499
50488
  const j = Math.floor(Math.random() * (i + 1));
50500
50489
  [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
50501
50490
  }
50502
- this.index.clear();
50503
- shuffled.forEach((card) => this.index.insert(card));
50491
+ this.removeChildItems(this.index.list());
50492
+ this.addChildItems(shuffled);
50504
50493
  }
50505
50494
  apply(op) {
50506
50495
  super.apply(op);
@@ -50508,11 +50497,12 @@ class Deck extends BaseItem {
50508
50497
  }
50509
50498
  updateMbr() {
50510
50499
  const { translateX, translateY } = this.transformation.matrix;
50511
- const indexMbr = this.index.getMbr();
50500
+ const items = this.index.list();
50501
+ const itemsMbr = items[0].getMbr().combine(items.slice(1).map((item) => item.getMbr()));
50512
50502
  this.left = translateX;
50513
50503
  this.top = translateY;
50514
- this.right = translateX + indexMbr.getWidth();
50515
- this.bottom = translateY + indexMbr.getHeight();
50504
+ this.right = translateX + itemsMbr.getWidth();
50505
+ this.bottom = translateY + itemsMbr.getHeight();
50516
50506
  }
50517
50507
  deserialize(data) {
50518
50508
  super.deserialize(data);
@@ -47772,22 +47772,11 @@ var defaultDeckData = {
47772
47772
  class Deck extends BaseItem {
47773
47773
  subject = new Subject;
47774
47774
  shouldUseCustomRender = false;
47775
- constructor(board, id = "", defaultData2, cards) {
47775
+ constructor(board, id = "") {
47776
47776
  super(board, id, defaultDeckData, true);
47777
47777
  this.index.getUnderPoint = () => [];
47778
47778
  this.index.getEnclosed = () => [];
47779
47779
  this.index.getEnclosedOrCrossed = () => [];
47780
- if (cards) {
47781
- this.transformation.apply({
47782
- class: "Transformation",
47783
- method: "translateTo",
47784
- item: [this.id],
47785
- x: cards[0].left,
47786
- y: cards[0].top
47787
- });
47788
- this.updateMbr();
47789
- this.applyAddChildren(cards.map((card) => card.getId()));
47790
- }
47791
47780
  this.transformation.subject.subscribe(() => {
47792
47781
  this.updateMbr();
47793
47782
  this.subject.publish(this);
@@ -47875,8 +47864,8 @@ class Deck extends BaseItem {
47875
47864
  const j = Math.floor(Math.random() * (i + 1));
47876
47865
  [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
47877
47866
  }
47878
- this.index.clear();
47879
- shuffled.forEach((card) => this.index.insert(card));
47867
+ this.removeChildItems(this.index.list());
47868
+ this.addChildItems(shuffled);
47880
47869
  }
47881
47870
  apply(op) {
47882
47871
  super.apply(op);
@@ -47884,11 +47873,12 @@ class Deck extends BaseItem {
47884
47873
  }
47885
47874
  updateMbr() {
47886
47875
  const { translateX, translateY } = this.transformation.matrix;
47887
- const indexMbr = this.index.getMbr();
47876
+ const items = this.index.list();
47877
+ const itemsMbr = items[0].getMbr().combine(items.slice(1).map((item) => item.getMbr()));
47888
47878
  this.left = translateX;
47889
47879
  this.top = translateY;
47890
- this.right = translateX + indexMbr.getWidth();
47891
- this.bottom = translateY + indexMbr.getHeight();
47880
+ this.right = translateX + itemsMbr.getWidth();
47881
+ this.bottom = translateY + itemsMbr.getHeight();
47892
47882
  }
47893
47883
  deserialize(data) {
47894
47884
  super.deserialize(data);
package/dist/esm/index.js CHANGED
@@ -47765,22 +47765,11 @@ var defaultDeckData = {
47765
47765
  class Deck extends BaseItem {
47766
47766
  subject = new Subject;
47767
47767
  shouldUseCustomRender = false;
47768
- constructor(board, id = "", defaultData2, cards) {
47768
+ constructor(board, id = "") {
47769
47769
  super(board, id, defaultDeckData, true);
47770
47770
  this.index.getUnderPoint = () => [];
47771
47771
  this.index.getEnclosed = () => [];
47772
47772
  this.index.getEnclosedOrCrossed = () => [];
47773
- if (cards) {
47774
- this.transformation.apply({
47775
- class: "Transformation",
47776
- method: "translateTo",
47777
- item: [this.id],
47778
- x: cards[0].left,
47779
- y: cards[0].top
47780
- });
47781
- this.updateMbr();
47782
- this.applyAddChildren(cards.map((card) => card.getId()));
47783
- }
47784
47773
  this.transformation.subject.subscribe(() => {
47785
47774
  this.updateMbr();
47786
47775
  this.subject.publish(this);
@@ -47868,8 +47857,8 @@ class Deck extends BaseItem {
47868
47857
  const j = Math.floor(Math.random() * (i + 1));
47869
47858
  [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
47870
47859
  }
47871
- this.index.clear();
47872
- shuffled.forEach((card) => this.index.insert(card));
47860
+ this.removeChildItems(this.index.list());
47861
+ this.addChildItems(shuffled);
47873
47862
  }
47874
47863
  apply(op) {
47875
47864
  super.apply(op);
@@ -47877,11 +47866,12 @@ class Deck extends BaseItem {
47877
47866
  }
47878
47867
  updateMbr() {
47879
47868
  const { translateX, translateY } = this.transformation.matrix;
47880
- const indexMbr = this.index.getMbr();
47869
+ const items = this.index.list();
47870
+ const itemsMbr = items[0].getMbr().combine(items.slice(1).map((item) => item.getMbr()));
47881
47871
  this.left = translateX;
47882
47872
  this.top = translateY;
47883
- this.right = translateX + indexMbr.getWidth();
47884
- this.bottom = translateY + indexMbr.getHeight();
47873
+ this.right = translateX + itemsMbr.getWidth();
47874
+ this.bottom = translateY + itemsMbr.getHeight();
47885
47875
  }
47886
47876
  deserialize(data) {
47887
47877
  super.deserialize(data);
package/dist/esm/node.js CHANGED
@@ -50233,22 +50233,11 @@ var defaultDeckData = {
50233
50233
  class Deck extends BaseItem {
50234
50234
  subject = new Subject;
50235
50235
  shouldUseCustomRender = false;
50236
- constructor(board, id = "", defaultData2, cards) {
50236
+ constructor(board, id = "") {
50237
50237
  super(board, id, defaultDeckData, true);
50238
50238
  this.index.getUnderPoint = () => [];
50239
50239
  this.index.getEnclosed = () => [];
50240
50240
  this.index.getEnclosedOrCrossed = () => [];
50241
- if (cards) {
50242
- this.transformation.apply({
50243
- class: "Transformation",
50244
- method: "translateTo",
50245
- item: [this.id],
50246
- x: cards[0].left,
50247
- y: cards[0].top
50248
- });
50249
- this.updateMbr();
50250
- this.applyAddChildren(cards.map((card) => card.getId()));
50251
- }
50252
50241
  this.transformation.subject.subscribe(() => {
50253
50242
  this.updateMbr();
50254
50243
  this.subject.publish(this);
@@ -50336,8 +50325,8 @@ class Deck extends BaseItem {
50336
50325
  const j = Math.floor(Math.random() * (i + 1));
50337
50326
  [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
50338
50327
  }
50339
- this.index.clear();
50340
- shuffled.forEach((card) => this.index.insert(card));
50328
+ this.removeChildItems(this.index.list());
50329
+ this.addChildItems(shuffled);
50341
50330
  }
50342
50331
  apply(op) {
50343
50332
  super.apply(op);
@@ -50345,11 +50334,12 @@ class Deck extends BaseItem {
50345
50334
  }
50346
50335
  updateMbr() {
50347
50336
  const { translateX, translateY } = this.transformation.matrix;
50348
- const indexMbr = this.index.getMbr();
50337
+ const items = this.index.list();
50338
+ const itemsMbr = items[0].getMbr().combine(items.slice(1).map((item) => item.getMbr()));
50349
50339
  this.left = translateX;
50350
50340
  this.top = translateY;
50351
- this.right = translateX + indexMbr.getWidth();
50352
- this.bottom = translateY + indexMbr.getHeight();
50341
+ this.right = translateX + itemsMbr.getWidth();
50342
+ this.bottom = translateY + itemsMbr.getHeight();
50353
50343
  }
50354
50344
  deserialize(data) {
50355
50345
  super.deserialize(data);
@@ -8,7 +8,7 @@ export declare const defaultDeckData: BaseItemData;
8
8
  export declare class Deck extends BaseItem {
9
9
  readonly subject: Subject<Deck>;
10
10
  shouldUseCustomRender: boolean;
11
- constructor(board: Board, id?: string, defaultData?: BaseItemData, cards?: Card[]);
11
+ constructor(board: Board, id?: string);
12
12
  applyAddChildren(childIds: string[]): void;
13
13
  applyRemoveChildren(childIds: string[]): void;
14
14
  getDeck(): Card[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.4.78",
3
+ "version": "0.4.80",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",