Move ManuallySized to a separate module.

Purpose: allow it to be used both for static and animated diagrams.
This commit is contained in:
Justus Sagemüller 2018-03-07 00:36:35 +01:00
parent 76945388e8
commit ad89fc4554
3 changed files with 13 additions and 9 deletions

View File

@ -1,5 +1,4 @@
{-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-}
{-# LANGUAGE DeriveFunctor, DeriveGeneric #-}
module IHaskell.Display.Diagrams
( diagram, animation
@ -12,14 +11,7 @@ import Diagrams.Backend.Cairo
import Diagrams.Prelude
import IHaskell.Display
import IHaskell.Display.Diagrams.Animation
import GHC.Generics (Generic)
data ManuallySized a = ManuallySized
{ contentToDisplay :: a
, imgManualWidth :: Double
, imgManualHeight :: Double
} deriving (Show, Functor, Generic)
import IHaskell.Display.Diagrams.ImgSize
instance IHaskellDisplay (ManuallySized (QDiagram Cairo V2 Double Any)) where
display renderable = do

View File

@ -0,0 +1,11 @@
{-# LANGUAGE DeriveFunctor, DeriveGeneric #-}
module IHaskell.Display.Diagrams.ImgSize where
import GHC.Generics (Generic)
data ManuallySized a = ManuallySized
{ contentToDisplay :: a
, imgManualWidth :: Double
, imgManualHeight :: Double
} deriving (Show, Functor, Generic)

View File

@ -52,6 +52,7 @@ library
-- Modules included in this library but not exported.
other-modules: IHaskell.Display.Diagrams.Animation
IHaskell.Display.Diagrams.ImgSize
-- Other library packages from which modules are imported.
build-depends: base >=4.6 && <5,