-
Notifications
You must be signed in to change notification settings - Fork 187
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
#2060: Don't break the selection if the user's cursor goes beyond the canvas #2071
#2060: Don't break the selection if the user's cursor goes beyond the canvas #2071
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eaa2bff
to
35c91bb
Compare
35c91bb
to
838bf08
Compare
{ target: clientArea, eventName: 'mousedown' }, | ||
{ target: document, eventName: 'mousemove' }, | ||
{ target: document, eventName: 'mouseup' }, | ||
{ target: document, eventName: 'mouseleave' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi 😃 seems it causes a small bug: pasted structure is here to stay when the mouse is moving outside the canvas.
Steps to Reproduce
- Cut or copy a structure
Ctrl+v
to paste it on the canvas- Move the mouse to the toolbar
Actual behavior
The pasted structure is still here
Expected behavior
The pasted structure disappears. The following GIF is created on v2.7.0 RC test remote version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have explicit requirements to remove it when over a toolbar?
Why should we use controversial logic for different tools? We do not break selection when going over toolbars, why should we break copy-paste action?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. Actually, sometimes I'm a bit confused about some controversial logic. Thanks for your fast reply :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And please check out this one. The hand tool is still following the cursor when moving outside the canvas.
I'm not sure if it's caused by that line of code, but I guess it's because the mouseleave
event is not triggered. The following code in ketcher-react/src/script/ui/views/components/StructEditor/StructEditor.jsx
may help.
case 'leave':
this.editorRef.current.classList.remove(classes.enableCursor)
this.setState({
enableCursor: false
})
break
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that does look weird. Thanks for noticing.
I think it deserves its own issue on the board. I'll look into it later.
Now selection tool does not break when cursor leaves canvas.
Fixes #2060