From 0979b84b90e6396aa1f26a9918136a826931fd36 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sun, 18 Dec 2022 19:57:56 -0500 Subject: node-2d: Add place-at, place-at-x, place-at-y procedures. --- catbird/node-2d.scm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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." -- cgit v1.2.3