Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ui/src/workflow/nodes/loop-body-node/LoopBodyContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ function enlargeHandle() {
props.nodeModel.graphModel.transformModel.focusOn(
props.nodeModel.x,
props.nodeModel.y,
props.nodeModel.width + 470,
props.nodeModel.width + window.innerWidth - props.nodeModel.width,
props.nodeModel.height - 30,
)
height.value =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The provided code snippet is attempting to adjust a canvas's focus within an SVG node based on the current model properties. Here are some points of consideration:

  1. Syntax Error: There's a syntax error where height.value is not properly closed with quotes or semicolons.

  2. Window Width Calculation: The expression to calculate outerWidth seems incorrect. It should use window.outerWidth instead of just window.innerWidth.

  3. Logic Review:

    • Adding props.nodeModel.width + window.outerWidth - props.nodeModel.width will always result in window.outerWidth.
    • The calculation (props.nodeModel.x, props.nodeModel.y) does nothing because it has no side effects.

Here's how you can fix these issues and optimize the code slightly:

function enlargeHandle() {
  // Corrected calculation assuming outerWidth is intended
  const newCenterX = (props.nodeModel.x + window.outerWidth / 2);

  // Use focusOn method correctly
  props.nodeModel.graphModel.transformModel.focusOn(
    newCenterX,
    props.nodeModel.y,
    props.nodeModel.width * 2, // Assuming double size for enlargement
    props.nodeModel.height - 30,
  );

  // Example correction for height assignment (assuming it was supposed to be outside)
  let newHeight;
  if (!isNaN(props.nodeModel.height)) { // Check if height is valid number before using
    newHeight = props.nodeModel.height; // Assign original height back or whatever needs to be done here
  } else {
    newHeight = 50; // Default value if needed
  }
}

Key Improvements:

  • Adjusting the center calculation to take into account the full width of the viewport.
  • Ensuring proper closing of strings and syntax errors.
  • Simplifying unnecessary operations and ensuring logical clarity.

Expand Down
Loading