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

another approach #1

Open
xem opened this issue May 21, 2014 · 1 comment
Open

another approach #1

xem opened this issue May 21, 2014 · 1 comment

Comments

@xem
Copy link
Member

xem commented May 21, 2014

Hi, nice project!

Here's an idea that is a bit dirty but could make a shorter code and a better compatibility (multiple checkboxes, firefox, ... which is not currently the case)

The textarea contains monospace characters. They are something like 10*18px each.

So when the user clicks the textarea, knowing the mouse position in the textarea, you can compute which character is clicked, and if this character is part of "[ ]", replace it with "[x]".

The only trap is to handle line breaks / line wraps correctly. But that's doable.

@subzey
Copy link
Member

subzey commented May 21, 2014

Uhh... I guess we'll have to deal with scrollTop/scrollWidth in that case. And glyph metrics may vary a lot depending on font face.

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