microboard-temp 0.13.3 → 0.13.5

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.
@@ -41067,8 +41067,8 @@ class Frame2 extends BaseItem {
41067
41067
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontSize: 18, fontColor: FRAME_TITLE_COLOR });
41068
41068
  this.text.editor.verticalAlignment = "bottom";
41069
41069
  this.text.setSelectionHorisontalAlignment("left");
41070
- this.textContainer.top = -25;
41071
- this.textContainer.bottom = -2;
41070
+ this.textContainer.top = -45;
41071
+ this.textContainer.bottom = -12;
41072
41072
  this.text.customTransformationMatrix = () => {
41073
41073
  const matrix = this.transformation.toMatrix();
41074
41074
  return new Matrix(matrix.translateX, matrix.translateY, 1, 1);
@@ -54350,8 +54350,9 @@ class GravityEngine {
54350
54350
  lastSyncedPositions = new Map;
54351
54351
  G = 80;
54352
54352
  G_CENTER = 120;
54353
- DAMPING = 0.92;
54354
- REPULSION = 800;
54353
+ DAMPING = 0.96;
54354
+ RESTITUTION = 0.5;
54355
+ REPULSION = 200;
54355
54356
  TICK_MS = 33;
54356
54357
  SYNC_MS = 300;
54357
54358
  MAX_DISTANCE = 3000;
@@ -54440,12 +54441,19 @@ class GravityEngine {
54440
54441
  const overlapY = Math.min(s1.bottom, s2.bottom) - Math.max(s1.top, s2.top);
54441
54442
  if (overlapX < overlapY) {
54442
54443
  const sign = s1.cx < s2.cx ? -1 : 1;
54444
+ if (sign * vel.vx < 0)
54445
+ vel.vx = -vel.vx * this.RESTITUTION;
54443
54446
  ax += sign * this.REPULSION * overlapX;
54444
54447
  } else {
54445
54448
  const sign = s1.cy < s2.cy ? -1 : 1;
54449
+ if (sign * vel.vy < 0)
54450
+ vel.vy = -vel.vy * this.RESTITUTION;
54446
54451
  ay += sign * this.REPULSION * overlapY;
54447
54452
  }
54448
54453
  } else {
54454
+ const touchDist = (s1.w + s2.w + s1.h + s2.h) * 0.25;
54455
+ if (dist < touchDist + 5)
54456
+ continue;
54449
54457
  const distSq = dx * dx + dy * dy;
54450
54458
  const gravAcc = this.G * s2.mass / (distSq + this.SOFTENING_SQ);
54451
54459
  ax += gravAcc * dx / dist;
package/dist/cjs/index.js CHANGED
@@ -41067,8 +41067,8 @@ class Frame2 extends BaseItem {
41067
41067
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontSize: 18, fontColor: FRAME_TITLE_COLOR });
41068
41068
  this.text.editor.verticalAlignment = "bottom";
41069
41069
  this.text.setSelectionHorisontalAlignment("left");
41070
- this.textContainer.top = -25;
41071
- this.textContainer.bottom = -2;
41070
+ this.textContainer.top = -45;
41071
+ this.textContainer.bottom = -12;
41072
41072
  this.text.customTransformationMatrix = () => {
41073
41073
  const matrix = this.transformation.toMatrix();
41074
41074
  return new Matrix(matrix.translateX, matrix.translateY, 1, 1);
@@ -54350,8 +54350,9 @@ class GravityEngine {
54350
54350
  lastSyncedPositions = new Map;
54351
54351
  G = 80;
54352
54352
  G_CENTER = 120;
54353
- DAMPING = 0.92;
54354
- REPULSION = 800;
54353
+ DAMPING = 0.96;
54354
+ RESTITUTION = 0.5;
54355
+ REPULSION = 200;
54355
54356
  TICK_MS = 33;
54356
54357
  SYNC_MS = 300;
54357
54358
  MAX_DISTANCE = 3000;
@@ -54440,12 +54441,19 @@ class GravityEngine {
54440
54441
  const overlapY = Math.min(s1.bottom, s2.bottom) - Math.max(s1.top, s2.top);
54441
54442
  if (overlapX < overlapY) {
54442
54443
  const sign = s1.cx < s2.cx ? -1 : 1;
54444
+ if (sign * vel.vx < 0)
54445
+ vel.vx = -vel.vx * this.RESTITUTION;
54443
54446
  ax += sign * this.REPULSION * overlapX;
54444
54447
  } else {
54445
54448
  const sign = s1.cy < s2.cy ? -1 : 1;
54449
+ if (sign * vel.vy < 0)
54450
+ vel.vy = -vel.vy * this.RESTITUTION;
54446
54451
  ay += sign * this.REPULSION * overlapY;
54447
54452
  }
54448
54453
  } else {
54454
+ const touchDist = (s1.w + s2.w + s1.h + s2.h) * 0.25;
54455
+ if (dist < touchDist + 5)
54456
+ continue;
54449
54457
  const distSq = dx * dx + dy * dy;
54450
54458
  const gravAcc = this.G * s2.mass / (distSq + this.SOFTENING_SQ);
54451
54459
  ax += gravAcc * dx / dist;
package/dist/cjs/node.js CHANGED
@@ -43540,8 +43540,8 @@ class Frame2 extends BaseItem {
43540
43540
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontSize: 18, fontColor: FRAME_TITLE_COLOR });
43541
43541
  this.text.editor.verticalAlignment = "bottom";
43542
43542
  this.text.setSelectionHorisontalAlignment("left");
43543
- this.textContainer.top = -25;
43544
- this.textContainer.bottom = -2;
43543
+ this.textContainer.top = -45;
43544
+ this.textContainer.bottom = -12;
43545
43545
  this.text.customTransformationMatrix = () => {
43546
43546
  const matrix = this.transformation.toMatrix();
43547
43547
  return new Matrix(matrix.translateX, matrix.translateY, 1, 1);
@@ -56823,8 +56823,9 @@ class GravityEngine {
56823
56823
  lastSyncedPositions = new Map;
56824
56824
  G = 80;
56825
56825
  G_CENTER = 120;
56826
- DAMPING = 0.92;
56827
- REPULSION = 800;
56826
+ DAMPING = 0.96;
56827
+ RESTITUTION = 0.5;
56828
+ REPULSION = 200;
56828
56829
  TICK_MS = 33;
56829
56830
  SYNC_MS = 300;
56830
56831
  MAX_DISTANCE = 3000;
@@ -56913,12 +56914,19 @@ class GravityEngine {
56913
56914
  const overlapY = Math.min(s1.bottom, s2.bottom) - Math.max(s1.top, s2.top);
56914
56915
  if (overlapX < overlapY) {
56915
56916
  const sign = s1.cx < s2.cx ? -1 : 1;
56917
+ if (sign * vel.vx < 0)
56918
+ vel.vx = -vel.vx * this.RESTITUTION;
56916
56919
  ax += sign * this.REPULSION * overlapX;
56917
56920
  } else {
56918
56921
  const sign = s1.cy < s2.cy ? -1 : 1;
56922
+ if (sign * vel.vy < 0)
56923
+ vel.vy = -vel.vy * this.RESTITUTION;
56919
56924
  ay += sign * this.REPULSION * overlapY;
56920
56925
  }
56921
56926
  } else {
56927
+ const touchDist = (s1.w + s2.w + s1.h + s2.h) * 0.25;
56928
+ if (dist < touchDist + 5)
56929
+ continue;
56922
56930
  const distSq = dx * dx + dy * dy;
56923
56931
  const gravAcc = this.G * s2.mass / (distSq + this.SOFTENING_SQ);
56924
56932
  ax += gravAcc * dx / dist;
@@ -40896,8 +40896,8 @@ class Frame2 extends BaseItem {
40896
40896
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontSize: 18, fontColor: FRAME_TITLE_COLOR });
40897
40897
  this.text.editor.verticalAlignment = "bottom";
40898
40898
  this.text.setSelectionHorisontalAlignment("left");
40899
- this.textContainer.top = -25;
40900
- this.textContainer.bottom = -2;
40899
+ this.textContainer.top = -45;
40900
+ this.textContainer.bottom = -12;
40901
40901
  this.text.customTransformationMatrix = () => {
40902
40902
  const matrix = this.transformation.toMatrix();
40903
40903
  return new Matrix(matrix.translateX, matrix.translateY, 1, 1);
@@ -54179,8 +54179,9 @@ class GravityEngine {
54179
54179
  lastSyncedPositions = new Map;
54180
54180
  G = 80;
54181
54181
  G_CENTER = 120;
54182
- DAMPING = 0.92;
54183
- REPULSION = 800;
54182
+ DAMPING = 0.96;
54183
+ RESTITUTION = 0.5;
54184
+ REPULSION = 200;
54184
54185
  TICK_MS = 33;
54185
54186
  SYNC_MS = 300;
54186
54187
  MAX_DISTANCE = 3000;
@@ -54269,12 +54270,19 @@ class GravityEngine {
54269
54270
  const overlapY = Math.min(s1.bottom, s2.bottom) - Math.max(s1.top, s2.top);
54270
54271
  if (overlapX < overlapY) {
54271
54272
  const sign = s1.cx < s2.cx ? -1 : 1;
54273
+ if (sign * vel.vx < 0)
54274
+ vel.vx = -vel.vx * this.RESTITUTION;
54272
54275
  ax += sign * this.REPULSION * overlapX;
54273
54276
  } else {
54274
54277
  const sign = s1.cy < s2.cy ? -1 : 1;
54278
+ if (sign * vel.vy < 0)
54279
+ vel.vy = -vel.vy * this.RESTITUTION;
54275
54280
  ay += sign * this.REPULSION * overlapY;
54276
54281
  }
54277
54282
  } else {
54283
+ const touchDist = (s1.w + s2.w + s1.h + s2.h) * 0.25;
54284
+ if (dist < touchDist + 5)
54285
+ continue;
54278
54286
  const distSq = dx * dx + dy * dy;
54279
54287
  const gravAcc = this.G * s2.mass / (distSq + this.SOFTENING_SQ);
54280
54288
  ax += gravAcc * dx / dist;
package/dist/esm/index.js CHANGED
@@ -40889,8 +40889,8 @@ class Frame2 extends BaseItem {
40889
40889
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontSize: 18, fontColor: FRAME_TITLE_COLOR });
40890
40890
  this.text.editor.verticalAlignment = "bottom";
40891
40891
  this.text.setSelectionHorisontalAlignment("left");
40892
- this.textContainer.top = -25;
40893
- this.textContainer.bottom = -2;
40892
+ this.textContainer.top = -45;
40893
+ this.textContainer.bottom = -12;
40894
40894
  this.text.customTransformationMatrix = () => {
40895
40895
  const matrix = this.transformation.toMatrix();
40896
40896
  return new Matrix(matrix.translateX, matrix.translateY, 1, 1);
@@ -54172,8 +54172,9 @@ class GravityEngine {
54172
54172
  lastSyncedPositions = new Map;
54173
54173
  G = 80;
54174
54174
  G_CENTER = 120;
54175
- DAMPING = 0.92;
54176
- REPULSION = 800;
54175
+ DAMPING = 0.96;
54176
+ RESTITUTION = 0.5;
54177
+ REPULSION = 200;
54177
54178
  TICK_MS = 33;
54178
54179
  SYNC_MS = 300;
54179
54180
  MAX_DISTANCE = 3000;
@@ -54262,12 +54263,19 @@ class GravityEngine {
54262
54263
  const overlapY = Math.min(s1.bottom, s2.bottom) - Math.max(s1.top, s2.top);
54263
54264
  if (overlapX < overlapY) {
54264
54265
  const sign = s1.cx < s2.cx ? -1 : 1;
54266
+ if (sign * vel.vx < 0)
54267
+ vel.vx = -vel.vx * this.RESTITUTION;
54265
54268
  ax += sign * this.REPULSION * overlapX;
54266
54269
  } else {
54267
54270
  const sign = s1.cy < s2.cy ? -1 : 1;
54271
+ if (sign * vel.vy < 0)
54272
+ vel.vy = -vel.vy * this.RESTITUTION;
54268
54273
  ay += sign * this.REPULSION * overlapY;
54269
54274
  }
54270
54275
  } else {
54276
+ const touchDist = (s1.w + s2.w + s1.h + s2.h) * 0.25;
54277
+ if (dist < touchDist + 5)
54278
+ continue;
54271
54279
  const distSq = dx * dx + dy * dy;
54272
54280
  const gravAcc = this.G * s2.mass / (distSq + this.SOFTENING_SQ);
54273
54281
  ax += gravAcc * dx / dist;
package/dist/esm/node.js CHANGED
@@ -43357,8 +43357,8 @@ class Frame2 extends BaseItem {
43357
43357
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontSize: 18, fontColor: FRAME_TITLE_COLOR });
43358
43358
  this.text.editor.verticalAlignment = "bottom";
43359
43359
  this.text.setSelectionHorisontalAlignment("left");
43360
- this.textContainer.top = -25;
43361
- this.textContainer.bottom = -2;
43360
+ this.textContainer.top = -45;
43361
+ this.textContainer.bottom = -12;
43362
43362
  this.text.customTransformationMatrix = () => {
43363
43363
  const matrix = this.transformation.toMatrix();
43364
43364
  return new Matrix(matrix.translateX, matrix.translateY, 1, 1);
@@ -56640,8 +56640,9 @@ class GravityEngine {
56640
56640
  lastSyncedPositions = new Map;
56641
56641
  G = 80;
56642
56642
  G_CENTER = 120;
56643
- DAMPING = 0.92;
56644
- REPULSION = 800;
56643
+ DAMPING = 0.96;
56644
+ RESTITUTION = 0.5;
56645
+ REPULSION = 200;
56645
56646
  TICK_MS = 33;
56646
56647
  SYNC_MS = 300;
56647
56648
  MAX_DISTANCE = 3000;
@@ -56730,12 +56731,19 @@ class GravityEngine {
56730
56731
  const overlapY = Math.min(s1.bottom, s2.bottom) - Math.max(s1.top, s2.top);
56731
56732
  if (overlapX < overlapY) {
56732
56733
  const sign = s1.cx < s2.cx ? -1 : 1;
56734
+ if (sign * vel.vx < 0)
56735
+ vel.vx = -vel.vx * this.RESTITUTION;
56733
56736
  ax += sign * this.REPULSION * overlapX;
56734
56737
  } else {
56735
56738
  const sign = s1.cy < s2.cy ? -1 : 1;
56739
+ if (sign * vel.vy < 0)
56740
+ vel.vy = -vel.vy * this.RESTITUTION;
56736
56741
  ay += sign * this.REPULSION * overlapY;
56737
56742
  }
56738
56743
  } else {
56744
+ const touchDist = (s1.w + s2.w + s1.h + s2.h) * 0.25;
56745
+ if (dist < touchDist + 5)
56746
+ continue;
56739
56747
  const distSq = dx * dx + dy * dy;
56740
56748
  const gravAcc = this.G * s2.mass / (distSq + this.SOFTENING_SQ);
56741
56749
  ax += gravAcc * dx / dist;
@@ -7,8 +7,9 @@ export declare class GravityEngine {
7
7
  private lastSyncedPositions;
8
8
  readonly G = 80;
9
9
  readonly G_CENTER = 120;
10
- readonly DAMPING = 0.92;
11
- readonly REPULSION = 800;
10
+ readonly DAMPING = 0.96;
11
+ readonly RESTITUTION = 0.5;
12
+ readonly REPULSION = 200;
12
13
  readonly TICK_MS = 33;
13
14
  readonly SYNC_MS = 300;
14
15
  readonly MAX_DISTANCE = 3000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.13.3",
3
+ "version": "0.13.5",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",