Skip to content
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

能否支持动态显隐小地图? #3784

Closed
sh4wmoo opened this issue Jul 14, 2023 · 8 comments
Closed

能否支持动态显隐小地图? #3784

sh4wmoo opened this issue Jul 14, 2023 · 8 comments
Labels
type: discussion 讨论 Usage questions, guidance, and other discussions

Comments

@sh4wmoo
Copy link

sh4wmoo commented Jul 14, 2023

问题描述

个人认为小地图的初衷,应该是在用户无法完整的看到所有元素的情况下才需要的。那么能否支持提供一个参数,来根据当前画布与元素的容纳情况,来动态显隐小地图?

退而求其次:
image
根据上述api可以直接设置容纳所有元素。

请问能否提供API可以监听当前画布是否容纳了所有元素?

重现链接

重现步骤

预期无法实现

预期行为

方案1:当画布没有容纳所有元素时,自动触发小地图的显示,画布容纳了所有元素后,自动隐藏。
方案2:提供API可以监听当前画布是否容纳了所有元素,开发者自行完成期望目标

平台

  • 操作系统: [Windows.]
  • 网页浏览器: [Google Chrome]
  • X6 版本: [2.2.1]
  • minimap版本:[2.0.5]

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

@x6-bot
Copy link
Contributor

x6-bot bot commented Jul 14, 2023

👋 @sh4wmoo

Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.
We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@NewByVector
Copy link
Contributor

  1. 判断是否所有节点都处于可视区域内部可以通过节点的坐标来计算。
  2. 显示隐藏小地图可以通过 css 样式来显隐小地图容器。

@NewByVector NewByVector added the type: discussion 讨论 Usage questions, guidance, and other discussions label Jul 14, 2023
@sh4wmoo
Copy link
Author

sh4wmoo commented Jul 14, 2023

1.css隐藏小地图没问题,问题的初衷是”时机“。
2.只通过“节点的坐标"来判断是否所有节点都处于可视区域内,是否有待商榷?用户的行为可能是:拖拽元素、删除元素、添加元素、拖拽画布、缩放画布…… 以上情况是否均可以满足?
3.如果可以满足,那么应该用什么坐标去判断,能否详细说明一下?或者指明一下相关api链接?谢谢

@NewByVector
Copy link
Contributor

判断的逻辑就是计算所有节点的坐标是否在可视区域内部,大致代码:

const nodes = graph.getNodes()
const allInView = nodes.every((node) => {
  return node.getBBox().intersectsWithRect(graph.getGraphArea())
})

不过你上面也说了,后面会有很多操作会改变上面结果,所以你需要监听 节点增删画布平移画布缩放 等事件去重新计算上面结果。

@sh4wmoo
Copy link
Author

sh4wmoo commented Jul 17, 2023

判断的逻辑就是计算所有节点的坐标是否在可视区域内部,大致代码:

const nodes = graph.getNodes()
const allInView = nodes.every((node) => {
  return node.getBBox().intersectsWithRect(graph.getGraphArea())
})

不过你上面也说了,后面会有很多操作会改变上面结果,所以你需要监听 节点增删画布平移画布缩放 等事件去重新计算上面结果。

好的 我先按照这种方式试一下。

@sh4wmoo
Copy link
Author

sh4wmoo commented Jul 18, 2023

判断的逻辑就是计算所有节点的坐标是否在可视区域内部,大致代码:

const nodes = graph.getNodes()
const allInView = nodes.every((node) => {
  return node.getBBox().intersectsWithRect(graph.getGraphArea())
})

不过你上面也说了,后面会有很多操作会改变上面结果,所以你需要监听 节点增删画布平移画布缩放 等事件去重新计算上面结果。

这个方案被否定了,暂时不考虑这个需求。还有个问题请问一下,issue#3778的,我看到已经对vertices tool进行了完善,增加了[modifiers]。那么请问有没有发布计划?何时才能发布到NPM上?

@NewByVector
Copy link
Contributor

@sh4wmoo 已经发布了哈。

@x6-bot
Copy link
Contributor

x6-bot bot commented Jul 25, 2024

This thread has been automatically locked because it has not had recent activity.

Please open a new issue for related bugs and link to relevant comments in this thread.

@x6-bot x6-bot bot locked as resolved and limited conversation to collaborators Jul 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: discussion 讨论 Usage questions, guidance, and other discussions
Projects
None yet
Development

No branches or pull requests

2 participants