static private FitRectToScreen ( |
||
defaultRect | ||
forceCompletelyVisible | bool | |
useMouseScreen | bool | |
Résultat |
private static Rect FitRect(Rect rect, ContainerWindow popupContainerWindow) { if (popupContainerWindow != null) { return(popupContainerWindow.FitWindowRectToScreen(rect, true, true)); } return(ContainerWindow.FitRectToScreen(rect, true, true)); }
private static Rect FitRect(Rect rect, ContainerWindow popupContainerWindow) { if ((bool)((Object)popupContainerWindow)) { return(popupContainerWindow.FitWindowRectToScreen(rect, true, true)); } return(ContainerWindow.FitRectToScreen(rect, true, true)); }
private static Rect FitRect(Rect rect, ContainerWindow popupContainerWindow) { Rect result; if (popupContainerWindow) { result = popupContainerWindow.FitWindowRectToScreen(rect, true, true); } else { result = ContainerWindow.FitRectToScreen(rect, true, true); } return(result); }
void Setup(string tooltip, Rect rect, GUIView hostView) { m_hoverRect = rect; m_tooltip.text = tooltip; // Calculate size and position tooltip view m_Style = EditorStyles.tooltip; m_Style.wordWrap = false; m_optimalSize = m_Style.CalcSize(m_tooltip); if (m_optimalSize.x > MAX_WIDTH) { m_Style.wordWrap = true; m_optimalSize.x = MAX_WIDTH; m_optimalSize.y = m_Style.CalcHeight(m_tooltip, MAX_WIDTH); } var popupPosition = new Rect( Mathf.Floor(m_hoverRect.x + (m_hoverRect.width / 2) - (m_optimalSize.x / 2)), Mathf.Floor(m_hoverRect.y + (m_hoverRect.height) + 10.0f), m_optimalSize.x, m_optimalSize.y); if (hostView != null) { var viewRect = hostView.screenPosition; if (popupPosition.x < viewRect.x) { popupPosition.x = viewRect.x; } if (popupPosition.xMax > viewRect.xMax) { popupPosition.x -= popupPosition.xMax - viewRect.xMax; } if (popupPosition.y < viewRect.y) { popupPosition.y = viewRect.y; } if (popupPosition.yMax > viewRect.yMax) { popupPosition.y -= popupPosition.yMax - viewRect.yMax; } popupPosition.y = Mathf.Max(popupPosition.y, Mathf.Floor(m_hoverRect.y + (m_hoverRect.height) + 10.0f)); } // If when fitted to screen, the tooltip would overlap the hover area // (and thus potentially mouse) -- for example when the control is near // the bottom of screen, place it atop of the hover area instead. var fittedToScreen = ContainerWindow.FitRectToScreen(popupPosition, true, true); if (fittedToScreen.Overlaps(m_hoverRect)) { popupPosition.y = m_hoverRect.y - m_optimalSize.y - 10.0f; } window.position = popupPosition; position = new Rect(0, 0, m_optimalSize.x, m_optimalSize.y); window.ShowTooltip(); window.SetAlpha(1.0f); s_guiView.mouseRayInvisible = true; Repaint(); // Flag for repaint but allow time for updates }