diff options
-rw-r--r-- | catbird/node-2d.scm | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/catbird/node-2d.scm b/catbird/node-2d.scm index a81e2a6..9199536 100644 --- a/catbird/node-2d.scm +++ b/catbird/node-2d.scm @@ -336,7 +336,6 @@ ;; transformation matrix into consideration. (size #:getter size #:init-thunk make-null-rect) (width #:accessor width - #:init-keyword #:width #:observe? #t #:allocation #:virtual #:slot-ref (lambda (node) (rect-width (size node))) @@ -344,7 +343,6 @@ (set-rect-width! (size node) w) (expire-local-bounding-box node))) (height #:accessor height - #:init-keyword #:height #:observe? #t #:allocation #:virtual #:slot-ref (lambda (node) (rect-height (size node))) @@ -378,10 +376,11 @@ (slot-set! node 'scale (vec2 s s)))) ;; If caller doesn't specify a custom width and height, let the node ;; pick a reasonable default size. - (when (= (width node) 0.0) - (set! (width node) (default-width node))) - (when (= (height node) 0.0) - (set! (height node) (default-height node))) + (let ((r (size node))) + (set-rect-width! r (or (get-keyword #:width args) + (default-width node))) + (set-rect-height! r (or (get-keyword #:height args) + (default-height node)))) ;; Build an initial bounding box. (vec2-copy! (position node) (render-position node)) ;; Set the initial last position to the same as the initial position |