diff options
author | David Thompson <dthompson2@worcester.edu> | 2022-12-14 12:53:52 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2022-12-14 12:57:02 -0500 |
commit | b14358dc829b1b866016c364219d59f1e34ba474 (patch) | |
tree | 9575948645b7060348e985028265ddafb289d814 | |
parent | 0b1d3eeed88451c2c428de3d8904f21b4b1baade (diff) |
node-2d: Add methods for getting position/size in local space.
-rw-r--r-- | catbird/node-2d.scm | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/catbird/node-2d.scm b/catbird/node-2d.scm index a6a70bd..eb39b6b 100644 --- a/catbird/node-2d.scm +++ b/catbird/node-2d.scm @@ -60,7 +60,13 @@ expire-local-matrix follow-bezier-path local-bounding-box + local-height local-matrix + local-origin-x + local-origin-y + local-width + local-x + local-y move-by move-to on-child-resize @@ -405,6 +411,24 @@ (define-method (default-height (node <node-2d>)) 0.0) +(define-method (local-x (node <node-2d>)) + (rect-x (local-bounding-box node))) + +(define-method (local-y (node <node-2d>)) + (rect-y (local-bounding-box node))) + +(define-method (local-width (node <node-2d>)) + (rect-width (local-bounding-box node))) + +(define-method (local-height (node <node-2d>)) + (rect-height (local-bounding-box node))) + +(define-method (local-origin-x (node <node-2d>)) + (matrix4-transform-x (local-matrix node) 0.0 0.0)) + +(define-method (local-origin-y (node <node-2d>)) + (matrix4-transform-y (local-matrix node) 0.0 0.0)) + (define-method (on-child-resize node child) #t) |