microboard-temp 0.4.67 → 0.4.69
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.
- package/dist/cjs/browser.js +59 -1
- package/dist/cjs/index.js +59 -1
- package/dist/cjs/node.js +59 -1
- package/dist/esm/browser.js +59 -1
- package/dist/esm/index.js +59 -1
- package/dist/esm/node.js +59 -1
- package/dist/types/Items/Examples/CardGame/Hand/Hand.d.ts +11 -2
- package/dist/types/Items/Examples/CardGame/Hand/HandOperation.d.ts +21 -0
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -48377,7 +48377,7 @@ var handPath = new Path([
|
|
|
48377
48377
|
new Line(new Point(100, 0), new Point(100, 100)),
|
|
48378
48378
|
new Line(new Point(100, 100), new Point(0, 100)),
|
|
48379
48379
|
new Line(new Point(0, 100), new Point(0, 0))
|
|
48380
|
-
], true);
|
|
48380
|
+
], true, "#FFFFFF", "#000000");
|
|
48381
48381
|
var defaultHandData = {
|
|
48382
48382
|
itemType: "Hand",
|
|
48383
48383
|
ownerId: ""
|
|
@@ -48387,6 +48387,8 @@ class Hand extends BaseItem {
|
|
|
48387
48387
|
ownerId;
|
|
48388
48388
|
subject = new Subject;
|
|
48389
48389
|
path;
|
|
48390
|
+
borderWidth = 1;
|
|
48391
|
+
backgroundColor = "#FFFFFF";
|
|
48390
48392
|
constructor(board, id = "", ownerId = "") {
|
|
48391
48393
|
super(board, id, defaultHandData, true);
|
|
48392
48394
|
this.ownerId = ownerId;
|
|
@@ -48400,8 +48402,62 @@ class Hand extends BaseItem {
|
|
|
48400
48402
|
}
|
|
48401
48403
|
apply(op) {
|
|
48402
48404
|
super.apply(op);
|
|
48405
|
+
switch (op.class) {
|
|
48406
|
+
case "Hand":
|
|
48407
|
+
switch (op.method) {
|
|
48408
|
+
case "setBorderWidth":
|
|
48409
|
+
this.applyBorderWidth(op.newData.borderWidth);
|
|
48410
|
+
break;
|
|
48411
|
+
case "setBackgroundColor":
|
|
48412
|
+
this.applyBackgroundColor(op.newData.backgroundColor);
|
|
48413
|
+
break;
|
|
48414
|
+
case "setBorderColor":
|
|
48415
|
+
this.applyBorderColor(op.newData.borderColor);
|
|
48416
|
+
break;
|
|
48417
|
+
}
|
|
48418
|
+
break;
|
|
48419
|
+
}
|
|
48403
48420
|
this.subject.publish(this);
|
|
48404
48421
|
}
|
|
48422
|
+
applyBackgroundColor(backgroundColor) {
|
|
48423
|
+
this.backgroundColor = backgroundColor;
|
|
48424
|
+
this.path.setBackgroundColor(backgroundColor);
|
|
48425
|
+
}
|
|
48426
|
+
setBackgroundColor(backgroundColor) {
|
|
48427
|
+
this.emit({
|
|
48428
|
+
class: "Dice",
|
|
48429
|
+
method: "setBackgroundColor",
|
|
48430
|
+
item: [this.getId()],
|
|
48431
|
+
newData: { backgroundColor },
|
|
48432
|
+
prevData: { backgroundColor: this.backgroundColor }
|
|
48433
|
+
});
|
|
48434
|
+
}
|
|
48435
|
+
applyBorderWidth(borderWidth) {
|
|
48436
|
+
this.borderWidth = borderWidth;
|
|
48437
|
+
this.path.setBorderWidth(borderWidth);
|
|
48438
|
+
}
|
|
48439
|
+
setBorderWidth(borderWidth) {
|
|
48440
|
+
this.emit({
|
|
48441
|
+
class: "Dice",
|
|
48442
|
+
method: "setBorderWidth",
|
|
48443
|
+
item: [this.getId()],
|
|
48444
|
+
newData: { borderWidth },
|
|
48445
|
+
prevData: { borderWidth: this.borderWidth }
|
|
48446
|
+
});
|
|
48447
|
+
}
|
|
48448
|
+
applyBorderColor(borderColor) {
|
|
48449
|
+
this.borderColor = borderColor;
|
|
48450
|
+
this.path.setBorderColor(borderColor);
|
|
48451
|
+
}
|
|
48452
|
+
setBorderColor(borderColor) {
|
|
48453
|
+
this.emit({
|
|
48454
|
+
class: "Dice",
|
|
48455
|
+
method: "setBorderColor",
|
|
48456
|
+
item: [this.getId()],
|
|
48457
|
+
newData: { borderColor },
|
|
48458
|
+
prevData: { borderColor: this.borderColor }
|
|
48459
|
+
});
|
|
48460
|
+
}
|
|
48405
48461
|
applyOwnerId(ownerId) {
|
|
48406
48462
|
this.ownerId = ownerId;
|
|
48407
48463
|
}
|
|
@@ -48410,6 +48466,7 @@ class Hand extends BaseItem {
|
|
|
48410
48466
|
this.path.transform(this.transformation.matrix);
|
|
48411
48467
|
this.path.setBackgroundColor(this.backgroundColor);
|
|
48412
48468
|
this.path.setBorderColor(this.borderColor);
|
|
48469
|
+
this.path.setBorderWidth(this.borderWidth);
|
|
48413
48470
|
}
|
|
48414
48471
|
updateMbr() {
|
|
48415
48472
|
const { left, top, right, bottom } = this.path.getMbr();
|
|
@@ -48428,6 +48485,7 @@ class Hand extends BaseItem {
|
|
|
48428
48485
|
if (this.transformationRenderBlock) {
|
|
48429
48486
|
return;
|
|
48430
48487
|
}
|
|
48488
|
+
this.path.render(context);
|
|
48431
48489
|
if (localStorage.getItem("currentUser") === this.ownerId || !this.ownerId) {
|
|
48432
48490
|
super.render(context);
|
|
48433
48491
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -48377,7 +48377,7 @@ var handPath = new Path([
|
|
|
48377
48377
|
new Line(new Point(100, 0), new Point(100, 100)),
|
|
48378
48378
|
new Line(new Point(100, 100), new Point(0, 100)),
|
|
48379
48379
|
new Line(new Point(0, 100), new Point(0, 0))
|
|
48380
|
-
], true);
|
|
48380
|
+
], true, "#FFFFFF", "#000000");
|
|
48381
48381
|
var defaultHandData = {
|
|
48382
48382
|
itemType: "Hand",
|
|
48383
48383
|
ownerId: ""
|
|
@@ -48387,6 +48387,8 @@ class Hand extends BaseItem {
|
|
|
48387
48387
|
ownerId;
|
|
48388
48388
|
subject = new Subject;
|
|
48389
48389
|
path;
|
|
48390
|
+
borderWidth = 1;
|
|
48391
|
+
backgroundColor = "#FFFFFF";
|
|
48390
48392
|
constructor(board, id = "", ownerId = "") {
|
|
48391
48393
|
super(board, id, defaultHandData, true);
|
|
48392
48394
|
this.ownerId = ownerId;
|
|
@@ -48400,8 +48402,62 @@ class Hand extends BaseItem {
|
|
|
48400
48402
|
}
|
|
48401
48403
|
apply(op) {
|
|
48402
48404
|
super.apply(op);
|
|
48405
|
+
switch (op.class) {
|
|
48406
|
+
case "Hand":
|
|
48407
|
+
switch (op.method) {
|
|
48408
|
+
case "setBorderWidth":
|
|
48409
|
+
this.applyBorderWidth(op.newData.borderWidth);
|
|
48410
|
+
break;
|
|
48411
|
+
case "setBackgroundColor":
|
|
48412
|
+
this.applyBackgroundColor(op.newData.backgroundColor);
|
|
48413
|
+
break;
|
|
48414
|
+
case "setBorderColor":
|
|
48415
|
+
this.applyBorderColor(op.newData.borderColor);
|
|
48416
|
+
break;
|
|
48417
|
+
}
|
|
48418
|
+
break;
|
|
48419
|
+
}
|
|
48403
48420
|
this.subject.publish(this);
|
|
48404
48421
|
}
|
|
48422
|
+
applyBackgroundColor(backgroundColor) {
|
|
48423
|
+
this.backgroundColor = backgroundColor;
|
|
48424
|
+
this.path.setBackgroundColor(backgroundColor);
|
|
48425
|
+
}
|
|
48426
|
+
setBackgroundColor(backgroundColor) {
|
|
48427
|
+
this.emit({
|
|
48428
|
+
class: "Dice",
|
|
48429
|
+
method: "setBackgroundColor",
|
|
48430
|
+
item: [this.getId()],
|
|
48431
|
+
newData: { backgroundColor },
|
|
48432
|
+
prevData: { backgroundColor: this.backgroundColor }
|
|
48433
|
+
});
|
|
48434
|
+
}
|
|
48435
|
+
applyBorderWidth(borderWidth) {
|
|
48436
|
+
this.borderWidth = borderWidth;
|
|
48437
|
+
this.path.setBorderWidth(borderWidth);
|
|
48438
|
+
}
|
|
48439
|
+
setBorderWidth(borderWidth) {
|
|
48440
|
+
this.emit({
|
|
48441
|
+
class: "Dice",
|
|
48442
|
+
method: "setBorderWidth",
|
|
48443
|
+
item: [this.getId()],
|
|
48444
|
+
newData: { borderWidth },
|
|
48445
|
+
prevData: { borderWidth: this.borderWidth }
|
|
48446
|
+
});
|
|
48447
|
+
}
|
|
48448
|
+
applyBorderColor(borderColor) {
|
|
48449
|
+
this.borderColor = borderColor;
|
|
48450
|
+
this.path.setBorderColor(borderColor);
|
|
48451
|
+
}
|
|
48452
|
+
setBorderColor(borderColor) {
|
|
48453
|
+
this.emit({
|
|
48454
|
+
class: "Dice",
|
|
48455
|
+
method: "setBorderColor",
|
|
48456
|
+
item: [this.getId()],
|
|
48457
|
+
newData: { borderColor },
|
|
48458
|
+
prevData: { borderColor: this.borderColor }
|
|
48459
|
+
});
|
|
48460
|
+
}
|
|
48405
48461
|
applyOwnerId(ownerId) {
|
|
48406
48462
|
this.ownerId = ownerId;
|
|
48407
48463
|
}
|
|
@@ -48410,6 +48466,7 @@ class Hand extends BaseItem {
|
|
|
48410
48466
|
this.path.transform(this.transformation.matrix);
|
|
48411
48467
|
this.path.setBackgroundColor(this.backgroundColor);
|
|
48412
48468
|
this.path.setBorderColor(this.borderColor);
|
|
48469
|
+
this.path.setBorderWidth(this.borderWidth);
|
|
48413
48470
|
}
|
|
48414
48471
|
updateMbr() {
|
|
48415
48472
|
const { left, top, right, bottom } = this.path.getMbr();
|
|
@@ -48428,6 +48485,7 @@ class Hand extends BaseItem {
|
|
|
48428
48485
|
if (this.transformationRenderBlock) {
|
|
48429
48486
|
return;
|
|
48430
48487
|
}
|
|
48488
|
+
this.path.render(context);
|
|
48431
48489
|
if (localStorage.getItem("currentUser") === this.ownerId || !this.ownerId) {
|
|
48432
48490
|
super.render(context);
|
|
48433
48491
|
}
|
package/dist/cjs/node.js
CHANGED
|
@@ -50850,7 +50850,7 @@ var handPath = new Path([
|
|
|
50850
50850
|
new Line(new Point(100, 0), new Point(100, 100)),
|
|
50851
50851
|
new Line(new Point(100, 100), new Point(0, 100)),
|
|
50852
50852
|
new Line(new Point(0, 100), new Point(0, 0))
|
|
50853
|
-
], true);
|
|
50853
|
+
], true, "#FFFFFF", "#000000");
|
|
50854
50854
|
var defaultHandData = {
|
|
50855
50855
|
itemType: "Hand",
|
|
50856
50856
|
ownerId: ""
|
|
@@ -50860,6 +50860,8 @@ class Hand extends BaseItem {
|
|
|
50860
50860
|
ownerId;
|
|
50861
50861
|
subject = new Subject;
|
|
50862
50862
|
path;
|
|
50863
|
+
borderWidth = 1;
|
|
50864
|
+
backgroundColor = "#FFFFFF";
|
|
50863
50865
|
constructor(board, id = "", ownerId = "") {
|
|
50864
50866
|
super(board, id, defaultHandData, true);
|
|
50865
50867
|
this.ownerId = ownerId;
|
|
@@ -50873,8 +50875,62 @@ class Hand extends BaseItem {
|
|
|
50873
50875
|
}
|
|
50874
50876
|
apply(op) {
|
|
50875
50877
|
super.apply(op);
|
|
50878
|
+
switch (op.class) {
|
|
50879
|
+
case "Hand":
|
|
50880
|
+
switch (op.method) {
|
|
50881
|
+
case "setBorderWidth":
|
|
50882
|
+
this.applyBorderWidth(op.newData.borderWidth);
|
|
50883
|
+
break;
|
|
50884
|
+
case "setBackgroundColor":
|
|
50885
|
+
this.applyBackgroundColor(op.newData.backgroundColor);
|
|
50886
|
+
break;
|
|
50887
|
+
case "setBorderColor":
|
|
50888
|
+
this.applyBorderColor(op.newData.borderColor);
|
|
50889
|
+
break;
|
|
50890
|
+
}
|
|
50891
|
+
break;
|
|
50892
|
+
}
|
|
50876
50893
|
this.subject.publish(this);
|
|
50877
50894
|
}
|
|
50895
|
+
applyBackgroundColor(backgroundColor) {
|
|
50896
|
+
this.backgroundColor = backgroundColor;
|
|
50897
|
+
this.path.setBackgroundColor(backgroundColor);
|
|
50898
|
+
}
|
|
50899
|
+
setBackgroundColor(backgroundColor) {
|
|
50900
|
+
this.emit({
|
|
50901
|
+
class: "Dice",
|
|
50902
|
+
method: "setBackgroundColor",
|
|
50903
|
+
item: [this.getId()],
|
|
50904
|
+
newData: { backgroundColor },
|
|
50905
|
+
prevData: { backgroundColor: this.backgroundColor }
|
|
50906
|
+
});
|
|
50907
|
+
}
|
|
50908
|
+
applyBorderWidth(borderWidth) {
|
|
50909
|
+
this.borderWidth = borderWidth;
|
|
50910
|
+
this.path.setBorderWidth(borderWidth);
|
|
50911
|
+
}
|
|
50912
|
+
setBorderWidth(borderWidth) {
|
|
50913
|
+
this.emit({
|
|
50914
|
+
class: "Dice",
|
|
50915
|
+
method: "setBorderWidth",
|
|
50916
|
+
item: [this.getId()],
|
|
50917
|
+
newData: { borderWidth },
|
|
50918
|
+
prevData: { borderWidth: this.borderWidth }
|
|
50919
|
+
});
|
|
50920
|
+
}
|
|
50921
|
+
applyBorderColor(borderColor) {
|
|
50922
|
+
this.borderColor = borderColor;
|
|
50923
|
+
this.path.setBorderColor(borderColor);
|
|
50924
|
+
}
|
|
50925
|
+
setBorderColor(borderColor) {
|
|
50926
|
+
this.emit({
|
|
50927
|
+
class: "Dice",
|
|
50928
|
+
method: "setBorderColor",
|
|
50929
|
+
item: [this.getId()],
|
|
50930
|
+
newData: { borderColor },
|
|
50931
|
+
prevData: { borderColor: this.borderColor }
|
|
50932
|
+
});
|
|
50933
|
+
}
|
|
50878
50934
|
applyOwnerId(ownerId) {
|
|
50879
50935
|
this.ownerId = ownerId;
|
|
50880
50936
|
}
|
|
@@ -50883,6 +50939,7 @@ class Hand extends BaseItem {
|
|
|
50883
50939
|
this.path.transform(this.transformation.matrix);
|
|
50884
50940
|
this.path.setBackgroundColor(this.backgroundColor);
|
|
50885
50941
|
this.path.setBorderColor(this.borderColor);
|
|
50942
|
+
this.path.setBorderWidth(this.borderWidth);
|
|
50886
50943
|
}
|
|
50887
50944
|
updateMbr() {
|
|
50888
50945
|
const { left, top, right, bottom } = this.path.getMbr();
|
|
@@ -50901,6 +50958,7 @@ class Hand extends BaseItem {
|
|
|
50901
50958
|
if (this.transformationRenderBlock) {
|
|
50902
50959
|
return;
|
|
50903
50960
|
}
|
|
50961
|
+
this.path.render(context);
|
|
50904
50962
|
if (localStorage.getItem("currentUser") === this.ownerId || !this.ownerId) {
|
|
50905
50963
|
super.render(context);
|
|
50906
50964
|
}
|
package/dist/esm/browser.js
CHANGED
|
@@ -48226,7 +48226,7 @@ var handPath = new Path([
|
|
|
48226
48226
|
new Line(new Point(100, 0), new Point(100, 100)),
|
|
48227
48227
|
new Line(new Point(100, 100), new Point(0, 100)),
|
|
48228
48228
|
new Line(new Point(0, 100), new Point(0, 0))
|
|
48229
|
-
], true);
|
|
48229
|
+
], true, "#FFFFFF", "#000000");
|
|
48230
48230
|
var defaultHandData = {
|
|
48231
48231
|
itemType: "Hand",
|
|
48232
48232
|
ownerId: ""
|
|
@@ -48236,6 +48236,8 @@ class Hand extends BaseItem {
|
|
|
48236
48236
|
ownerId;
|
|
48237
48237
|
subject = new Subject;
|
|
48238
48238
|
path;
|
|
48239
|
+
borderWidth = 1;
|
|
48240
|
+
backgroundColor = "#FFFFFF";
|
|
48239
48241
|
constructor(board, id = "", ownerId = "") {
|
|
48240
48242
|
super(board, id, defaultHandData, true);
|
|
48241
48243
|
this.ownerId = ownerId;
|
|
@@ -48249,8 +48251,62 @@ class Hand extends BaseItem {
|
|
|
48249
48251
|
}
|
|
48250
48252
|
apply(op) {
|
|
48251
48253
|
super.apply(op);
|
|
48254
|
+
switch (op.class) {
|
|
48255
|
+
case "Hand":
|
|
48256
|
+
switch (op.method) {
|
|
48257
|
+
case "setBorderWidth":
|
|
48258
|
+
this.applyBorderWidth(op.newData.borderWidth);
|
|
48259
|
+
break;
|
|
48260
|
+
case "setBackgroundColor":
|
|
48261
|
+
this.applyBackgroundColor(op.newData.backgroundColor);
|
|
48262
|
+
break;
|
|
48263
|
+
case "setBorderColor":
|
|
48264
|
+
this.applyBorderColor(op.newData.borderColor);
|
|
48265
|
+
break;
|
|
48266
|
+
}
|
|
48267
|
+
break;
|
|
48268
|
+
}
|
|
48252
48269
|
this.subject.publish(this);
|
|
48253
48270
|
}
|
|
48271
|
+
applyBackgroundColor(backgroundColor) {
|
|
48272
|
+
this.backgroundColor = backgroundColor;
|
|
48273
|
+
this.path.setBackgroundColor(backgroundColor);
|
|
48274
|
+
}
|
|
48275
|
+
setBackgroundColor(backgroundColor) {
|
|
48276
|
+
this.emit({
|
|
48277
|
+
class: "Dice",
|
|
48278
|
+
method: "setBackgroundColor",
|
|
48279
|
+
item: [this.getId()],
|
|
48280
|
+
newData: { backgroundColor },
|
|
48281
|
+
prevData: { backgroundColor: this.backgroundColor }
|
|
48282
|
+
});
|
|
48283
|
+
}
|
|
48284
|
+
applyBorderWidth(borderWidth) {
|
|
48285
|
+
this.borderWidth = borderWidth;
|
|
48286
|
+
this.path.setBorderWidth(borderWidth);
|
|
48287
|
+
}
|
|
48288
|
+
setBorderWidth(borderWidth) {
|
|
48289
|
+
this.emit({
|
|
48290
|
+
class: "Dice",
|
|
48291
|
+
method: "setBorderWidth",
|
|
48292
|
+
item: [this.getId()],
|
|
48293
|
+
newData: { borderWidth },
|
|
48294
|
+
prevData: { borderWidth: this.borderWidth }
|
|
48295
|
+
});
|
|
48296
|
+
}
|
|
48297
|
+
applyBorderColor(borderColor) {
|
|
48298
|
+
this.borderColor = borderColor;
|
|
48299
|
+
this.path.setBorderColor(borderColor);
|
|
48300
|
+
}
|
|
48301
|
+
setBorderColor(borderColor) {
|
|
48302
|
+
this.emit({
|
|
48303
|
+
class: "Dice",
|
|
48304
|
+
method: "setBorderColor",
|
|
48305
|
+
item: [this.getId()],
|
|
48306
|
+
newData: { borderColor },
|
|
48307
|
+
prevData: { borderColor: this.borderColor }
|
|
48308
|
+
});
|
|
48309
|
+
}
|
|
48254
48310
|
applyOwnerId(ownerId) {
|
|
48255
48311
|
this.ownerId = ownerId;
|
|
48256
48312
|
}
|
|
@@ -48259,6 +48315,7 @@ class Hand extends BaseItem {
|
|
|
48259
48315
|
this.path.transform(this.transformation.matrix);
|
|
48260
48316
|
this.path.setBackgroundColor(this.backgroundColor);
|
|
48261
48317
|
this.path.setBorderColor(this.borderColor);
|
|
48318
|
+
this.path.setBorderWidth(this.borderWidth);
|
|
48262
48319
|
}
|
|
48263
48320
|
updateMbr() {
|
|
48264
48321
|
const { left, top, right, bottom } = this.path.getMbr();
|
|
@@ -48277,6 +48334,7 @@ class Hand extends BaseItem {
|
|
|
48277
48334
|
if (this.transformationRenderBlock) {
|
|
48278
48335
|
return;
|
|
48279
48336
|
}
|
|
48337
|
+
this.path.render(context);
|
|
48280
48338
|
if (localStorage.getItem("currentUser") === this.ownerId || !this.ownerId) {
|
|
48281
48339
|
super.render(context);
|
|
48282
48340
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -48219,7 +48219,7 @@ var handPath = new Path([
|
|
|
48219
48219
|
new Line(new Point(100, 0), new Point(100, 100)),
|
|
48220
48220
|
new Line(new Point(100, 100), new Point(0, 100)),
|
|
48221
48221
|
new Line(new Point(0, 100), new Point(0, 0))
|
|
48222
|
-
], true);
|
|
48222
|
+
], true, "#FFFFFF", "#000000");
|
|
48223
48223
|
var defaultHandData = {
|
|
48224
48224
|
itemType: "Hand",
|
|
48225
48225
|
ownerId: ""
|
|
@@ -48229,6 +48229,8 @@ class Hand extends BaseItem {
|
|
|
48229
48229
|
ownerId;
|
|
48230
48230
|
subject = new Subject;
|
|
48231
48231
|
path;
|
|
48232
|
+
borderWidth = 1;
|
|
48233
|
+
backgroundColor = "#FFFFFF";
|
|
48232
48234
|
constructor(board, id = "", ownerId = "") {
|
|
48233
48235
|
super(board, id, defaultHandData, true);
|
|
48234
48236
|
this.ownerId = ownerId;
|
|
@@ -48242,8 +48244,62 @@ class Hand extends BaseItem {
|
|
|
48242
48244
|
}
|
|
48243
48245
|
apply(op) {
|
|
48244
48246
|
super.apply(op);
|
|
48247
|
+
switch (op.class) {
|
|
48248
|
+
case "Hand":
|
|
48249
|
+
switch (op.method) {
|
|
48250
|
+
case "setBorderWidth":
|
|
48251
|
+
this.applyBorderWidth(op.newData.borderWidth);
|
|
48252
|
+
break;
|
|
48253
|
+
case "setBackgroundColor":
|
|
48254
|
+
this.applyBackgroundColor(op.newData.backgroundColor);
|
|
48255
|
+
break;
|
|
48256
|
+
case "setBorderColor":
|
|
48257
|
+
this.applyBorderColor(op.newData.borderColor);
|
|
48258
|
+
break;
|
|
48259
|
+
}
|
|
48260
|
+
break;
|
|
48261
|
+
}
|
|
48245
48262
|
this.subject.publish(this);
|
|
48246
48263
|
}
|
|
48264
|
+
applyBackgroundColor(backgroundColor) {
|
|
48265
|
+
this.backgroundColor = backgroundColor;
|
|
48266
|
+
this.path.setBackgroundColor(backgroundColor);
|
|
48267
|
+
}
|
|
48268
|
+
setBackgroundColor(backgroundColor) {
|
|
48269
|
+
this.emit({
|
|
48270
|
+
class: "Dice",
|
|
48271
|
+
method: "setBackgroundColor",
|
|
48272
|
+
item: [this.getId()],
|
|
48273
|
+
newData: { backgroundColor },
|
|
48274
|
+
prevData: { backgroundColor: this.backgroundColor }
|
|
48275
|
+
});
|
|
48276
|
+
}
|
|
48277
|
+
applyBorderWidth(borderWidth) {
|
|
48278
|
+
this.borderWidth = borderWidth;
|
|
48279
|
+
this.path.setBorderWidth(borderWidth);
|
|
48280
|
+
}
|
|
48281
|
+
setBorderWidth(borderWidth) {
|
|
48282
|
+
this.emit({
|
|
48283
|
+
class: "Dice",
|
|
48284
|
+
method: "setBorderWidth",
|
|
48285
|
+
item: [this.getId()],
|
|
48286
|
+
newData: { borderWidth },
|
|
48287
|
+
prevData: { borderWidth: this.borderWidth }
|
|
48288
|
+
});
|
|
48289
|
+
}
|
|
48290
|
+
applyBorderColor(borderColor) {
|
|
48291
|
+
this.borderColor = borderColor;
|
|
48292
|
+
this.path.setBorderColor(borderColor);
|
|
48293
|
+
}
|
|
48294
|
+
setBorderColor(borderColor) {
|
|
48295
|
+
this.emit({
|
|
48296
|
+
class: "Dice",
|
|
48297
|
+
method: "setBorderColor",
|
|
48298
|
+
item: [this.getId()],
|
|
48299
|
+
newData: { borderColor },
|
|
48300
|
+
prevData: { borderColor: this.borderColor }
|
|
48301
|
+
});
|
|
48302
|
+
}
|
|
48247
48303
|
applyOwnerId(ownerId) {
|
|
48248
48304
|
this.ownerId = ownerId;
|
|
48249
48305
|
}
|
|
@@ -48252,6 +48308,7 @@ class Hand extends BaseItem {
|
|
|
48252
48308
|
this.path.transform(this.transformation.matrix);
|
|
48253
48309
|
this.path.setBackgroundColor(this.backgroundColor);
|
|
48254
48310
|
this.path.setBorderColor(this.borderColor);
|
|
48311
|
+
this.path.setBorderWidth(this.borderWidth);
|
|
48255
48312
|
}
|
|
48256
48313
|
updateMbr() {
|
|
48257
48314
|
const { left, top, right, bottom } = this.path.getMbr();
|
|
@@ -48270,6 +48327,7 @@ class Hand extends BaseItem {
|
|
|
48270
48327
|
if (this.transformationRenderBlock) {
|
|
48271
48328
|
return;
|
|
48272
48329
|
}
|
|
48330
|
+
this.path.render(context);
|
|
48273
48331
|
if (localStorage.getItem("currentUser") === this.ownerId || !this.ownerId) {
|
|
48274
48332
|
super.render(context);
|
|
48275
48333
|
}
|
package/dist/esm/node.js
CHANGED
|
@@ -50687,7 +50687,7 @@ var handPath = new Path([
|
|
|
50687
50687
|
new Line(new Point(100, 0), new Point(100, 100)),
|
|
50688
50688
|
new Line(new Point(100, 100), new Point(0, 100)),
|
|
50689
50689
|
new Line(new Point(0, 100), new Point(0, 0))
|
|
50690
|
-
], true);
|
|
50690
|
+
], true, "#FFFFFF", "#000000");
|
|
50691
50691
|
var defaultHandData = {
|
|
50692
50692
|
itemType: "Hand",
|
|
50693
50693
|
ownerId: ""
|
|
@@ -50697,6 +50697,8 @@ class Hand extends BaseItem {
|
|
|
50697
50697
|
ownerId;
|
|
50698
50698
|
subject = new Subject;
|
|
50699
50699
|
path;
|
|
50700
|
+
borderWidth = 1;
|
|
50701
|
+
backgroundColor = "#FFFFFF";
|
|
50700
50702
|
constructor(board, id = "", ownerId = "") {
|
|
50701
50703
|
super(board, id, defaultHandData, true);
|
|
50702
50704
|
this.ownerId = ownerId;
|
|
@@ -50710,8 +50712,62 @@ class Hand extends BaseItem {
|
|
|
50710
50712
|
}
|
|
50711
50713
|
apply(op) {
|
|
50712
50714
|
super.apply(op);
|
|
50715
|
+
switch (op.class) {
|
|
50716
|
+
case "Hand":
|
|
50717
|
+
switch (op.method) {
|
|
50718
|
+
case "setBorderWidth":
|
|
50719
|
+
this.applyBorderWidth(op.newData.borderWidth);
|
|
50720
|
+
break;
|
|
50721
|
+
case "setBackgroundColor":
|
|
50722
|
+
this.applyBackgroundColor(op.newData.backgroundColor);
|
|
50723
|
+
break;
|
|
50724
|
+
case "setBorderColor":
|
|
50725
|
+
this.applyBorderColor(op.newData.borderColor);
|
|
50726
|
+
break;
|
|
50727
|
+
}
|
|
50728
|
+
break;
|
|
50729
|
+
}
|
|
50713
50730
|
this.subject.publish(this);
|
|
50714
50731
|
}
|
|
50732
|
+
applyBackgroundColor(backgroundColor) {
|
|
50733
|
+
this.backgroundColor = backgroundColor;
|
|
50734
|
+
this.path.setBackgroundColor(backgroundColor);
|
|
50735
|
+
}
|
|
50736
|
+
setBackgroundColor(backgroundColor) {
|
|
50737
|
+
this.emit({
|
|
50738
|
+
class: "Dice",
|
|
50739
|
+
method: "setBackgroundColor",
|
|
50740
|
+
item: [this.getId()],
|
|
50741
|
+
newData: { backgroundColor },
|
|
50742
|
+
prevData: { backgroundColor: this.backgroundColor }
|
|
50743
|
+
});
|
|
50744
|
+
}
|
|
50745
|
+
applyBorderWidth(borderWidth) {
|
|
50746
|
+
this.borderWidth = borderWidth;
|
|
50747
|
+
this.path.setBorderWidth(borderWidth);
|
|
50748
|
+
}
|
|
50749
|
+
setBorderWidth(borderWidth) {
|
|
50750
|
+
this.emit({
|
|
50751
|
+
class: "Dice",
|
|
50752
|
+
method: "setBorderWidth",
|
|
50753
|
+
item: [this.getId()],
|
|
50754
|
+
newData: { borderWidth },
|
|
50755
|
+
prevData: { borderWidth: this.borderWidth }
|
|
50756
|
+
});
|
|
50757
|
+
}
|
|
50758
|
+
applyBorderColor(borderColor) {
|
|
50759
|
+
this.borderColor = borderColor;
|
|
50760
|
+
this.path.setBorderColor(borderColor);
|
|
50761
|
+
}
|
|
50762
|
+
setBorderColor(borderColor) {
|
|
50763
|
+
this.emit({
|
|
50764
|
+
class: "Dice",
|
|
50765
|
+
method: "setBorderColor",
|
|
50766
|
+
item: [this.getId()],
|
|
50767
|
+
newData: { borderColor },
|
|
50768
|
+
prevData: { borderColor: this.borderColor }
|
|
50769
|
+
});
|
|
50770
|
+
}
|
|
50715
50771
|
applyOwnerId(ownerId) {
|
|
50716
50772
|
this.ownerId = ownerId;
|
|
50717
50773
|
}
|
|
@@ -50720,6 +50776,7 @@ class Hand extends BaseItem {
|
|
|
50720
50776
|
this.path.transform(this.transformation.matrix);
|
|
50721
50777
|
this.path.setBackgroundColor(this.backgroundColor);
|
|
50722
50778
|
this.path.setBorderColor(this.borderColor);
|
|
50779
|
+
this.path.setBorderWidth(this.borderWidth);
|
|
50723
50780
|
}
|
|
50724
50781
|
updateMbr() {
|
|
50725
50782
|
const { left, top, right, bottom } = this.path.getMbr();
|
|
@@ -50738,6 +50795,7 @@ class Hand extends BaseItem {
|
|
|
50738
50795
|
if (this.transformationRenderBlock) {
|
|
50739
50796
|
return;
|
|
50740
50797
|
}
|
|
50798
|
+
this.path.render(context);
|
|
50741
50799
|
if (localStorage.getItem("currentUser") === this.ownerId || !this.ownerId) {
|
|
50742
50800
|
super.render(context);
|
|
50743
50801
|
}
|
|
@@ -2,14 +2,23 @@ import { BaseItem, BaseItemData, SerializedItemData } from "Items/BaseItem/BaseI
|
|
|
2
2
|
import { Board } from "Board";
|
|
3
3
|
import { Subject } from "Subject";
|
|
4
4
|
import { DrawingContext } from "Items/DrawingContext";
|
|
5
|
-
import {
|
|
5
|
+
import { BorderWidth } from "../../../Path";
|
|
6
|
+
import { HandOperation } from "./HandOperation";
|
|
6
7
|
export declare const defaultHandData: BaseItemData;
|
|
7
8
|
export declare class Hand extends BaseItem {
|
|
8
9
|
private ownerId;
|
|
9
10
|
readonly subject: Subject<Hand>;
|
|
10
11
|
private path;
|
|
12
|
+
private borderWidth;
|
|
13
|
+
backgroundColor: string;
|
|
11
14
|
constructor(board: Board, id?: string, ownerId?: string);
|
|
12
|
-
apply(op:
|
|
15
|
+
apply(op: HandOperation): void;
|
|
16
|
+
private applyBackgroundColor;
|
|
17
|
+
setBackgroundColor(backgroundColor: string): void;
|
|
18
|
+
private applyBorderWidth;
|
|
19
|
+
setBorderWidth(borderWidth: BorderWidth): void;
|
|
20
|
+
private applyBorderColor;
|
|
21
|
+
setBorderColor(borderColor: string): void;
|
|
13
22
|
applyOwnerId(ownerId: string): void;
|
|
14
23
|
private transformPath;
|
|
15
24
|
updateMbr(): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseOperation } from "Events/EventsOperations";
|
|
2
|
+
export type HandOperation = SetBackgroundColor | SetBorderColor | SetBorderWidth;
|
|
3
|
+
interface SetBackgroundColor extends BaseOperation<{
|
|
4
|
+
backgroundColor: string;
|
|
5
|
+
}> {
|
|
6
|
+
class: "Hand";
|
|
7
|
+
method: "setBackgroundColor";
|
|
8
|
+
}
|
|
9
|
+
interface SetBorderColor extends BaseOperation<{
|
|
10
|
+
borderColor: string;
|
|
11
|
+
}> {
|
|
12
|
+
class: "Hand";
|
|
13
|
+
method: "setBorderColor";
|
|
14
|
+
}
|
|
15
|
+
export interface SetBorderWidth extends BaseOperation<{
|
|
16
|
+
borderWidth: number;
|
|
17
|
+
}> {
|
|
18
|
+
class: "Hand";
|
|
19
|
+
method: "setBorderWidth";
|
|
20
|
+
}
|
|
21
|
+
export {};
|