async Task HighlightView( Point screenPt, bool andSelect, string hierarchyKind, CancellationToken cancellationToken = default(CancellationToken)) { Point devicePt; InspectView view = null; if (coordinateMapper != null && coordinateMapper.TryGetLocalCoordinate(screenPt, out devicePt)) { view = await clientSession.Agent.Api.HighlightView <InspectView> ( devicePt.X, devicePt.Y, clear : true, hierarchyKind : hierarchyKind, cancellationToken : cancellationToken); } if (view == null) { highlightedView = null; overlayWindow.Clear(); return; } // Don't clear or redraw anything. We are over the same view. if (highlightedView != null && view.Handle == highlightedView.Handle && !andSelect) { return; } highlightedView = view; overlayWindow.Clear(); if (andSelect) { highlightedView = null; ViewSelected?.Invoke(this, new HighlightSelectionEventArgs { SelectedView = view }); } else { overlayWindow.HighlightRect(coordinateMapper.GetHostRect(new Rect { X = view.X, Y = view.Y, Width = view.Width, Height = view.Height, })); } }
public override void MouseUp(NSEvent theEvent) { base.MouseUp(theEvent); if (isDragging) { return; } var inspectView = focusedNode?.InspectView; if (inspectView != null) { ViewSelected?.Invoke(inspectView); } }
async Task HighlightView( CGPoint screenPt, bool andSelect, CancellationToken cancellationToken = default(CancellationToken)) { CGPoint devicePt = CGPoint.Empty; InspectView view = null; var isValidLocalCoordinate = coordinateMapper != null && coordinateMapper.TryGetLocalCoordinate(screenPt, out devicePt); view = await clientSession.Agent.Api.HighlightView <InspectView> ( devicePt.X, devicePt.Y, clear : andSelect || !isValidLocalCoordinate, hierarchyKind : hierarchyKind, cancellationToken : cancellationToken); if (!isValidLocalCoordinate || view == null) { highlightedView = null; return; } // Don't clear or redraw anything. We are over the same view. if (highlightedView != null && view.Handle == highlightedView.Handle && !andSelect) { return; } highlightedView = view; if (andSelect) { highlightedView = null; ViewSelected?.Invoke(this, new HighlightSelectionEventArgs { SelectedView = view }); } }
internal void OnViewSelected(EnvironmentView view) { ViewSelected?.Invoke(this, new EnvironmentViewEventArgs(view)); }