birchill / 10ten-ja-reader

A browser extension to translate Japanese by hovering over words.
https://addons.mozilla.org/firefox/addon/10ten-ja-reader/
GNU General Public License v3.0
609 stars 45 forks source link

Option to delay popup to appear #10

Closed Lebon14 closed 7 years ago

Lebon14 commented 7 years ago

Hi.

Thank you so so so much for bringing this to FF 57! Without this addon, I was upgrading from FF 56 at all.

Anyway, when I move my screen around and there's lots of Japanese, the popup appears INSTANTLY. So, even if pass even one frame over a character with my mouse, it's going to trigger and popup a box. It's kind of annoying. So, I was wondering you could implement some kind of delay (from, say, none to 500 ms) so that when I just moving my mouse around I'm not bothered by Rikaichamp popups for absolutely nothing.

Cheers and thanks for the hard work.

birtles commented 7 years ago

Not at all, you are very welcome! Thank you for using rikaichamp!

I was thinking of making rikaichamp detect the mouse velocity and only show the pop-up if the mouse is moving slowly or is stationary. Would that work for you?

Lebon14 commented 7 years ago

I'd have to see for myself, because, even when I move my mouse very fast over characters, the popup shows up. So yeah, that could help too.

birtles commented 7 years ago

I'll give it a try in the next release and if it doesn't work, I'll add the delay option.

Lebon14 commented 7 years ago

Awesome! Thanks for the hard work!

LuisOskar commented 7 years ago

@birtles I think a mix of the 2 is needed, since a fast mouse movement would disable the popup to be seen but once the mouse isn't moving it should show the popup of whatever word it is currently hovering over.

birtles commented 7 years ago

Yeah, I'll give it a try -- I assume the mouse won't normally stop on a dime so you'd get at least one mousemove event where the velocity is low enough to display the pop-up.

redshoulder commented 7 years ago

Yes, a delay would be very helpful, it wasn't needed before because rikaichan was very slow.

Lebon14 commented 7 years ago

With 0.10 here (where are the release notes btw?), it didn't improve at all... For testing, I was moving my mouse cursor over a tweet. You could see that the numerous popups. And it wasn't slow either; it was a very fast waggling over the text. :\

And, yes, in the past, Rikaichan was so slow that such option wasn't needed.

birtles commented 7 years ago

The release notes are:

And as you notice I haven't gotten to this issue yet. It's number 2 on my list of things to-do though (number 1 being fixing some problems I noticed when using Gmail's pop-up compose window).

I'll update this issue when I make some change.

birtles commented 7 years ago

I've tweaked this in version 0.0.11 so please give it a try. It's not perfect -- I set the speed tolerance for hiding the popup pretty high since otherwise the tooltip over images would rarely show (since you often do just mouse over the image and then stop) -- but let me know if it helps.

Also, it doesn't help with scrolling since I mistakenly used clientX and clientY instead of pageX and pageY. I'll fix that in the next release though.

Lebon14 commented 7 years ago

Perfect!! Works perfect!

birtles commented 7 years ago

Great! I'll fix the scrolling issue soon but it sounds like I can close this issue for now.