Skip to content

Conversation

@shaohuzhang1
Copy link
Contributor

feat: Loop body supports zooming in and out

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Sep 24, 2025

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Sep 24, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

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.

@shaohuzhang1 shaohuzhang1 merged commit 5cbf216 into v2 Sep 24, 2025
4 of 5 checks passed
@shaohuzhang1 shaohuzhang1 deleted the pr@v2@fix_loop branch September 24, 2025 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants