return false;
else
return propagateEvent(event, _last_mouse_down.path);
- case Event::WHEEL:
case Event::MOUSE_MOVE:
+ handleMove(event, path);
+ break;
+ case Event::MOUSE_LEAVE:
+ // Mouse leaves window and therefore also current mouseover element
+ handleMove(event, EventPropagationPath());
+ return true;
+ case Event::WHEEL:
break;
default:
return false;
_last_click = StampedPropagationPath(path, event->getTime());
}
+ //----------------------------------------------------------------------------
+ void EventManager::handleMove( const MouseEventPtr& event,
+ const EventPropagationPath& path )
+ {
+ if( _last_mouse_over.path == path )
+ return;
+
+ if( !_last_mouse_over.path.empty() )
+ {
+ MouseEventPtr mouseout(new MouseEvent(*event));
+ mouseout->type = Event::MOUSE_OUT;
+ propagateEvent(mouseout, _last_mouse_over.path);
+ }
+
+ if( !path.empty() )
+ {
+ MouseEventPtr mouseover(new MouseEvent(*event));
+ mouseover->type = Event::MOUSE_OVER;
+ propagateEvent(mouseover, path);
+ }
+
+ _last_mouse_over.path = path;
+ }
+
//----------------------------------------------------------------------------
bool EventManager::propagateEvent( const EventPtr& event,
const EventPropagationPath& path )
// (eg. removed by another event handler)
continue;
- if( mouse_event && event->type != Event::DRAG )
- {
- // TODO transform pos and delta for drag events. Maybe we should just
- // store the global coordinates and convert to local coordinates
- // on demand.
-
- // Position and delta are specified in local coordinate system of
- // current element
- mouse_event->pos = it->local_pos;
- mouse_event->delta = it->local_delta;
- }
+ // TODO provide functions to convert position and delta to local
+ // coordinates on demand. Events shouldn't contain informations in
+ // local coordinates as they might differe between different elements
+ // receiving the same event.
+// if( mouse_event && event->type != Event::DRAG )
+// {
+// // TODO transform pos and delta for drag events. Maybe we should just
+// // store the global coordinates and convert to local coordinates
+// // on demand.
+//
+// // Position and delta are specified in local coordinate system of
+// // current element
+// mouse_event->pos = it->local_pos;
+// mouse_event->delta = it->local_delta;
+// }
el->callListeners(event);