@plait/mind 0.24.0 → 0.24.1

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.
@@ -1119,6 +1119,9 @@ const getNewNodeHeight = (board, element, newNodeDynamicWidth) => {
1119
1119
  if (height !== newHeight) {
1120
1120
  return newHeight;
1121
1121
  }
1122
+ if (Math.abs(newHeight / board.viewport.zoom - element.height) > 2) {
1123
+ return newHeight;
1124
+ }
1122
1125
  return undefined;
1123
1126
  };
1124
1127
 
@@ -3064,8 +3067,6 @@ class MindNodeComponent extends PlaitPluginElementComponent {
3064
3067
  this.textManage = new TextManage(this.board, this.viewContainerRef, () => {
3065
3068
  const rect = getTopicRectangleByNode(this.board, this.node);
3066
3069
  return rect;
3067
- }, (point) => {
3068
- return isHitMindElement(this.board, point, this.element);
3069
3070
  }, (textManageRef) => {
3070
3071
  const width = textManageRef.width;
3071
3072
  const height = textManageRef.height;
@@ -3204,10 +3205,21 @@ class MindNodeComponent extends PlaitPluginElementComponent {
3204
3205
  }
3205
3206
  editTopic() {
3206
3207
  this.activeDrawer.draw(this.element, this.g, { selected: this.selected, isEditing: true });
3208
+ // update text max-width when image width greater than topic default max width to cover node topic default max width style
3209
+ const defaultMaxWidth = TOPIC_DEFAULT_MAX_WORD_COUNT * (PlaitMind.isMind(this.element) ? ROOT_TOPIC_FONT_SIZE : TOPIC_FONT_SIZE);
3210
+ let hasMaxWidth = false;
3211
+ if (!this.element.manualWidth && MindElement.hasImage(this.element) && this.element.data.image.width > defaultMaxWidth) {
3212
+ const width = NodeSpace.getNodeDynamicWidth(this.board, this.element);
3213
+ this.textManage.updateWidth(width);
3214
+ hasMaxWidth = true;
3215
+ }
3207
3216
  this.textManage.edit((origin) => {
3208
3217
  if (origin === ExitOrigin.default) {
3209
3218
  this.activeDrawer.draw(this.element, this.g, { selected: this.selected, isEditing: false });
3210
3219
  }
3220
+ if (hasMaxWidth) {
3221
+ this.textManage.updateWidth(0);
3222
+ }
3211
3223
  });
3212
3224
  }
3213
3225
  ngOnDestroy() {