diff --git a/src/controllers.lisp b/src/controllers.lisp index 6345650..641f519 100644 --- a/src/controllers.lisp +++ b/src/controllers.lisp @@ -11,6 +11,7 @@ ;;; Mouse (defparameter *current-entity* nil) +(defparameter *current-sketch* nil) (defun propagate-to-entity (sketch f x y &rest other-args) (loop @@ -60,6 +61,13 @@ x & y are assumed to come last in the argument list." (on-enter entity)) (call-next-method))) +(defmethod on-hover :around ((instance sketch) ix iy) + (unless (eql *current-sketch* instance) + (on-leave *current-sketch*) + (setf *current-sketch* instance) + (on-enter instance)) + (call-next-method)) + (defmethod kit.sdl2:mousebutton-event ((instance sketch-window) state timestamp button x y) ;; For backward compatibility. (kit.sdl2:mousebutton-event (%sketch instance) state timestamp button x y)