Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graphics.Element middle position can be off by one pixel due to rounding #59

Closed
parkermalenke opened this issue Dec 19, 2014 · 1 comment

Comments

@parkermalenke
Copy link

Hello,

Just started playing around with Elm and am finding it very impressive! Keep up the great work.

I noticed that in certain cases attempting to position an element in the middle of another element results in a layout that is off by a single pixel. I believe this is because line 241 and 236 in the source javascript are using the bitwise or to round towards a single pixel instead of something like Math.round().

For a reproduction see this example which should draw a red rectangle with a single pixel border all the way around, but instead draws it with a 2px border at the top and left only.

import Graphics.Element (..)
import Color (red, blue)

main = spacer 99 19
  |> color red
  |> container 101 21 middle
  |> color blue

screen shot 2014-12-18 at 9 00 33 pm

On an unrelated note, I noticed P, Z, and N seem to refer to different methods of setting an axis origin for positioning. This terminology is unfamiliar to me and I would be interested to know what it refers to.

@evancz
Copy link
Member

evancz commented May 11, 2016

Sorry this did not get attention til now! The Graphics.* modules now live in evancz/elm-graphics so I am trying to get stuff migrated over there. I'm hoping this will make it easier to get help on stuff like this!

@evancz evancz closed this as completed May 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants