microboard-temp 0.4.19 → 0.4.20

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.
@@ -46314,8 +46314,8 @@ class Dice extends BaseItem {
46314
46314
  this.subject.publish(this);
46315
46315
  return this;
46316
46316
  }
46317
- isClosed() {
46318
- return true;
46317
+ getIsRotating() {
46318
+ return !!this.animationFrameId;
46319
46319
  }
46320
46320
  applyBackgroundColor(backgroundColor) {
46321
46321
  this.backgroundColor = backgroundColor;
@@ -46370,24 +46370,12 @@ class Dice extends BaseItem {
46370
46370
  class: "Dice",
46371
46371
  method: "changeValue",
46372
46372
  item: [this.getId()],
46373
- newData: { value },
46374
- prevData: { value: this.value }
46375
- });
46376
- }
46377
- setIsRotating(isRotating) {
46378
- this.emit({
46379
- class: "Dice",
46380
- method: "setIsRotating",
46381
- item: [this.getId()],
46382
- newData: { isRotating },
46383
- prevData: { isRotating: false }
46373
+ newData: { value, shouldRotate: true },
46374
+ prevData: { value: this.value, shouldRotate: false }
46384
46375
  });
46385
46376
  }
46386
46377
  throwDice() {
46387
- this.setIsRotating(true);
46388
- setTimeout(() => {
46389
- this.setValue(Math.ceil(Math.random() * (this.range.max - this.range.min)) + this.range.min);
46390
- }, TIMEOUT);
46378
+ this.setValue(Math.ceil(Math.random() * (this.range.max - this.range.min)) + this.range.min);
46391
46379
  }
46392
46380
  apply(op) {
46393
46381
  super.apply(op);
@@ -46403,17 +46391,17 @@ class Dice extends BaseItem {
46403
46391
  case "setBorderColor":
46404
46392
  this.applyBorderColor(op.newData.borderColor);
46405
46393
  break;
46406
- case "setIsRotating":
46407
- if (op.newData.isRotating) {
46394
+ case "changeValue":
46395
+ if (op.newData.shouldRotate) {
46408
46396
  this.startRotation();
46409
46397
  setTimeout(() => {
46410
46398
  this.stopRotation();
46399
+ this.value = op.newData.value;
46411
46400
  }, TIMEOUT);
46401
+ } else {
46402
+ this.value = op.newData.value;
46412
46403
  }
46413
46404
  break;
46414
- case "changeValue":
46415
- this.value = op.newData.value;
46416
- break;
46417
46405
  case "changeValuesRange":
46418
46406
  this.range = op.newData;
46419
46407
  break;
package/dist/cjs/index.js CHANGED
@@ -46314,8 +46314,8 @@ class Dice extends BaseItem {
46314
46314
  this.subject.publish(this);
46315
46315
  return this;
46316
46316
  }
46317
- isClosed() {
46318
- return true;
46317
+ getIsRotating() {
46318
+ return !!this.animationFrameId;
46319
46319
  }
46320
46320
  applyBackgroundColor(backgroundColor) {
46321
46321
  this.backgroundColor = backgroundColor;
@@ -46370,24 +46370,12 @@ class Dice extends BaseItem {
46370
46370
  class: "Dice",
46371
46371
  method: "changeValue",
46372
46372
  item: [this.getId()],
46373
- newData: { value },
46374
- prevData: { value: this.value }
46375
- });
46376
- }
46377
- setIsRotating(isRotating) {
46378
- this.emit({
46379
- class: "Dice",
46380
- method: "setIsRotating",
46381
- item: [this.getId()],
46382
- newData: { isRotating },
46383
- prevData: { isRotating: false }
46373
+ newData: { value, shouldRotate: true },
46374
+ prevData: { value: this.value, shouldRotate: false }
46384
46375
  });
46385
46376
  }
46386
46377
  throwDice() {
46387
- this.setIsRotating(true);
46388
- setTimeout(() => {
46389
- this.setValue(Math.ceil(Math.random() * (this.range.max - this.range.min)) + this.range.min);
46390
- }, TIMEOUT);
46378
+ this.setValue(Math.ceil(Math.random() * (this.range.max - this.range.min)) + this.range.min);
46391
46379
  }
46392
46380
  apply(op) {
46393
46381
  super.apply(op);
@@ -46403,17 +46391,17 @@ class Dice extends BaseItem {
46403
46391
  case "setBorderColor":
46404
46392
  this.applyBorderColor(op.newData.borderColor);
46405
46393
  break;
46406
- case "setIsRotating":
46407
- if (op.newData.isRotating) {
46394
+ case "changeValue":
46395
+ if (op.newData.shouldRotate) {
46408
46396
  this.startRotation();
46409
46397
  setTimeout(() => {
46410
46398
  this.stopRotation();
46399
+ this.value = op.newData.value;
46411
46400
  }, TIMEOUT);
46401
+ } else {
46402
+ this.value = op.newData.value;
46412
46403
  }
46413
46404
  break;
46414
- case "changeValue":
46415
- this.value = op.newData.value;
46416
- break;
46417
46405
  case "changeValuesRange":
46418
46406
  this.range = op.newData;
46419
46407
  break;
package/dist/cjs/node.js CHANGED
@@ -48854,8 +48854,8 @@ class Dice extends BaseItem {
48854
48854
  this.subject.publish(this);
48855
48855
  return this;
48856
48856
  }
48857
- isClosed() {
48858
- return true;
48857
+ getIsRotating() {
48858
+ return !!this.animationFrameId;
48859
48859
  }
48860
48860
  applyBackgroundColor(backgroundColor) {
48861
48861
  this.backgroundColor = backgroundColor;
@@ -48910,24 +48910,12 @@ class Dice extends BaseItem {
48910
48910
  class: "Dice",
48911
48911
  method: "changeValue",
48912
48912
  item: [this.getId()],
48913
- newData: { value },
48914
- prevData: { value: this.value }
48915
- });
48916
- }
48917
- setIsRotating(isRotating) {
48918
- this.emit({
48919
- class: "Dice",
48920
- method: "setIsRotating",
48921
- item: [this.getId()],
48922
- newData: { isRotating },
48923
- prevData: { isRotating: false }
48913
+ newData: { value, shouldRotate: true },
48914
+ prevData: { value: this.value, shouldRotate: false }
48924
48915
  });
48925
48916
  }
48926
48917
  throwDice() {
48927
- this.setIsRotating(true);
48928
- setTimeout(() => {
48929
- this.setValue(Math.ceil(Math.random() * (this.range.max - this.range.min)) + this.range.min);
48930
- }, TIMEOUT);
48918
+ this.setValue(Math.ceil(Math.random() * (this.range.max - this.range.min)) + this.range.min);
48931
48919
  }
48932
48920
  apply(op) {
48933
48921
  super.apply(op);
@@ -48943,17 +48931,17 @@ class Dice extends BaseItem {
48943
48931
  case "setBorderColor":
48944
48932
  this.applyBorderColor(op.newData.borderColor);
48945
48933
  break;
48946
- case "setIsRotating":
48947
- if (op.newData.isRotating) {
48934
+ case "changeValue":
48935
+ if (op.newData.shouldRotate) {
48948
48936
  this.startRotation();
48949
48937
  setTimeout(() => {
48950
48938
  this.stopRotation();
48939
+ this.value = op.newData.value;
48951
48940
  }, TIMEOUT);
48941
+ } else {
48942
+ this.value = op.newData.value;
48952
48943
  }
48953
48944
  break;
48954
- case "changeValue":
48955
- this.value = op.newData.value;
48956
- break;
48957
48945
  case "changeValuesRange":
48958
48946
  this.range = op.newData;
48959
48947
  break;
@@ -46164,8 +46164,8 @@ class Dice extends BaseItem {
46164
46164
  this.subject.publish(this);
46165
46165
  return this;
46166
46166
  }
46167
- isClosed() {
46168
- return true;
46167
+ getIsRotating() {
46168
+ return !!this.animationFrameId;
46169
46169
  }
46170
46170
  applyBackgroundColor(backgroundColor) {
46171
46171
  this.backgroundColor = backgroundColor;
@@ -46220,24 +46220,12 @@ class Dice extends BaseItem {
46220
46220
  class: "Dice",
46221
46221
  method: "changeValue",
46222
46222
  item: [this.getId()],
46223
- newData: { value },
46224
- prevData: { value: this.value }
46225
- });
46226
- }
46227
- setIsRotating(isRotating) {
46228
- this.emit({
46229
- class: "Dice",
46230
- method: "setIsRotating",
46231
- item: [this.getId()],
46232
- newData: { isRotating },
46233
- prevData: { isRotating: false }
46223
+ newData: { value, shouldRotate: true },
46224
+ prevData: { value: this.value, shouldRotate: false }
46234
46225
  });
46235
46226
  }
46236
46227
  throwDice() {
46237
- this.setIsRotating(true);
46238
- setTimeout(() => {
46239
- this.setValue(Math.ceil(Math.random() * (this.range.max - this.range.min)) + this.range.min);
46240
- }, TIMEOUT);
46228
+ this.setValue(Math.ceil(Math.random() * (this.range.max - this.range.min)) + this.range.min);
46241
46229
  }
46242
46230
  apply(op) {
46243
46231
  super.apply(op);
@@ -46253,17 +46241,17 @@ class Dice extends BaseItem {
46253
46241
  case "setBorderColor":
46254
46242
  this.applyBorderColor(op.newData.borderColor);
46255
46243
  break;
46256
- case "setIsRotating":
46257
- if (op.newData.isRotating) {
46244
+ case "changeValue":
46245
+ if (op.newData.shouldRotate) {
46258
46246
  this.startRotation();
46259
46247
  setTimeout(() => {
46260
46248
  this.stopRotation();
46249
+ this.value = op.newData.value;
46261
46250
  }, TIMEOUT);
46251
+ } else {
46252
+ this.value = op.newData.value;
46262
46253
  }
46263
46254
  break;
46264
- case "changeValue":
46265
- this.value = op.newData.value;
46266
- break;
46267
46255
  case "changeValuesRange":
46268
46256
  this.range = op.newData;
46269
46257
  break;
package/dist/esm/index.js CHANGED
@@ -46157,8 +46157,8 @@ class Dice extends BaseItem {
46157
46157
  this.subject.publish(this);
46158
46158
  return this;
46159
46159
  }
46160
- isClosed() {
46161
- return true;
46160
+ getIsRotating() {
46161
+ return !!this.animationFrameId;
46162
46162
  }
46163
46163
  applyBackgroundColor(backgroundColor) {
46164
46164
  this.backgroundColor = backgroundColor;
@@ -46213,24 +46213,12 @@ class Dice extends BaseItem {
46213
46213
  class: "Dice",
46214
46214
  method: "changeValue",
46215
46215
  item: [this.getId()],
46216
- newData: { value },
46217
- prevData: { value: this.value }
46218
- });
46219
- }
46220
- setIsRotating(isRotating) {
46221
- this.emit({
46222
- class: "Dice",
46223
- method: "setIsRotating",
46224
- item: [this.getId()],
46225
- newData: { isRotating },
46226
- prevData: { isRotating: false }
46216
+ newData: { value, shouldRotate: true },
46217
+ prevData: { value: this.value, shouldRotate: false }
46227
46218
  });
46228
46219
  }
46229
46220
  throwDice() {
46230
- this.setIsRotating(true);
46231
- setTimeout(() => {
46232
- this.setValue(Math.ceil(Math.random() * (this.range.max - this.range.min)) + this.range.min);
46233
- }, TIMEOUT);
46221
+ this.setValue(Math.ceil(Math.random() * (this.range.max - this.range.min)) + this.range.min);
46234
46222
  }
46235
46223
  apply(op) {
46236
46224
  super.apply(op);
@@ -46246,17 +46234,17 @@ class Dice extends BaseItem {
46246
46234
  case "setBorderColor":
46247
46235
  this.applyBorderColor(op.newData.borderColor);
46248
46236
  break;
46249
- case "setIsRotating":
46250
- if (op.newData.isRotating) {
46237
+ case "changeValue":
46238
+ if (op.newData.shouldRotate) {
46251
46239
  this.startRotation();
46252
46240
  setTimeout(() => {
46253
46241
  this.stopRotation();
46242
+ this.value = op.newData.value;
46254
46243
  }, TIMEOUT);
46244
+ } else {
46245
+ this.value = op.newData.value;
46255
46246
  }
46256
46247
  break;
46257
- case "changeValue":
46258
- this.value = op.newData.value;
46259
- break;
46260
46248
  case "changeValuesRange":
46261
46249
  this.range = op.newData;
46262
46250
  break;
package/dist/esm/node.js CHANGED
@@ -48692,8 +48692,8 @@ class Dice extends BaseItem {
48692
48692
  this.subject.publish(this);
48693
48693
  return this;
48694
48694
  }
48695
- isClosed() {
48696
- return true;
48695
+ getIsRotating() {
48696
+ return !!this.animationFrameId;
48697
48697
  }
48698
48698
  applyBackgroundColor(backgroundColor) {
48699
48699
  this.backgroundColor = backgroundColor;
@@ -48748,24 +48748,12 @@ class Dice extends BaseItem {
48748
48748
  class: "Dice",
48749
48749
  method: "changeValue",
48750
48750
  item: [this.getId()],
48751
- newData: { value },
48752
- prevData: { value: this.value }
48753
- });
48754
- }
48755
- setIsRotating(isRotating) {
48756
- this.emit({
48757
- class: "Dice",
48758
- method: "setIsRotating",
48759
- item: [this.getId()],
48760
- newData: { isRotating },
48761
- prevData: { isRotating: false }
48751
+ newData: { value, shouldRotate: true },
48752
+ prevData: { value: this.value, shouldRotate: false }
48762
48753
  });
48763
48754
  }
48764
48755
  throwDice() {
48765
- this.setIsRotating(true);
48766
- setTimeout(() => {
48767
- this.setValue(Math.ceil(Math.random() * (this.range.max - this.range.min)) + this.range.min);
48768
- }, TIMEOUT);
48756
+ this.setValue(Math.ceil(Math.random() * (this.range.max - this.range.min)) + this.range.min);
48769
48757
  }
48770
48758
  apply(op) {
48771
48759
  super.apply(op);
@@ -48781,17 +48769,17 @@ class Dice extends BaseItem {
48781
48769
  case "setBorderColor":
48782
48770
  this.applyBorderColor(op.newData.borderColor);
48783
48771
  break;
48784
- case "setIsRotating":
48785
- if (op.newData.isRotating) {
48772
+ case "changeValue":
48773
+ if (op.newData.shouldRotate) {
48786
48774
  this.startRotation();
48787
48775
  setTimeout(() => {
48788
48776
  this.stopRotation();
48777
+ this.value = op.newData.value;
48789
48778
  }, TIMEOUT);
48779
+ } else {
48780
+ this.value = op.newData.value;
48790
48781
  }
48791
48782
  break;
48792
- case "changeValue":
48793
- this.value = op.newData.value;
48794
- break;
48795
48783
  case "changeValuesRange":
48796
48784
  this.range = op.newData;
48797
48785
  break;
@@ -25,7 +25,7 @@ export declare class Dice extends BaseItem {
25
25
  getPath(): Path;
26
26
  renderHTML(documentFactory: DocumentFactory): HTMLElement;
27
27
  deserialize(data: SerializedItemData): this;
28
- isClosed(): boolean;
28
+ getIsRotating(): boolean;
29
29
  private applyBackgroundColor;
30
30
  setBackgroundColor(backgroundColor: string): void;
31
31
  private applyBorderWidth;
@@ -37,7 +37,6 @@ export declare class Dice extends BaseItem {
37
37
  max: number;
38
38
  }): void;
39
39
  setValue(value: number): void;
40
- setIsRotating(isRotating: boolean): void;
41
40
  throwDice(): void;
42
41
  apply(op: DiceOperation): void;
43
42
  startRotation(): void;
@@ -1,7 +1,8 @@
1
1
  import { BaseOperation } from "Events/EventsOperations";
2
- export type DiceOperation = ChangeValue | ChangeValuesRange | SetIsRotating | SetBackgroundColor | SetBorderColor | SetBorderWidth;
2
+ export type DiceOperation = ChangeValue | ChangeValuesRange | SetBackgroundColor | SetBorderColor | SetBorderWidth;
3
3
  interface ChangeValue extends BaseOperation<{
4
4
  value: number;
5
+ shouldRotate: boolean;
5
6
  }> {
6
7
  class: "Dice";
7
8
  method: "changeValue";
@@ -13,12 +14,6 @@ interface ChangeValuesRange extends BaseOperation<{
13
14
  class: "Dice";
14
15
  method: "changeValuesRange";
15
16
  }
16
- interface SetIsRotating extends BaseOperation<{
17
- isRotating: boolean;
18
- }> {
19
- class: "Dice";
20
- method: "setIsRotating";
21
- }
22
17
  interface SetBackgroundColor extends BaseOperation<{
23
18
  backgroundColor: string;
24
19
  }> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.4.19",
3
+ "version": "0.4.20",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",