From 0f88b3d96308c4164f8d540b72fe26f6f34fc302 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 14 Apr 2021 21:15:11 -0400 Subject: node-2d: Fix exported class name. --- starling/node-2d.scm | 26 +++++++++++++++++++------- 1 file 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 - + <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 ) args) - (next-method) - (set-canvas-painter! (canvas path) (painter path))) +(define-method (refresh-painter (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 )) + (refresh-painter path)) (define-method (on-change (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 ) alpha) (draw-canvas* (canvas path) (world-matrix path))) -- cgit v1.2.3