-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: Loop body supports zooming in and out #4099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,17 @@ class LoopBodyModel extends AppNodeModel { | |
|
|
||
| return anchors | ||
| } | ||
| setHeight(height: number) { | ||
| this.properties['height'] = height | ||
| this.outgoing.edges.forEach((edge: any) => { | ||
| // 调用自定义的更新方案 | ||
| edge.updatePathByAnchor() | ||
| }) | ||
| this.incoming.edges.forEach((edge: any) => { | ||
| // 调用自定义的更新方案 | ||
| edge.updatePathByAnchor() | ||
| }) | ||
| } | ||
| } | ||
| export default { | ||
| type: 'loop-body-node', | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The provided code looks largely valid and well-organized. It defines a
Here is the updated code with some suggested improvements: @@ -36,6 +36,18 @@ class LoopBodyModel extends AppNodeModel {
getAnchors(): any[] {
return this.anchors;
}
+ setHeight(height: number): void {
+ if (!Number.isInteger(height)) {
+ throw new Error('Height must be an integer');
+ }
+
+ this.properties['height'] = height;
+
+ this.outgoing.edges.forEach((edge: any) => {
+ edge.updatePathByAnchor();
+ });
+
+ this.incoming.edges.forEach((edge: any) => {
+ edge.updatePathByAnchor();
+ });
+ }
}In summary, the code itself seems functional, but improving readability and robustness would provide better overall quality and maintenance. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| <template> | ||
| <LoopBodyContainer :nodeModel="nodeModel"> | ||
| <div ref="containerRef" @wheel.stop style="height: 600px"></div> | ||
| <div ref="containerRef" @wheel.stop style="height: 100%; width: 100%"></div> | ||
| </LoopBodyContainer> | ||
| </template> | ||
| <script setup lang="ts"> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The updated code changes the Overall, this change seems reasonable within typical use cases, but there aren't any noticeable issues that would prevent the component from functioning correctly as intended. If you anticipate scrolling in different directions or need additional customization based on specific context, further adjustments might be necessary. Otherwise, your changes should work well. |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
</div>).showiconref definition since it's not used in the code snippet provided.stepContainerHeight,inputContainerHeight, andoutputContainerHeightproperties ofprops.nodeModel.graphModelare set before using them to changeheightvalue.if (enlarge.value)with actual logic for animating the step container resizing effect.