gampleman / elm-visualization

A data visualization library for Elm

Home Page:http://package.elm-lang.org/packages/gampleman/elm-visualization/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ForceDirectedGraph example: node does not follow mouse on drag.

Anton-4 opened this issue · comments

Clicking on a circle results the circle to be displaced with some offset from the mouse.
This offset gets larger as the drag coordinates get larger.
So at (x:0, y:0) the circle is located at the position of the mouse, for larger coordinates this is no longer the case. This offset getting larger implies the drag coordinates are erroneously multiplied by some factor.

I looked around somewhat but could not find the cause of this bug.

image
image
image

Did you get this issue when running the example in isolation (aka outside the examples website?)

This is a problem with responsive SVG scaling. I've been working on solutions but Elm is unfortunately missing some SVG methods to make this straightforward. You can see #86 for an example that solves this problem.

Yes it did happen in isolation.

Alright, I'll see if I can transfer the solution from #86.

We'll merge #86 soon-ish. I'd like to keep some of the complexity out if possible. I suspect that the simplest solution for this would be just to set the SVG width and height attributes.

AFAIK this can be closed? I don' think there is a staightforward fix, apart from doing some of the stuff in the example.