microboard-temp 0.12.2 → 0.12.3

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.
@@ -19483,6 +19483,9 @@ class Comment {
19483
19483
  }
19484
19484
  addOnRemoveCallback(_cb) {}
19485
19485
  onRemove() {}
19486
+ highlightMbr() {}
19487
+ clearHighlightMbr() {}
19488
+ renderHoverHighlight(_context) {}
19486
19489
  render(context) {}
19487
19490
  renderHTML(documentFactory) {
19488
19491
  const div = documentFactory.createElement("comment-item");
@@ -54345,9 +54348,9 @@ class GravityEngine {
54345
54348
  let sumX = 0;
54346
54349
  let sumY = 0;
54347
54350
  for (const item of items) {
54348
- const pos = item.transformation.getTranslation();
54349
- sumX += pos.x;
54350
- sumY += pos.y;
54351
+ const mbr = item.getMbr();
54352
+ sumX += mbr.left + mbr.getWidth() * 0.5;
54353
+ sumY += mbr.top + mbr.getHeight() * 0.5;
54351
54354
  }
54352
54355
  const centerX = sumX / items.length;
54353
54356
  const centerY = sumY / items.length;
@@ -54357,26 +54360,28 @@ class GravityEngine {
54357
54360
  this.velocities.set(id, { vx: 0, vy: 0 });
54358
54361
  }
54359
54362
  const vel = this.velocities.get(id);
54360
- const pos1 = item.transformation.getTranslation();
54361
54363
  const mbr1 = item.getMbr();
54362
54364
  const w1 = mbr1.getWidth();
54363
54365
  const h1 = mbr1.getHeight();
54364
54366
  let ax = 0;
54365
54367
  let ay = 0;
54366
- const dcx = centerX - pos1.x;
54367
- const dcy = centerY - pos1.y;
54368
+ const cx1 = mbr1.left + w1 * 0.5;
54369
+ const cy1 = mbr1.top + h1 * 0.5;
54370
+ const dcx = centerX - cx1;
54371
+ const dcy = centerY - cy1;
54368
54372
  const distCenter = Math.sqrt(dcx * dcx + dcy * dcy) + 1;
54369
54373
  ax += this.G_CENTER * dcx / distCenter;
54370
54374
  ay += this.G_CENTER * dcy / distCenter;
54371
- const nearby = this.board.items.getEnclosedOrCrossed(pos1.x - this.MAX_DISTANCE, pos1.y - this.MAX_DISTANCE, pos1.x + this.MAX_DISTANCE * 2, pos1.y + this.MAX_DISTANCE * 2).filter((other) => other.getId() !== id && !EXCLUDED_ITEM_TYPES.has(other.itemType));
54375
+ const nearby = this.board.items.getEnclosedOrCrossed(cx1 - this.MAX_DISTANCE, cy1 - this.MAX_DISTANCE, cx1 + this.MAX_DISTANCE * 2, cy1 + this.MAX_DISTANCE * 2).filter((other) => other.getId() !== id && !EXCLUDED_ITEM_TYPES.has(other.itemType));
54372
54376
  for (const other of nearby) {
54373
- const pos2 = other.transformation.getTranslation();
54374
54377
  const mbr2 = other.getMbr();
54375
54378
  const w2 = mbr2.getWidth();
54376
54379
  const h2 = mbr2.getHeight();
54377
54380
  const mass2 = w2 * h2;
54378
- const dx = pos2.x - pos1.x;
54379
- const dy = pos2.y - pos1.y;
54381
+ const cx2 = mbr2.left + w2 * 0.5;
54382
+ const cy2 = mbr2.top + h2 * 0.5;
54383
+ const dx = cx2 - cx1;
54384
+ const dy = cy2 - cy1;
54380
54385
  const distSq = dx * dx + dy * dy;
54381
54386
  const dist = Math.sqrt(distSq) + 0.001;
54382
54387
  const minDist = (w1 + w2) * 0.5 + (h1 + h2) * 0.5;
package/dist/cjs/index.js CHANGED
@@ -19483,6 +19483,9 @@ class Comment {
19483
19483
  }
19484
19484
  addOnRemoveCallback(_cb) {}
19485
19485
  onRemove() {}
19486
+ highlightMbr() {}
19487
+ clearHighlightMbr() {}
19488
+ renderHoverHighlight(_context) {}
19486
19489
  render(context) {}
19487
19490
  renderHTML(documentFactory) {
19488
19491
  const div = documentFactory.createElement("comment-item");
@@ -54345,9 +54348,9 @@ class GravityEngine {
54345
54348
  let sumX = 0;
54346
54349
  let sumY = 0;
54347
54350
  for (const item of items) {
54348
- const pos = item.transformation.getTranslation();
54349
- sumX += pos.x;
54350
- sumY += pos.y;
54351
+ const mbr = item.getMbr();
54352
+ sumX += mbr.left + mbr.getWidth() * 0.5;
54353
+ sumY += mbr.top + mbr.getHeight() * 0.5;
54351
54354
  }
54352
54355
  const centerX = sumX / items.length;
54353
54356
  const centerY = sumY / items.length;
@@ -54357,26 +54360,28 @@ class GravityEngine {
54357
54360
  this.velocities.set(id, { vx: 0, vy: 0 });
54358
54361
  }
54359
54362
  const vel = this.velocities.get(id);
54360
- const pos1 = item.transformation.getTranslation();
54361
54363
  const mbr1 = item.getMbr();
54362
54364
  const w1 = mbr1.getWidth();
54363
54365
  const h1 = mbr1.getHeight();
54364
54366
  let ax = 0;
54365
54367
  let ay = 0;
54366
- const dcx = centerX - pos1.x;
54367
- const dcy = centerY - pos1.y;
54368
+ const cx1 = mbr1.left + w1 * 0.5;
54369
+ const cy1 = mbr1.top + h1 * 0.5;
54370
+ const dcx = centerX - cx1;
54371
+ const dcy = centerY - cy1;
54368
54372
  const distCenter = Math.sqrt(dcx * dcx + dcy * dcy) + 1;
54369
54373
  ax += this.G_CENTER * dcx / distCenter;
54370
54374
  ay += this.G_CENTER * dcy / distCenter;
54371
- const nearby = this.board.items.getEnclosedOrCrossed(pos1.x - this.MAX_DISTANCE, pos1.y - this.MAX_DISTANCE, pos1.x + this.MAX_DISTANCE * 2, pos1.y + this.MAX_DISTANCE * 2).filter((other) => other.getId() !== id && !EXCLUDED_ITEM_TYPES.has(other.itemType));
54375
+ const nearby = this.board.items.getEnclosedOrCrossed(cx1 - this.MAX_DISTANCE, cy1 - this.MAX_DISTANCE, cx1 + this.MAX_DISTANCE * 2, cy1 + this.MAX_DISTANCE * 2).filter((other) => other.getId() !== id && !EXCLUDED_ITEM_TYPES.has(other.itemType));
54372
54376
  for (const other of nearby) {
54373
- const pos2 = other.transformation.getTranslation();
54374
54377
  const mbr2 = other.getMbr();
54375
54378
  const w2 = mbr2.getWidth();
54376
54379
  const h2 = mbr2.getHeight();
54377
54380
  const mass2 = w2 * h2;
54378
- const dx = pos2.x - pos1.x;
54379
- const dy = pos2.y - pos1.y;
54381
+ const cx2 = mbr2.left + w2 * 0.5;
54382
+ const cy2 = mbr2.top + h2 * 0.5;
54383
+ const dx = cx2 - cx1;
54384
+ const dy = cy2 - cy1;
54380
54385
  const distSq = dx * dx + dy * dy;
54381
54386
  const dist = Math.sqrt(distSq) + 0.001;
54382
54387
  const minDist = (w1 + w2) * 0.5 + (h1 + h2) * 0.5;
package/dist/cjs/node.js CHANGED
@@ -22022,6 +22022,9 @@ class Comment {
22022
22022
  }
22023
22023
  addOnRemoveCallback(_cb) {}
22024
22024
  onRemove() {}
22025
+ highlightMbr() {}
22026
+ clearHighlightMbr() {}
22027
+ renderHoverHighlight(_context) {}
22025
22028
  render(context) {}
22026
22029
  renderHTML(documentFactory) {
22027
22030
  const div = documentFactory.createElement("comment-item");
@@ -56818,9 +56821,9 @@ class GravityEngine {
56818
56821
  let sumX = 0;
56819
56822
  let sumY = 0;
56820
56823
  for (const item of items) {
56821
- const pos = item.transformation.getTranslation();
56822
- sumX += pos.x;
56823
- sumY += pos.y;
56824
+ const mbr = item.getMbr();
56825
+ sumX += mbr.left + mbr.getWidth() * 0.5;
56826
+ sumY += mbr.top + mbr.getHeight() * 0.5;
56824
56827
  }
56825
56828
  const centerX = sumX / items.length;
56826
56829
  const centerY = sumY / items.length;
@@ -56830,26 +56833,28 @@ class GravityEngine {
56830
56833
  this.velocities.set(id, { vx: 0, vy: 0 });
56831
56834
  }
56832
56835
  const vel = this.velocities.get(id);
56833
- const pos1 = item.transformation.getTranslation();
56834
56836
  const mbr1 = item.getMbr();
56835
56837
  const w1 = mbr1.getWidth();
56836
56838
  const h1 = mbr1.getHeight();
56837
56839
  let ax = 0;
56838
56840
  let ay = 0;
56839
- const dcx = centerX - pos1.x;
56840
- const dcy = centerY - pos1.y;
56841
+ const cx1 = mbr1.left + w1 * 0.5;
56842
+ const cy1 = mbr1.top + h1 * 0.5;
56843
+ const dcx = centerX - cx1;
56844
+ const dcy = centerY - cy1;
56841
56845
  const distCenter = Math.sqrt(dcx * dcx + dcy * dcy) + 1;
56842
56846
  ax += this.G_CENTER * dcx / distCenter;
56843
56847
  ay += this.G_CENTER * dcy / distCenter;
56844
- const nearby = this.board.items.getEnclosedOrCrossed(pos1.x - this.MAX_DISTANCE, pos1.y - this.MAX_DISTANCE, pos1.x + this.MAX_DISTANCE * 2, pos1.y + this.MAX_DISTANCE * 2).filter((other) => other.getId() !== id && !EXCLUDED_ITEM_TYPES.has(other.itemType));
56848
+ const nearby = this.board.items.getEnclosedOrCrossed(cx1 - this.MAX_DISTANCE, cy1 - this.MAX_DISTANCE, cx1 + this.MAX_DISTANCE * 2, cy1 + this.MAX_DISTANCE * 2).filter((other) => other.getId() !== id && !EXCLUDED_ITEM_TYPES.has(other.itemType));
56845
56849
  for (const other of nearby) {
56846
- const pos2 = other.transformation.getTranslation();
56847
56850
  const mbr2 = other.getMbr();
56848
56851
  const w2 = mbr2.getWidth();
56849
56852
  const h2 = mbr2.getHeight();
56850
56853
  const mass2 = w2 * h2;
56851
- const dx = pos2.x - pos1.x;
56852
- const dy = pos2.y - pos1.y;
56854
+ const cx2 = mbr2.left + w2 * 0.5;
56855
+ const cy2 = mbr2.top + h2 * 0.5;
56856
+ const dx = cx2 - cx1;
56857
+ const dy = cy2 - cy1;
56853
56858
  const distSq = dx * dx + dy * dy;
56854
56859
  const dist = Math.sqrt(distSq) + 0.001;
56855
56860
  const minDist = (w1 + w2) * 0.5 + (h1 + h2) * 0.5;
@@ -19312,6 +19312,9 @@ class Comment {
19312
19312
  }
19313
19313
  addOnRemoveCallback(_cb) {}
19314
19314
  onRemove() {}
19315
+ highlightMbr() {}
19316
+ clearHighlightMbr() {}
19317
+ renderHoverHighlight(_context) {}
19315
19318
  render(context) {}
19316
19319
  renderHTML(documentFactory) {
19317
19320
  const div = documentFactory.createElement("comment-item");
@@ -54174,9 +54177,9 @@ class GravityEngine {
54174
54177
  let sumX = 0;
54175
54178
  let sumY = 0;
54176
54179
  for (const item of items) {
54177
- const pos = item.transformation.getTranslation();
54178
- sumX += pos.x;
54179
- sumY += pos.y;
54180
+ const mbr = item.getMbr();
54181
+ sumX += mbr.left + mbr.getWidth() * 0.5;
54182
+ sumY += mbr.top + mbr.getHeight() * 0.5;
54180
54183
  }
54181
54184
  const centerX = sumX / items.length;
54182
54185
  const centerY = sumY / items.length;
@@ -54186,26 +54189,28 @@ class GravityEngine {
54186
54189
  this.velocities.set(id, { vx: 0, vy: 0 });
54187
54190
  }
54188
54191
  const vel = this.velocities.get(id);
54189
- const pos1 = item.transformation.getTranslation();
54190
54192
  const mbr1 = item.getMbr();
54191
54193
  const w1 = mbr1.getWidth();
54192
54194
  const h1 = mbr1.getHeight();
54193
54195
  let ax = 0;
54194
54196
  let ay = 0;
54195
- const dcx = centerX - pos1.x;
54196
- const dcy = centerY - pos1.y;
54197
+ const cx1 = mbr1.left + w1 * 0.5;
54198
+ const cy1 = mbr1.top + h1 * 0.5;
54199
+ const dcx = centerX - cx1;
54200
+ const dcy = centerY - cy1;
54197
54201
  const distCenter = Math.sqrt(dcx * dcx + dcy * dcy) + 1;
54198
54202
  ax += this.G_CENTER * dcx / distCenter;
54199
54203
  ay += this.G_CENTER * dcy / distCenter;
54200
- const nearby = this.board.items.getEnclosedOrCrossed(pos1.x - this.MAX_DISTANCE, pos1.y - this.MAX_DISTANCE, pos1.x + this.MAX_DISTANCE * 2, pos1.y + this.MAX_DISTANCE * 2).filter((other) => other.getId() !== id && !EXCLUDED_ITEM_TYPES.has(other.itemType));
54204
+ const nearby = this.board.items.getEnclosedOrCrossed(cx1 - this.MAX_DISTANCE, cy1 - this.MAX_DISTANCE, cx1 + this.MAX_DISTANCE * 2, cy1 + this.MAX_DISTANCE * 2).filter((other) => other.getId() !== id && !EXCLUDED_ITEM_TYPES.has(other.itemType));
54201
54205
  for (const other of nearby) {
54202
- const pos2 = other.transformation.getTranslation();
54203
54206
  const mbr2 = other.getMbr();
54204
54207
  const w2 = mbr2.getWidth();
54205
54208
  const h2 = mbr2.getHeight();
54206
54209
  const mass2 = w2 * h2;
54207
- const dx = pos2.x - pos1.x;
54208
- const dy = pos2.y - pos1.y;
54210
+ const cx2 = mbr2.left + w2 * 0.5;
54211
+ const cy2 = mbr2.top + h2 * 0.5;
54212
+ const dx = cx2 - cx1;
54213
+ const dy = cy2 - cy1;
54209
54214
  const distSq = dx * dx + dy * dy;
54210
54215
  const dist = Math.sqrt(distSq) + 0.001;
54211
54216
  const minDist = (w1 + w2) * 0.5 + (h1 + h2) * 0.5;
package/dist/esm/index.js CHANGED
@@ -19305,6 +19305,9 @@ class Comment {
19305
19305
  }
19306
19306
  addOnRemoveCallback(_cb) {}
19307
19307
  onRemove() {}
19308
+ highlightMbr() {}
19309
+ clearHighlightMbr() {}
19310
+ renderHoverHighlight(_context) {}
19308
19311
  render(context) {}
19309
19312
  renderHTML(documentFactory) {
19310
19313
  const div = documentFactory.createElement("comment-item");
@@ -54167,9 +54170,9 @@ class GravityEngine {
54167
54170
  let sumX = 0;
54168
54171
  let sumY = 0;
54169
54172
  for (const item of items) {
54170
- const pos = item.transformation.getTranslation();
54171
- sumX += pos.x;
54172
- sumY += pos.y;
54173
+ const mbr = item.getMbr();
54174
+ sumX += mbr.left + mbr.getWidth() * 0.5;
54175
+ sumY += mbr.top + mbr.getHeight() * 0.5;
54173
54176
  }
54174
54177
  const centerX = sumX / items.length;
54175
54178
  const centerY = sumY / items.length;
@@ -54179,26 +54182,28 @@ class GravityEngine {
54179
54182
  this.velocities.set(id, { vx: 0, vy: 0 });
54180
54183
  }
54181
54184
  const vel = this.velocities.get(id);
54182
- const pos1 = item.transformation.getTranslation();
54183
54185
  const mbr1 = item.getMbr();
54184
54186
  const w1 = mbr1.getWidth();
54185
54187
  const h1 = mbr1.getHeight();
54186
54188
  let ax = 0;
54187
54189
  let ay = 0;
54188
- const dcx = centerX - pos1.x;
54189
- const dcy = centerY - pos1.y;
54190
+ const cx1 = mbr1.left + w1 * 0.5;
54191
+ const cy1 = mbr1.top + h1 * 0.5;
54192
+ const dcx = centerX - cx1;
54193
+ const dcy = centerY - cy1;
54190
54194
  const distCenter = Math.sqrt(dcx * dcx + dcy * dcy) + 1;
54191
54195
  ax += this.G_CENTER * dcx / distCenter;
54192
54196
  ay += this.G_CENTER * dcy / distCenter;
54193
- const nearby = this.board.items.getEnclosedOrCrossed(pos1.x - this.MAX_DISTANCE, pos1.y - this.MAX_DISTANCE, pos1.x + this.MAX_DISTANCE * 2, pos1.y + this.MAX_DISTANCE * 2).filter((other) => other.getId() !== id && !EXCLUDED_ITEM_TYPES.has(other.itemType));
54197
+ const nearby = this.board.items.getEnclosedOrCrossed(cx1 - this.MAX_DISTANCE, cy1 - this.MAX_DISTANCE, cx1 + this.MAX_DISTANCE * 2, cy1 + this.MAX_DISTANCE * 2).filter((other) => other.getId() !== id && !EXCLUDED_ITEM_TYPES.has(other.itemType));
54194
54198
  for (const other of nearby) {
54195
- const pos2 = other.transformation.getTranslation();
54196
54199
  const mbr2 = other.getMbr();
54197
54200
  const w2 = mbr2.getWidth();
54198
54201
  const h2 = mbr2.getHeight();
54199
54202
  const mass2 = w2 * h2;
54200
- const dx = pos2.x - pos1.x;
54201
- const dy = pos2.y - pos1.y;
54203
+ const cx2 = mbr2.left + w2 * 0.5;
54204
+ const cy2 = mbr2.top + h2 * 0.5;
54205
+ const dx = cx2 - cx1;
54206
+ const dy = cy2 - cy1;
54202
54207
  const distSq = dx * dx + dy * dy;
54203
54208
  const dist = Math.sqrt(distSq) + 0.001;
54204
54209
  const minDist = (w1 + w2) * 0.5 + (h1 + h2) * 0.5;
package/dist/esm/node.js CHANGED
@@ -21839,6 +21839,9 @@ class Comment {
21839
21839
  }
21840
21840
  addOnRemoveCallback(_cb) {}
21841
21841
  onRemove() {}
21842
+ highlightMbr() {}
21843
+ clearHighlightMbr() {}
21844
+ renderHoverHighlight(_context) {}
21842
21845
  render(context) {}
21843
21846
  renderHTML(documentFactory) {
21844
21847
  const div = documentFactory.createElement("comment-item");
@@ -56635,9 +56638,9 @@ class GravityEngine {
56635
56638
  let sumX = 0;
56636
56639
  let sumY = 0;
56637
56640
  for (const item of items) {
56638
- const pos = item.transformation.getTranslation();
56639
- sumX += pos.x;
56640
- sumY += pos.y;
56641
+ const mbr = item.getMbr();
56642
+ sumX += mbr.left + mbr.getWidth() * 0.5;
56643
+ sumY += mbr.top + mbr.getHeight() * 0.5;
56641
56644
  }
56642
56645
  const centerX = sumX / items.length;
56643
56646
  const centerY = sumY / items.length;
@@ -56647,26 +56650,28 @@ class GravityEngine {
56647
56650
  this.velocities.set(id, { vx: 0, vy: 0 });
56648
56651
  }
56649
56652
  const vel = this.velocities.get(id);
56650
- const pos1 = item.transformation.getTranslation();
56651
56653
  const mbr1 = item.getMbr();
56652
56654
  const w1 = mbr1.getWidth();
56653
56655
  const h1 = mbr1.getHeight();
56654
56656
  let ax = 0;
56655
56657
  let ay = 0;
56656
- const dcx = centerX - pos1.x;
56657
- const dcy = centerY - pos1.y;
56658
+ const cx1 = mbr1.left + w1 * 0.5;
56659
+ const cy1 = mbr1.top + h1 * 0.5;
56660
+ const dcx = centerX - cx1;
56661
+ const dcy = centerY - cy1;
56658
56662
  const distCenter = Math.sqrt(dcx * dcx + dcy * dcy) + 1;
56659
56663
  ax += this.G_CENTER * dcx / distCenter;
56660
56664
  ay += this.G_CENTER * dcy / distCenter;
56661
- const nearby = this.board.items.getEnclosedOrCrossed(pos1.x - this.MAX_DISTANCE, pos1.y - this.MAX_DISTANCE, pos1.x + this.MAX_DISTANCE * 2, pos1.y + this.MAX_DISTANCE * 2).filter((other) => other.getId() !== id && !EXCLUDED_ITEM_TYPES.has(other.itemType));
56665
+ const nearby = this.board.items.getEnclosedOrCrossed(cx1 - this.MAX_DISTANCE, cy1 - this.MAX_DISTANCE, cx1 + this.MAX_DISTANCE * 2, cy1 + this.MAX_DISTANCE * 2).filter((other) => other.getId() !== id && !EXCLUDED_ITEM_TYPES.has(other.itemType));
56662
56666
  for (const other of nearby) {
56663
- const pos2 = other.transformation.getTranslation();
56664
56667
  const mbr2 = other.getMbr();
56665
56668
  const w2 = mbr2.getWidth();
56666
56669
  const h2 = mbr2.getHeight();
56667
56670
  const mass2 = w2 * h2;
56668
- const dx = pos2.x - pos1.x;
56669
- const dy = pos2.y - pos1.y;
56671
+ const cx2 = mbr2.left + w2 * 0.5;
56672
+ const cy2 = mbr2.top + h2 * 0.5;
56673
+ const dx = cx2 - cx1;
56674
+ const dy = cy2 - cy1;
56670
56675
  const distSq = dx * dx + dy * dy;
56671
56676
  const dist = Math.sqrt(distSq) + 0.001;
56672
56677
  const minDist = (w1 + w2) * 0.5 + (h1 + h2) * 0.5;
@@ -104,6 +104,9 @@ export declare class Comment implements Geometry {
104
104
  handleNesting(_item: unknown): boolean;
105
105
  addOnRemoveCallback(_cb: () => void): void;
106
106
  onRemove(): void;
107
+ highlightMbr(): void;
108
+ clearHighlightMbr(): void;
109
+ renderHoverHighlight(_context: DrawingContext): void;
107
110
  render(context: DrawingContext): void;
108
111
  renderHTML(documentFactory: DocumentFactory): HTMLElement;
109
112
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.12.2",
3
+ "version": "0.12.3",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",