diff options
author | David Thompson <dthompson2@worcester.edu> | 2022-12-18 19:57:56 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2022-12-18 19:57:56 -0500 |
commit | 0979b84b90e6396aa1f26a9918136a826931fd36 (patch) | |
tree | 24ef29db4018307a333e080ae1f3246d9358da96 | |
parent | 966cfb53458e3aad27a092fcebd804a2fce6f474 (diff) |
node-2d: Add place-at, place-at-x, place-at-y procedures.
-rw-r--r-- | catbird/node-2d.scm | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/catbird/node-2d.scm b/catbird/node-2d.scm index a390201..eefb8f3 100644 --- a/catbird/node-2d.scm +++ b/catbird/node-2d.scm @@ -81,6 +81,9 @@ origin-y pick place-above + place-at + place-at-x + place-at-y place-below place-left place-right @@ -655,6 +658,18 @@ ;; the nodes are in the same local coordinate space. If this is not ;; the case, the results will be garbage. +(define (place-at-x node x) + (set! (position-x node) + (+ x (- (local-origin-x node) (local-x node))))) + +(define (place-at-y node y) + (set! (position-y node) + (+ y (- (local-origin-y node) (local-y node))))) + +(define (place-at node x y) + (place-at-x node x) + (place-at-y node y)) + (define* (place-right a b #:key (padding 0.0)) "Adjust B's x position coordinate so that it is PADDING distance to the right of A." |