graphicsvg icon indicating copy to clipboard operation
graphicsvg copied to clipboard

[notify functions] mouse co-ordinates broken in Firefox

Open CSchank opened this issue 5 years ago • 7 comments

Related to the way co-ordinates are calculated within a div after the introduction of widgets. Seems to work in 7.0.0 if I remember correctly. Thanks to @kapooa13 for finding this again. I had noticed it a while ago but forgot to file an issue.

CSchank avatar May 24 '19 02:05 CSchank

Ah, so is that what this is about?

update Msg: PointerMove (Infinity,-Infinity)

Erudition avatar Jan 16 '22 19:01 Erudition

Found this same issue in Chromium now too. Merging #2 is a great idea for preventing this Infinity nonsense, but the logic for calculating coordinates is still buggy... Do I have to downgrade to 7.0.0?

Erudition avatar Jan 16 '22 19:01 Erudition

Oh, is it really? This traditionally has been an issue in Firefox but we've stuck to Chromium-based browsers instead. Hmm.

CSchank avatar Jan 16 '22 20:01 CSchank

Downgrading to 7.0.0 seems to force going a major version back in elm/http, so I tried 7.1.0. No difference.

I suspect 7.0.0 would not have worked better, simply looking at the commits since then - can't see anything that would change the viewPort calculation. Only thing I notice is the width and height of the SVG is specified differently, but when manually adjusting that (via inspecting element) it does not fix it either.

I really wanted to try this library as a widget in my app, and spent a bunch of time wiring it all up, but I did not realize the project seems more or less abandoned. I definitely need the mouse features, and I would fork it if I knew how to fix it...

Erudition avatar Jan 16 '22 20:01 Erudition

Fascinating, I managed to find a way to get correct behavior - resizing the window. Triggering a resize message seems to get the pointer coordinates to come out correctly (or at least not infinity) in both Chromium and Firefox: image

Erudition avatar Jan 16 '22 20:01 Erudition

Oh! Did you use the initial commands provided by GraphicSVG? This is needed to poll for the screen size at the very beginning (if you don't do this you're likely getting a division by zero which leads to Infinity). Which kind of app are you using? I assume one of the more manual ones which doesn't do this for you.

CSchank avatar Jan 17 '22 00:01 CSchank

Oh jeez, yes I was creating the initial widget state in my model (in a dictionary no less) init function which Isn't meant to spit out commands... had to rewire everything to support page-specific init commands, but yes, now it works!! (In both browsers btw) Thank you!

Erudition avatar Jan 19 '22 00:01 Erudition