mouse events in [0,WIDTH] x [0,HEIGHT]
svn: r11413
This commit is contained in:
parent
6793197f68
commit
a56b3bff61
|
@ -635,11 +635,16 @@ Matthew
|
||||||
(define (set-and-show-frame w h animated-gif)
|
(define (set-and-show-frame w h animated-gif)
|
||||||
(define the-play-back-custodian (make-custodian))
|
(define the-play-back-custodian (make-custodian))
|
||||||
(define frame (create-frame the-play-back-custodian))
|
(define frame (create-frame the-play-back-custodian))
|
||||||
|
(set! WIDTH w)
|
||||||
|
(set! HEIGHT h)
|
||||||
(when animated-gif
|
(when animated-gif
|
||||||
(add-stop-and-image-buttons frame the-play-back-custodian))
|
(add-stop-and-image-buttons frame the-play-back-custodian))
|
||||||
(add-editor-canvas frame visible-world w h)
|
(add-editor-canvas frame visible-world w h)
|
||||||
(send frame show #t))
|
(send frame show #t))
|
||||||
|
|
||||||
|
(define WIDTH 0)
|
||||||
|
(define HEIGHT 0)
|
||||||
|
|
||||||
;; [Box (union false Thread)] -> Frame
|
;; [Box (union false Thread)] -> Frame
|
||||||
;; create a frame that shuts down the custodian on close
|
;; create a frame that shuts down the custodian on close
|
||||||
(define (create-frame the-play-back-custodian)
|
(define (create-frame the-play-back-custodian)
|
||||||
|
@ -902,13 +907,14 @@ Matthew
|
||||||
(parameterize ([current-eventspace evt-space])
|
(parameterize ([current-eventspace evt-space])
|
||||||
(queue-callback
|
(queue-callback
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(with-handlers ([exn:break? break-handler][exn? exn-handler])
|
(define x (- (send e get-x) INSET))
|
||||||
(define x (- (send e get-x) INSET))
|
(define y (- (send e get-y) INSET))
|
||||||
(define y (- (send e get-y) INSET))
|
(define m (mouse-event->symbol e))
|
||||||
(define m (mouse-event->symbol e))
|
(when (and (<= 0 x WIDTH) (<= 0 y HEIGHT))
|
||||||
(set! the-world (f the-world x y m))
|
(with-handlers ([exn:break? break-handler][exn? exn-handler])
|
||||||
(add-event MOUSE x y m)
|
(set! the-world (f the-world x y m))
|
||||||
(redraw-callback))))))
|
(add-event MOUSE x y m)
|
||||||
|
(redraw-callback)))))))
|
||||||
|
|
||||||
;; MouseEvent -> MouseEventType
|
;; MouseEvent -> MouseEventType
|
||||||
(define (mouse-event->symbol e)
|
(define (mouse-event->symbol e)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user