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

怎么自适应设置节点宽高 #3711

Closed
PalmerShuai opened this issue Jun 27, 2023 · 4 comments
Closed

怎么自适应设置节点宽高 #3711

PalmerShuai opened this issue Jun 27, 2023 · 4 comments
Labels
type: discussion 讨论 Usage questions, guidance, and other discussions

Comments

@PalmerShuai
Copy link

问题描述

页面初始化的时候,自定义固定宽高的节点,点击自定义节点,弹框配置相关内容,关闭弹框重新新绘制画布上节点,怎么实现自定义节点的宽高由弹框配置的内容撑
求方法!!!

重现链接

暂无

重现步骤

暂无

预期行为

暂无

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox ...]
  • X6 版本: [2.11.1 ...]
    暂无

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

@x6-bot
Copy link
Contributor

x6-bot bot commented Jun 27, 2023

👋 @PalmerShuai

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.

@PalmerShuai
Copy link
Author

目前实现的方式是重绘之前根据配置内容的字数,使用js计算出大概高度,但是这样的计算是不太准确的,想请教一下有没有其他的实现方式

@NewByVector
Copy link
Contributor

提供两个思路:

  1. 使用 textWrap 来实现超出部分...显示。
  2. 使用 Dom.measureText 获取文本总长度 l,然后 l / nodeWidth * lineHeight 就是新的节点高度。

@NewByVector NewByVector added the type: discussion 讨论 Usage questions, guidance, and other discussions label Jun 27, 2023
@x6-bot
Copy link
Contributor

x6-bot bot commented Jul 10, 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 10, 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