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

Fix/calculation error #18

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Fix/calculation error #18

wants to merge 3 commits into from

Conversation

LinXiaoTao
Copy link

@LinXiaoTao LinXiaoTao commented Jun 14, 2019

when ImageSpan is the first span, dx calculation error.

当 ImageSpan 作为第一个 span 时,dx 看起来计算不对,会遮挡后面的 span。

修复之前:
Screenshot_20190614-112909

修复之后:
Screenshot_20190614-113056

可能原因:
问题出在以下这些代码:

Offset offsetForCaret = getOffsetForCaret(       
  TextPosition(offset: textOffset),              
  bounds,                                        
);                                               

当 textOffset = 0 时,也就是第一个 span 是 ImageSpan,dx 应该等于 0,当调用 getOffsetForCaret() 后,offsetForCaret.dx 大于 0,所以导致第一个 ImageSpan 绘制到后面的 span 上了。

@2dxgujun
Copy link

发现如果外层设置了 padding,还是会有问题

@LinXiaoTao
Copy link
Author

@2dxgujun 看下我最新提交的。

@LinXiaoTao
Copy link
Author

if (textOffset == 0) {
          offsetForCaret = Offset(0, offsetForCaret.dy);
    }
}

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

Successfully merging this pull request may close these issues.

2 participants