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

计算文字宽度 #15

Closed
liunnn1994 opened this issue May 25, 2023 · 9 comments · Fixed by #16
Closed

计算文字宽度 #15

liunnn1994 opened this issue May 25, 2023 · 9 comments · Fixed by #16

Comments

@liunnn1994
Copy link
Member

你的功能请求是否与问题有关?请描述

需要一个计算文字宽度的函数。

描述你想要的解决方案

css em 的宽度不精准,需要使用 canvas 动态计算。

描述你考虑过的替代方案

css 的 em 和 ch 都不精确。

liunnn1994 pushed a commit that referenced this issue May 25, 2023
ni-team-bot pushed a commit that referenced this issue May 25, 2023
# 1.0.0-development.1 (2023-05-25)

### Features

* 清除历史日志,项目迁移 ([5ec0f43](5ec0f43))
* 计算文字宽度 ([b916185](b916185)), closes [#15](#15)
* 重置版本号 ([55def4a](55def4a))
@ni-team-bot
Copy link
Member

🎉 This issue has been resolved in version 1.0.0-development.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

liunnn1994 pushed a commit that referenced this issue May 25, 2023
liunnn1994 pushed a commit that referenced this issue May 25, 2023
# 1.0.0-development.1 (2023-05-25)

### Features

* 清除历史日志,项目迁移 ([5ec0f43](5ec0f43))
* 计算文字宽度 ([b916185](b916185)), closes [#15](#15)
* 重置版本号 ([55def4a](55def4a))
ni-team-bot pushed a commit that referenced this issue May 30, 2023
# 1.0.0-beta.1 (2023-05-30)

### Features

* 添加文档框架 ([1e64c6b](1e64c6b))
* 添加文档框架 ([da23561](da23561))
* 清除历史日志,项目迁移 ([5ec0f43](5ec0f43))
* 计算文字宽度 ([03fb18c](03fb18c)), closes [#15](#15)
* 重置版本号 ([55def4a](55def4a))
@ni-team-bot
Copy link
Member

🎉 This issue has been resolved in version 1.0.0-beta.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

liunnn1994 pushed a commit that referenced this issue May 30, 2023
# 1.0.0-beta.1 (2023-05-30)

### Features

* 添加文档框架 ([1e64c6b](1e64c6b))
* 添加文档框架 ([da23561](da23561))
* 清除历史日志,项目迁移 ([5ec0f43](5ec0f43))
* 计算文字宽度 ([03fb18c](03fb18c)), closes [#15](#15)
* 重置版本号 ([55def4a](55def4a))
ni-team-bot pushed a commit that referenced this issue May 30, 2023
# 1.0.0 (2023-05-30)

### Features

* 添加文档框架 ([1e64c6b](1e64c6b))
* 添加文档框架 ([da23561](da23561))
* 清除历史日志,项目迁移 ([5ec0f43](5ec0f43))
* 计算文字宽度 ([03fb18c](03fb18c)), closes [#15](#15)
* 重置版本号 ([55def4a](55def4a))
@ni-team-bot
Copy link
Member

🎉 This issue has been resolved in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

liunnn1994 pushed a commit that referenced this issue May 30, 2023
# 1.0.0 (2023-05-30)

### Features

* 添加文档框架 ([1e64c6b](1e64c6b))
* 添加文档框架 ([da23561](da23561))
* 清除历史日志,项目迁移 ([5ec0f43](5ec0f43))
* 计算文字宽度 ([03fb18c](03fb18c)), closes [#15](#15)
* 重置版本号 ([55def4a](55def4a))
liunnn1994 added a commit that referenced this issue Jun 2, 2023
* feat: 添加文档框架

* ci: 修改发布触发条件

* ci: 新增自动分配 reviewers action

* ci: 修改 action 版本号

* ci: 规范 action 名称

* upgrade: 更新依赖

* feat: 添加文档框架

* feat: 添加文档框架

* ci: 修改发布触发条件

* ci: 新增自动分配 reviewers action

* ci: 修改 action 版本号

* ci: 规范 action 名称

* upgrade: 更新依赖

* ci: 修改 pr 文档部署触发条件

* ci: 新增基于 Netlify 的文档

* ci: 移除基于 surge 的文档预览

* ci: 修改分配 reviewer 的时机

* ci: 修改 token 设置

* ci: 修改获取 token 的方式

---------

Co-authored-by: liu <liunian7965@navinfo.com>

* ci: 修改 beta 分支

* ci: 修改版本号规则

* ci: 修改 release 触发分支

* refactor: 修改 computedTextWidth 返回值说明

* chore(release): 1.0.0-beta.1 [skip ci]

# 1.0.0-beta.1 (2023-05-30)

### Features

* 添加文档框架 ([1e64c6b](1e64c6b))
* 添加文档框架 ([da23561](da23561))
* 清除历史日志,项目迁移 ([5ec0f43](5ec0f43))
* 计算文字宽度 ([03fb18c](03fb18c)), closes [#15](#15)
* 重置版本号 ([55def4a](55def4a))

* ci: 修复 ci 取值错误的问题

* ci: 修改文档部署触发条件

* ci: 修改文档部署触发时机

* chore(release): 1.0.0 [skip ci]

# 1.0.0 (2023-05-30)

### Features

* 添加文档框架 ([1e64c6b](1e64c6b))
* 添加文档框架 ([da23561](da23561))
* 清除历史日志,项目迁移 ([5ec0f43](5ec0f43))
* 计算文字宽度 ([03fb18c](03fb18c)), closes [#15](#15)
* 重置版本号 ([55def4a](55def4a))

* docs: 从 jsdoc 中转移文档到 vitepress

* chore: 移除有包含 LGPL-2.0 协议的库

为防止协议的传染,移除了该库 @see
https://www.gnu.org/licenses/license-compatibility.zh-cn.html

* upgrade: 更新依赖

* feat: 项目名称由 common-util 改为 common-utils

BREAKING CHANGE: 🧨 项目名称由 common-util 改为 common-utils

* feat: 更新依赖并重置版本号

---------

Co-authored-by: liu <liunian7965@navinfo.com>
Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
liunnn1994 pushed a commit that referenced this issue Jun 2, 2023
# 1.0.0 (2023-05-30)

### Features

* 添加文档框架 ([1e64c6b](1e64c6b))
* 添加文档框架 ([da23561](da23561))
* 清除历史日志,项目迁移 ([5ec0f43](5ec0f43))
* 计算文字宽度 ([03fb18c](03fb18c)), closes [#15](#15)
* 重置版本号 ([55def4a](55def4a))
liunnn1994 added a commit that referenced this issue Jun 2, 2023
* feat: 添加文档框架

* ci: 修改发布触发条件

* ci: 新增自动分配 reviewers action

* ci: 修改 action 版本号

* ci: 规范 action 名称

* upgrade: 更新依赖

* feat: 添加文档框架

* feat: 添加文档框架

* ci: 修改发布触发条件

* ci: 新增自动分配 reviewers action

* ci: 修改 action 版本号

* ci: 规范 action 名称

* upgrade: 更新依赖

* ci: 修改 pr 文档部署触发条件

* ci: 新增基于 Netlify 的文档

* ci: 移除基于 surge 的文档预览

* ci: 修改分配 reviewer 的时机

* ci: 修改 token 设置

* ci: 修改获取 token 的方式

---------

Co-authored-by: liu <liunian7965@navinfo.com>

* ci: 修改 beta 分支

* ci: 修改版本号规则

* ci: 修改 release 触发分支

* refactor: 修改 computedTextWidth 返回值说明

* chore(release): 1.0.0-beta.1 [skip ci]

# 1.0.0-beta.1 (2023-05-30)

### Features

* 添加文档框架 ([1e64c6b](1e64c6b))
* 添加文档框架 ([da23561](da23561))
* 清除历史日志,项目迁移 ([5ec0f43](5ec0f43))
* 计算文字宽度 ([03fb18c](03fb18c)), closes [#15](#15)
* 重置版本号 ([55def4a](55def4a))

* ci: 修复 ci 取值错误的问题

* ci: 修改文档部署触发条件

* ci: 修改文档部署触发时机

* chore(release): 1.0.0 [skip ci]

# 1.0.0 (2023-05-30)

### Features

* 添加文档框架 ([1e64c6b](1e64c6b))
* 添加文档框架 ([da23561](da23561))
* 清除历史日志,项目迁移 ([5ec0f43](5ec0f43))
* 计算文字宽度 ([03fb18c](03fb18c)), closes [#15](#15)
* 重置版本号 ([55def4a](55def4a))

* docs: 从 jsdoc 中转移文档到 vitepress

* chore: 移除有包含 LGPL-2.0 协议的库

为防止协议的传染,移除了该库 @see
https://www.gnu.org/licenses/license-compatibility.zh-cn.html

* upgrade: 更新依赖

* feat: 项目名称由 common-util 改为 common-utils

BREAKING CHANGE: 🧨 项目名称由 common-util 改为 common-utils

* feat: 更新依赖并重置版本号

---------

Co-authored-by: liu <liunian7965@navinfo.com>
Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
ni-team-bot pushed a commit that referenced this issue Jun 2, 2023
# 1.0.0 (2023-06-02)

### Bug Fixes

* 修复由于修改仓库名而丢失的链接 ([752f3b9](752f3b9))
* 修复由于修改仓库名而丢失的链接 ([ccb0cac](ccb0cac))

### Features

* 添加文档框架 ([1e64c6b](1e64c6b))
* 添加文档框架 ([1960f59](1960f59))
* 添加文档框架 ([a7aa14b](a7aa14b))
* 添加文档框架 ([da23561](da23561))
* 清除历史日志,项目迁移 ([5ec0f43](5ec0f43))
* 计算文字宽度 ([03fb18c](03fb18c)), closes [#15](#15)
* 重置版本号 ([55def4a](55def4a))
@ni-team-bot
Copy link
Member

🎉 This issue has been resolved in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

alanwhy added a commit that referenced this issue Jun 14, 2023
* feat: 计算文字宽度

✅ Closes: #15

* chore(release): 1.0.0-development.1 [skip ci]

# 1.0.0-development.1 (2023-05-25)

### Features

* 清除历史日志,项目迁移 ([5ec0f43](5ec0f43))
* 计算文字宽度 ([b916185](b916185)), closes [#15](#15)
* 重置版本号 ([55def4a](55def4a))

* docs: update README.md

---------

Co-authored-by: liu <liunian@2077tech.com>
Co-authored-by: liu <liunian7965@navinfo.com>
Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
Co-authored-by: wuhaoyuan <wuhaoyuan@cennavi.com.cn>
@github-actions
Copy link

github-actions bot commented Jul 2, 2023

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。

@github-actions github-actions bot locked and limited conversation to collaborators Jul 2, 2023
alanwhy added a commit that referenced this issue Jul 19, 2023
* ci: 新增 action 手动触发

* ci: 新增手动 action 提示

* chore(release): 1.1.0-beta.1 [skip ci]

# [1.1.0-beta.1](v1.0.0...v1.1.0-beta.1) (2023-06-14)

### Features

* 添加文档搜索功能 ([#24](#24)) ([9248fb6](9248fb6))

* docs: update README.md (#17)

* feat: 计算文字宽度

✅ Closes: #15

* chore(release): 1.0.0-development.1 [skip ci]

# 1.0.0-development.1 (2023-05-25)

### Features

* 清除历史日志,项目迁移 ([5ec0f43](5ec0f43))
* 计算文字宽度 ([b916185](b916185)), closes [#15](#15)
* 重置版本号 ([55def4a](55def4a))

* docs: update README.md

---------

Co-authored-by: liu <liunian@2077tech.com>
Co-authored-by: liu <liunian7965@navinfo.com>
Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
Co-authored-by: wuhaoyuan <wuhaoyuan@cennavi.com.cn>

* ci: 修改触发单元测试覆盖率的分支

old:main -> new:development

* ci: 兼容新版 vitest

vitest-dev/vitest#3339

* ci: 测试覆盖率前生成 banner

* test: 单元测试更新 (#28)

Co-authored-by: lyj <liyanjie@cennavi.com.cn>

* docs: readme update (#30)

Co-authored-by: wuhaoyuan <wuhaoyuan@cennavi.com.cn>

* build: 使用 pnpm 替代 yarn (#31)

* feat: 异步加载文件成功提示信息 (#32)

Co-authored-by: wuhaoyuan <wuhaoyuan@cennavi.com.cn>
Co-authored-by: liu <liunian@2077tech.com>

* feature: 更新 load 方法,并修改 vite 打包暴露的全局变量名称为 niUtils (#33)

* refactor: 修改默认暴露名称

* fix: 修改load的函数

---------

Co-authored-by: wuhaoyuan <wuhaoyuan@cennavi.com.cn>
Co-authored-by: wuhaoyuan <wuhaoyuan11101@navinfo.com>

* feat: 补充单元测试并增加 e2e 相关测试 (#34)

* feat: 单元测试增加jsdom相关测试

* test: 添加 e2e 的测试并使用 eslint 重新格式化整个项目

* feat: 新增获取元素样式的值的函数

* test: 修复错误的 computedTextWidth 测试用例逻辑

* ci: 添加 cypress 的缓存

---------

Co-authored-by: lyj <liyanjie@cennavi.com.cn>
Co-authored-by: liunian <liunian@2077tech.com>

---------

Co-authored-by: liunian <liunian@2077tech.com>
Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
Co-authored-by: liu <liunian7965@navinfo.com>
Co-authored-by: wuhaoyuan <wuhaoyuan@cennavi.com.cn>
Co-authored-by: 李彦杰 <1132925293@qq.com>
Co-authored-by: lyj <liyanjie@cennavi.com.cn>
Co-authored-by: wuhaoyuan <wuhaoyuan11101@navinfo.com>
@ni-team-bot
Copy link
Member

🎉 This issue has been resolved in version 1.1.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

liunnn1994 added a commit that referenced this issue Jul 19, 2023
* publish (#38)

* ci: 新增 action 手动触发

* ci: 新增手动 action 提示

* chore(release): 1.1.0-beta.1 [skip ci]

# [1.1.0-beta.1](v1.0.0...v1.1.0-beta.1) (2023-06-14)

### Features

* 添加文档搜索功能 ([#24](#24)) ([9248fb6](9248fb6))

* docs: update README.md (#17)

* feat: 计算文字宽度

✅ Closes: #15

* chore(release): 1.0.0-development.1 [skip ci]

# 1.0.0-development.1 (2023-05-25)

### Features

* 清除历史日志,项目迁移 ([5ec0f43](5ec0f43))
* 计算文字宽度 ([b916185](b916185)), closes [#15](#15)
* 重置版本号 ([55def4a](55def4a))

* docs: update README.md

---------

Co-authored-by: liu <liunian@2077tech.com>
Co-authored-by: liu <liunian7965@navinfo.com>
Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
Co-authored-by: wuhaoyuan <wuhaoyuan@cennavi.com.cn>

* ci: 修改触发单元测试覆盖率的分支

old:main -> new:development

* ci: 兼容新版 vitest

vitest-dev/vitest#3339

* ci: 测试覆盖率前生成 banner

* test: 单元测试更新 (#28)

Co-authored-by: lyj <liyanjie@cennavi.com.cn>

* docs: readme update (#30)

Co-authored-by: wuhaoyuan <wuhaoyuan@cennavi.com.cn>

* build: 使用 pnpm 替代 yarn (#31)

* feat: 异步加载文件成功提示信息 (#32)

Co-authored-by: wuhaoyuan <wuhaoyuan@cennavi.com.cn>
Co-authored-by: liu <liunian@2077tech.com>

* feature: 更新 load 方法,并修改 vite 打包暴露的全局变量名称为 niUtils (#33)

* refactor: 修改默认暴露名称

* fix: 修改load的函数

---------

Co-authored-by: wuhaoyuan <wuhaoyuan@cennavi.com.cn>
Co-authored-by: wuhaoyuan <wuhaoyuan11101@navinfo.com>

* feat: 补充单元测试并增加 e2e 相关测试 (#34)

* feat: 单元测试增加jsdom相关测试

* test: 添加 e2e 的测试并使用 eslint 重新格式化整个项目

* feat: 新增获取元素样式的值的函数

* test: 修复错误的 computedTextWidth 测试用例逻辑

* ci: 添加 cypress 的缓存

---------

Co-authored-by: lyj <liyanjie@cennavi.com.cn>
Co-authored-by: liunian <liunian@2077tech.com>

---------

Co-authored-by: liunian <liunian@2077tech.com>
Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
Co-authored-by: liu <liunian7965@navinfo.com>
Co-authored-by: wuhaoyuan <wuhaoyuan@cennavi.com.cn>
Co-authored-by: 李彦杰 <1132925293@qq.com>
Co-authored-by: lyj <liyanjie@cennavi.com.cn>
Co-authored-by: wuhaoyuan <wuhaoyuan11101@navinfo.com>

* feat: 修改 keywords

* chore(release): 1.1.0 [skip ci]

# [1.1.0](v1.0.0...v1.1.0) (2023-07-19)

### Features

* 修改 keywords ([11c4e02](11c4e02))
* 添加文档搜索功能 ([#24](#24)) ([9248fb6](9248fb6))

* fix: 修复 preinstall 导致的错误

---------

Co-authored-by: alanwhy <34852024+alanwhy@users.noreply.github.com>
Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
Co-authored-by: liu <liunian7965@navinfo.com>
Co-authored-by: wuhaoyuan <wuhaoyuan@cennavi.com.cn>
Co-authored-by: 李彦杰 <1132925293@qq.com>
Co-authored-by: lyj <liyanjie@cennavi.com.cn>
Co-authored-by: wuhaoyuan <wuhaoyuan11101@navinfo.com>
@ni-team-bot
Copy link
Member

🎉 This issue has been resolved in version 1.2.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@ni-team-bot
Copy link
Member

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。

1 similar comment
@ni-team-bot
Copy link
Member

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants