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

Overlay layer with SVG is only showing on top left tile #1

Closed
tilmans opened this issue Oct 5, 2017 · 2 comments
Closed

Overlay layer with SVG is only showing on top left tile #1

tilmans opened this issue Oct 5, 2017 · 2 comments

Comments

@tilmans
Copy link

tilmans commented Oct 5, 2017

Drawing an overlay layer with a simple SVG circle. The circle shows on the top-left tile but the other tiles seem to have a higher z-index and hide the SVG.

Browser: Chrome 61 on Mac OS

render : List Location -> Map msg -> Svg msg
render locations map =
    let
        size =
            Map.size map

        locToScreen =
            Map.locationToScreenPoint map

        pointList =
            List.map locToScreen locations

        circles =
            List.map
                (\{ x, y } ->
                    circle
                        [ cx (toString x)
                        , cy (toString y)
                        , r "20"
                        , stroke "red"
                        ]
                        []
                )
                pointList
    in
        svg [] circles


layer : List Location -> Layer msg
layer locations =
    Layer.overlay |> Layer.custom (render locations)

2017-10-05 at 20 37

@tilmans tilmans closed this as completed Oct 5, 2017
@tilmans
Copy link
Author

tilmans commented Oct 5, 2017

Never mind, being stupid. Note to future self: Make sure to set the correct SVG canvas size ...

@klaftertief
Copy link
Owner

Glad you figured it out. Setting the dimensions was not needed in an earlier iteration as the svg element was created automatically. I'll have this in mind when writing some proper documentation, soon.

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