microboard-temp 0.4.20 → 0.4.21

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.
@@ -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
@@ -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
@@ -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
  };
@@ -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
@@ -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
@@ -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.21",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",