microboard-temp 0.4.20 → 0.4.22

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.
@@ -46224,7 +46224,7 @@ class AddDice extends ShapeTool {
46224
46224
  }
46225
46225
 
46226
46226
  // src/Items/Examples/CardGame/Dice/Dice.ts
46227
- var TIMEOUT = 3000;
46227
+ var TIMEOUT = 2000;
46228
46228
  var defaultDiceData = {
46229
46229
  itemType: "Dice",
46230
46230
  backgroundColor: "#FFFFFF",
@@ -46271,7 +46271,7 @@ class Dice extends BaseItem {
46271
46271
  context.ctx.save();
46272
46272
  if (this.animationFrameId) {
46273
46273
  const now = Date.now();
46274
- const angle = now % 1000 / 1000 * 2 * Math.PI;
46274
+ const angle = now % 500 / 500 * 2 * Math.PI;
46275
46275
  const mbr2 = this.getMbr();
46276
46276
  const centerX2 = (mbr2.left + mbr2.right) / 2;
46277
46277
  const centerY2 = (mbr2.top + mbr2.bottom) / 2;
@@ -46288,10 +46288,6 @@ class Dice extends BaseItem {
46288
46288
  context.ctx.textAlign = "center";
46289
46289
  context.ctx.textBaseline = "middle";
46290
46290
  context.ctx.fillText(String(this.value), centerX, centerY);
46291
- if (this.getLinkTo()) {
46292
- const { top, right } = this.getMbr();
46293
- this.linkTo.render(context, top, right, this.board.camera.getScale());
46294
- }
46295
46291
  context.ctx.restore();
46296
46292
  }
46297
46293
  updateMbr() {
@@ -46370,7 +46366,7 @@ class Dice extends BaseItem {
46370
46366
  class: "Dice",
46371
46367
  method: "changeValue",
46372
46368
  item: [this.getId()],
46373
- newData: { value, shouldRotate: true },
46369
+ newData: { value, shouldRotate: true, timeStamp: Date.now() },
46374
46370
  prevData: { value: this.value, shouldRotate: false }
46375
46371
  });
46376
46372
  }
@@ -46392,7 +46388,7 @@ class Dice extends BaseItem {
46392
46388
  this.applyBorderColor(op.newData.borderColor);
46393
46389
  break;
46394
46390
  case "changeValue":
46395
- if (op.newData.shouldRotate) {
46391
+ if (op.newData.shouldRotate && op.newData.timeStamp && Date.now() - op.newData.timeStamp < 1e4) {
46396
46392
  this.startRotation();
46397
46393
  setTimeout(() => {
46398
46394
  this.stopRotation();
@@ -46414,7 +46410,7 @@ class Dice extends BaseItem {
46414
46410
  if (!this.animationFrameId) {
46415
46411
  const animate = () => {
46416
46412
  if (this.drawingContext) {
46417
- this.render(this.drawingContext);
46413
+ this.subject.publish(this);
46418
46414
  this.animationFrameId = requestAnimationFrame(animate);
46419
46415
  }
46420
46416
  };
package/dist/cjs/index.js CHANGED
@@ -46224,7 +46224,7 @@ class AddDice extends ShapeTool {
46224
46224
  }
46225
46225
 
46226
46226
  // src/Items/Examples/CardGame/Dice/Dice.ts
46227
- var TIMEOUT = 3000;
46227
+ var TIMEOUT = 2000;
46228
46228
  var defaultDiceData = {
46229
46229
  itemType: "Dice",
46230
46230
  backgroundColor: "#FFFFFF",
@@ -46271,7 +46271,7 @@ class Dice extends BaseItem {
46271
46271
  context.ctx.save();
46272
46272
  if (this.animationFrameId) {
46273
46273
  const now = Date.now();
46274
- const angle = now % 1000 / 1000 * 2 * Math.PI;
46274
+ const angle = now % 500 / 500 * 2 * Math.PI;
46275
46275
  const mbr2 = this.getMbr();
46276
46276
  const centerX2 = (mbr2.left + mbr2.right) / 2;
46277
46277
  const centerY2 = (mbr2.top + mbr2.bottom) / 2;
@@ -46288,10 +46288,6 @@ class Dice extends BaseItem {
46288
46288
  context.ctx.textAlign = "center";
46289
46289
  context.ctx.textBaseline = "middle";
46290
46290
  context.ctx.fillText(String(this.value), centerX, centerY);
46291
- if (this.getLinkTo()) {
46292
- const { top, right } = this.getMbr();
46293
- this.linkTo.render(context, top, right, this.board.camera.getScale());
46294
- }
46295
46291
  context.ctx.restore();
46296
46292
  }
46297
46293
  updateMbr() {
@@ -46370,7 +46366,7 @@ class Dice extends BaseItem {
46370
46366
  class: "Dice",
46371
46367
  method: "changeValue",
46372
46368
  item: [this.getId()],
46373
- newData: { value, shouldRotate: true },
46369
+ newData: { value, shouldRotate: true, timeStamp: Date.now() },
46374
46370
  prevData: { value: this.value, shouldRotate: false }
46375
46371
  });
46376
46372
  }
@@ -46392,7 +46388,7 @@ class Dice extends BaseItem {
46392
46388
  this.applyBorderColor(op.newData.borderColor);
46393
46389
  break;
46394
46390
  case "changeValue":
46395
- if (op.newData.shouldRotate) {
46391
+ if (op.newData.shouldRotate && op.newData.timeStamp && Date.now() - op.newData.timeStamp < 1e4) {
46396
46392
  this.startRotation();
46397
46393
  setTimeout(() => {
46398
46394
  this.stopRotation();
@@ -46414,7 +46410,7 @@ class Dice extends BaseItem {
46414
46410
  if (!this.animationFrameId) {
46415
46411
  const animate = () => {
46416
46412
  if (this.drawingContext) {
46417
- this.render(this.drawingContext);
46413
+ this.subject.publish(this);
46418
46414
  this.animationFrameId = requestAnimationFrame(animate);
46419
46415
  }
46420
46416
  };
package/dist/cjs/node.js CHANGED
@@ -48764,7 +48764,7 @@ class AddDice extends ShapeTool {
48764
48764
  }
48765
48765
 
48766
48766
  // src/Items/Examples/CardGame/Dice/Dice.ts
48767
- var TIMEOUT = 3000;
48767
+ var TIMEOUT = 2000;
48768
48768
  var defaultDiceData = {
48769
48769
  itemType: "Dice",
48770
48770
  backgroundColor: "#FFFFFF",
@@ -48811,7 +48811,7 @@ class Dice extends BaseItem {
48811
48811
  context.ctx.save();
48812
48812
  if (this.animationFrameId) {
48813
48813
  const now = Date.now();
48814
- const angle = now % 1000 / 1000 * 2 * Math.PI;
48814
+ const angle = now % 500 / 500 * 2 * Math.PI;
48815
48815
  const mbr2 = this.getMbr();
48816
48816
  const centerX2 = (mbr2.left + mbr2.right) / 2;
48817
48817
  const centerY2 = (mbr2.top + mbr2.bottom) / 2;
@@ -48828,10 +48828,6 @@ class Dice extends BaseItem {
48828
48828
  context.ctx.textAlign = "center";
48829
48829
  context.ctx.textBaseline = "middle";
48830
48830
  context.ctx.fillText(String(this.value), centerX, centerY);
48831
- if (this.getLinkTo()) {
48832
- const { top, right } = this.getMbr();
48833
- this.linkTo.render(context, top, right, this.board.camera.getScale());
48834
- }
48835
48831
  context.ctx.restore();
48836
48832
  }
48837
48833
  updateMbr() {
@@ -48910,7 +48906,7 @@ class Dice extends BaseItem {
48910
48906
  class: "Dice",
48911
48907
  method: "changeValue",
48912
48908
  item: [this.getId()],
48913
- newData: { value, shouldRotate: true },
48909
+ newData: { value, shouldRotate: true, timeStamp: Date.now() },
48914
48910
  prevData: { value: this.value, shouldRotate: false }
48915
48911
  });
48916
48912
  }
@@ -48932,7 +48928,7 @@ class Dice extends BaseItem {
48932
48928
  this.applyBorderColor(op.newData.borderColor);
48933
48929
  break;
48934
48930
  case "changeValue":
48935
- if (op.newData.shouldRotate) {
48931
+ if (op.newData.shouldRotate && op.newData.timeStamp && Date.now() - op.newData.timeStamp < 1e4) {
48936
48932
  this.startRotation();
48937
48933
  setTimeout(() => {
48938
48934
  this.stopRotation();
@@ -48954,7 +48950,7 @@ class Dice extends BaseItem {
48954
48950
  if (!this.animationFrameId) {
48955
48951
  const animate = () => {
48956
48952
  if (this.drawingContext) {
48957
- this.render(this.drawingContext);
48953
+ this.subject.publish(this);
48958
48954
  this.animationFrameId = requestAnimationFrame(animate);
48959
48955
  }
48960
48956
  };
@@ -46074,7 +46074,7 @@ class AddDice extends ShapeTool {
46074
46074
  }
46075
46075
 
46076
46076
  // src/Items/Examples/CardGame/Dice/Dice.ts
46077
- var TIMEOUT = 3000;
46077
+ var TIMEOUT = 2000;
46078
46078
  var defaultDiceData = {
46079
46079
  itemType: "Dice",
46080
46080
  backgroundColor: "#FFFFFF",
@@ -46121,7 +46121,7 @@ class Dice extends BaseItem {
46121
46121
  context.ctx.save();
46122
46122
  if (this.animationFrameId) {
46123
46123
  const now = Date.now();
46124
- const angle = now % 1000 / 1000 * 2 * Math.PI;
46124
+ const angle = now % 500 / 500 * 2 * Math.PI;
46125
46125
  const mbr2 = this.getMbr();
46126
46126
  const centerX2 = (mbr2.left + mbr2.right) / 2;
46127
46127
  const centerY2 = (mbr2.top + mbr2.bottom) / 2;
@@ -46138,10 +46138,6 @@ class Dice extends BaseItem {
46138
46138
  context.ctx.textAlign = "center";
46139
46139
  context.ctx.textBaseline = "middle";
46140
46140
  context.ctx.fillText(String(this.value), centerX, centerY);
46141
- if (this.getLinkTo()) {
46142
- const { top, right } = this.getMbr();
46143
- this.linkTo.render(context, top, right, this.board.camera.getScale());
46144
- }
46145
46141
  context.ctx.restore();
46146
46142
  }
46147
46143
  updateMbr() {
@@ -46220,7 +46216,7 @@ class Dice extends BaseItem {
46220
46216
  class: "Dice",
46221
46217
  method: "changeValue",
46222
46218
  item: [this.getId()],
46223
- newData: { value, shouldRotate: true },
46219
+ newData: { value, shouldRotate: true, timeStamp: Date.now() },
46224
46220
  prevData: { value: this.value, shouldRotate: false }
46225
46221
  });
46226
46222
  }
@@ -46242,7 +46238,7 @@ class Dice extends BaseItem {
46242
46238
  this.applyBorderColor(op.newData.borderColor);
46243
46239
  break;
46244
46240
  case "changeValue":
46245
- if (op.newData.shouldRotate) {
46241
+ if (op.newData.shouldRotate && op.newData.timeStamp && Date.now() - op.newData.timeStamp < 1e4) {
46246
46242
  this.startRotation();
46247
46243
  setTimeout(() => {
46248
46244
  this.stopRotation();
@@ -46264,7 +46260,7 @@ class Dice extends BaseItem {
46264
46260
  if (!this.animationFrameId) {
46265
46261
  const animate = () => {
46266
46262
  if (this.drawingContext) {
46267
- this.render(this.drawingContext);
46263
+ this.subject.publish(this);
46268
46264
  this.animationFrameId = requestAnimationFrame(animate);
46269
46265
  }
46270
46266
  };
package/dist/esm/index.js CHANGED
@@ -46067,7 +46067,7 @@ class AddDice extends ShapeTool {
46067
46067
  }
46068
46068
 
46069
46069
  // src/Items/Examples/CardGame/Dice/Dice.ts
46070
- var TIMEOUT = 3000;
46070
+ var TIMEOUT = 2000;
46071
46071
  var defaultDiceData = {
46072
46072
  itemType: "Dice",
46073
46073
  backgroundColor: "#FFFFFF",
@@ -46114,7 +46114,7 @@ class Dice extends BaseItem {
46114
46114
  context.ctx.save();
46115
46115
  if (this.animationFrameId) {
46116
46116
  const now = Date.now();
46117
- const angle = now % 1000 / 1000 * 2 * Math.PI;
46117
+ const angle = now % 500 / 500 * 2 * Math.PI;
46118
46118
  const mbr2 = this.getMbr();
46119
46119
  const centerX2 = (mbr2.left + mbr2.right) / 2;
46120
46120
  const centerY2 = (mbr2.top + mbr2.bottom) / 2;
@@ -46131,10 +46131,6 @@ class Dice extends BaseItem {
46131
46131
  context.ctx.textAlign = "center";
46132
46132
  context.ctx.textBaseline = "middle";
46133
46133
  context.ctx.fillText(String(this.value), centerX, centerY);
46134
- if (this.getLinkTo()) {
46135
- const { top, right } = this.getMbr();
46136
- this.linkTo.render(context, top, right, this.board.camera.getScale());
46137
- }
46138
46134
  context.ctx.restore();
46139
46135
  }
46140
46136
  updateMbr() {
@@ -46213,7 +46209,7 @@ class Dice extends BaseItem {
46213
46209
  class: "Dice",
46214
46210
  method: "changeValue",
46215
46211
  item: [this.getId()],
46216
- newData: { value, shouldRotate: true },
46212
+ newData: { value, shouldRotate: true, timeStamp: Date.now() },
46217
46213
  prevData: { value: this.value, shouldRotate: false }
46218
46214
  });
46219
46215
  }
@@ -46235,7 +46231,7 @@ class Dice extends BaseItem {
46235
46231
  this.applyBorderColor(op.newData.borderColor);
46236
46232
  break;
46237
46233
  case "changeValue":
46238
- if (op.newData.shouldRotate) {
46234
+ if (op.newData.shouldRotate && op.newData.timeStamp && Date.now() - op.newData.timeStamp < 1e4) {
46239
46235
  this.startRotation();
46240
46236
  setTimeout(() => {
46241
46237
  this.stopRotation();
@@ -46257,7 +46253,7 @@ class Dice extends BaseItem {
46257
46253
  if (!this.animationFrameId) {
46258
46254
  const animate = () => {
46259
46255
  if (this.drawingContext) {
46260
- this.render(this.drawingContext);
46256
+ this.subject.publish(this);
46261
46257
  this.animationFrameId = requestAnimationFrame(animate);
46262
46258
  }
46263
46259
  };
package/dist/esm/node.js CHANGED
@@ -48602,7 +48602,7 @@ class AddDice extends ShapeTool {
48602
48602
  }
48603
48603
 
48604
48604
  // src/Items/Examples/CardGame/Dice/Dice.ts
48605
- var TIMEOUT = 3000;
48605
+ var TIMEOUT = 2000;
48606
48606
  var defaultDiceData = {
48607
48607
  itemType: "Dice",
48608
48608
  backgroundColor: "#FFFFFF",
@@ -48649,7 +48649,7 @@ class Dice extends BaseItem {
48649
48649
  context.ctx.save();
48650
48650
  if (this.animationFrameId) {
48651
48651
  const now = Date.now();
48652
- const angle = now % 1000 / 1000 * 2 * Math.PI;
48652
+ const angle = now % 500 / 500 * 2 * Math.PI;
48653
48653
  const mbr2 = this.getMbr();
48654
48654
  const centerX2 = (mbr2.left + mbr2.right) / 2;
48655
48655
  const centerY2 = (mbr2.top + mbr2.bottom) / 2;
@@ -48666,10 +48666,6 @@ class Dice extends BaseItem {
48666
48666
  context.ctx.textAlign = "center";
48667
48667
  context.ctx.textBaseline = "middle";
48668
48668
  context.ctx.fillText(String(this.value), centerX, centerY);
48669
- if (this.getLinkTo()) {
48670
- const { top, right } = this.getMbr();
48671
- this.linkTo.render(context, top, right, this.board.camera.getScale());
48672
- }
48673
48669
  context.ctx.restore();
48674
48670
  }
48675
48671
  updateMbr() {
@@ -48748,7 +48744,7 @@ class Dice extends BaseItem {
48748
48744
  class: "Dice",
48749
48745
  method: "changeValue",
48750
48746
  item: [this.getId()],
48751
- newData: { value, shouldRotate: true },
48747
+ newData: { value, shouldRotate: true, timeStamp: Date.now() },
48752
48748
  prevData: { value: this.value, shouldRotate: false }
48753
48749
  });
48754
48750
  }
@@ -48770,7 +48766,7 @@ class Dice extends BaseItem {
48770
48766
  this.applyBorderColor(op.newData.borderColor);
48771
48767
  break;
48772
48768
  case "changeValue":
48773
- if (op.newData.shouldRotate) {
48769
+ if (op.newData.shouldRotate && op.newData.timeStamp && Date.now() - op.newData.timeStamp < 1e4) {
48774
48770
  this.startRotation();
48775
48771
  setTimeout(() => {
48776
48772
  this.stopRotation();
@@ -48792,7 +48788,7 @@ class Dice extends BaseItem {
48792
48788
  if (!this.animationFrameId) {
48793
48789
  const animate = () => {
48794
48790
  if (this.drawingContext) {
48795
- this.render(this.drawingContext);
48791
+ this.subject.publish(this);
48796
48792
  this.animationFrameId = requestAnimationFrame(animate);
48797
48793
  }
48798
48794
  };
@@ -3,6 +3,7 @@ export type DiceOperation = ChangeValue | ChangeValuesRange | SetBackgroundColor
3
3
  interface ChangeValue extends BaseOperation<{
4
4
  value: number;
5
5
  shouldRotate: boolean;
6
+ timeStamp?: number;
6
7
  }> {
7
8
  class: "Dice";
8
9
  method: "changeValue";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.4.20",
3
+ "version": "0.4.22",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",