Mercurial > hg > indyvon
changeset 79:5fd50e400124
Fixed processing of mouse-released events.
author | Mikhail Kryshen <mikhail@kryshen.net> |
---|---|
date | Wed, 01 Sep 2010 22:24:17 +0400 |
parents | 4c0f2af742ba |
children | 880ae8e03408 |
files | src/net/kryshen/indyvon/core.clj |
diffstat | 1 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/net/kryshen/indyvon/core.clj Wed Sep 01 21:13:55 2010 +0400 +++ b/src/net/kryshen/indyvon/core.clj Wed Sep 01 22:24:17 2010 +0400 @@ -498,10 +498,17 @@ (defn- dispatch-mouse-button [picked-ref hovered-ref ^java.awt.event.MouseEvent event] (let [id (awt-events (.getID event)) - hovered (if (= id :mouse-pressed) - (dosync (ref-set picked-ref @hovered-ref)) - @hovered-ref)] - (translate-and-dispatch hovered true event id))) + nodes (case id + :mouse-pressed + (dosync + (ref-set picked-ref @hovered-ref)) + :mouse-released + (dosync + (let [picked @picked-ref] + (ref-set picked-ref nil) + picked)) + @hovered-ref)] + (translate-and-dispatch nodes true event id))) (defn root-event-dispatcher [] (let [tree-r (ref {}) ; register @@ -535,8 +542,7 @@ (mousePressed [this event] (dispatch-mouse-button picked hovered event)) (mouseReleased [this event] - (translate-and-dispatch @picked true event)) - ;;(dispatch-mouse-button picked hovered event)) + (dispatch-mouse-button picked hovered event)) MouseMotionListener (mouseDragged [this event] (translate-and-dispatch @picked true event))