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

a bug #56

Closed
wangzhedong opened this issue Feb 20, 2019 · 3 comments
Closed

a bug #56

wangzhedong opened this issue Feb 20, 2019 · 3 comments

Comments

@wangzhedong
Copy link

当文字的长度超过了单元的宽度,点击文本对齐的居中,或者居右,会出现文字溢出到左边单元格的情况,这个怎么解决?

@wangzhedong
Copy link
Author

draw.js 222 line
add code:
substring the text
if(txtWidth > box.innerWidth() && align != 'left'){
let singleTxtDpr = txtWidth/txt.length;
let overCellDpr = txtWidth-box.innerWidth();
let txtCount = Math.round(overCellDpr/singleTxtDpr);
txt = txt.substring(txtCount,txt.length);
}

@myliang
Copy link
Owner

myliang commented Feb 21, 2019

等我重构一下核心代码,再修改这个问题

@wangzhedong
Copy link
Author

我们这边项目用了一个quicksheet的插件,这个插件也有这个问题,我们解决方案是用离屏canvas解决的,我上面贴的那段代码也能解决这个问题,就是算文本的像素位置,然后截断

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

No branches or pull requests

2 participants