microboard-temp 0.4.66 → 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.
@@ -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,
@@ -48359,6 +48360,84 @@ registerItem({
48359
48360
  defaultData: defaultDiceData,
48360
48361
  toolData: { name: "AddDice", tool: AddDice }
48361
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
+ });
48362
48441
  // src/Pointer/Cursor.ts
48363
48442
  var defaultCursors = [
48364
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,
@@ -48359,6 +48360,84 @@ registerItem({
48359
48360
  defaultData: defaultDiceData,
48360
48361
  toolData: { name: "AddDice", tool: AddDice }
48361
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
+ });
48362
48441
  // src/Pointer/Cursor.ts
48363
48442
  var defaultCursors = [
48364
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,
@@ -50832,6 +50833,84 @@ registerItem({
50832
50833
  defaultData: defaultDiceData,
50833
50834
  toolData: { name: "AddDice", tool: AddDice }
50834
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
+ });
50835
50914
  // src/Pointer/Cursor.ts
50836
50915
  var defaultCursors = [
50837
50916
  "default",
@@ -48209,6 +48209,84 @@ registerItem({
48209
48209
  defaultData: defaultDiceData,
48210
48210
  toolData: { name: "AddDice", tool: AddDice }
48211
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
+ });
48212
48290
  // src/Pointer/Cursor.ts
48213
48291
  var defaultCursors = [
48214
48292
  "default",
@@ -56738,6 +56816,7 @@ export {
56738
56816
  Keyboard,
56739
56817
  Items,
56740
56818
  ImageItem,
56819
+ Hand,
56741
56820
  Group,
56742
56821
  Frames,
56743
56822
  FrameCommand,
package/dist/esm/index.js CHANGED
@@ -48202,6 +48202,84 @@ registerItem({
48202
48202
  defaultData: defaultDiceData,
48203
48203
  toolData: { name: "AddDice", tool: AddDice }
48204
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
+ });
48205
48283
  // src/Pointer/Cursor.ts
48206
48284
  var defaultCursors = [
48207
48285
  "default",
@@ -56636,6 +56714,7 @@ export {
56636
56714
  Keyboard,
56637
56715
  Items,
56638
56716
  ImageItem,
56717
+ Hand,
56639
56718
  Group,
56640
56719
  Frames,
56641
56720
  FrameCommand,
package/dist/esm/node.js CHANGED
@@ -50670,6 +50670,84 @@ registerItem({
50670
50670
  defaultData: defaultDiceData,
50671
50671
  toolData: { name: "AddDice", tool: AddDice }
50672
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
+ });
50673
50751
  // src/Pointer/Cursor.ts
50674
50752
  var defaultCursors = [
50675
50753
  "default",
@@ -59271,6 +59349,7 @@ export {
59271
59349
  Keyboard,
59272
59350
  Items,
59273
59351
  ImageItem,
59352
+ Hand,
59274
59353
  Group,
59275
59354
  Frames,
59276
59355
  FrameCommand,
@@ -1,6 +1,6 @@
1
1
  import { Board } from "Board";
2
2
  import { ShapeTool } from "Tools/CustomTool";
3
- export declare class AddDice extends ShapeTool {
3
+ export declare class AddHand extends ShapeTool {
4
4
  constructor(board: Board, name: string);
5
5
  pointerUp(): boolean;
6
6
  }
@@ -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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.4.66",
3
+ "version": "0.4.67",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",