microboard-temp 0.13.83 → 0.13.85

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.
@@ -59958,6 +59958,29 @@ var init_Frame = __esm(() => {
59958
59958
  this.board = board;
59959
59959
  return this;
59960
59960
  }
59961
+ addChildItems(children) {
59962
+ if (!this.index || children.length === 0)
59963
+ return;
59964
+ this.emit({
59965
+ class: this.itemType,
59966
+ method: "addChildren",
59967
+ item: [this.getId()],
59968
+ childId: children.map((child) => child.getId())
59969
+ });
59970
+ }
59971
+ removeChildItems(children) {
59972
+ if (!this.index)
59973
+ return;
59974
+ const childrenArr = Array.isArray(children) ? children : [children];
59975
+ if (childrenArr.length === 0)
59976
+ return;
59977
+ this.emit({
59978
+ class: this.itemType,
59979
+ method: "removeChildren",
59980
+ item: [this.getId()],
59981
+ childId: childrenArr.map((child) => child.getId())
59982
+ });
59983
+ }
59961
59984
  getLinkTo() {
59962
59985
  return this.linkTo.link;
59963
59986
  }
@@ -60147,6 +60170,17 @@ var init_Frame = __esm(() => {
60147
60170
  this.path.setBorderOpacity(this.borderOpacity);
60148
60171
  }
60149
60172
  apply(op) {
60173
+ if (op.class === "Frame") {
60174
+ if (op.method === "addChildren" || op.method === "addChild") {
60175
+ this.applyAddChildren(op.childId);
60176
+ this.subject.publish(this);
60177
+ return;
60178
+ } else if (op.method === "removeChildren" || op.method === "removeChild") {
60179
+ this.applyRemoveChildren(op.childId);
60180
+ this.subject.publish(this);
60181
+ return;
60182
+ }
60183
+ }
60150
60184
  super.apply(op);
60151
60185
  switch (op.class) {
60152
60186
  case "Frame":
@@ -60156,10 +60190,6 @@ var init_Frame = __esm(() => {
60156
60190
  this.applyCanChangeRatio(op.canChangeRatio);
60157
60191
  } else if (op.method === "setFrameType") {
60158
60192
  this.applyFrameType(op.shapeType);
60159
- } else if (op.method === "addChild") {
60160
- this.applyAddChildren(op.childId);
60161
- } else if (op.method === "removeChild") {
60162
- this.applyRemoveChildren(op.childId);
60163
60193
  }
60164
60194
  break;
60165
60195
  case "RichText":
@@ -61468,7 +61498,7 @@ var init_Drawing = __esm(() => {
61468
61498
  return null;
61469
61499
  }
61470
61500
  isPointNearLine(point5, threshold = 10) {
61471
- const { translateX: drawingTranslateX, translateY: drawingTranslateY, scaleX: drawingScaleX, scaleY: drawingScaleY } = this.transformation.getMatrixData();
61501
+ const { translateX: drawingTranslateX, translateY: drawingTranslateY, scaleX: drawingScaleX, scaleY: drawingScaleY } = this.getWorldMatrix();
61472
61502
  const transformedMouseX = (point5.x - drawingTranslateX) / drawingScaleX;
61473
61503
  const transformedMouseY = (point5.y - drawingTranslateY) / drawingScaleY;
61474
61504
  const transformedMouse = new Point(transformedMouseX, transformedMouseY);
package/dist/cjs/index.js CHANGED
@@ -59958,6 +59958,29 @@ var init_Frame = __esm(() => {
59958
59958
  this.board = board;
59959
59959
  return this;
59960
59960
  }
59961
+ addChildItems(children) {
59962
+ if (!this.index || children.length === 0)
59963
+ return;
59964
+ this.emit({
59965
+ class: this.itemType,
59966
+ method: "addChildren",
59967
+ item: [this.getId()],
59968
+ childId: children.map((child) => child.getId())
59969
+ });
59970
+ }
59971
+ removeChildItems(children) {
59972
+ if (!this.index)
59973
+ return;
59974
+ const childrenArr = Array.isArray(children) ? children : [children];
59975
+ if (childrenArr.length === 0)
59976
+ return;
59977
+ this.emit({
59978
+ class: this.itemType,
59979
+ method: "removeChildren",
59980
+ item: [this.getId()],
59981
+ childId: childrenArr.map((child) => child.getId())
59982
+ });
59983
+ }
59961
59984
  getLinkTo() {
59962
59985
  return this.linkTo.link;
59963
59986
  }
@@ -60147,6 +60170,17 @@ var init_Frame = __esm(() => {
60147
60170
  this.path.setBorderOpacity(this.borderOpacity);
60148
60171
  }
60149
60172
  apply(op) {
60173
+ if (op.class === "Frame") {
60174
+ if (op.method === "addChildren" || op.method === "addChild") {
60175
+ this.applyAddChildren(op.childId);
60176
+ this.subject.publish(this);
60177
+ return;
60178
+ } else if (op.method === "removeChildren" || op.method === "removeChild") {
60179
+ this.applyRemoveChildren(op.childId);
60180
+ this.subject.publish(this);
60181
+ return;
60182
+ }
60183
+ }
60150
60184
  super.apply(op);
60151
60185
  switch (op.class) {
60152
60186
  case "Frame":
@@ -60156,10 +60190,6 @@ var init_Frame = __esm(() => {
60156
60190
  this.applyCanChangeRatio(op.canChangeRatio);
60157
60191
  } else if (op.method === "setFrameType") {
60158
60192
  this.applyFrameType(op.shapeType);
60159
- } else if (op.method === "addChild") {
60160
- this.applyAddChildren(op.childId);
60161
- } else if (op.method === "removeChild") {
60162
- this.applyRemoveChildren(op.childId);
60163
60193
  }
60164
60194
  break;
60165
60195
  case "RichText":
@@ -61468,7 +61498,7 @@ var init_Drawing = __esm(() => {
61468
61498
  return null;
61469
61499
  }
61470
61500
  isPointNearLine(point5, threshold = 10) {
61471
- const { translateX: drawingTranslateX, translateY: drawingTranslateY, scaleX: drawingScaleX, scaleY: drawingScaleY } = this.transformation.getMatrixData();
61501
+ const { translateX: drawingTranslateX, translateY: drawingTranslateY, scaleX: drawingScaleX, scaleY: drawingScaleY } = this.getWorldMatrix();
61472
61502
  const transformedMouseX = (point5.x - drawingTranslateX) / drawingScaleX;
61473
61503
  const transformedMouseY = (point5.y - drawingTranslateY) / drawingScaleY;
61474
61504
  const transformedMouse = new Point(transformedMouseX, transformedMouseY);
package/dist/cjs/node.js CHANGED
@@ -62378,6 +62378,29 @@ var init_Frame = __esm(() => {
62378
62378
  this.board = board;
62379
62379
  return this;
62380
62380
  }
62381
+ addChildItems(children) {
62382
+ if (!this.index || children.length === 0)
62383
+ return;
62384
+ this.emit({
62385
+ class: this.itemType,
62386
+ method: "addChildren",
62387
+ item: [this.getId()],
62388
+ childId: children.map((child) => child.getId())
62389
+ });
62390
+ }
62391
+ removeChildItems(children) {
62392
+ if (!this.index)
62393
+ return;
62394
+ const childrenArr = Array.isArray(children) ? children : [children];
62395
+ if (childrenArr.length === 0)
62396
+ return;
62397
+ this.emit({
62398
+ class: this.itemType,
62399
+ method: "removeChildren",
62400
+ item: [this.getId()],
62401
+ childId: childrenArr.map((child) => child.getId())
62402
+ });
62403
+ }
62381
62404
  getLinkTo() {
62382
62405
  return this.linkTo.link;
62383
62406
  }
@@ -62567,6 +62590,17 @@ var init_Frame = __esm(() => {
62567
62590
  this.path.setBorderOpacity(this.borderOpacity);
62568
62591
  }
62569
62592
  apply(op) {
62593
+ if (op.class === "Frame") {
62594
+ if (op.method === "addChildren" || op.method === "addChild") {
62595
+ this.applyAddChildren(op.childId);
62596
+ this.subject.publish(this);
62597
+ return;
62598
+ } else if (op.method === "removeChildren" || op.method === "removeChild") {
62599
+ this.applyRemoveChildren(op.childId);
62600
+ this.subject.publish(this);
62601
+ return;
62602
+ }
62603
+ }
62570
62604
  super.apply(op);
62571
62605
  switch (op.class) {
62572
62606
  case "Frame":
@@ -62576,10 +62610,6 @@ var init_Frame = __esm(() => {
62576
62610
  this.applyCanChangeRatio(op.canChangeRatio);
62577
62611
  } else if (op.method === "setFrameType") {
62578
62612
  this.applyFrameType(op.shapeType);
62579
- } else if (op.method === "addChild") {
62580
- this.applyAddChildren(op.childId);
62581
- } else if (op.method === "removeChild") {
62582
- this.applyRemoveChildren(op.childId);
62583
62613
  }
62584
62614
  break;
62585
62615
  case "RichText":
@@ -63888,7 +63918,7 @@ var init_Drawing = __esm(() => {
63888
63918
  return null;
63889
63919
  }
63890
63920
  isPointNearLine(point5, threshold = 10) {
63891
- const { translateX: drawingTranslateX, translateY: drawingTranslateY, scaleX: drawingScaleX, scaleY: drawingScaleY } = this.transformation.getMatrixData();
63921
+ const { translateX: drawingTranslateX, translateY: drawingTranslateY, scaleX: drawingScaleX, scaleY: drawingScaleY } = this.getWorldMatrix();
63892
63922
  const transformedMouseX = (point5.x - drawingTranslateX) / drawingScaleX;
63893
63923
  const transformedMouseY = (point5.y - drawingTranslateY) / drawingScaleY;
63894
63924
  const transformedMouse = new Point(transformedMouseX, transformedMouseY);
@@ -59896,6 +59896,29 @@ var init_Frame = __esm(() => {
59896
59896
  this.board = board;
59897
59897
  return this;
59898
59898
  }
59899
+ addChildItems(children) {
59900
+ if (!this.index || children.length === 0)
59901
+ return;
59902
+ this.emit({
59903
+ class: this.itemType,
59904
+ method: "addChildren",
59905
+ item: [this.getId()],
59906
+ childId: children.map((child) => child.getId())
59907
+ });
59908
+ }
59909
+ removeChildItems(children) {
59910
+ if (!this.index)
59911
+ return;
59912
+ const childrenArr = Array.isArray(children) ? children : [children];
59913
+ if (childrenArr.length === 0)
59914
+ return;
59915
+ this.emit({
59916
+ class: this.itemType,
59917
+ method: "removeChildren",
59918
+ item: [this.getId()],
59919
+ childId: childrenArr.map((child) => child.getId())
59920
+ });
59921
+ }
59899
59922
  getLinkTo() {
59900
59923
  return this.linkTo.link;
59901
59924
  }
@@ -60085,6 +60108,17 @@ var init_Frame = __esm(() => {
60085
60108
  this.path.setBorderOpacity(this.borderOpacity);
60086
60109
  }
60087
60110
  apply(op) {
60111
+ if (op.class === "Frame") {
60112
+ if (op.method === "addChildren" || op.method === "addChild") {
60113
+ this.applyAddChildren(op.childId);
60114
+ this.subject.publish(this);
60115
+ return;
60116
+ } else if (op.method === "removeChildren" || op.method === "removeChild") {
60117
+ this.applyRemoveChildren(op.childId);
60118
+ this.subject.publish(this);
60119
+ return;
60120
+ }
60121
+ }
60088
60122
  super.apply(op);
60089
60123
  switch (op.class) {
60090
60124
  case "Frame":
@@ -60094,10 +60128,6 @@ var init_Frame = __esm(() => {
60094
60128
  this.applyCanChangeRatio(op.canChangeRatio);
60095
60129
  } else if (op.method === "setFrameType") {
60096
60130
  this.applyFrameType(op.shapeType);
60097
- } else if (op.method === "addChild") {
60098
- this.applyAddChildren(op.childId);
60099
- } else if (op.method === "removeChild") {
60100
- this.applyRemoveChildren(op.childId);
60101
60131
  }
60102
60132
  break;
60103
60133
  case "RichText":
@@ -61406,7 +61436,7 @@ var init_Drawing = __esm(() => {
61406
61436
  return null;
61407
61437
  }
61408
61438
  isPointNearLine(point5, threshold = 10) {
61409
- const { translateX: drawingTranslateX, translateY: drawingTranslateY, scaleX: drawingScaleX, scaleY: drawingScaleY } = this.transformation.getMatrixData();
61439
+ const { translateX: drawingTranslateX, translateY: drawingTranslateY, scaleX: drawingScaleX, scaleY: drawingScaleY } = this.getWorldMatrix();
61410
61440
  const transformedMouseX = (point5.x - drawingTranslateX) / drawingScaleX;
61411
61441
  const transformedMouseY = (point5.y - drawingTranslateY) / drawingScaleY;
61412
61442
  const transformedMouse = new Point(transformedMouseX, transformedMouseY);
package/dist/esm/index.js CHANGED
@@ -59889,6 +59889,29 @@ var init_Frame = __esm(() => {
59889
59889
  this.board = board;
59890
59890
  return this;
59891
59891
  }
59892
+ addChildItems(children) {
59893
+ if (!this.index || children.length === 0)
59894
+ return;
59895
+ this.emit({
59896
+ class: this.itemType,
59897
+ method: "addChildren",
59898
+ item: [this.getId()],
59899
+ childId: children.map((child) => child.getId())
59900
+ });
59901
+ }
59902
+ removeChildItems(children) {
59903
+ if (!this.index)
59904
+ return;
59905
+ const childrenArr = Array.isArray(children) ? children : [children];
59906
+ if (childrenArr.length === 0)
59907
+ return;
59908
+ this.emit({
59909
+ class: this.itemType,
59910
+ method: "removeChildren",
59911
+ item: [this.getId()],
59912
+ childId: childrenArr.map((child) => child.getId())
59913
+ });
59914
+ }
59892
59915
  getLinkTo() {
59893
59916
  return this.linkTo.link;
59894
59917
  }
@@ -60078,6 +60101,17 @@ var init_Frame = __esm(() => {
60078
60101
  this.path.setBorderOpacity(this.borderOpacity);
60079
60102
  }
60080
60103
  apply(op) {
60104
+ if (op.class === "Frame") {
60105
+ if (op.method === "addChildren" || op.method === "addChild") {
60106
+ this.applyAddChildren(op.childId);
60107
+ this.subject.publish(this);
60108
+ return;
60109
+ } else if (op.method === "removeChildren" || op.method === "removeChild") {
60110
+ this.applyRemoveChildren(op.childId);
60111
+ this.subject.publish(this);
60112
+ return;
60113
+ }
60114
+ }
60081
60115
  super.apply(op);
60082
60116
  switch (op.class) {
60083
60117
  case "Frame":
@@ -60087,10 +60121,6 @@ var init_Frame = __esm(() => {
60087
60121
  this.applyCanChangeRatio(op.canChangeRatio);
60088
60122
  } else if (op.method === "setFrameType") {
60089
60123
  this.applyFrameType(op.shapeType);
60090
- } else if (op.method === "addChild") {
60091
- this.applyAddChildren(op.childId);
60092
- } else if (op.method === "removeChild") {
60093
- this.applyRemoveChildren(op.childId);
60094
60124
  }
60095
60125
  break;
60096
60126
  case "RichText":
@@ -61399,7 +61429,7 @@ var init_Drawing = __esm(() => {
61399
61429
  return null;
61400
61430
  }
61401
61431
  isPointNearLine(point5, threshold = 10) {
61402
- const { translateX: drawingTranslateX, translateY: drawingTranslateY, scaleX: drawingScaleX, scaleY: drawingScaleY } = this.transformation.getMatrixData();
61432
+ const { translateX: drawingTranslateX, translateY: drawingTranslateY, scaleX: drawingScaleX, scaleY: drawingScaleY } = this.getWorldMatrix();
61403
61433
  const transformedMouseX = (point5.x - drawingTranslateX) / drawingScaleX;
61404
61434
  const transformedMouseY = (point5.y - drawingTranslateY) / drawingScaleY;
61405
61435
  const transformedMouse = new Point(transformedMouseX, transformedMouseY);
package/dist/esm/node.js CHANGED
@@ -62298,6 +62298,29 @@ var init_Frame = __esm(() => {
62298
62298
  this.board = board;
62299
62299
  return this;
62300
62300
  }
62301
+ addChildItems(children) {
62302
+ if (!this.index || children.length === 0)
62303
+ return;
62304
+ this.emit({
62305
+ class: this.itemType,
62306
+ method: "addChildren",
62307
+ item: [this.getId()],
62308
+ childId: children.map((child) => child.getId())
62309
+ });
62310
+ }
62311
+ removeChildItems(children) {
62312
+ if (!this.index)
62313
+ return;
62314
+ const childrenArr = Array.isArray(children) ? children : [children];
62315
+ if (childrenArr.length === 0)
62316
+ return;
62317
+ this.emit({
62318
+ class: this.itemType,
62319
+ method: "removeChildren",
62320
+ item: [this.getId()],
62321
+ childId: childrenArr.map((child) => child.getId())
62322
+ });
62323
+ }
62301
62324
  getLinkTo() {
62302
62325
  return this.linkTo.link;
62303
62326
  }
@@ -62487,6 +62510,17 @@ var init_Frame = __esm(() => {
62487
62510
  this.path.setBorderOpacity(this.borderOpacity);
62488
62511
  }
62489
62512
  apply(op) {
62513
+ if (op.class === "Frame") {
62514
+ if (op.method === "addChildren" || op.method === "addChild") {
62515
+ this.applyAddChildren(op.childId);
62516
+ this.subject.publish(this);
62517
+ return;
62518
+ } else if (op.method === "removeChildren" || op.method === "removeChild") {
62519
+ this.applyRemoveChildren(op.childId);
62520
+ this.subject.publish(this);
62521
+ return;
62522
+ }
62523
+ }
62490
62524
  super.apply(op);
62491
62525
  switch (op.class) {
62492
62526
  case "Frame":
@@ -62496,10 +62530,6 @@ var init_Frame = __esm(() => {
62496
62530
  this.applyCanChangeRatio(op.canChangeRatio);
62497
62531
  } else if (op.method === "setFrameType") {
62498
62532
  this.applyFrameType(op.shapeType);
62499
- } else if (op.method === "addChild") {
62500
- this.applyAddChildren(op.childId);
62501
- } else if (op.method === "removeChild") {
62502
- this.applyRemoveChildren(op.childId);
62503
62533
  }
62504
62534
  break;
62505
62535
  case "RichText":
@@ -63808,7 +63838,7 @@ var init_Drawing = __esm(() => {
63808
63838
  return null;
63809
63839
  }
63810
63840
  isPointNearLine(point5, threshold = 10) {
63811
- const { translateX: drawingTranslateX, translateY: drawingTranslateY, scaleX: drawingScaleX, scaleY: drawingScaleY } = this.transformation.getMatrixData();
63841
+ const { translateX: drawingTranslateX, translateY: drawingTranslateY, scaleX: drawingScaleX, scaleY: drawingScaleY } = this.getWorldMatrix();
63812
63842
  const transformedMouseX = (point5.x - drawingTranslateX) / drawingScaleX;
63813
63843
  const transformedMouseY = (point5.y - drawingTranslateY) / drawingScaleY;
63814
63844
  const transformedMouse = new Point(transformedMouseX, transformedMouseY);
@@ -8,6 +8,7 @@ import type { Item } from "../Item";
8
8
  import { RichText } from "../RichText/RichText";
9
9
  import { Matrix } from "../Transformation/Matrix";
10
10
  import type { SerializedItemData } from "../BaseItem/BaseItem";
11
+ import { BaseItem } from "../BaseItem/BaseItem";
11
12
  import { Subject } from "../../Subject";
12
13
  import { DrawingContext } from "../DrawingContext";
13
14
  import { Operation } from "../../Events";
@@ -20,7 +21,6 @@ import { LinkTo } from "../LinkTo/LinkTo";
20
21
  import { FrameData } from "./FrameData";
21
22
  import { DocumentFactory } from "../../api/DocumentFactory";
22
23
  import { ResizeType } from "../../Selection/Transformer/TransformerHelpers/getResizeType";
23
- import { BaseItem } from "../BaseItem";
24
24
  import { ColorValue } from "../../..";
25
25
  export declare class Frame extends BaseItem<Frame> {
26
26
  private getItemById;
@@ -53,6 +53,8 @@ export declare class Frame extends BaseItem<Frame> {
53
53
  * Child cant be itself,
54
54
  * frame cant be child
55
55
  */
56
+ addChildItems(children: BaseItem[]): void;
57
+ removeChildItems(children: BaseItem[] | BaseItem): void;
56
58
  getLinkTo(): string | undefined;
57
59
  /**
58
60
  * Returns:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.13.83",
3
+ "version": "0.13.85",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",