public override Widget build(BuildContext context) { D.assert(Overlay.of(context, debugRequiredFor: widget) != null); ThemeData theme = Theme.of(context); TooltipThemeData tooltipTheme = TooltipTheme.of(context); TextStyle defaultTextStyle; BoxDecoration defaultDecoration; if (theme.brightness == Brightness.dark) { defaultTextStyle = theme.textTheme.bodyText2.copyWith( color: Colors.black ); defaultDecoration = new BoxDecoration( color: Colors.white.withOpacity(0.9f), borderRadius: BorderRadius.all(Radius.circular(4)) ); } else { defaultTextStyle = theme.textTheme.bodyText2.copyWith( color: Colors.white ); defaultDecoration = new BoxDecoration( color: Colors.grey[700].withOpacity(0.9f), borderRadius: BorderRadius.all(Radius.circular(4)) ); } height = widget.height ?? tooltipTheme?.height ?? _defaultTooltipHeight; padding = widget.padding ?? tooltipTheme?.padding ?? _defaultPadding; margin = widget.margin ?? tooltipTheme?.margin ?? _defaultMargin; verticalOffset = widget.verticalOffset ?? tooltipTheme?.verticalOffset ?? _defaultVerticalOffset; preferBelow = widget.preferBelow ?? tooltipTheme?.preferBelow ?? _defaultPreferBelow; excludeFromSemantics = widget.excludeFromSemantics ?? tooltipTheme?.excludeFromSemantics ?? _defaultExcludeFromSemantics; decoration = widget.decoration ?? tooltipTheme?.decoration ?? defaultDecoration; textStyle = widget.textStyle ?? tooltipTheme?.textStyle ?? defaultTextStyle; waitDuration = widget.waitDuration ?? tooltipTheme?.waitDuration ?? _defaultWaitDuration; showDuration = widget.showDuration ?? tooltipTheme?.showDuration ?? _defaultShowDuration; Widget result = new GestureDetector( behavior: HitTestBehavior.opaque, onLongPress: _handleLongPress, child: widget.child ); if (_mouseIsConnected) { result = new MouseRegion( onEnter: (PointerEnterEvent _event) => _showTooltip(), onExit: (PointerExitEvent _event) => _hideTooltip(), child: result ); } return(result); }
private void CalculateMouseRegion() { foreach (KeyValuePair <MouseRegion, Rect> pair in this._mouseRegionRect) { if (pair.Value.Contains(Event.current.mousePosition)) { this._mouseRegionUpdate = pair.Key; break; } } }
void OnGUI() { LayoutEditorGUIStyle.Init(); this._mouseRegionUpdate = MouseRegion.Outside; bool mouseDown = this.m_MouseDown; HandleInput(); EditorGUILayout.BeginVertical(); RenderToolBar(); //Layout cur_layout = m_layout_mng.CurEditLayout; //if (cur_layout != null) { EditorGUILayout.BeginHorizontal(); Rect realRect = EditorGUILayout.BeginVertical(GUILayout.Width(LayoutEditorGUI.panelLayoutListWidth)); if (realRect.width > LayoutEditorGUI.panelLayoutListWidth) { LayoutEditorGUI.panelLayoutListWidth = (int)realRect.width; } RenderCurUIHierarchy(); DrawGUIHorizontalDivider(); SetMouseRegion(MouseRegion.HandleTreeAndFile); RenderLayoutList(); EditorGUILayout.EndVertical(); DrawGUIVerticalDivider(); SetMouseRegion(MouseRegion.HandleTreeAndMain); RenderView(); DrawGUIVerticalDivider(); SetMouseRegion(MouseRegion.HandleMainAndProp); OnInspector(); EditorGUILayout.EndHorizontal(); CalculateMouseRegion(); if (!mouseDown && this.m_MouseDown) { this.m_MouseDownRegion = this._mouseRegion; } } EditorGUILayout.EndVertical(); }
void Update() { curSelUI = m_layout_mng.CurEditLayout == null ? null : new List <UIElement>(m_layout_mng.CurEditLayout.SelElements); bool changed = CmdManager.Instance.syncCmd(); if (changed && m_layout_mng.CurEditLayout != null) { m_layout_mng.CurEditLayout.SetDirty(); } this._mouseRegion = this._mouseRegionUpdate; OnMouseMove(); if (_wasRepaintRequested) { _wasRepaintRequested = false; Repaint(); } }
public void SetMouseRegion(MouseRegion region) { if (Event.current.type == EventType.Repaint) { this._mouseRegionRect[region] = GUILayoutUtility.GetLastRect(); } if (this._mouseRegionRect.ContainsKey(region) && GUI.enabled) { switch (region) { case MouseRegion.HandleTreeAndFile: EditorGUIUtility.AddCursorRect(this._mouseRegionRect[region], MouseCursor.ResizeVertical); return; case MouseRegion.HandleTreeAndMain: case MouseRegion.HandleMainAndProp: EditorGUIUtility.AddCursorRect(this._mouseRegionRect[region], MouseCursor.ResizeHorizontal); return; } } }
public override Widget build(BuildContext context) { Widget child = new MouseRegion( onEnter: _handleMouseEnter, onExit: _handleMouseExit, child: new Focus( focusNode: widget.focusNode, autofocus: widget.autofocus, canRequestFocus: widget.enabled, onFocusChange: _handleFocusChange, child: widget.child ) ); if (widget.enabled && widget.actions != null && widget.actions.isNotEmpty()) { child = new Actions(actions: widget.actions, child: child); } if (widget.enabled && widget.shortcuts != null && widget.shortcuts.isNotEmpty()) { child = new Shortcuts(shortcuts: widget.shortcuts, child: child); } return(child); }