Skip to content

Commit

Permalink
add 'crop' as a synonym for 'rectEnvelope'
Browse files Browse the repository at this point in the history
  • Loading branch information
byorgey committed Jun 20, 2018
1 parent b501c12 commit 1f863bf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Diagrams/TwoD.hs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ module Diagrams.TwoD

, extrudeLeft, extrudeRight, extrudeBottom, extrudeTop

, rectEnvelope
, rectEnvelope, crop

-- ** Background

Expand Down
9 changes: 7 additions & 2 deletions src/Diagrams/TwoD/Combinators.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ScopedTypeVariables #-}
Expand Down Expand Up @@ -32,7 +32,7 @@ module Diagrams.TwoD.Combinators

, extrudeLeft, extrudeRight, extrudeBottom, extrudeTop

, rectEnvelope
, rectEnvelope, crop

, boundingRect, bg, bgFrame

Expand Down Expand Up @@ -245,6 +245,11 @@ rectEnvelope :: forall b n m. (OrderedField n, Monoid' m)
=> Point V2 n -> V2 n -> QDiagram b V2 n m -> QDiagram b V2 n m
rectEnvelope p (V2 w h) = withEnvelope (rect w h # alignBL # moveTo p :: Path V2 n)

-- | A synonym for 'rectEnvelope'.
crop :: forall b n m. (OrderedField n, Monoid' m)
=> Point V2 n -> V2 n -> QDiagram b V2 n m -> QDiagram b V2 n m
crop = rectEnvelope

-- | Construct a bounding rectangle for an enveloped object, that is,
-- the smallest axis-aligned rectangle which encloses the object.
boundingRect :: ( InSpace V2 n a, SameSpace a t
Expand Down

0 comments on commit 1f863bf

Please sign in to comment.