Closed kolchanov closed 6 years ago
Hi @kolchanov , I think the problem is that you apply named "b"
after translating the rectangle. This can be a bit counterintuitive, but named
always attaches a name to the local origin of the diagram, and translateX
and translateY
work by moving the diagram relative to the local origin. You can see this if you do rect 2 1 # translateX 3 # translateY (-3) # showOrigin
, which will show you the point to which a name will be attached if you use named
at that point.
I think what you want to do is just switch the call to named
to come before the calls to translateX
and translateY
. Let us know if that works!
This recommendation works for me. Thank you!
Great! Glad to help.
{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE NoMonomorphismRestriction #-}
import Diagrams.Prelude import Diagrams.Backend.SVG.CmdLine
out :: Diagram B out = (rect 2 1 # named "a" ||| rect 2 1 # translateX 3 # translateY (-3) # named "b") # connect "a" "b"
main = mainWith ( out )
produces arrow with wrong endpoint