Skip to content

Commit

Permalink
fix Dashing transform
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyrosenbluth committed Mar 25, 2014
1 parent e625a48 commit 2578d59
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/Diagrams/TwoD/Attributes.hs
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,18 @@ instance AttributeClass DashingA
type instance V DashingA = R2

instance Transformable DashingA where
transform t (DashingA (Last (Dashing [Local w] (Local v)))) =
DashingA (Last (Dashing [Local r] (Local s)))
transform t (DashingA (Last (Dashing w v))) =
DashingA (Last (Dashing (trLocals w) (trLocal v)))
where
r = avgScale t * w
s = avgScale t * v
transform _ l = l
s = avgScale t

trLocals [] = []

This comment has been minimized.

Copy link
@byorgey

byorgey Mar 25, 2014

Member

trLocals = map trLocal

This comment has been minimized.

Copy link
@byorgey

byorgey Mar 25, 2014

Member

Now might be a good time to just go ahead and make a Transformable instance for Measure and refactor all these Transformable instances to use it.

trLocals ((Local h) : tl) = Local (h * s) : trLocals tl
trLocals (x : tl) = x : trLocals tl

trLocal (Local y) = Local (y * s)
trLocal z = z


getDashing :: DashingA -> Dashing
getDashing (DashingA (Last d)) = d
Expand Down

1 comment on commit 2578d59

@jeffreyrosenbluth
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea

Please sign in to comment.