diff options
author | David Thompson <dthompson2@worcester.edu> | 2021-04-14 21:15:11 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2021-04-14 21:15:11 -0400 |
commit | 0f88b3d96308c4164f8d540b72fe26f6f34fc302 (patch) | |
tree | ffc8a5cff34e5a714e87c66f6d5936032128e791 | |
parent | 8024b9bb5106f9d8a83893364c1b643dfa0dce40 (diff) |
node-2d: Fix exported class name.
-rw-r--r-- | starling/node-2d.scm | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/starling/node-2d.scm b/starling/node-2d.scm index 1e3c76f..34a1786 100644 --- a/starling/node-2d.scm +++ b/starling/node-2d.scm @@ -113,7 +113,7 @@ start-time change-animation - <nine-patch> + <9-patch> top-margin bottom-margin left-margin @@ -761,14 +761,26 @@ (painter #:accessor painter #:init-keyword #:painter #:watch? #t) (canvas #:accessor canvas #:init-thunk make-empty-canvas)) -(define-method (initialize (path <path>) args) - (next-method) - (set-canvas-painter! (canvas path) (painter path))) +(define-method (refresh-painter (path <path>)) + (let ((p (painter path)) + ;;(bb (painter-bounding-box p)) + ) + (set-canvas-painter! (canvas path) (painter path)) + ;; (set! (origin-x path) (- (rect-x bb))) + ;; (set! (origin-y path) (- (rect-y bb))) + ;; (set! (width path) (rect-width bb)) + ;; (set! (height path) (rect-height bb)) + )) + +(define-method (on-boot (path <path>)) + (refresh-painter path)) (define-method (on-change (path <path>) slot-name old new) - (pk 'change slot-name old new) - (when (eq? slot-name 'painter) - (set-canvas-painter! (canvas path) new))) + (case slot-name + ((painter) + (refresh-painter path)) + (else + (next-method)))) (define-method (render (path <path>) alpha) (draw-canvas* (canvas path) (world-matrix path))) |