Center text stickers around point

This commit is contained in:
Emi Simpson 2023-06-27 13:57:50 -04:00
parent c126291ef8
commit e7e61bbd4e
Signed by: Emi
GPG Key ID: A12F2C2FFDC3D847
1 changed files with 7 additions and 3 deletions

View File

@ -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 ]