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

Juxtaposing padded lines not working as expected. #330

Open
bacchanalia opened this issue Mar 11, 2019 · 4 comments
Open

Juxtaposing padded lines not working as expected. #330

bacchanalia opened this issue Mar 11, 2019 · 4 comments

Comments

@bacchanalia
Copy link

I expect there to be separation between the segments because of the padX, but there is not.
padline

{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
module Main where
import Diagrams.Prelude
import Diagrams.Backend.Cairo.CmdLine

ex :: Diagram Cairo
ex = foldl1 (|||) $ map (padX 2) [l, r # lc red]
  where
    l = strokeP $ p2 (0, 0) ~~ p2 (1, 1)
    r = strokeP $ p2 (1, 1) ~~ p2 (2, 0)

dia :: Diagram Cairo
dia = (centerXY ex # pad 1.1)

main = mainWith (dia # bg white)
@byorgey
Copy link
Member

byorgey commented Mar 11, 2019

What version of diagrams-lib are you using?

@bacchanalia
Copy link
Author

I'm using HEAD.

@byorgey
Copy link
Member

byorgey commented Mar 11, 2019

l seems to work fine. But something funky is going on with the envelope of r:

image

{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies     #-}

module Main where

import           Diagrams.Backend.Rasterific.CmdLine
import           Diagrams.Prelude

ex2 :: Diagram Rasterific
ex2 = hcat . map showEnvelope $ [r, padX 2 r]
  where
    r = strokeP $ p2 (1, 1) ~~ p2 (2, 0)

dia :: Diagram Rasterific
dia = (centerXY ex2 # pad 1.1)

main = mainWith (dia # bg white)

@byorgey
Copy link
Member

byorgey commented Mar 11, 2019

@bacchanalia , incidentally, foldl1 (|||) should be equivalent to hcat.

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