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

event/away? stays false when mouse exit face whil LMB is down #5472

Open
luce80 opened this issue Jan 31, 2024 · 6 comments
Open

event/away? stays false when mouse exit face whil LMB is down #5472

luce80 opened this issue Jan 31, 2024 · 6 comments
Assignees
Labels
GUI type.review Ticket describes a possible improvement.

Comments

@luce80
Copy link

luce80 commented Jan 31, 2024

Describe the bug
When I have the left mouse button down I don't receive away? = true notifications, neither in event/away? nor in event/flags

To reproduce
print "" ; open console
view [base all-over on-over [?? event/away? ?? event/flags]]

Expected behavior
Even if LMB is down event/away? should return true when the mouse cursor exits the face boundaries.

Platform version

>> about/debug
-----------RED & PLATFORM VERSION----------- 
RED: [ branch: "master" tag: #v0.6.4 ahead: 5092 date: 24-Jan-2024/4:14:00 commit: #10dc97b01cda5bb347f2ca5741da7a82f02b37a4 ]
PLATFORM: [ name: "Windows 11" OS: 'Windows arch: 'x86-64 version: 10.0.0 build: 22631 ]
--------------------------------------------
@hiiamboris
Copy link
Collaborator

hiiamboris commented Jan 31, 2024

Your test doesn't show it, but I now think what happens is face gets locked to enable dragging. So away? gets generated once LMB is up. So this is more a question of naming, we think of away? as geometric property, but it's more complex. And whether away? should be applied to the last event with LMB down, or like now - only after its release. And of how do we control the locking? Does OS even allow us or we have to check the offsets?

@hiiamboris hiiamboris added the GUI label Jan 31, 2024
@qtxie
Copy link
Contributor

qtxie commented Feb 1, 2024

Your test doesn't show it, but I now think what happens is face gets locked to enable dragging. So away? gets generated once LMB is up. So this is more a question of naming, we think of away? as geometric property, but it's more complex. And whether away? should be applied to the last event with LMB down, or like now - only after its release. And of how do we control the locking? Does OS even allow us or we have to check the offsets?

We need a new option to control the locking.

@qtxie
Copy link
Contributor

qtxie commented Feb 1, 2024

Expected behavior
Even if LMB is down event/away? should return true when the mouse cursor exits the face boundaries.

@luce80 What's the use case for this?

@dockimbel dockimbel added the type.review Ticket describes a possible improvement. label Feb 1, 2024
@luce80
Copy link
Author

luce80 commented Feb 1, 2024

I am trying to implement an area using rich-text. When I start selecting the text and then , while still selecting, I exit the boundaries I expect the text to scroll to be able to continue selecting (like you can do in this same GitHub editor...). To do this it would be nice if event/away? still works even when LMB is down.
P.S. my example shows that if you click on the gray base and then try to "drag" it, when you exit it event/away? remains false.

@qtxie
Copy link
Contributor

qtxie commented Feb 2, 2024

@luce80 Checking event/offset in the over event is a better option. You can know which edge the mouse cursor is on by checking event/offset and how far away from the edge.

@luce80
Copy link
Author

luce80 commented Feb 2, 2024

Ok, never mind, the fix was quite easy:

away?: func [face event][event/offset <> min max 0x0 event/offset face/size]

I spent more time writing in this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GUI type.review Ticket describes a possible improvement.
Projects
None yet
Development

No branches or pull requests

4 participants