microboard-temp 0.4.7 → 0.4.8

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.
@@ -752,7 +752,7 @@ __export(exports_browser, {
752
752
  ConnectorData: () => ConnectorData2,
753
753
  Connector: () => Connector2,
754
754
  ConnectionLineWidths: () => ConnectionLineWidths,
755
- Comment: () => Comment2,
755
+ Comment: () => Comment,
756
756
  Camera: () => Camera,
757
757
  CURSORS_IDLE_CLEANUP_DELAY: () => CURSORS_IDLE_CLEANUP_DELAY,
758
758
  CURSORS_ANIMATION_DURATION: () => CURSORS_ANIMATION_DURATION,
@@ -18953,7 +18953,7 @@ var v4_default = v4;
18953
18953
  // src/Items/Comment/Comment.ts
18954
18954
  var ANONYMOUS_ID = 9999999999;
18955
18955
 
18956
- class Comment2 {
18956
+ class Comment {
18957
18957
  anchor;
18958
18958
  events;
18959
18959
  id;
@@ -19726,6 +19726,9 @@ class BaseItem extends Mbr {
19726
19726
  getPathMbr() {
19727
19727
  return this.getMbr().copy();
19728
19728
  }
19729
+ getPath() {
19730
+ return new Path(this.getMbr().getLines());
19731
+ }
19729
19732
  render(context) {}
19730
19733
  renderHTML(documentFactory) {
19731
19734
  return documentFactory.createElement("div");
@@ -38497,10 +38500,6 @@ class Frame extends BaseItem {
38497
38500
  return this.mbr.copy();
38498
38501
  }
38499
38502
  doResize(resizeType, pointer, mbr, opposite, startMbr, timeStamp) {
38500
- if (this.transformation.isLocked) {
38501
- this.board?.pointer.setCursor("default");
38502
- return false;
38503
- }
38504
38503
  const res = this.getCanChangeRatio() ? getResize(resizeType, pointer, mbr, opposite) : getProportionalResize(resizeType, pointer, mbr, opposite);
38505
38504
  if (!res) {
38506
38505
  return {
@@ -41078,7 +41077,7 @@ function createComment(id, data, board) {
41078
41077
  if (!isCommentData(data)) {
41079
41078
  throw new Error("Invalid data for Comment");
41080
41079
  }
41081
- const comment2 = new Comment2(new Point, board.events).setId(id).deserialize(data);
41080
+ const comment2 = new Comment(new Point, board.events).setId(id).deserialize(data);
41082
41081
  return comment2;
41083
41082
  }
41084
41083
  function createAINode(id, data, board) {
@@ -41282,7 +41281,7 @@ class AddComment extends BoardTool {
41282
41281
  leftButtonUp() {
41283
41282
  this.isDown = false;
41284
41283
  this.board.selection.removeAll();
41285
- this.comment = this.board.add(this.board, new Comment(this.board.pointer.point));
41284
+ this.comment = this.board.add(new Comment(this.board.pointer.point));
41286
41285
  this.board.tools.publish();
41287
41286
  return true;
41288
41287
  }
@@ -41602,7 +41601,6 @@ class ConnectorSnap {
41602
41601
 
41603
41602
  // src/Tools/AddConnector/AddConnector.ts
41604
41603
  class AddConnector extends BoardTool {
41605
- board;
41606
41604
  connector = null;
41607
41605
  lineStyle = "curved";
41608
41606
  startPointer;
@@ -41617,7 +41615,6 @@ class AddConnector extends BoardTool {
41617
41615
  isQuickAdd = false;
41618
41616
  constructor(board, itemToStart, position4) {
41619
41617
  super(board);
41620
- this.board = board;
41621
41618
  this.snap = new ConnectorSnap(this.board);
41622
41619
  this.setCursor();
41623
41620
  const storage = new SessionStorage;
@@ -41679,16 +41676,16 @@ class AddConnector extends BoardTool {
41679
41676
  this.board.tools.publish();
41680
41677
  return true;
41681
41678
  }
41682
- async leftButtonUp() {
41679
+ leftButtonUp() {
41683
41680
  this.isDown = false;
41684
41681
  if (!this.connector) {
41685
41682
  return true;
41686
41683
  }
41687
41684
  if (this.isDoneSecondPoint) {
41688
- await this.board.add(this.connector);
41685
+ this.board.add(this.connector);
41689
41686
  this.board.tools.select();
41690
41687
  } else if (this.isDraggingFromFirstToSecond) {
41691
- const addedConnector = await this.board.add(this.connector);
41688
+ const addedConnector = this.board.add(this.connector);
41692
41689
  const endPoint = this.connector.getEndPoint();
41693
41690
  this.board.tools.select();
41694
41691
  if (this.isQuickAdd && endPoint.pointType === "Board") {
@@ -43799,7 +43796,7 @@ class AlignmentHelper {
43799
43796
  if (i === 0) {
43800
43797
  return acc;
43801
43798
  }
43802
- const itemMbr = item.itemType === "Shape" ? item.getPath().getMbr() : item.getMbr();
43799
+ const itemMbr = item.getPathMbr();
43803
43800
  return acc.combine(itemMbr);
43804
43801
  }, items[0].getMbr());
43805
43802
  }
@@ -44118,9 +44115,11 @@ class AlignmentHelper {
44118
44115
  const translation = this.board.selection.getManyItemsTranslation(x, y);
44119
44116
  this.board.selection.transformMany(translation, timeStamp);
44120
44117
  } else {
44121
- const key = item.getId();
44118
+ const id = item.getId();
44122
44119
  const transformMap = {};
44123
- transformMap[key] = {
44120
+ transformMap[id] = {
44121
+ class: "Transformation",
44122
+ item: [id],
44124
44123
  method: "translateBy",
44125
44124
  x,
44126
44125
  y,
@@ -44425,7 +44424,7 @@ class Select extends Tool {
44425
44424
  const itemCenter = this.downOnItem.getMbr().getCenter();
44426
44425
  this.initialCursorPos = new Point(this.board.pointer.point.x - itemCenter.x, this.board.pointer.point.y - itemCenter.y);
44427
44426
  }
44428
- if (this.downOnItem.itemType === "Connector" && this.downOnItem.isConnectedOnePoint() && !this.board.keyboard.isCtrl) {
44427
+ if (this.downOnItem instanceof Connector2 && this.downOnItem.isConnectedOnePoint() && !this.board.keyboard.isCtrl) {
44429
44428
  this.board.selection.editUnderPointer();
44430
44429
  this.board.tools.publish();
44431
44430
  this.clear();
@@ -44474,7 +44473,7 @@ class Select extends Tool {
44474
44473
  const isDrawingSelectionMbr = this.isDrawingRectangle && this.line && this.rect;
44475
44474
  if (isDrawingSelectionMbr) {
44476
44475
  const point5 = this.board.pointer.point.copy();
44477
- this.line = new Line(this.line.start, point5);
44476
+ this.line = new Line(this.line?.start, point5);
44478
44477
  this.rect = this.line.getMbr();
44479
44478
  this.rect.borderColor = conf.SELECTION_COLOR;
44480
44479
  this.rect.backgroundColor = conf.SELECTION_BACKGROUND;
@@ -44715,7 +44714,7 @@ class Select extends Tool {
44715
44714
  const isNotInSelection = this.board.selection.items.findById(underPointer.getId()) === null;
44716
44715
  if (isNotInSelection) {
44717
44716
  this.board.selection.add(underPointer);
44718
- if (underPointer.itemType === "Frame") {
44717
+ if (underPointer instanceof Frame) {
44719
44718
  const { left, right, top, bottom } = underPointer.getMbr();
44720
44719
  const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => underPointer.getChildrenIds().includes(item.getId()));
44721
44720
  this.board.selection.add(itemsInFrame);
@@ -44843,13 +44842,13 @@ class Select extends Tool {
44843
44842
  }
44844
44843
  onConfirm() {
44845
44844
  const single = this.board.selection.items.getSingle();
44846
- if (this.board.selection.showQuickAddPanel && single && single.itemType === "Connector") {
44847
- quickAddItem(this.board, "copy", single);
44845
+ if (this.board.selection.showQuickAddPanel && single && single instanceof Connector2) {
44846
+ quickAddItem(this.board, "Rectangle", single);
44848
44847
  } else if (single && this.board.selection.getContext() !== "EditTextUnderPointer" && !this.board.selection.getIsLockedSelection()) {
44849
44848
  this.board.selection.editText(undefined, true);
44850
44849
  } else if (isSafari() && this.board.selection.getContext() === "EditTextUnderPointer" && !this.board.selection.getIsLockedSelection()) {
44851
- if (single && "text" in single || single?.itemType === "RichText") {
44852
- const text5 = single.itemType === "RichText" ? single : single.text;
44850
+ if (single && "text" in single || single instanceof RichText) {
44851
+ const text5 = single instanceof RichText ? single : single.text;
44853
44852
  text5.editor.splitNode();
44854
44853
  }
44855
44854
  }
@@ -49340,7 +49339,7 @@ class SpatialIndex {
49340
49339
  return this.itemsIndex.getRectsEnclosedOrCrossedBy(new Mbr(left, top, right, bottom));
49341
49340
  }
49342
49341
  getComments() {
49343
- return this.itemsArray.filter((item) => item instanceof Comment2);
49342
+ return this.itemsArray.filter((item) => item instanceof Comment);
49344
49343
  }
49345
49344
  getMbr() {
49346
49345
  return this.Mbr;
@@ -50042,7 +50041,7 @@ function getItemTranslation({
50042
50041
  scale: { x: 1, y: 1 }
50043
50042
  };
50044
50043
  } else {
50045
- if (item.itemType === "Frame" && item.getCanChangeRatio() && isShiftPressed && item.getFrameType() !== "Custom") {
50044
+ if (item instanceof Frame && item.getCanChangeRatio() && isShiftPressed && item.getFrameType() !== "Custom") {
50046
50045
  item.setFrameType("Custom");
50047
50046
  }
50048
50047
  return {
@@ -50055,7 +50054,7 @@ function getItemTranslation({
50055
50054
  }
50056
50055
  }
50057
50056
 
50058
- // src/Selection/Transformer/TransformerHelpers/ransformShape.ts
50057
+ // src/Selection/Transformer/TransformerHelpers/transformShape.ts
50059
50058
  function transformShape({
50060
50059
  mbr,
50061
50060
  board,
@@ -50325,7 +50324,7 @@ function transformItems({
50325
50324
  if (includesProportionalItem && (isWidth || isHeight)) {
50326
50325
  return null;
50327
50326
  }
50328
- const isIncludesFixedFrame = items.some((item) => item.itemType === "Frame" && !item.getCanChangeRatio());
50327
+ const isIncludesFixedFrame = items.some((item) => item instanceof Frame && !item.getCanChangeRatio());
50329
50328
  const shouldBeProportionalResize = isIncludesFixedFrame || includesProportionalItem || isShiftPressed || !isWidth && !isHeight;
50330
50329
  const resize = shouldBeProportionalResize ? getProportionalResize(resizeType, board.pointer.point, mbr, oppositePoint) : getResize(resizeType, board.pointer.point, mbr, oppositePoint);
50331
50330
  if (canvasDrawer.getLastCreatedCanvas() && !debounceUpd.shouldUpd()) {
@@ -50497,7 +50496,7 @@ class Transformer extends Tool {
50497
50496
  return resizeType;
50498
50497
  }
50499
50498
  updateAlignmentBySnapLines(single) {
50500
- if (single) {
50499
+ if (single && this.resizeType) {
50501
50500
  this.snapLines = this.alignmentHelper.checkAlignment(single);
50502
50501
  const snapped = this.alignmentHelper.snapToSide(single, this.snapLines, this.beginTimeStamp, this.resizeType);
50503
50502
  if (snapped) {
@@ -53178,7 +53177,7 @@ class Board {
53178
53177
  }
53179
53178
  removeVoidComments() {
53180
53179
  const voidComments = this.items.listAll().filter((item) => {
53181
- return item instanceof Comment2 && !item.getThread().length;
53180
+ return item instanceof Comment && !item.getThread().length;
53182
53181
  });
53183
53182
  if (voidComments) {
53184
53183
  for (const comment2 of voidComments) {
package/dist/cjs/index.js CHANGED
@@ -752,7 +752,7 @@ __export(exports_src, {
752
752
  ConnectorData: () => ConnectorData2,
753
753
  Connector: () => Connector2,
754
754
  ConnectionLineWidths: () => ConnectionLineWidths,
755
- Comment: () => Comment2,
755
+ Comment: () => Comment,
756
756
  Camera: () => Camera,
757
757
  CURSORS_IDLE_CLEANUP_DELAY: () => CURSORS_IDLE_CLEANUP_DELAY,
758
758
  CURSORS_ANIMATION_DURATION: () => CURSORS_ANIMATION_DURATION,
@@ -18953,7 +18953,7 @@ var v4_default = v4;
18953
18953
  // src/Items/Comment/Comment.ts
18954
18954
  var ANONYMOUS_ID = 9999999999;
18955
18955
 
18956
- class Comment2 {
18956
+ class Comment {
18957
18957
  anchor;
18958
18958
  events;
18959
18959
  id;
@@ -19726,6 +19726,9 @@ class BaseItem extends Mbr {
19726
19726
  getPathMbr() {
19727
19727
  return this.getMbr().copy();
19728
19728
  }
19729
+ getPath() {
19730
+ return new Path(this.getMbr().getLines());
19731
+ }
19729
19732
  render(context) {}
19730
19733
  renderHTML(documentFactory) {
19731
19734
  return documentFactory.createElement("div");
@@ -38497,10 +38500,6 @@ class Frame extends BaseItem {
38497
38500
  return this.mbr.copy();
38498
38501
  }
38499
38502
  doResize(resizeType, pointer, mbr, opposite, startMbr, timeStamp) {
38500
- if (this.transformation.isLocked) {
38501
- this.board?.pointer.setCursor("default");
38502
- return false;
38503
- }
38504
38503
  const res = this.getCanChangeRatio() ? getResize(resizeType, pointer, mbr, opposite) : getProportionalResize(resizeType, pointer, mbr, opposite);
38505
38504
  if (!res) {
38506
38505
  return {
@@ -41078,7 +41077,7 @@ function createComment(id, data, board) {
41078
41077
  if (!isCommentData(data)) {
41079
41078
  throw new Error("Invalid data for Comment");
41080
41079
  }
41081
- const comment2 = new Comment2(new Point, board.events).setId(id).deserialize(data);
41080
+ const comment2 = new Comment(new Point, board.events).setId(id).deserialize(data);
41082
41081
  return comment2;
41083
41082
  }
41084
41083
  function createAINode(id, data, board) {
@@ -41282,7 +41281,7 @@ class AddComment extends BoardTool {
41282
41281
  leftButtonUp() {
41283
41282
  this.isDown = false;
41284
41283
  this.board.selection.removeAll();
41285
- this.comment = this.board.add(this.board, new Comment(this.board.pointer.point));
41284
+ this.comment = this.board.add(new Comment(this.board.pointer.point));
41286
41285
  this.board.tools.publish();
41287
41286
  return true;
41288
41287
  }
@@ -41602,7 +41601,6 @@ class ConnectorSnap {
41602
41601
 
41603
41602
  // src/Tools/AddConnector/AddConnector.ts
41604
41603
  class AddConnector extends BoardTool {
41605
- board;
41606
41604
  connector = null;
41607
41605
  lineStyle = "curved";
41608
41606
  startPointer;
@@ -41617,7 +41615,6 @@ class AddConnector extends BoardTool {
41617
41615
  isQuickAdd = false;
41618
41616
  constructor(board, itemToStart, position4) {
41619
41617
  super(board);
41620
- this.board = board;
41621
41618
  this.snap = new ConnectorSnap(this.board);
41622
41619
  this.setCursor();
41623
41620
  const storage = new SessionStorage;
@@ -41679,16 +41676,16 @@ class AddConnector extends BoardTool {
41679
41676
  this.board.tools.publish();
41680
41677
  return true;
41681
41678
  }
41682
- async leftButtonUp() {
41679
+ leftButtonUp() {
41683
41680
  this.isDown = false;
41684
41681
  if (!this.connector) {
41685
41682
  return true;
41686
41683
  }
41687
41684
  if (this.isDoneSecondPoint) {
41688
- await this.board.add(this.connector);
41685
+ this.board.add(this.connector);
41689
41686
  this.board.tools.select();
41690
41687
  } else if (this.isDraggingFromFirstToSecond) {
41691
- const addedConnector = await this.board.add(this.connector);
41688
+ const addedConnector = this.board.add(this.connector);
41692
41689
  const endPoint = this.connector.getEndPoint();
41693
41690
  this.board.tools.select();
41694
41691
  if (this.isQuickAdd && endPoint.pointType === "Board") {
@@ -43799,7 +43796,7 @@ class AlignmentHelper {
43799
43796
  if (i === 0) {
43800
43797
  return acc;
43801
43798
  }
43802
- const itemMbr = item.itemType === "Shape" ? item.getPath().getMbr() : item.getMbr();
43799
+ const itemMbr = item.getPathMbr();
43803
43800
  return acc.combine(itemMbr);
43804
43801
  }, items[0].getMbr());
43805
43802
  }
@@ -44118,9 +44115,11 @@ class AlignmentHelper {
44118
44115
  const translation = this.board.selection.getManyItemsTranslation(x, y);
44119
44116
  this.board.selection.transformMany(translation, timeStamp);
44120
44117
  } else {
44121
- const key = item.getId();
44118
+ const id = item.getId();
44122
44119
  const transformMap = {};
44123
- transformMap[key] = {
44120
+ transformMap[id] = {
44121
+ class: "Transformation",
44122
+ item: [id],
44124
44123
  method: "translateBy",
44125
44124
  x,
44126
44125
  y,
@@ -44425,7 +44424,7 @@ class Select extends Tool {
44425
44424
  const itemCenter = this.downOnItem.getMbr().getCenter();
44426
44425
  this.initialCursorPos = new Point(this.board.pointer.point.x - itemCenter.x, this.board.pointer.point.y - itemCenter.y);
44427
44426
  }
44428
- if (this.downOnItem.itemType === "Connector" && this.downOnItem.isConnectedOnePoint() && !this.board.keyboard.isCtrl) {
44427
+ if (this.downOnItem instanceof Connector2 && this.downOnItem.isConnectedOnePoint() && !this.board.keyboard.isCtrl) {
44429
44428
  this.board.selection.editUnderPointer();
44430
44429
  this.board.tools.publish();
44431
44430
  this.clear();
@@ -44474,7 +44473,7 @@ class Select extends Tool {
44474
44473
  const isDrawingSelectionMbr = this.isDrawingRectangle && this.line && this.rect;
44475
44474
  if (isDrawingSelectionMbr) {
44476
44475
  const point5 = this.board.pointer.point.copy();
44477
- this.line = new Line(this.line.start, point5);
44476
+ this.line = new Line(this.line?.start, point5);
44478
44477
  this.rect = this.line.getMbr();
44479
44478
  this.rect.borderColor = conf.SELECTION_COLOR;
44480
44479
  this.rect.backgroundColor = conf.SELECTION_BACKGROUND;
@@ -44715,7 +44714,7 @@ class Select extends Tool {
44715
44714
  const isNotInSelection = this.board.selection.items.findById(underPointer.getId()) === null;
44716
44715
  if (isNotInSelection) {
44717
44716
  this.board.selection.add(underPointer);
44718
- if (underPointer.itemType === "Frame") {
44717
+ if (underPointer instanceof Frame) {
44719
44718
  const { left, right, top, bottom } = underPointer.getMbr();
44720
44719
  const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => underPointer.getChildrenIds().includes(item.getId()));
44721
44720
  this.board.selection.add(itemsInFrame);
@@ -44843,13 +44842,13 @@ class Select extends Tool {
44843
44842
  }
44844
44843
  onConfirm() {
44845
44844
  const single = this.board.selection.items.getSingle();
44846
- if (this.board.selection.showQuickAddPanel && single && single.itemType === "Connector") {
44847
- quickAddItem(this.board, "copy", single);
44845
+ if (this.board.selection.showQuickAddPanel && single && single instanceof Connector2) {
44846
+ quickAddItem(this.board, "Rectangle", single);
44848
44847
  } else if (single && this.board.selection.getContext() !== "EditTextUnderPointer" && !this.board.selection.getIsLockedSelection()) {
44849
44848
  this.board.selection.editText(undefined, true);
44850
44849
  } else if (isSafari() && this.board.selection.getContext() === "EditTextUnderPointer" && !this.board.selection.getIsLockedSelection()) {
44851
- if (single && "text" in single || single?.itemType === "RichText") {
44852
- const text5 = single.itemType === "RichText" ? single : single.text;
44850
+ if (single && "text" in single || single instanceof RichText) {
44851
+ const text5 = single instanceof RichText ? single : single.text;
44853
44852
  text5.editor.splitNode();
44854
44853
  }
44855
44854
  }
@@ -49340,7 +49339,7 @@ class SpatialIndex {
49340
49339
  return this.itemsIndex.getRectsEnclosedOrCrossedBy(new Mbr(left, top, right, bottom));
49341
49340
  }
49342
49341
  getComments() {
49343
- return this.itemsArray.filter((item) => item instanceof Comment2);
49342
+ return this.itemsArray.filter((item) => item instanceof Comment);
49344
49343
  }
49345
49344
  getMbr() {
49346
49345
  return this.Mbr;
@@ -50042,7 +50041,7 @@ function getItemTranslation({
50042
50041
  scale: { x: 1, y: 1 }
50043
50042
  };
50044
50043
  } else {
50045
- if (item.itemType === "Frame" && item.getCanChangeRatio() && isShiftPressed && item.getFrameType() !== "Custom") {
50044
+ if (item instanceof Frame && item.getCanChangeRatio() && isShiftPressed && item.getFrameType() !== "Custom") {
50046
50045
  item.setFrameType("Custom");
50047
50046
  }
50048
50047
  return {
@@ -50055,7 +50054,7 @@ function getItemTranslation({
50055
50054
  }
50056
50055
  }
50057
50056
 
50058
- // src/Selection/Transformer/TransformerHelpers/ransformShape.ts
50057
+ // src/Selection/Transformer/TransformerHelpers/transformShape.ts
50059
50058
  function transformShape({
50060
50059
  mbr,
50061
50060
  board,
@@ -50325,7 +50324,7 @@ function transformItems({
50325
50324
  if (includesProportionalItem && (isWidth || isHeight)) {
50326
50325
  return null;
50327
50326
  }
50328
- const isIncludesFixedFrame = items.some((item) => item.itemType === "Frame" && !item.getCanChangeRatio());
50327
+ const isIncludesFixedFrame = items.some((item) => item instanceof Frame && !item.getCanChangeRatio());
50329
50328
  const shouldBeProportionalResize = isIncludesFixedFrame || includesProportionalItem || isShiftPressed || !isWidth && !isHeight;
50330
50329
  const resize = shouldBeProportionalResize ? getProportionalResize(resizeType, board.pointer.point, mbr, oppositePoint) : getResize(resizeType, board.pointer.point, mbr, oppositePoint);
50331
50330
  if (canvasDrawer.getLastCreatedCanvas() && !debounceUpd.shouldUpd()) {
@@ -50497,7 +50496,7 @@ class Transformer extends Tool {
50497
50496
  return resizeType;
50498
50497
  }
50499
50498
  updateAlignmentBySnapLines(single) {
50500
- if (single) {
50499
+ if (single && this.resizeType) {
50501
50500
  this.snapLines = this.alignmentHelper.checkAlignment(single);
50502
50501
  const snapped = this.alignmentHelper.snapToSide(single, this.snapLines, this.beginTimeStamp, this.resizeType);
50503
50502
  if (snapped) {
@@ -53178,7 +53177,7 @@ class Board {
53178
53177
  }
53179
53178
  removeVoidComments() {
53180
53179
  const voidComments = this.items.listAll().filter((item) => {
53181
- return item instanceof Comment2 && !item.getThread().length;
53180
+ return item instanceof Comment && !item.getThread().length;
53182
53181
  });
53183
53182
  if (voidComments) {
53184
53183
  for (const comment2 of voidComments) {
package/dist/cjs/node.js CHANGED
@@ -1789,7 +1789,7 @@ __export(exports_node, {
1789
1789
  ConnectorData: () => ConnectorData2,
1790
1790
  Connector: () => Connector2,
1791
1791
  ConnectionLineWidths: () => ConnectionLineWidths,
1792
- Comment: () => Comment2,
1792
+ Comment: () => Comment,
1793
1793
  Camera: () => Camera,
1794
1794
  CURSORS_IDLE_CLEANUP_DELAY: () => CURSORS_IDLE_CLEANUP_DELAY,
1795
1795
  CURSORS_ANIMATION_DURATION: () => CURSORS_ANIMATION_DURATION,
@@ -21492,7 +21492,7 @@ var v4_default = v4;
21492
21492
  // src/Items/Comment/Comment.ts
21493
21493
  var ANONYMOUS_ID = 9999999999;
21494
21494
 
21495
- class Comment2 {
21495
+ class Comment {
21496
21496
  anchor;
21497
21497
  events;
21498
21498
  id;
@@ -22265,6 +22265,9 @@ class BaseItem extends Mbr {
22265
22265
  getPathMbr() {
22266
22266
  return this.getMbr().copy();
22267
22267
  }
22268
+ getPath() {
22269
+ return new Path(this.getMbr().getLines());
22270
+ }
22268
22271
  render(context) {}
22269
22272
  renderHTML(documentFactory) {
22270
22273
  return documentFactory.createElement("div");
@@ -41037,10 +41040,6 @@ class Frame extends BaseItem {
41037
41040
  return this.mbr.copy();
41038
41041
  }
41039
41042
  doResize(resizeType, pointer, mbr, opposite, startMbr, timeStamp) {
41040
- if (this.transformation.isLocked) {
41041
- this.board?.pointer.setCursor("default");
41042
- return false;
41043
- }
41044
41043
  const res = this.getCanChangeRatio() ? getResize(resizeType, pointer, mbr, opposite) : getProportionalResize(resizeType, pointer, mbr, opposite);
41045
41044
  if (!res) {
41046
41045
  return {
@@ -43618,7 +43617,7 @@ function createComment(id, data, board) {
43618
43617
  if (!isCommentData(data)) {
43619
43618
  throw new Error("Invalid data for Comment");
43620
43619
  }
43621
- const comment2 = new Comment2(new Point, board.events).setId(id).deserialize(data);
43620
+ const comment2 = new Comment(new Point, board.events).setId(id).deserialize(data);
43622
43621
  return comment2;
43623
43622
  }
43624
43623
  function createAINode(id, data, board) {
@@ -43822,7 +43821,7 @@ class AddComment extends BoardTool {
43822
43821
  leftButtonUp() {
43823
43822
  this.isDown = false;
43824
43823
  this.board.selection.removeAll();
43825
- this.comment = this.board.add(this.board, new Comment(this.board.pointer.point));
43824
+ this.comment = this.board.add(new Comment(this.board.pointer.point));
43826
43825
  this.board.tools.publish();
43827
43826
  return true;
43828
43827
  }
@@ -44142,7 +44141,6 @@ class ConnectorSnap {
44142
44141
 
44143
44142
  // src/Tools/AddConnector/AddConnector.ts
44144
44143
  class AddConnector extends BoardTool {
44145
- board;
44146
44144
  connector = null;
44147
44145
  lineStyle = "curved";
44148
44146
  startPointer;
@@ -44157,7 +44155,6 @@ class AddConnector extends BoardTool {
44157
44155
  isQuickAdd = false;
44158
44156
  constructor(board, itemToStart, position4) {
44159
44157
  super(board);
44160
- this.board = board;
44161
44158
  this.snap = new ConnectorSnap(this.board);
44162
44159
  this.setCursor();
44163
44160
  const storage = new SessionStorage;
@@ -44219,16 +44216,16 @@ class AddConnector extends BoardTool {
44219
44216
  this.board.tools.publish();
44220
44217
  return true;
44221
44218
  }
44222
- async leftButtonUp() {
44219
+ leftButtonUp() {
44223
44220
  this.isDown = false;
44224
44221
  if (!this.connector) {
44225
44222
  return true;
44226
44223
  }
44227
44224
  if (this.isDoneSecondPoint) {
44228
- await this.board.add(this.connector);
44225
+ this.board.add(this.connector);
44229
44226
  this.board.tools.select();
44230
44227
  } else if (this.isDraggingFromFirstToSecond) {
44231
- const addedConnector = await this.board.add(this.connector);
44228
+ const addedConnector = this.board.add(this.connector);
44232
44229
  const endPoint = this.connector.getEndPoint();
44233
44230
  this.board.tools.select();
44234
44231
  if (this.isQuickAdd && endPoint.pointType === "Board") {
@@ -46339,7 +46336,7 @@ class AlignmentHelper {
46339
46336
  if (i === 0) {
46340
46337
  return acc;
46341
46338
  }
46342
- const itemMbr = item.itemType === "Shape" ? item.getPath().getMbr() : item.getMbr();
46339
+ const itemMbr = item.getPathMbr();
46343
46340
  return acc.combine(itemMbr);
46344
46341
  }, items[0].getMbr());
46345
46342
  }
@@ -46658,9 +46655,11 @@ class AlignmentHelper {
46658
46655
  const translation = this.board.selection.getManyItemsTranslation(x, y);
46659
46656
  this.board.selection.transformMany(translation, timeStamp);
46660
46657
  } else {
46661
- const key = item.getId();
46658
+ const id = item.getId();
46662
46659
  const transformMap = {};
46663
- transformMap[key] = {
46660
+ transformMap[id] = {
46661
+ class: "Transformation",
46662
+ item: [id],
46664
46663
  method: "translateBy",
46665
46664
  x,
46666
46665
  y,
@@ -46965,7 +46964,7 @@ class Select extends Tool {
46965
46964
  const itemCenter = this.downOnItem.getMbr().getCenter();
46966
46965
  this.initialCursorPos = new Point(this.board.pointer.point.x - itemCenter.x, this.board.pointer.point.y - itemCenter.y);
46967
46966
  }
46968
- if (this.downOnItem.itemType === "Connector" && this.downOnItem.isConnectedOnePoint() && !this.board.keyboard.isCtrl) {
46967
+ if (this.downOnItem instanceof Connector2 && this.downOnItem.isConnectedOnePoint() && !this.board.keyboard.isCtrl) {
46969
46968
  this.board.selection.editUnderPointer();
46970
46969
  this.board.tools.publish();
46971
46970
  this.clear();
@@ -47014,7 +47013,7 @@ class Select extends Tool {
47014
47013
  const isDrawingSelectionMbr = this.isDrawingRectangle && this.line && this.rect;
47015
47014
  if (isDrawingSelectionMbr) {
47016
47015
  const point5 = this.board.pointer.point.copy();
47017
- this.line = new Line(this.line.start, point5);
47016
+ this.line = new Line(this.line?.start, point5);
47018
47017
  this.rect = this.line.getMbr();
47019
47018
  this.rect.borderColor = conf.SELECTION_COLOR;
47020
47019
  this.rect.backgroundColor = conf.SELECTION_BACKGROUND;
@@ -47255,7 +47254,7 @@ class Select extends Tool {
47255
47254
  const isNotInSelection = this.board.selection.items.findById(underPointer.getId()) === null;
47256
47255
  if (isNotInSelection) {
47257
47256
  this.board.selection.add(underPointer);
47258
- if (underPointer.itemType === "Frame") {
47257
+ if (underPointer instanceof Frame) {
47259
47258
  const { left, right, top, bottom } = underPointer.getMbr();
47260
47259
  const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => underPointer.getChildrenIds().includes(item.getId()));
47261
47260
  this.board.selection.add(itemsInFrame);
@@ -47383,13 +47382,13 @@ class Select extends Tool {
47383
47382
  }
47384
47383
  onConfirm() {
47385
47384
  const single = this.board.selection.items.getSingle();
47386
- if (this.board.selection.showQuickAddPanel && single && single.itemType === "Connector") {
47387
- quickAddItem(this.board, "copy", single);
47385
+ if (this.board.selection.showQuickAddPanel && single && single instanceof Connector2) {
47386
+ quickAddItem(this.board, "Rectangle", single);
47388
47387
  } else if (single && this.board.selection.getContext() !== "EditTextUnderPointer" && !this.board.selection.getIsLockedSelection()) {
47389
47388
  this.board.selection.editText(undefined, true);
47390
47389
  } else if (isSafari() && this.board.selection.getContext() === "EditTextUnderPointer" && !this.board.selection.getIsLockedSelection()) {
47391
- if (single && "text" in single || single?.itemType === "RichText") {
47392
- const text5 = single.itemType === "RichText" ? single : single.text;
47390
+ if (single && "text" in single || single instanceof RichText) {
47391
+ const text5 = single instanceof RichText ? single : single.text;
47393
47392
  text5.editor.splitNode();
47394
47393
  }
47395
47394
  }
@@ -51813,7 +51812,7 @@ class SpatialIndex {
51813
51812
  return this.itemsIndex.getRectsEnclosedOrCrossedBy(new Mbr(left, top, right, bottom));
51814
51813
  }
51815
51814
  getComments() {
51816
- return this.itemsArray.filter((item) => item instanceof Comment2);
51815
+ return this.itemsArray.filter((item) => item instanceof Comment);
51817
51816
  }
51818
51817
  getMbr() {
51819
51818
  return this.Mbr;
@@ -52515,7 +52514,7 @@ function getItemTranslation({
52515
52514
  scale: { x: 1, y: 1 }
52516
52515
  };
52517
52516
  } else {
52518
- if (item.itemType === "Frame" && item.getCanChangeRatio() && isShiftPressed && item.getFrameType() !== "Custom") {
52517
+ if (item instanceof Frame && item.getCanChangeRatio() && isShiftPressed && item.getFrameType() !== "Custom") {
52519
52518
  item.setFrameType("Custom");
52520
52519
  }
52521
52520
  return {
@@ -52528,7 +52527,7 @@ function getItemTranslation({
52528
52527
  }
52529
52528
  }
52530
52529
 
52531
- // src/Selection/Transformer/TransformerHelpers/ransformShape.ts
52530
+ // src/Selection/Transformer/TransformerHelpers/transformShape.ts
52532
52531
  function transformShape({
52533
52532
  mbr,
52534
52533
  board,
@@ -52798,7 +52797,7 @@ function transformItems({
52798
52797
  if (includesProportionalItem && (isWidth || isHeight)) {
52799
52798
  return null;
52800
52799
  }
52801
- const isIncludesFixedFrame = items.some((item) => item.itemType === "Frame" && !item.getCanChangeRatio());
52800
+ const isIncludesFixedFrame = items.some((item) => item instanceof Frame && !item.getCanChangeRatio());
52802
52801
  const shouldBeProportionalResize = isIncludesFixedFrame || includesProportionalItem || isShiftPressed || !isWidth && !isHeight;
52803
52802
  const resize = shouldBeProportionalResize ? getProportionalResize(resizeType, board.pointer.point, mbr, oppositePoint) : getResize(resizeType, board.pointer.point, mbr, oppositePoint);
52804
52803
  if (canvasDrawer.getLastCreatedCanvas() && !debounceUpd.shouldUpd()) {
@@ -52970,7 +52969,7 @@ class Transformer extends Tool {
52970
52969
  return resizeType;
52971
52970
  }
52972
52971
  updateAlignmentBySnapLines(single) {
52973
- if (single) {
52972
+ if (single && this.resizeType) {
52974
52973
  this.snapLines = this.alignmentHelper.checkAlignment(single);
52975
52974
  const snapped = this.alignmentHelper.snapToSide(single, this.snapLines, this.beginTimeStamp, this.resizeType);
52976
52975
  if (snapped) {
@@ -55651,7 +55650,7 @@ class Board {
55651
55650
  }
55652
55651
  removeVoidComments() {
55653
55652
  const voidComments = this.items.listAll().filter((item) => {
55654
- return item instanceof Comment2 && !item.getThread().length;
55653
+ return item instanceof Comment && !item.getThread().length;
55655
55654
  });
55656
55655
  if (voidComments) {
55657
55656
  for (const comment2 of voidComments) {