microboard-temp 0.4.65 → 0.4.67
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 +83 -0
- package/dist/cjs/index.js +83 -0
- package/dist/cjs/node.js +83 -0
- package/dist/esm/browser.js +83 -0
- package/dist/esm/index.js +83 -0
- package/dist/esm/node.js +83 -0
- package/dist/types/Items/Examples/CardGame/Hand/AddHand.d.ts +6 -0
- package/dist/types/Items/Examples/CardGame/Hand/Hand.d.ts +18 -0
- package/dist/types/Items/Examples/CardGame/Hand/index.d.ts +1 -0
- package/dist/types/Items/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -729,6 +729,7 @@ __export(exports_browser, {
|
|
|
729
729
|
Keyboard: () => Keyboard,
|
|
730
730
|
Items: () => Items,
|
|
731
731
|
ImageItem: () => ImageItem,
|
|
732
|
+
Hand: () => Hand,
|
|
732
733
|
Group: () => Group,
|
|
733
734
|
Frames: () => Frames,
|
|
734
735
|
FrameCommand: () => FrameCommand,
|
|
@@ -21464,6 +21465,7 @@ class BaseItem extends Mbr {
|
|
|
21464
21465
|
this.id = id;
|
|
21465
21466
|
if (isGroupItem) {
|
|
21466
21467
|
this.index = new SimpleSpatialIndex(board.camera, board.pointer);
|
|
21468
|
+
this.canBeNested = false;
|
|
21467
21469
|
}
|
|
21468
21470
|
if (defaultItemData) {
|
|
21469
21471
|
Object.entries(defaultItemData).forEach(([key, value]) => {
|
|
@@ -21588,6 +21590,9 @@ class BaseItem extends Mbr {
|
|
|
21588
21590
|
return null;
|
|
21589
21591
|
}
|
|
21590
21592
|
deserialize(data) {
|
|
21593
|
+
if (data.children) {
|
|
21594
|
+
this.applyAddChildren(data.children);
|
|
21595
|
+
}
|
|
21591
21596
|
Object.entries(data).forEach(([key, value]) => {
|
|
21592
21597
|
if (this[key]?.deserialize) {
|
|
21593
21598
|
this[key].deserialize(value);
|
|
@@ -48355,6 +48360,84 @@ registerItem({
|
|
|
48355
48360
|
defaultData: defaultDiceData,
|
|
48356
48361
|
toolData: { name: "AddDice", tool: AddDice }
|
|
48357
48362
|
});
|
|
48363
|
+
// src/Items/Examples/CardGame/Hand/AddHand.ts
|
|
48364
|
+
class AddHand extends ShapeTool {
|
|
48365
|
+
constructor(board, name) {
|
|
48366
|
+
super(board, name, Hand, { cursorName: "crosshair", fixedRatio: false });
|
|
48367
|
+
}
|
|
48368
|
+
pointerUp() {
|
|
48369
|
+
this.item.applyOwnerId(localStorage.getItem("currentUser") || "");
|
|
48370
|
+
return super.pointerUp();
|
|
48371
|
+
}
|
|
48372
|
+
}
|
|
48373
|
+
|
|
48374
|
+
// src/Items/Examples/CardGame/Hand/Hand.ts
|
|
48375
|
+
var handPath = new Path([
|
|
48376
|
+
new Line(new Point(0, 0), new Point(100, 0)),
|
|
48377
|
+
new Line(new Point(100, 0), new Point(100, 100)),
|
|
48378
|
+
new Line(new Point(100, 100), new Point(0, 100)),
|
|
48379
|
+
new Line(new Point(0, 100), new Point(0, 0))
|
|
48380
|
+
], true);
|
|
48381
|
+
var defaultHandData = {
|
|
48382
|
+
itemType: "Hand",
|
|
48383
|
+
ownerId: ""
|
|
48384
|
+
};
|
|
48385
|
+
|
|
48386
|
+
class Hand extends BaseItem {
|
|
48387
|
+
ownerId;
|
|
48388
|
+
subject = new Subject;
|
|
48389
|
+
path;
|
|
48390
|
+
constructor(board, id = "", ownerId = "") {
|
|
48391
|
+
super(board, id, defaultHandData, true);
|
|
48392
|
+
this.ownerId = ownerId;
|
|
48393
|
+
this.transformation.subject.subscribe(() => {
|
|
48394
|
+
this.transformPath();
|
|
48395
|
+
this.updateMbr();
|
|
48396
|
+
this.subject.publish(this);
|
|
48397
|
+
});
|
|
48398
|
+
this.transformPath();
|
|
48399
|
+
this.updateMbr();
|
|
48400
|
+
}
|
|
48401
|
+
apply(op) {
|
|
48402
|
+
super.apply(op);
|
|
48403
|
+
this.subject.publish(this);
|
|
48404
|
+
}
|
|
48405
|
+
applyOwnerId(ownerId) {
|
|
48406
|
+
this.ownerId = ownerId;
|
|
48407
|
+
}
|
|
48408
|
+
transformPath() {
|
|
48409
|
+
this.path = handPath.copy();
|
|
48410
|
+
this.path.transform(this.transformation.matrix);
|
|
48411
|
+
this.path.setBackgroundColor(this.backgroundColor);
|
|
48412
|
+
this.path.setBorderColor(this.borderColor);
|
|
48413
|
+
}
|
|
48414
|
+
updateMbr() {
|
|
48415
|
+
const { left, top, right, bottom } = this.path.getMbr();
|
|
48416
|
+
this.left = left;
|
|
48417
|
+
this.right = right;
|
|
48418
|
+
this.top = top;
|
|
48419
|
+
this.bottom = bottom;
|
|
48420
|
+
}
|
|
48421
|
+
deserialize(data) {
|
|
48422
|
+
super.deserialize(data);
|
|
48423
|
+
this.transformPath();
|
|
48424
|
+
this.subject.publish(this);
|
|
48425
|
+
return this;
|
|
48426
|
+
}
|
|
48427
|
+
render(context) {
|
|
48428
|
+
if (this.transformationRenderBlock) {
|
|
48429
|
+
return;
|
|
48430
|
+
}
|
|
48431
|
+
if (localStorage.getItem("currentUser") === this.ownerId || !this.ownerId) {
|
|
48432
|
+
super.render(context);
|
|
48433
|
+
}
|
|
48434
|
+
}
|
|
48435
|
+
}
|
|
48436
|
+
registerItem({
|
|
48437
|
+
item: Hand,
|
|
48438
|
+
defaultData: defaultHandData,
|
|
48439
|
+
toolData: { name: "AddHand", tool: AddHand }
|
|
48440
|
+
});
|
|
48358
48441
|
// src/Pointer/Cursor.ts
|
|
48359
48442
|
var defaultCursors = [
|
|
48360
48443
|
"default",
|
package/dist/cjs/index.js
CHANGED
|
@@ -729,6 +729,7 @@ __export(exports_src, {
|
|
|
729
729
|
Keyboard: () => Keyboard,
|
|
730
730
|
Items: () => Items,
|
|
731
731
|
ImageItem: () => ImageItem,
|
|
732
|
+
Hand: () => Hand,
|
|
732
733
|
Group: () => Group,
|
|
733
734
|
Frames: () => Frames,
|
|
734
735
|
FrameCommand: () => FrameCommand,
|
|
@@ -21464,6 +21465,7 @@ class BaseItem extends Mbr {
|
|
|
21464
21465
|
this.id = id;
|
|
21465
21466
|
if (isGroupItem) {
|
|
21466
21467
|
this.index = new SimpleSpatialIndex(board.camera, board.pointer);
|
|
21468
|
+
this.canBeNested = false;
|
|
21467
21469
|
}
|
|
21468
21470
|
if (defaultItemData) {
|
|
21469
21471
|
Object.entries(defaultItemData).forEach(([key, value]) => {
|
|
@@ -21588,6 +21590,9 @@ class BaseItem extends Mbr {
|
|
|
21588
21590
|
return null;
|
|
21589
21591
|
}
|
|
21590
21592
|
deserialize(data) {
|
|
21593
|
+
if (data.children) {
|
|
21594
|
+
this.applyAddChildren(data.children);
|
|
21595
|
+
}
|
|
21591
21596
|
Object.entries(data).forEach(([key, value]) => {
|
|
21592
21597
|
if (this[key]?.deserialize) {
|
|
21593
21598
|
this[key].deserialize(value);
|
|
@@ -48355,6 +48360,84 @@ registerItem({
|
|
|
48355
48360
|
defaultData: defaultDiceData,
|
|
48356
48361
|
toolData: { name: "AddDice", tool: AddDice }
|
|
48357
48362
|
});
|
|
48363
|
+
// src/Items/Examples/CardGame/Hand/AddHand.ts
|
|
48364
|
+
class AddHand extends ShapeTool {
|
|
48365
|
+
constructor(board, name) {
|
|
48366
|
+
super(board, name, Hand, { cursorName: "crosshair", fixedRatio: false });
|
|
48367
|
+
}
|
|
48368
|
+
pointerUp() {
|
|
48369
|
+
this.item.applyOwnerId(localStorage.getItem("currentUser") || "");
|
|
48370
|
+
return super.pointerUp();
|
|
48371
|
+
}
|
|
48372
|
+
}
|
|
48373
|
+
|
|
48374
|
+
// src/Items/Examples/CardGame/Hand/Hand.ts
|
|
48375
|
+
var handPath = new Path([
|
|
48376
|
+
new Line(new Point(0, 0), new Point(100, 0)),
|
|
48377
|
+
new Line(new Point(100, 0), new Point(100, 100)),
|
|
48378
|
+
new Line(new Point(100, 100), new Point(0, 100)),
|
|
48379
|
+
new Line(new Point(0, 100), new Point(0, 0))
|
|
48380
|
+
], true);
|
|
48381
|
+
var defaultHandData = {
|
|
48382
|
+
itemType: "Hand",
|
|
48383
|
+
ownerId: ""
|
|
48384
|
+
};
|
|
48385
|
+
|
|
48386
|
+
class Hand extends BaseItem {
|
|
48387
|
+
ownerId;
|
|
48388
|
+
subject = new Subject;
|
|
48389
|
+
path;
|
|
48390
|
+
constructor(board, id = "", ownerId = "") {
|
|
48391
|
+
super(board, id, defaultHandData, true);
|
|
48392
|
+
this.ownerId = ownerId;
|
|
48393
|
+
this.transformation.subject.subscribe(() => {
|
|
48394
|
+
this.transformPath();
|
|
48395
|
+
this.updateMbr();
|
|
48396
|
+
this.subject.publish(this);
|
|
48397
|
+
});
|
|
48398
|
+
this.transformPath();
|
|
48399
|
+
this.updateMbr();
|
|
48400
|
+
}
|
|
48401
|
+
apply(op) {
|
|
48402
|
+
super.apply(op);
|
|
48403
|
+
this.subject.publish(this);
|
|
48404
|
+
}
|
|
48405
|
+
applyOwnerId(ownerId) {
|
|
48406
|
+
this.ownerId = ownerId;
|
|
48407
|
+
}
|
|
48408
|
+
transformPath() {
|
|
48409
|
+
this.path = handPath.copy();
|
|
48410
|
+
this.path.transform(this.transformation.matrix);
|
|
48411
|
+
this.path.setBackgroundColor(this.backgroundColor);
|
|
48412
|
+
this.path.setBorderColor(this.borderColor);
|
|
48413
|
+
}
|
|
48414
|
+
updateMbr() {
|
|
48415
|
+
const { left, top, right, bottom } = this.path.getMbr();
|
|
48416
|
+
this.left = left;
|
|
48417
|
+
this.right = right;
|
|
48418
|
+
this.top = top;
|
|
48419
|
+
this.bottom = bottom;
|
|
48420
|
+
}
|
|
48421
|
+
deserialize(data) {
|
|
48422
|
+
super.deserialize(data);
|
|
48423
|
+
this.transformPath();
|
|
48424
|
+
this.subject.publish(this);
|
|
48425
|
+
return this;
|
|
48426
|
+
}
|
|
48427
|
+
render(context) {
|
|
48428
|
+
if (this.transformationRenderBlock) {
|
|
48429
|
+
return;
|
|
48430
|
+
}
|
|
48431
|
+
if (localStorage.getItem("currentUser") === this.ownerId || !this.ownerId) {
|
|
48432
|
+
super.render(context);
|
|
48433
|
+
}
|
|
48434
|
+
}
|
|
48435
|
+
}
|
|
48436
|
+
registerItem({
|
|
48437
|
+
item: Hand,
|
|
48438
|
+
defaultData: defaultHandData,
|
|
48439
|
+
toolData: { name: "AddHand", tool: AddHand }
|
|
48440
|
+
});
|
|
48358
48441
|
// src/Pointer/Cursor.ts
|
|
48359
48442
|
var defaultCursors = [
|
|
48360
48443
|
"default",
|
package/dist/cjs/node.js
CHANGED
|
@@ -1766,6 +1766,7 @@ __export(exports_node, {
|
|
|
1766
1766
|
Keyboard: () => Keyboard,
|
|
1767
1767
|
Items: () => Items,
|
|
1768
1768
|
ImageItem: () => ImageItem,
|
|
1769
|
+
Hand: () => Hand,
|
|
1769
1770
|
Group: () => Group,
|
|
1770
1771
|
Frames: () => Frames,
|
|
1771
1772
|
FrameCommand: () => FrameCommand,
|
|
@@ -23936,6 +23937,7 @@ class BaseItem extends Mbr {
|
|
|
23936
23937
|
this.id = id;
|
|
23937
23938
|
if (isGroupItem) {
|
|
23938
23939
|
this.index = new SimpleSpatialIndex(board.camera, board.pointer);
|
|
23940
|
+
this.canBeNested = false;
|
|
23939
23941
|
}
|
|
23940
23942
|
if (defaultItemData) {
|
|
23941
23943
|
Object.entries(defaultItemData).forEach(([key, value]) => {
|
|
@@ -24060,6 +24062,9 @@ class BaseItem extends Mbr {
|
|
|
24060
24062
|
return null;
|
|
24061
24063
|
}
|
|
24062
24064
|
deserialize(data) {
|
|
24065
|
+
if (data.children) {
|
|
24066
|
+
this.applyAddChildren(data.children);
|
|
24067
|
+
}
|
|
24063
24068
|
Object.entries(data).forEach(([key, value]) => {
|
|
24064
24069
|
if (this[key]?.deserialize) {
|
|
24065
24070
|
this[key].deserialize(value);
|
|
@@ -50828,6 +50833,84 @@ registerItem({
|
|
|
50828
50833
|
defaultData: defaultDiceData,
|
|
50829
50834
|
toolData: { name: "AddDice", tool: AddDice }
|
|
50830
50835
|
});
|
|
50836
|
+
// src/Items/Examples/CardGame/Hand/AddHand.ts
|
|
50837
|
+
class AddHand extends ShapeTool {
|
|
50838
|
+
constructor(board, name) {
|
|
50839
|
+
super(board, name, Hand, { cursorName: "crosshair", fixedRatio: false });
|
|
50840
|
+
}
|
|
50841
|
+
pointerUp() {
|
|
50842
|
+
this.item.applyOwnerId(localStorage.getItem("currentUser") || "");
|
|
50843
|
+
return super.pointerUp();
|
|
50844
|
+
}
|
|
50845
|
+
}
|
|
50846
|
+
|
|
50847
|
+
// src/Items/Examples/CardGame/Hand/Hand.ts
|
|
50848
|
+
var handPath = new Path([
|
|
50849
|
+
new Line(new Point(0, 0), new Point(100, 0)),
|
|
50850
|
+
new Line(new Point(100, 0), new Point(100, 100)),
|
|
50851
|
+
new Line(new Point(100, 100), new Point(0, 100)),
|
|
50852
|
+
new Line(new Point(0, 100), new Point(0, 0))
|
|
50853
|
+
], true);
|
|
50854
|
+
var defaultHandData = {
|
|
50855
|
+
itemType: "Hand",
|
|
50856
|
+
ownerId: ""
|
|
50857
|
+
};
|
|
50858
|
+
|
|
50859
|
+
class Hand extends BaseItem {
|
|
50860
|
+
ownerId;
|
|
50861
|
+
subject = new Subject;
|
|
50862
|
+
path;
|
|
50863
|
+
constructor(board, id = "", ownerId = "") {
|
|
50864
|
+
super(board, id, defaultHandData, true);
|
|
50865
|
+
this.ownerId = ownerId;
|
|
50866
|
+
this.transformation.subject.subscribe(() => {
|
|
50867
|
+
this.transformPath();
|
|
50868
|
+
this.updateMbr();
|
|
50869
|
+
this.subject.publish(this);
|
|
50870
|
+
});
|
|
50871
|
+
this.transformPath();
|
|
50872
|
+
this.updateMbr();
|
|
50873
|
+
}
|
|
50874
|
+
apply(op) {
|
|
50875
|
+
super.apply(op);
|
|
50876
|
+
this.subject.publish(this);
|
|
50877
|
+
}
|
|
50878
|
+
applyOwnerId(ownerId) {
|
|
50879
|
+
this.ownerId = ownerId;
|
|
50880
|
+
}
|
|
50881
|
+
transformPath() {
|
|
50882
|
+
this.path = handPath.copy();
|
|
50883
|
+
this.path.transform(this.transformation.matrix);
|
|
50884
|
+
this.path.setBackgroundColor(this.backgroundColor);
|
|
50885
|
+
this.path.setBorderColor(this.borderColor);
|
|
50886
|
+
}
|
|
50887
|
+
updateMbr() {
|
|
50888
|
+
const { left, top, right, bottom } = this.path.getMbr();
|
|
50889
|
+
this.left = left;
|
|
50890
|
+
this.right = right;
|
|
50891
|
+
this.top = top;
|
|
50892
|
+
this.bottom = bottom;
|
|
50893
|
+
}
|
|
50894
|
+
deserialize(data) {
|
|
50895
|
+
super.deserialize(data);
|
|
50896
|
+
this.transformPath();
|
|
50897
|
+
this.subject.publish(this);
|
|
50898
|
+
return this;
|
|
50899
|
+
}
|
|
50900
|
+
render(context) {
|
|
50901
|
+
if (this.transformationRenderBlock) {
|
|
50902
|
+
return;
|
|
50903
|
+
}
|
|
50904
|
+
if (localStorage.getItem("currentUser") === this.ownerId || !this.ownerId) {
|
|
50905
|
+
super.render(context);
|
|
50906
|
+
}
|
|
50907
|
+
}
|
|
50908
|
+
}
|
|
50909
|
+
registerItem({
|
|
50910
|
+
item: Hand,
|
|
50911
|
+
defaultData: defaultHandData,
|
|
50912
|
+
toolData: { name: "AddHand", tool: AddHand }
|
|
50913
|
+
});
|
|
50831
50914
|
// src/Pointer/Cursor.ts
|
|
50832
50915
|
var defaultCursors = [
|
|
50833
50916
|
"default",
|
package/dist/esm/browser.js
CHANGED
|
@@ -21314,6 +21314,7 @@ class BaseItem extends Mbr {
|
|
|
21314
21314
|
this.id = id;
|
|
21315
21315
|
if (isGroupItem) {
|
|
21316
21316
|
this.index = new SimpleSpatialIndex(board.camera, board.pointer);
|
|
21317
|
+
this.canBeNested = false;
|
|
21317
21318
|
}
|
|
21318
21319
|
if (defaultItemData) {
|
|
21319
21320
|
Object.entries(defaultItemData).forEach(([key, value]) => {
|
|
@@ -21438,6 +21439,9 @@ class BaseItem extends Mbr {
|
|
|
21438
21439
|
return null;
|
|
21439
21440
|
}
|
|
21440
21441
|
deserialize(data) {
|
|
21442
|
+
if (data.children) {
|
|
21443
|
+
this.applyAddChildren(data.children);
|
|
21444
|
+
}
|
|
21441
21445
|
Object.entries(data).forEach(([key, value]) => {
|
|
21442
21446
|
if (this[key]?.deserialize) {
|
|
21443
21447
|
this[key].deserialize(value);
|
|
@@ -48205,6 +48209,84 @@ registerItem({
|
|
|
48205
48209
|
defaultData: defaultDiceData,
|
|
48206
48210
|
toolData: { name: "AddDice", tool: AddDice }
|
|
48207
48211
|
});
|
|
48212
|
+
// src/Items/Examples/CardGame/Hand/AddHand.ts
|
|
48213
|
+
class AddHand extends ShapeTool {
|
|
48214
|
+
constructor(board, name) {
|
|
48215
|
+
super(board, name, Hand, { cursorName: "crosshair", fixedRatio: false });
|
|
48216
|
+
}
|
|
48217
|
+
pointerUp() {
|
|
48218
|
+
this.item.applyOwnerId(localStorage.getItem("currentUser") || "");
|
|
48219
|
+
return super.pointerUp();
|
|
48220
|
+
}
|
|
48221
|
+
}
|
|
48222
|
+
|
|
48223
|
+
// src/Items/Examples/CardGame/Hand/Hand.ts
|
|
48224
|
+
var handPath = new Path([
|
|
48225
|
+
new Line(new Point(0, 0), new Point(100, 0)),
|
|
48226
|
+
new Line(new Point(100, 0), new Point(100, 100)),
|
|
48227
|
+
new Line(new Point(100, 100), new Point(0, 100)),
|
|
48228
|
+
new Line(new Point(0, 100), new Point(0, 0))
|
|
48229
|
+
], true);
|
|
48230
|
+
var defaultHandData = {
|
|
48231
|
+
itemType: "Hand",
|
|
48232
|
+
ownerId: ""
|
|
48233
|
+
};
|
|
48234
|
+
|
|
48235
|
+
class Hand extends BaseItem {
|
|
48236
|
+
ownerId;
|
|
48237
|
+
subject = new Subject;
|
|
48238
|
+
path;
|
|
48239
|
+
constructor(board, id = "", ownerId = "") {
|
|
48240
|
+
super(board, id, defaultHandData, true);
|
|
48241
|
+
this.ownerId = ownerId;
|
|
48242
|
+
this.transformation.subject.subscribe(() => {
|
|
48243
|
+
this.transformPath();
|
|
48244
|
+
this.updateMbr();
|
|
48245
|
+
this.subject.publish(this);
|
|
48246
|
+
});
|
|
48247
|
+
this.transformPath();
|
|
48248
|
+
this.updateMbr();
|
|
48249
|
+
}
|
|
48250
|
+
apply(op) {
|
|
48251
|
+
super.apply(op);
|
|
48252
|
+
this.subject.publish(this);
|
|
48253
|
+
}
|
|
48254
|
+
applyOwnerId(ownerId) {
|
|
48255
|
+
this.ownerId = ownerId;
|
|
48256
|
+
}
|
|
48257
|
+
transformPath() {
|
|
48258
|
+
this.path = handPath.copy();
|
|
48259
|
+
this.path.transform(this.transformation.matrix);
|
|
48260
|
+
this.path.setBackgroundColor(this.backgroundColor);
|
|
48261
|
+
this.path.setBorderColor(this.borderColor);
|
|
48262
|
+
}
|
|
48263
|
+
updateMbr() {
|
|
48264
|
+
const { left, top, right, bottom } = this.path.getMbr();
|
|
48265
|
+
this.left = left;
|
|
48266
|
+
this.right = right;
|
|
48267
|
+
this.top = top;
|
|
48268
|
+
this.bottom = bottom;
|
|
48269
|
+
}
|
|
48270
|
+
deserialize(data) {
|
|
48271
|
+
super.deserialize(data);
|
|
48272
|
+
this.transformPath();
|
|
48273
|
+
this.subject.publish(this);
|
|
48274
|
+
return this;
|
|
48275
|
+
}
|
|
48276
|
+
render(context) {
|
|
48277
|
+
if (this.transformationRenderBlock) {
|
|
48278
|
+
return;
|
|
48279
|
+
}
|
|
48280
|
+
if (localStorage.getItem("currentUser") === this.ownerId || !this.ownerId) {
|
|
48281
|
+
super.render(context);
|
|
48282
|
+
}
|
|
48283
|
+
}
|
|
48284
|
+
}
|
|
48285
|
+
registerItem({
|
|
48286
|
+
item: Hand,
|
|
48287
|
+
defaultData: defaultHandData,
|
|
48288
|
+
toolData: { name: "AddHand", tool: AddHand }
|
|
48289
|
+
});
|
|
48208
48290
|
// src/Pointer/Cursor.ts
|
|
48209
48291
|
var defaultCursors = [
|
|
48210
48292
|
"default",
|
|
@@ -56734,6 +56816,7 @@ export {
|
|
|
56734
56816
|
Keyboard,
|
|
56735
56817
|
Items,
|
|
56736
56818
|
ImageItem,
|
|
56819
|
+
Hand,
|
|
56737
56820
|
Group,
|
|
56738
56821
|
Frames,
|
|
56739
56822
|
FrameCommand,
|
package/dist/esm/index.js
CHANGED
|
@@ -21307,6 +21307,7 @@ class BaseItem extends Mbr {
|
|
|
21307
21307
|
this.id = id;
|
|
21308
21308
|
if (isGroupItem) {
|
|
21309
21309
|
this.index = new SimpleSpatialIndex(board.camera, board.pointer);
|
|
21310
|
+
this.canBeNested = false;
|
|
21310
21311
|
}
|
|
21311
21312
|
if (defaultItemData) {
|
|
21312
21313
|
Object.entries(defaultItemData).forEach(([key, value]) => {
|
|
@@ -21431,6 +21432,9 @@ class BaseItem extends Mbr {
|
|
|
21431
21432
|
return null;
|
|
21432
21433
|
}
|
|
21433
21434
|
deserialize(data) {
|
|
21435
|
+
if (data.children) {
|
|
21436
|
+
this.applyAddChildren(data.children);
|
|
21437
|
+
}
|
|
21434
21438
|
Object.entries(data).forEach(([key, value]) => {
|
|
21435
21439
|
if (this[key]?.deserialize) {
|
|
21436
21440
|
this[key].deserialize(value);
|
|
@@ -48198,6 +48202,84 @@ registerItem({
|
|
|
48198
48202
|
defaultData: defaultDiceData,
|
|
48199
48203
|
toolData: { name: "AddDice", tool: AddDice }
|
|
48200
48204
|
});
|
|
48205
|
+
// src/Items/Examples/CardGame/Hand/AddHand.ts
|
|
48206
|
+
class AddHand extends ShapeTool {
|
|
48207
|
+
constructor(board, name) {
|
|
48208
|
+
super(board, name, Hand, { cursorName: "crosshair", fixedRatio: false });
|
|
48209
|
+
}
|
|
48210
|
+
pointerUp() {
|
|
48211
|
+
this.item.applyOwnerId(localStorage.getItem("currentUser") || "");
|
|
48212
|
+
return super.pointerUp();
|
|
48213
|
+
}
|
|
48214
|
+
}
|
|
48215
|
+
|
|
48216
|
+
// src/Items/Examples/CardGame/Hand/Hand.ts
|
|
48217
|
+
var handPath = new Path([
|
|
48218
|
+
new Line(new Point(0, 0), new Point(100, 0)),
|
|
48219
|
+
new Line(new Point(100, 0), new Point(100, 100)),
|
|
48220
|
+
new Line(new Point(100, 100), new Point(0, 100)),
|
|
48221
|
+
new Line(new Point(0, 100), new Point(0, 0))
|
|
48222
|
+
], true);
|
|
48223
|
+
var defaultHandData = {
|
|
48224
|
+
itemType: "Hand",
|
|
48225
|
+
ownerId: ""
|
|
48226
|
+
};
|
|
48227
|
+
|
|
48228
|
+
class Hand extends BaseItem {
|
|
48229
|
+
ownerId;
|
|
48230
|
+
subject = new Subject;
|
|
48231
|
+
path;
|
|
48232
|
+
constructor(board, id = "", ownerId = "") {
|
|
48233
|
+
super(board, id, defaultHandData, true);
|
|
48234
|
+
this.ownerId = ownerId;
|
|
48235
|
+
this.transformation.subject.subscribe(() => {
|
|
48236
|
+
this.transformPath();
|
|
48237
|
+
this.updateMbr();
|
|
48238
|
+
this.subject.publish(this);
|
|
48239
|
+
});
|
|
48240
|
+
this.transformPath();
|
|
48241
|
+
this.updateMbr();
|
|
48242
|
+
}
|
|
48243
|
+
apply(op) {
|
|
48244
|
+
super.apply(op);
|
|
48245
|
+
this.subject.publish(this);
|
|
48246
|
+
}
|
|
48247
|
+
applyOwnerId(ownerId) {
|
|
48248
|
+
this.ownerId = ownerId;
|
|
48249
|
+
}
|
|
48250
|
+
transformPath() {
|
|
48251
|
+
this.path = handPath.copy();
|
|
48252
|
+
this.path.transform(this.transformation.matrix);
|
|
48253
|
+
this.path.setBackgroundColor(this.backgroundColor);
|
|
48254
|
+
this.path.setBorderColor(this.borderColor);
|
|
48255
|
+
}
|
|
48256
|
+
updateMbr() {
|
|
48257
|
+
const { left, top, right, bottom } = this.path.getMbr();
|
|
48258
|
+
this.left = left;
|
|
48259
|
+
this.right = right;
|
|
48260
|
+
this.top = top;
|
|
48261
|
+
this.bottom = bottom;
|
|
48262
|
+
}
|
|
48263
|
+
deserialize(data) {
|
|
48264
|
+
super.deserialize(data);
|
|
48265
|
+
this.transformPath();
|
|
48266
|
+
this.subject.publish(this);
|
|
48267
|
+
return this;
|
|
48268
|
+
}
|
|
48269
|
+
render(context) {
|
|
48270
|
+
if (this.transformationRenderBlock) {
|
|
48271
|
+
return;
|
|
48272
|
+
}
|
|
48273
|
+
if (localStorage.getItem("currentUser") === this.ownerId || !this.ownerId) {
|
|
48274
|
+
super.render(context);
|
|
48275
|
+
}
|
|
48276
|
+
}
|
|
48277
|
+
}
|
|
48278
|
+
registerItem({
|
|
48279
|
+
item: Hand,
|
|
48280
|
+
defaultData: defaultHandData,
|
|
48281
|
+
toolData: { name: "AddHand", tool: AddHand }
|
|
48282
|
+
});
|
|
48201
48283
|
// src/Pointer/Cursor.ts
|
|
48202
48284
|
var defaultCursors = [
|
|
48203
48285
|
"default",
|
|
@@ -56632,6 +56714,7 @@ export {
|
|
|
56632
56714
|
Keyboard,
|
|
56633
56715
|
Items,
|
|
56634
56716
|
ImageItem,
|
|
56717
|
+
Hand,
|
|
56635
56718
|
Group,
|
|
56636
56719
|
Frames,
|
|
56637
56720
|
FrameCommand,
|
package/dist/esm/node.js
CHANGED
|
@@ -23774,6 +23774,7 @@ class BaseItem extends Mbr {
|
|
|
23774
23774
|
this.id = id;
|
|
23775
23775
|
if (isGroupItem) {
|
|
23776
23776
|
this.index = new SimpleSpatialIndex(board.camera, board.pointer);
|
|
23777
|
+
this.canBeNested = false;
|
|
23777
23778
|
}
|
|
23778
23779
|
if (defaultItemData) {
|
|
23779
23780
|
Object.entries(defaultItemData).forEach(([key, value]) => {
|
|
@@ -23898,6 +23899,9 @@ class BaseItem extends Mbr {
|
|
|
23898
23899
|
return null;
|
|
23899
23900
|
}
|
|
23900
23901
|
deserialize(data) {
|
|
23902
|
+
if (data.children) {
|
|
23903
|
+
this.applyAddChildren(data.children);
|
|
23904
|
+
}
|
|
23901
23905
|
Object.entries(data).forEach(([key, value]) => {
|
|
23902
23906
|
if (this[key]?.deserialize) {
|
|
23903
23907
|
this[key].deserialize(value);
|
|
@@ -50666,6 +50670,84 @@ registerItem({
|
|
|
50666
50670
|
defaultData: defaultDiceData,
|
|
50667
50671
|
toolData: { name: "AddDice", tool: AddDice }
|
|
50668
50672
|
});
|
|
50673
|
+
// src/Items/Examples/CardGame/Hand/AddHand.ts
|
|
50674
|
+
class AddHand extends ShapeTool {
|
|
50675
|
+
constructor(board, name) {
|
|
50676
|
+
super(board, name, Hand, { cursorName: "crosshair", fixedRatio: false });
|
|
50677
|
+
}
|
|
50678
|
+
pointerUp() {
|
|
50679
|
+
this.item.applyOwnerId(localStorage.getItem("currentUser") || "");
|
|
50680
|
+
return super.pointerUp();
|
|
50681
|
+
}
|
|
50682
|
+
}
|
|
50683
|
+
|
|
50684
|
+
// src/Items/Examples/CardGame/Hand/Hand.ts
|
|
50685
|
+
var handPath = new Path([
|
|
50686
|
+
new Line(new Point(0, 0), new Point(100, 0)),
|
|
50687
|
+
new Line(new Point(100, 0), new Point(100, 100)),
|
|
50688
|
+
new Line(new Point(100, 100), new Point(0, 100)),
|
|
50689
|
+
new Line(new Point(0, 100), new Point(0, 0))
|
|
50690
|
+
], true);
|
|
50691
|
+
var defaultHandData = {
|
|
50692
|
+
itemType: "Hand",
|
|
50693
|
+
ownerId: ""
|
|
50694
|
+
};
|
|
50695
|
+
|
|
50696
|
+
class Hand extends BaseItem {
|
|
50697
|
+
ownerId;
|
|
50698
|
+
subject = new Subject;
|
|
50699
|
+
path;
|
|
50700
|
+
constructor(board, id = "", ownerId = "") {
|
|
50701
|
+
super(board, id, defaultHandData, true);
|
|
50702
|
+
this.ownerId = ownerId;
|
|
50703
|
+
this.transformation.subject.subscribe(() => {
|
|
50704
|
+
this.transformPath();
|
|
50705
|
+
this.updateMbr();
|
|
50706
|
+
this.subject.publish(this);
|
|
50707
|
+
});
|
|
50708
|
+
this.transformPath();
|
|
50709
|
+
this.updateMbr();
|
|
50710
|
+
}
|
|
50711
|
+
apply(op) {
|
|
50712
|
+
super.apply(op);
|
|
50713
|
+
this.subject.publish(this);
|
|
50714
|
+
}
|
|
50715
|
+
applyOwnerId(ownerId) {
|
|
50716
|
+
this.ownerId = ownerId;
|
|
50717
|
+
}
|
|
50718
|
+
transformPath() {
|
|
50719
|
+
this.path = handPath.copy();
|
|
50720
|
+
this.path.transform(this.transformation.matrix);
|
|
50721
|
+
this.path.setBackgroundColor(this.backgroundColor);
|
|
50722
|
+
this.path.setBorderColor(this.borderColor);
|
|
50723
|
+
}
|
|
50724
|
+
updateMbr() {
|
|
50725
|
+
const { left, top, right, bottom } = this.path.getMbr();
|
|
50726
|
+
this.left = left;
|
|
50727
|
+
this.right = right;
|
|
50728
|
+
this.top = top;
|
|
50729
|
+
this.bottom = bottom;
|
|
50730
|
+
}
|
|
50731
|
+
deserialize(data) {
|
|
50732
|
+
super.deserialize(data);
|
|
50733
|
+
this.transformPath();
|
|
50734
|
+
this.subject.publish(this);
|
|
50735
|
+
return this;
|
|
50736
|
+
}
|
|
50737
|
+
render(context) {
|
|
50738
|
+
if (this.transformationRenderBlock) {
|
|
50739
|
+
return;
|
|
50740
|
+
}
|
|
50741
|
+
if (localStorage.getItem("currentUser") === this.ownerId || !this.ownerId) {
|
|
50742
|
+
super.render(context);
|
|
50743
|
+
}
|
|
50744
|
+
}
|
|
50745
|
+
}
|
|
50746
|
+
registerItem({
|
|
50747
|
+
item: Hand,
|
|
50748
|
+
defaultData: defaultHandData,
|
|
50749
|
+
toolData: { name: "AddHand", tool: AddHand }
|
|
50750
|
+
});
|
|
50669
50751
|
// src/Pointer/Cursor.ts
|
|
50670
50752
|
var defaultCursors = [
|
|
50671
50753
|
"default",
|
|
@@ -59267,6 +59349,7 @@ export {
|
|
|
59267
59349
|
Keyboard,
|
|
59268
59350
|
Items,
|
|
59269
59351
|
ImageItem,
|
|
59352
|
+
Hand,
|
|
59270
59353
|
Group,
|
|
59271
59354
|
Frames,
|
|
59272
59355
|
FrameCommand,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseItem, BaseItemData, SerializedItemData } from "Items/BaseItem/BaseItem";
|
|
2
|
+
import { Board } from "Board";
|
|
3
|
+
import { Subject } from "Subject";
|
|
4
|
+
import { DrawingContext } from "Items/DrawingContext";
|
|
5
|
+
import { DeckOperation } from "Items/Examples/CardGame/Deck/DeckOperation";
|
|
6
|
+
export declare const defaultHandData: BaseItemData;
|
|
7
|
+
export declare class Hand extends BaseItem {
|
|
8
|
+
private ownerId;
|
|
9
|
+
readonly subject: Subject<Hand>;
|
|
10
|
+
private path;
|
|
11
|
+
constructor(board: Board, id?: string, ownerId?: string);
|
|
12
|
+
apply(op: DeckOperation): void;
|
|
13
|
+
applyOwnerId(ownerId: string): void;
|
|
14
|
+
private transformPath;
|
|
15
|
+
updateMbr(): void;
|
|
16
|
+
deserialize(data: SerializedItemData): this;
|
|
17
|
+
render(context: DrawingContext): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Hand } from "./Hand";
|
|
@@ -26,5 +26,6 @@ export { Counter } from "./Examples/Counter";
|
|
|
26
26
|
export { Card } from "./Examples/CardGame/Card";
|
|
27
27
|
export { Deck } from "./Examples/CardGame/Deck";
|
|
28
28
|
export { Dice } from "./Examples/CardGame/Dice";
|
|
29
|
+
export { Hand } from "./Examples/CardGame/Hand";
|
|
29
30
|
export { Comment } from "./Comment";
|
|
30
31
|
export type { HorisontalAlignment, VerticalAlignment } from "./Alignment";
|