phetsims / inverse-square-law-common

GNU General Public License v3.0
1 stars 2 forks source link

ISLCGridNode doesn't align with model #49

Closed jessegreenberg closed 6 years ago

jessegreenberg commented 6 years ago

Not a big deal, but the ISLCGridNode, which is useful for debugging, doesn't quite align with the model. The model behavior still looks correct without the visible grid, but it would still nice to figure out why this is. Could be something about the drawing code in ISLCGridNode. Maybe the stroke extends outside of the shape, so the gridPosition needs to be offset by 1/2 of the lineWidth? Or maybe the node just needs to be centered correctly in the subtypes. @mbarlow12 would you mind looking into this further?

capture

mbarlow12 commented 6 years ago

Fixed by subtracting 1 from layoutBounds.minX. See the above commit—funny.

jessegreenberg commented 6 years ago

@mbarlow12 could you please add a comment about why that is necessary? Is it related to the line width?

mbarlow12 commented 6 years ago

The lines all appear to be the same width except those connecting the charges to their arrows. I'm not entirely sure why this works. One possibility is how Shape draws the line? I haven't looked into it in detail; however, I doubt that everything in the model is shifted over by 1 pixel.

Perhaps this is worth investigating after the a11y work has cooled a bit.

jessegreenberg commented 6 years ago

One possibility is how Shape draws the line

Thats what I suspected too, but I tried bumping up the line width and your fix still works. Thanks for looking into it, and I agree it doesn't seem worth more time now. Closing.