Skip to content

feat: 添加画布一件美化 #1618

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

Merged
merged 1 commit into from
Nov 13, 2024
Merged

Conversation

shaohuzhang1
Copy link
Contributor

feat: 添加画布一件美化

Copy link

f2c-ci-robot bot commented Nov 13, 2024

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.

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/test-infra repository.

Copy link

f2c-ci-robot bot commented Nov 13, 2024

[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.

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

@shaohuzhang1 shaohuzhang1 merged commit 7369231 into main Nov 13, 2024
4 checks passed
@shaohuzhang1 shaohuzhang1 deleted the pr@main@feat_workflow_layout branch November 13, 2024 08:57
})
this.lf.fitView()
}
}

Choose a reason for hiding this comment

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

该代码存在一些问题和不规则的部分:

  1. render 方法应作为类的成员而不是函数来定义,在 JavaScript 中,方法通常被声明为静态属性或类变量。
  2. 错误地导入了 package.json 文件中的 module.exports 块,并将它导出为 DagreLayout. 应将 @antv/layout/Dagre 导入并使用这个版本。
  3. 不正确地设置了布局方向。对于单层图形(如饼图),可能不需要改变方向即可工作。但对于多层级结构,则需要设置正确的方向以获得预期的效果。

根据这些发现进行调整:

import { DAGRE_LAYOUT_OPTIONS, LayoutOptions } from '@antv/dagre-plugin'

const layoutInstance = new DAGRE_LAYOUT_OPTIONS(options).layout()

// ...

)
])
}
}
// 'app-history-outlined': {
// iconReader: () => {
// return h('i', [

Choose a reason for hiding this comment

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

这个代码中的一个主要问题是样式重复使用(style和class重叠)。例如,两个div都有相同的style部分:height: 100%; width: 100%,所以应该只在第一个出现一次。另一个问题是没有明确地将这些内容分块或归类为不同的组件文件。

对于优化,可以创建一个单独的CSS文件来集中处理这些图标和其他元素的样式,并且尽量减少标签的选择器长度以提高性能。此外,考虑重构并按逻辑模块进行组织结构,以清晰展示每个任务的功能和状态。

this.y = y
}
this.refreshDeges()
}
getResizeOutlineStyle() {
const style = super.getResizeOutlineStyle()
style.stroke = 'none'

Choose a reason for hiding this comment

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

我发现了两个问题:

  1. 第一个问题是类AppNode在HtmlResize中继承了view。
  2. 第二个问题是class AppNodeModel在.HtmlResize模型上是被继承的。

对于第一个问题和第二个问题,可以采取两种解决方案:

对第一个人而言:你可以将它转换为子类别或实现自己的功能,并将其放在HTMLResizer组件内;

其次,对第二个人而言:你可以创建一个新的父类别或改变结构来管理整个系统的布局。

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