-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Hold click to open glance #11343
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
base: dev
Are you sure you want to change the base?
Hold click to open glance #11343
Conversation
* Update ZenGlanceChild.sys.mjs * Update ZenActorsManager.sys.mjs * Update zenLooksAndFeel.inc.xhtml * Update zen-preferences.ftl
performance.now is lightweight so this method is fine, using XOR is kinda wrong I think considering odd numbers pass, and some default shortcuts use 3 modifier keys (god knows who uses them but they exist, even if they are weird e.g open linkedIn in default browser) moveThreshold not being squared(not checking diagonals properly) should be fine since its not that much of an importance, the default value 8px is small anyways. Signed-off-by: devdinc <[email protected]>
| #ensureOnlyOneModifierKeyIsPressed(event) { | ||
| return ( | ||
| [event.ctrlKey, event.altKey, event.shiftKey, event.metaKey].filter(Boolean).length === 1 | ||
| ); |
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.
I think we can make this ensureOnlyOneModifierKeyIsPressed faster and lighter by avoiding the array allocation and filter.
Since JavaScript coerces booleans to numbers during addition, we can just sum them up such as:
#ensureOnlyOneModifierKeyIsPressed(event) { return (event.ctrlKey + event.altKey + event.shiftKey + event.metaKey) === 1; }
This would be more lightweight for a high-frequency usage event handler. Nothing goes to the heap and nothing would need to be garbage collected.
|
Could you please show me a video on how it should look? |
There is no visual changes or an indicator. When mouse up is done after 300ms it opens glance. If you are wondering whether the code works, I have not really tested the code except some POC version that I posted into web console that logs the duration and the element. We can consider adding visual indicator, some circular slider like thing maybe? To cancel the visual indicator, we can create a message endpoint in parent. Adding an attribute on the top element is risky as before and after might be already used, so we need to create an element probably like a popup that has the same proportions and edit that using css. |
Added the ability to hold your mouse click button to open glance.
Don't know whether this is finished or not, so will do a draft PR.
activation ms threshold can be a preference, etc.
Also since we detect movement, it should fix the issue related to Alt + Hold Click to select links.