|
|
|
|
|
|
|
|
|
|
public delegate void PointerExitEventListener(PointerExitEvent evt); |
|
|
|
|
|
|
|
#if UNITY_EDITOR
|
|
|
|
public delegate void PointerDragFromEditorEnterEventListener(PointerDragFromEditorEnterEvent evt); |
|
|
|
|
|
|
|
public delegate void PointerDragFromEditorHoverEventListener(PointerDragFromEditorHoverEvent evt); |
|
|
|
|
|
|
public delegate void PointerDragFromEditorReleaseEventListener(PointerDragFromEditorReleaseEvent evt); |
|
|
|
#endif
|
|
|
|
|
|
|
|
/// The annotation object used to annotate layers that are interested in mouse
|
|
|
|
/// movements.
|
|
|
|
|
|
|
PointerEnterEventListener onEnter = null, |
|
|
|
PointerHoverEventListener onHover = null, |
|
|
|
PointerExitEventListener onExit = null |
|
|
|
#if UNITY_EDITOR
|
|
|
|
, PointerDragFromEditorEnterEventListener onDragFromEditorEnter = null |
|
|
|
, PointerDragFromEditorHoverEventListener onDragFromEditorHover = null |
|
|
|
, PointerDragFromEditorExitEventListener onDragFromEditorExit = null |
|
|
|
, PointerDragFromEditorReleaseEventListener onDragFromEditorRelease = null |
|
|
|
#endif
|
|
|
|
PointerExitEventListener onExit = null, |
|
|
|
PointerDragFromEditorEnterEventListener onDragFromEditorEnter = null, |
|
|
|
PointerDragFromEditorHoverEventListener onDragFromEditorHover = null, |
|
|
|
PointerDragFromEditorExitEventListener onDragFromEditorExit = null, |
|
|
|
PointerDragFromEditorReleaseEventListener onDragFromEditorRelease = null |
|
|
|
#if UNITY_EDITOR
|
|
|
|
#endif
|
|
|
|
} |
|
|
|
|
|
|
|
public readonly PointerEnterEventListener onEnter; |
|
|
|
|
|
|
public readonly PointerExitEventListener onExit; |
|
|
|
|
|
|
|
#if UNITY_EDITOR
|
|
|
|
#endif
|
|
|
|
|
|
|
|
public override string ToString() { |
|
|
|
return |
|
|
|
|
|
|
public partial class MouseTracker { |
|
|
|
public MouseTracker( |
|
|
|
PointerRouter router, |
|
|
|
MouseDetectorAnnotationFinder annotationFinder) { |
|
|
|
MouseDetectorAnnotationFinder annotationFinder, |
|
|
|
bool inEditor = false |
|
|
|
) { |
|
|
|
this.inEditor = inEditor; |
|
|
|
|
|
|
|
readonly bool inEditor; |
|
|
|
|
|
|
|
readonly Dictionary<int, PointerEvent> _lastMouseEvent = new Dictionary<int, PointerEvent>(); |
|
|
|
|
|
|
|
|
|
|
public void attachAnnotation(MouseTrackerAnnotation annotation) { |
|
|
|
this._trackedAnnotations[annotation] = new _TrackedAnnotation(annotation); |
|
|
|
this._scheduleMousePositionCheck(); |
|
|
|
|
|
|
|
this._scheduleDragFromEditorMousePositionCheck(); |
|
|
|
if (this.inEditor) { |
|
|
|
this._scheduleDragFromEditorMousePositionCheck(); |
|
|
|
} |
|
|
|
#endif
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
PointerExitEvent.fromHoverEvent((PointerHoverEvent) this._lastMouseEvent[deviceId])); |
|
|
|
} |
|
|
|
#if UNITY_EDITOR
|
|
|
|
if (annotation.onDragFromEditorExit != null) { |
|
|
|
if (this.inEditor && annotation.onDragFromEditorExit != null) { |
|
|
|
annotation.onDragFromEditorExit( |
|
|
|
PointerDragFromEditorExitEvent.fromDragFromEditorEvent(this._lastMouseEvent[deviceId])); |
|
|
|
#endif
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#if UNITY_EDITOR
|
|
|
|
this._handleDragFromEditorEvent(evt, deviceId); |
|
|
|
if (this.inEditor) { |
|
|
|
this._handleDragFromEditorEvent(evt, deviceId); |
|
|
|
} |
|
|
|
#endif
|
|
|
|
} |
|
|
|
|
|
|
|