private void UpdateState(Rect cameraRect, bool isGameView) { bool isPointerOver = cameraRect.Contains(Input.mousePosition) && !RuntimeTools.IsPointerOverGameObject(); if (RuntimeEditorApplication.IsPointerOverWindow(this)) { if (!isPointerOver) { RuntimeEditorApplication.PointerExit(this); } } else { if (isPointerOver) { RuntimeEditorApplication.PointerEnter(this); } } if (isPointerOver) { if (Input.GetMouseButtonUp(0) || Input.GetMouseButtonUp(1) || Input.GetMouseButtonUp(2) || Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || Input.GetMouseButtonDown(2)) { if (!isGameView || isGameView && RuntimeEditorApplication.IsPlaying) { RuntimeEditorApplication.ActivateWindow(this); } } } }
void IPointerEnterHandler.OnPointerEnter(PointerEventData eventData) { if (WindowType == RuntimeWindowType.SceneView || WindowType == RuntimeWindowType.GameView) { return; } m_isPointerOver = true; RuntimeEditorApplication.PointerEnter(this); OnPointerEnterOverride(eventData); }
protected override void OnPointerEnterOverride(PointerEventData eventData) { base.OnPointerEnterOverride(eventData); if (WindowType == RuntimeWindowType.SceneView || WindowType == RuntimeWindowType.GameView) { return; } m_isPointerOver = true; RuntimeEditorApplication.PointerEnter(this); }