microboard-temp 0.13.5 → 0.13.7

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.
@@ -4674,7 +4674,13 @@ var conf = {
4674
4674
  CARD_DIMENSIONS: { width: 250, height: 400 },
4675
4675
  DEFAULT_GAME_ITEM_DIMENSIONS: { width: 200, height: 200 },
4676
4676
  MAX_CARD_SIZE: 500,
4677
- CONNECTOR_ITEM_OFFSET: 20
4677
+ CONNECTOR_ITEM_OFFSET: 20,
4678
+ GRAVITY_G: 80,
4679
+ GRAVITY_G_CENTER: 120,
4680
+ GRAVITY_DAMPING: 0.96,
4681
+ GRAVITY_RESTITUTION: 0.5,
4682
+ GRAVITY_REPULSION: 200,
4683
+ GRAVITY_MAX_DISTANCE: 3000
4678
4684
  };
4679
4685
  initDefaultI18N();
4680
4686
 
@@ -22202,6 +22208,7 @@ class RichText extends BaseItem {
22202
22208
  autoSizeScale = 1;
22203
22209
  containerMaxWidth;
22204
22210
  linkTo;
22211
+ localArea;
22205
22212
  maxHeight;
22206
22213
  selection;
22207
22214
  transformationRenderBlock = undefined;
@@ -22223,6 +22230,7 @@ class RichText extends BaseItem {
22223
22230
  this.autoSize = autoSize;
22224
22231
  this.insideOf = insideOf;
22225
22232
  this.initialTextStyles = initialTextStyles;
22233
+ this.localArea = container.copy();
22226
22234
  counter = counter + 1;
22227
22235
  this.rtCounter = counter;
22228
22236
  this.linkTo = linkTo || new LinkTo(this.id, this.board.events);
@@ -22375,7 +22383,7 @@ class RichText extends BaseItem {
22375
22383
  this.layoutNodes.width = this.containerMaxWidth;
22376
22384
  }
22377
22385
  }
22378
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
22386
+ this.alignInRectangle(this.localArea, this.editor.verticalAlignment);
22379
22387
  this.transformCanvas();
22380
22388
  this.subject.publish(this);
22381
22389
  this.updateRequired = false;
@@ -22455,7 +22463,7 @@ class RichText extends BaseItem {
22455
22463
  this.right = transformed.right;
22456
22464
  this.bottom = transformed.bottom;
22457
22465
  } else {
22458
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
22466
+ this.alignInRectangle(this.localArea, this.editor.verticalAlignment);
22459
22467
  }
22460
22468
  this.setClipPath();
22461
22469
  if (!this.isInShape && !this.autoSize) {
@@ -22483,16 +22491,16 @@ class RichText extends BaseItem {
22483
22491
  }
22484
22492
  }
22485
22493
  setClipPath() {
22486
- const container = this.getTransformedContainer();
22487
- const width = container.getWidth();
22488
- const height = container.getHeight();
22494
+ const width = this.localArea.getWidth();
22495
+ const height = this.localArea.getHeight();
22489
22496
  this.clipPath = new conf.path2DFactory;
22490
22497
  this.clipPath.rect(0, 0, width, height);
22491
22498
  }
22492
22499
  setContainer(container) {
22493
22500
  this.isContainerSet = true;
22501
+ this.localArea = container.copy();
22494
22502
  this.container = container;
22495
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
22503
+ this.updateElement();
22496
22504
  }
22497
22505
  applyMaxWidth(maxWidth) {
22498
22506
  const shouldNotShrink = this.insideOf !== "RichText" && this.insideOf !== "AINode" && this.containerMaxWidth && this.shrinkWidth;
@@ -22515,8 +22523,8 @@ class RichText extends BaseItem {
22515
22523
  matrix = this.transformation.toMatrix();
22516
22524
  }
22517
22525
  const { translateX, translateY, scaleX, scaleY } = matrix;
22518
- const scaledMatrix = new Matrix(translateX, translateY, scaleX, scaleY);
22519
- return this.container.getTransformed(scaledMatrix);
22526
+ const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
22527
+ return this.localArea.getTransformed(scaledMatrix);
22520
22528
  }
22521
22529
  emitWithoutApplying = (op) => {
22522
22530
  if (this.board.events) {
@@ -22858,7 +22866,7 @@ class RichText extends BaseItem {
22858
22866
  if (typeof document !== "undefined") {
22859
22867
  document.fonts.ready.then(() => {
22860
22868
  this.layoutNodes = getBlockNodes(this.getBlockNodes(), this.shrinkWidth ? Infinity : this.getMaxWidth() || 0, this.shrinkWidth, this.insideOf === "Frame");
22861
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
22869
+ this.alignInRectangle(this.localArea, this.editor.verticalAlignment);
22862
22870
  this.transformCanvas();
22863
22871
  });
22864
22872
  }
@@ -22888,7 +22896,7 @@ class RichText extends BaseItem {
22888
22896
  const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
22889
22897
  context.matrix = scaledMatrix;
22890
22898
  context.applyChanges();
22891
- ctx.translate(this.container.left, this.container.top);
22899
+ ctx.translate(this.left, this.top);
22892
22900
  const shouldClip = this.insideOf === "Shape" || this.insideOf === "Sticker";
22893
22901
  if (shouldClip) {
22894
22902
  ctx.clip(this.clipPath.nativePath);
@@ -23029,7 +23037,7 @@ class RichText extends BaseItem {
23029
23037
  }
23030
23038
  const { translateX, translateY, scaleX, scaleY } = matrix;
23031
23039
  const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
23032
- const transform = `translate(${scaledMatrix.translateX + this.container.left * scaledMatrix.scaleX}px, ${scaledMatrix.translateY + this.container.top * scaledMatrix.scaleY}px) scale(${scaledMatrix.scaleX}, ${scaledMatrix.scaleY})`;
23040
+ const transform = `translate(${scaledMatrix.translateX + this.left * scaledMatrix.scaleX}px, ${scaledMatrix.translateY + this.top * scaledMatrix.scaleY}px) scale(${scaledMatrix.scaleX}, ${scaledMatrix.scaleY})`;
23033
23041
  const transformedWidth = this.getMbr().getWidth();
23034
23042
  const transformedHeight = this.getMbr().getHeight();
23035
23043
  const div = documentFactory.createElement("rich-text");
@@ -23125,6 +23133,19 @@ class RichText extends BaseItem {
23125
23133
  getPrevMbr() {
23126
23134
  return this.prevMbr;
23127
23135
  }
23136
+ getMbr() {
23137
+ const cameraScale = this.board.camera.getScale();
23138
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
23139
+ let matrix;
23140
+ if (this.customTransformationMatrix) {
23141
+ matrix = this.customTransformationMatrix();
23142
+ } else {
23143
+ matrix = this.transformation.toMatrix();
23144
+ }
23145
+ const { translateX, translateY, scaleX, scaleY } = matrix;
23146
+ const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
23147
+ return new Mbr(this.left, this.top, this.right, this.bottom).getTransformed(scaledMatrix);
23148
+ }
23128
23149
  }
23129
23150
 
23130
23151
  // src/Items/Mbr/updateRects.ts
@@ -41024,6 +41045,8 @@ class DefaultFrameData {
41024
41045
 
41025
41046
  // src/Items/Frame/Frame.ts
41026
41047
  var defaultFrameData = new DefaultFrameData;
41048
+ var HEADING_TOP_OFFSET = -45;
41049
+ var HEADING_BOTTOM_OFFSET = -12;
41027
41050
 
41028
41051
  class Frame2 extends BaseItem {
41029
41052
  getItemById;
@@ -41061,14 +41084,14 @@ class Frame2 extends BaseItem {
41061
41084
  this.borderStyle = borderStyle;
41062
41085
  this.borderWidth = borderWidth;
41063
41086
  this.textContainer = Frames[this.shapeType].textBounds.copy();
41087
+ this.textContainer.top = HEADING_TOP_OFFSET;
41088
+ this.textContainer.bottom = HEADING_BOTTOM_OFFSET;
41064
41089
  this.path = Frames[this.shapeType].path.copy();
41065
41090
  this.transformation = new Transformation(this.id, board.events);
41066
41091
  this.linkTo = new LinkTo(this.id, board.events);
41067
41092
  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
41093
  this.text.editor.verticalAlignment = "bottom";
41069
41094
  this.text.setSelectionHorisontalAlignment("left");
41070
- this.textContainer.top = -45;
41071
- this.textContainer.bottom = -12;
41072
41095
  this.text.customTransformationMatrix = () => {
41073
41096
  const matrix = this.transformation.toMatrix();
41074
41097
  return new Matrix(matrix.translateX, matrix.translateY, 1, 1);
@@ -41101,6 +41124,8 @@ class Frame2 extends BaseItem {
41101
41124
  initPath() {
41102
41125
  this.path = Frames[this.shapeType].path.copy();
41103
41126
  this.textContainer = Frames[this.shapeType].textBounds.copy();
41127
+ this.textContainer.top = HEADING_TOP_OFFSET;
41128
+ this.textContainer.bottom = HEADING_BOTTOM_OFFSET;
41104
41129
  this.text.setContainer(this.textContainer.copy());
41105
41130
  this.text.updateElement();
41106
41131
  }
@@ -41245,6 +41270,9 @@ class Frame2 extends BaseItem {
41245
41270
  }
41246
41271
  if (data.text) {
41247
41272
  this.text.deserialize(data.text);
41273
+ this.textContainer.top = HEADING_TOP_OFFSET;
41274
+ this.textContainer.bottom = HEADING_BOTTOM_OFFSET;
41275
+ this.text.setContainer(this.textContainer.copy());
41248
41276
  }
41249
41277
  this.canChangeRatio = data.canChangeRatio ?? this.canChangeRatio;
41250
41278
  this.subject.publish(this);
@@ -54348,14 +54376,8 @@ class GravityEngine {
54348
54376
  tickTimer = null;
54349
54377
  syncTimer = null;
54350
54378
  lastSyncedPositions = new Map;
54351
- G = 80;
54352
- G_CENTER = 120;
54353
- DAMPING = 0.96;
54354
- RESTITUTION = 0.5;
54355
- REPULSION = 200;
54356
54379
  TICK_MS = 33;
54357
54380
  SYNC_MS = 300;
54358
- MAX_DISTANCE = 3000;
54359
54381
  SOFTENING_SQ = 50 * 50;
54360
54382
  MIN_MOVE_PX = 0.1;
54361
54383
  constructor(board) {
@@ -54424,8 +54446,8 @@ class GravityEngine {
54424
54446
  const dcx = centerX - s1.cx;
54425
54447
  const dcy = centerY - s1.cy;
54426
54448
  const distCenter = Math.sqrt(dcx * dcx + dcy * dcy) + 1;
54427
- ax += this.G_CENTER * dcx / distCenter;
54428
- ay += this.G_CENTER * dcy / distCenter;
54449
+ ax += conf.GRAVITY_G_CENTER * dcx / distCenter;
54450
+ ay += conf.GRAVITY_G_CENTER * dcy / distCenter;
54429
54451
  for (let j = 0;j < snap.length; j++) {
54430
54452
  if (i === j)
54431
54453
  continue;
@@ -54433,7 +54455,7 @@ class GravityEngine {
54433
54455
  const dx = s2.cx - s1.cx;
54434
54456
  const dy = s2.cy - s1.cy;
54435
54457
  const dist = Math.sqrt(dx * dx + dy * dy) + 0.001;
54436
- if (dist > this.MAX_DISTANCE)
54458
+ if (dist > conf.GRAVITY_MAX_DISTANCE)
54437
54459
  continue;
54438
54460
  const overlapping = s1.right > s2.left && s2.right > s1.left && s1.bottom > s2.top && s2.bottom > s1.top;
54439
54461
  if (overlapping) {
@@ -54442,26 +54464,26 @@ class GravityEngine {
54442
54464
  if (overlapX < overlapY) {
54443
54465
  const sign = s1.cx < s2.cx ? -1 : 1;
54444
54466
  if (sign * vel.vx < 0)
54445
- vel.vx = -vel.vx * this.RESTITUTION;
54446
- ax += sign * this.REPULSION * overlapX;
54467
+ vel.vx = -vel.vx * conf.GRAVITY_RESTITUTION;
54468
+ ax += sign * conf.GRAVITY_REPULSION * overlapX;
54447
54469
  } else {
54448
54470
  const sign = s1.cy < s2.cy ? -1 : 1;
54449
54471
  if (sign * vel.vy < 0)
54450
- vel.vy = -vel.vy * this.RESTITUTION;
54451
- ay += sign * this.REPULSION * overlapY;
54472
+ vel.vy = -vel.vy * conf.GRAVITY_RESTITUTION;
54473
+ ay += sign * conf.GRAVITY_REPULSION * overlapY;
54452
54474
  }
54453
54475
  } else {
54454
54476
  const touchDist = (s1.w + s2.w + s1.h + s2.h) * 0.25;
54455
54477
  if (dist < touchDist + 5)
54456
54478
  continue;
54457
54479
  const distSq = dx * dx + dy * dy;
54458
- const gravAcc = this.G * s2.mass / (distSq + this.SOFTENING_SQ);
54480
+ const gravAcc = conf.GRAVITY_G * s2.mass / (distSq + this.SOFTENING_SQ);
54459
54481
  ax += gravAcc * dx / dist;
54460
54482
  ay += gravAcc * dy / dist;
54461
54483
  }
54462
54484
  }
54463
- vel.vx = (vel.vx + ax * dt) * this.DAMPING;
54464
- vel.vy = (vel.vy + ay * dt) * this.DAMPING;
54485
+ vel.vx = (vel.vx + ax * dt) * conf.GRAVITY_DAMPING;
54486
+ vel.vy = (vel.vy + ay * dt) * conf.GRAVITY_DAMPING;
54465
54487
  const moveX = vel.vx * dt;
54466
54488
  const moveY = vel.vy * dt;
54467
54489
  if (Math.abs(moveX) >= this.MIN_MOVE_PX || Math.abs(moveY) >= this.MIN_MOVE_PX) {
package/dist/cjs/index.js CHANGED
@@ -4674,7 +4674,13 @@ var conf = {
4674
4674
  CARD_DIMENSIONS: { width: 250, height: 400 },
4675
4675
  DEFAULT_GAME_ITEM_DIMENSIONS: { width: 200, height: 200 },
4676
4676
  MAX_CARD_SIZE: 500,
4677
- CONNECTOR_ITEM_OFFSET: 20
4677
+ CONNECTOR_ITEM_OFFSET: 20,
4678
+ GRAVITY_G: 80,
4679
+ GRAVITY_G_CENTER: 120,
4680
+ GRAVITY_DAMPING: 0.96,
4681
+ GRAVITY_RESTITUTION: 0.5,
4682
+ GRAVITY_REPULSION: 200,
4683
+ GRAVITY_MAX_DISTANCE: 3000
4678
4684
  };
4679
4685
  initDefaultI18N();
4680
4686
 
@@ -22202,6 +22208,7 @@ class RichText extends BaseItem {
22202
22208
  autoSizeScale = 1;
22203
22209
  containerMaxWidth;
22204
22210
  linkTo;
22211
+ localArea;
22205
22212
  maxHeight;
22206
22213
  selection;
22207
22214
  transformationRenderBlock = undefined;
@@ -22223,6 +22230,7 @@ class RichText extends BaseItem {
22223
22230
  this.autoSize = autoSize;
22224
22231
  this.insideOf = insideOf;
22225
22232
  this.initialTextStyles = initialTextStyles;
22233
+ this.localArea = container.copy();
22226
22234
  counter = counter + 1;
22227
22235
  this.rtCounter = counter;
22228
22236
  this.linkTo = linkTo || new LinkTo(this.id, this.board.events);
@@ -22375,7 +22383,7 @@ class RichText extends BaseItem {
22375
22383
  this.layoutNodes.width = this.containerMaxWidth;
22376
22384
  }
22377
22385
  }
22378
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
22386
+ this.alignInRectangle(this.localArea, this.editor.verticalAlignment);
22379
22387
  this.transformCanvas();
22380
22388
  this.subject.publish(this);
22381
22389
  this.updateRequired = false;
@@ -22455,7 +22463,7 @@ class RichText extends BaseItem {
22455
22463
  this.right = transformed.right;
22456
22464
  this.bottom = transformed.bottom;
22457
22465
  } else {
22458
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
22466
+ this.alignInRectangle(this.localArea, this.editor.verticalAlignment);
22459
22467
  }
22460
22468
  this.setClipPath();
22461
22469
  if (!this.isInShape && !this.autoSize) {
@@ -22483,16 +22491,16 @@ class RichText extends BaseItem {
22483
22491
  }
22484
22492
  }
22485
22493
  setClipPath() {
22486
- const container = this.getTransformedContainer();
22487
- const width = container.getWidth();
22488
- const height = container.getHeight();
22494
+ const width = this.localArea.getWidth();
22495
+ const height = this.localArea.getHeight();
22489
22496
  this.clipPath = new conf.path2DFactory;
22490
22497
  this.clipPath.rect(0, 0, width, height);
22491
22498
  }
22492
22499
  setContainer(container) {
22493
22500
  this.isContainerSet = true;
22501
+ this.localArea = container.copy();
22494
22502
  this.container = container;
22495
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
22503
+ this.updateElement();
22496
22504
  }
22497
22505
  applyMaxWidth(maxWidth) {
22498
22506
  const shouldNotShrink = this.insideOf !== "RichText" && this.insideOf !== "AINode" && this.containerMaxWidth && this.shrinkWidth;
@@ -22515,8 +22523,8 @@ class RichText extends BaseItem {
22515
22523
  matrix = this.transformation.toMatrix();
22516
22524
  }
22517
22525
  const { translateX, translateY, scaleX, scaleY } = matrix;
22518
- const scaledMatrix = new Matrix(translateX, translateY, scaleX, scaleY);
22519
- return this.container.getTransformed(scaledMatrix);
22526
+ const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
22527
+ return this.localArea.getTransformed(scaledMatrix);
22520
22528
  }
22521
22529
  emitWithoutApplying = (op) => {
22522
22530
  if (this.board.events) {
@@ -22858,7 +22866,7 @@ class RichText extends BaseItem {
22858
22866
  if (typeof document !== "undefined") {
22859
22867
  document.fonts.ready.then(() => {
22860
22868
  this.layoutNodes = getBlockNodes(this.getBlockNodes(), this.shrinkWidth ? Infinity : this.getMaxWidth() || 0, this.shrinkWidth, this.insideOf === "Frame");
22861
- this.alignInRectangle(this.getTransformedContainer(), this.editor.verticalAlignment);
22869
+ this.alignInRectangle(this.localArea, this.editor.verticalAlignment);
22862
22870
  this.transformCanvas();
22863
22871
  });
22864
22872
  }
@@ -22888,7 +22896,7 @@ class RichText extends BaseItem {
22888
22896
  const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
22889
22897
  context.matrix = scaledMatrix;
22890
22898
  context.applyChanges();
22891
- ctx.translate(this.container.left, this.container.top);
22899
+ ctx.translate(this.left, this.top);
22892
22900
  const shouldClip = this.insideOf === "Shape" || this.insideOf === "Sticker";
22893
22901
  if (shouldClip) {
22894
22902
  ctx.clip(this.clipPath.nativePath);
@@ -23029,7 +23037,7 @@ class RichText extends BaseItem {
23029
23037
  }
23030
23038
  const { translateX, translateY, scaleX, scaleY } = matrix;
23031
23039
  const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
23032
- const transform = `translate(${scaledMatrix.translateX + this.container.left * scaledMatrix.scaleX}px, ${scaledMatrix.translateY + this.container.top * scaledMatrix.scaleY}px) scale(${scaledMatrix.scaleX}, ${scaledMatrix.scaleY})`;
23040
+ const transform = `translate(${scaledMatrix.translateX + this.left * scaledMatrix.scaleX}px, ${scaledMatrix.translateY + this.top * scaledMatrix.scaleY}px) scale(${scaledMatrix.scaleX}, ${scaledMatrix.scaleY})`;
23033
23041
  const transformedWidth = this.getMbr().getWidth();
23034
23042
  const transformedHeight = this.getMbr().getHeight();
23035
23043
  const div = documentFactory.createElement("rich-text");
@@ -23125,6 +23133,19 @@ class RichText extends BaseItem {
23125
23133
  getPrevMbr() {
23126
23134
  return this.prevMbr;
23127
23135
  }
23136
+ getMbr() {
23137
+ const cameraScale = this.board.camera.getScale();
23138
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
23139
+ let matrix;
23140
+ if (this.customTransformationMatrix) {
23141
+ matrix = this.customTransformationMatrix();
23142
+ } else {
23143
+ matrix = this.transformation.toMatrix();
23144
+ }
23145
+ const { translateX, translateY, scaleX, scaleY } = matrix;
23146
+ const scaledMatrix = new Matrix(translateX, translateY, scaleX * extraScale, scaleY * extraScale);
23147
+ return new Mbr(this.left, this.top, this.right, this.bottom).getTransformed(scaledMatrix);
23148
+ }
23128
23149
  }
23129
23150
 
23130
23151
  // src/Items/Mbr/updateRects.ts
@@ -41024,6 +41045,8 @@ class DefaultFrameData {
41024
41045
 
41025
41046
  // src/Items/Frame/Frame.ts
41026
41047
  var defaultFrameData = new DefaultFrameData;
41048
+ var HEADING_TOP_OFFSET = -45;
41049
+ var HEADING_BOTTOM_OFFSET = -12;
41027
41050
 
41028
41051
  class Frame2 extends BaseItem {
41029
41052
  getItemById;
@@ -41061,14 +41084,14 @@ class Frame2 extends BaseItem {
41061
41084
  this.borderStyle = borderStyle;
41062
41085
  this.borderWidth = borderWidth;
41063
41086
  this.textContainer = Frames[this.shapeType].textBounds.copy();
41087
+ this.textContainer.top = HEADING_TOP_OFFSET;
41088
+ this.textContainer.bottom = HEADING_BOTTOM_OFFSET;
41064
41089
  this.path = Frames[this.shapeType].path.copy();
41065
41090
  this.transformation = new Transformation(this.id, board.events);
41066
41091
  this.linkTo = new LinkTo(this.id, board.events);
41067
41092
  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
41093
  this.text.editor.verticalAlignment = "bottom";
41069
41094
  this.text.setSelectionHorisontalAlignment("left");
41070
- this.textContainer.top = -45;
41071
- this.textContainer.bottom = -12;
41072
41095
  this.text.customTransformationMatrix = () => {
41073
41096
  const matrix = this.transformation.toMatrix();
41074
41097
  return new Matrix(matrix.translateX, matrix.translateY, 1, 1);
@@ -41101,6 +41124,8 @@ class Frame2 extends BaseItem {
41101
41124
  initPath() {
41102
41125
  this.path = Frames[this.shapeType].path.copy();
41103
41126
  this.textContainer = Frames[this.shapeType].textBounds.copy();
41127
+ this.textContainer.top = HEADING_TOP_OFFSET;
41128
+ this.textContainer.bottom = HEADING_BOTTOM_OFFSET;
41104
41129
  this.text.setContainer(this.textContainer.copy());
41105
41130
  this.text.updateElement();
41106
41131
  }
@@ -41245,6 +41270,9 @@ class Frame2 extends BaseItem {
41245
41270
  }
41246
41271
  if (data.text) {
41247
41272
  this.text.deserialize(data.text);
41273
+ this.textContainer.top = HEADING_TOP_OFFSET;
41274
+ this.textContainer.bottom = HEADING_BOTTOM_OFFSET;
41275
+ this.text.setContainer(this.textContainer.copy());
41248
41276
  }
41249
41277
  this.canChangeRatio = data.canChangeRatio ?? this.canChangeRatio;
41250
41278
  this.subject.publish(this);
@@ -54348,14 +54376,8 @@ class GravityEngine {
54348
54376
  tickTimer = null;
54349
54377
  syncTimer = null;
54350
54378
  lastSyncedPositions = new Map;
54351
- G = 80;
54352
- G_CENTER = 120;
54353
- DAMPING = 0.96;
54354
- RESTITUTION = 0.5;
54355
- REPULSION = 200;
54356
54379
  TICK_MS = 33;
54357
54380
  SYNC_MS = 300;
54358
- MAX_DISTANCE = 3000;
54359
54381
  SOFTENING_SQ = 50 * 50;
54360
54382
  MIN_MOVE_PX = 0.1;
54361
54383
  constructor(board) {
@@ -54424,8 +54446,8 @@ class GravityEngine {
54424
54446
  const dcx = centerX - s1.cx;
54425
54447
  const dcy = centerY - s1.cy;
54426
54448
  const distCenter = Math.sqrt(dcx * dcx + dcy * dcy) + 1;
54427
- ax += this.G_CENTER * dcx / distCenter;
54428
- ay += this.G_CENTER * dcy / distCenter;
54449
+ ax += conf.GRAVITY_G_CENTER * dcx / distCenter;
54450
+ ay += conf.GRAVITY_G_CENTER * dcy / distCenter;
54429
54451
  for (let j = 0;j < snap.length; j++) {
54430
54452
  if (i === j)
54431
54453
  continue;
@@ -54433,7 +54455,7 @@ class GravityEngine {
54433
54455
  const dx = s2.cx - s1.cx;
54434
54456
  const dy = s2.cy - s1.cy;
54435
54457
  const dist = Math.sqrt(dx * dx + dy * dy) + 0.001;
54436
- if (dist > this.MAX_DISTANCE)
54458
+ if (dist > conf.GRAVITY_MAX_DISTANCE)
54437
54459
  continue;
54438
54460
  const overlapping = s1.right > s2.left && s2.right > s1.left && s1.bottom > s2.top && s2.bottom > s1.top;
54439
54461
  if (overlapping) {
@@ -54442,26 +54464,26 @@ class GravityEngine {
54442
54464
  if (overlapX < overlapY) {
54443
54465
  const sign = s1.cx < s2.cx ? -1 : 1;
54444
54466
  if (sign * vel.vx < 0)
54445
- vel.vx = -vel.vx * this.RESTITUTION;
54446
- ax += sign * this.REPULSION * overlapX;
54467
+ vel.vx = -vel.vx * conf.GRAVITY_RESTITUTION;
54468
+ ax += sign * conf.GRAVITY_REPULSION * overlapX;
54447
54469
  } else {
54448
54470
  const sign = s1.cy < s2.cy ? -1 : 1;
54449
54471
  if (sign * vel.vy < 0)
54450
- vel.vy = -vel.vy * this.RESTITUTION;
54451
- ay += sign * this.REPULSION * overlapY;
54472
+ vel.vy = -vel.vy * conf.GRAVITY_RESTITUTION;
54473
+ ay += sign * conf.GRAVITY_REPULSION * overlapY;
54452
54474
  }
54453
54475
  } else {
54454
54476
  const touchDist = (s1.w + s2.w + s1.h + s2.h) * 0.25;
54455
54477
  if (dist < touchDist + 5)
54456
54478
  continue;
54457
54479
  const distSq = dx * dx + dy * dy;
54458
- const gravAcc = this.G * s2.mass / (distSq + this.SOFTENING_SQ);
54480
+ const gravAcc = conf.GRAVITY_G * s2.mass / (distSq + this.SOFTENING_SQ);
54459
54481
  ax += gravAcc * dx / dist;
54460
54482
  ay += gravAcc * dy / dist;
54461
54483
  }
54462
54484
  }
54463
- vel.vx = (vel.vx + ax * dt) * this.DAMPING;
54464
- vel.vy = (vel.vy + ay * dt) * this.DAMPING;
54485
+ vel.vx = (vel.vx + ax * dt) * conf.GRAVITY_DAMPING;
54486
+ vel.vy = (vel.vy + ay * dt) * conf.GRAVITY_DAMPING;
54465
54487
  const moveX = vel.vx * dt;
54466
54488
  const moveY = vel.vy * dt;
54467
54489
  if (Math.abs(moveX) >= this.MIN_MOVE_PX || Math.abs(moveY) >= this.MIN_MOVE_PX) {