Quicksaver / The-Fox--Only-Better

A Firefox add-on to improve the feeling of using the new Australis theme.
https://addons.mozilla.org/firefox/addon/the-fox-only-better/
Mozilla Public License 2.0
91 stars 22 forks source link

Slim Chrome - proximity trigger add #164

Closed ZeroUnderscoreOu closed 8 years ago

ZeroUnderscoreOu commented 8 years ago

Hi. Would it be possible without any excessive load on the browser to add a proximity trigger for Slim Chrome, so it would appear not only on hover, but also when the cursor is at set distance to the top panel?

Quicksaver commented 8 years ago

Doing it is technically possible, but not without an excessive toll on the browser like you asked. It would have to follow every single mouse movement, calculate its direction and speed, and compare with the boundaries of the toolbars. This is a lot to process, at least dozens and possibly hundreds of times in a fraction of a second while the mouse moves.

And to be honest, I don't think the gain outweighs the effort of implementing something like this, especially because it could noticeably lag down the browser.

ZeroUnderscoreOu commented 8 years ago

Yea, constantly checking the position was my initial thought, and it's clearly intensive. But later I got another idea. I don't know which of this would work, as I don't know if UI event handling is different from JS's: instead of checking cursor position, add a transparent panel at the targeted location and add a OnMouseOver event. The question is how to make it trigger and not capturing another input. In some other environment making it transparent and keeping on top would work, but not with JS. Moving it to background would work too, but then it should wrap overlapped elements at the same time (viewed page, probably). But it surely would work with JS and proper CSS. Also theoretically you could capture events but continue their propagation to underlying elements.

I'll understand if you wouldn't want to add that, probably I would be able to add it myself when I'll get familiar with UI structure & stuff. But for me that functionality would definitely be an improvement.

Quicksaver commented 8 years ago

The question is how to make it trigger and not capturing another input.

Exactly. You don't. ;) You either capture all mouse events or none. For instance, to add a mouseover handler to that panel, it would have to be on top of the toolbars/webpage/whatever, otherwise if it was behind those the handler wouldn't capture (because the mouse wouldn't actually enter the panel). But if it's on top, then you can't click on whatever's behind it, because you're actually clicking the panel.

Also theoretically you could capture events but continue their propagation to underlying elements.

I don't know how to do this, I don't believe it's possible without simulating extra clicks at the same coordinates on whatever's behind it for instance. And that means at least double the events.