@@ -388,11 +388,11 @@ data TextAlign
388
388
= AlignLeft | AlignRight | AlignCenter | AlignStart | AlignEnd
389
389
390
390
instance showTextAlign :: Show TextAlign where
391
- show AlignLeft = " left "
392
- show AlignRight = " right "
393
- show AlignCenter = " center "
394
- show AlignStart = " start "
395
- show AlignEnd = " end "
391
+ show AlignLeft = " AlignLeft "
392
+ show AlignRight = " AlignRight "
393
+ show AlignCenter = " AlignCenter "
394
+ show AlignStart = " AlignStart "
395
+ show AlignEnd = " AlignEnd "
396
396
397
397
foreign import textAlignImpl :: forall eff . Context2D -> Eff (canvas :: Canvas | eff ) String
398
398
@@ -414,7 +414,13 @@ foreign import setTextAlignImpl :: forall eff. Context2D -> String -> (Eff (canv
414
414
-- | Set the current text alignment.
415
415
setTextAlign :: forall eff . Context2D -> TextAlign -> Eff (canvas :: Canvas | eff ) Context2D
416
416
setTextAlign ctx textalign =
417
- setTextAlignImpl ctx (show textalign)
417
+ setTextAlignImpl ctx (toString textalign)
418
+ where
419
+ toString AlignLeft = " left"
420
+ toString AlignRight = " right"
421
+ toString AlignCenter = " center"
422
+ toString AlignStart = " start"
423
+ toString AlignEnd = " end"
418
424
419
425
-- | Text metrics:
420
426
-- |
@@ -482,14 +488,22 @@ foreign import drawImageFull :: forall eff. Context2D -> CanvasImageSource -> Nu
482
488
-- | Enumerates the different types of pattern repetitions.
483
489
data PatternRepeat = Repeat | RepeatX | RepeatY | NoRepeat
484
490
491
+ instance showPatternRepeat :: Show PatternRepeat where
492
+ show Repeat = " Repeat"
493
+ show RepeatX = " RepeatX"
494
+ show RepeatY = " RepeatY"
495
+ show NoRepeat = " NoRepeat"
496
+
485
497
foreign import createPatternImpl :: forall eff . CanvasImageSource -> String -> Context2D -> Eff (canvas :: Canvas | eff ) CanvasPattern
486
498
487
499
-- | Create a new canvas pattern (repeatable image).
488
500
createPattern :: forall eff . CanvasImageSource -> PatternRepeat -> Context2D -> Eff (canvas :: Canvas | eff ) CanvasPattern
489
- createPattern img Repeat = createPatternImpl img " repeat"
490
- createPattern img RepeatX = createPatternImpl img " repeat-x"
491
- createPattern img RepeatY = createPatternImpl img " repeat-y"
492
- createPattern img NoRepeat = createPatternImpl img " no-repeat"
501
+ createPattern img repeat = createPatternImpl img (toString repeat)
502
+ where
503
+ toString Repeat = " repeat"
504
+ toString RepeatX = " repeat-x"
505
+ toString RepeatY = " repeat-y"
506
+ toString NoRepeat = " no-repeat"
493
507
494
508
-- | Set the Context2D fillstyle to the CanvasPattern.
495
509
foreign import setPatternFillStyle :: forall eff . CanvasPattern -> Context2D -> Eff (canvas :: Canvas | eff ) Context2D
0 commit comments