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

Select and delete text in Textbox object does not clear the selection #3378

Closed
prokilogrammer opened this issue Oct 27, 2016 · 3 comments · Fixed by #3388
Closed

Select and delete text in Textbox object does not clear the selection #3378

prokilogrammer opened this issue Oct 27, 2016 · 3 comments · Fixed by #3388
Labels

Comments

@prokilogrammer
Copy link

prokilogrammer commented Oct 27, 2016

Version

1.6.5

Test Case

http://jsfiddle.net/1azfo9t6/

Steps to reproduce

  1. Create a canvas with selection = false
  2. Initialize a Textbox object
  3. Write text that wraps to multiple lines
  4. Select all the text inside the box
  5. Press "backspace" or "delete" to delete all the text

Expected Behavior

All the text gets deleted AND selection also gets cleared

Actual Behavior

All the text gets deleted BUT selection does NOT get cleared

@asturur
Copy link
Member

asturur commented Oct 27, 2016

oh ok. i see the bug :)

@asturur asturur added the bug label Oct 27, 2016
@prokilogrammer
Copy link
Author

Do you have a fix in mind? I tried taking a stab at it but didn't get too far. Looks like oldWidth and oldHeight of IText are being set to the shrunken box dimensions after removing characters - https://github.com/kangax/fabric.js/blob/master/src/shapes/itext.class.js#L314-L321. I tried setting oldWidth/oldHeight in removeChars() (https://github.com/kangax/fabric.js/blob/master/src/mixins/itext_key_behavior.mixin.js#L606) but no effect.

I would be happy to send a PR if you guide me in the right direction.

@asturur
Copy link
Member

asturur commented Oct 27, 2016

Yes the fix is clear the right part of the screen. i m heavely working on text those days for other reason, if i step into it, i will drop a notice here.

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

Successfully merging a pull request may close this issue.

2 participants