Center text stickers around point
This commit is contained in:
parent
c126291ef8
commit
e7e61bbd4e
|
@ -2,7 +2,7 @@ module Stickers exposing (Sticker, StickerContent(..), viewSticker)
|
|||
|
||||
import String exposing (fromInt)
|
||||
import Svg exposing (Svg, text, text_)
|
||||
import Svg.Attributes exposing (fill, fontSize, x, y)
|
||||
import Svg.Attributes exposing (fill, fontSize, textAnchor, x, y)
|
||||
|
||||
type alias Sticker =
|
||||
{ content: StickerContent
|
||||
|
@ -21,10 +21,14 @@ viewSticker sticker =
|
|||
let
|
||||
attributes =
|
||||
[ x <| fromInt sticker.x
|
||||
, y <| fromInt sticker.y
|
||||
, y <| fromInt (sticker.y + 100)
|
||||
]
|
||||
in case sticker.content of
|
||||
TextSticker textContent color ->
|
||||
text_
|
||||
(fill color :: fontSize "200px" :: attributes)
|
||||
( fill color
|
||||
:: fontSize "200px"
|
||||
:: textAnchor "middle"
|
||||
:: attributes
|
||||
)
|
||||
[ text textContent ]
|
Loading…
Reference in a new issue