private void statisticsTab_PointerPressed(object sender, PointerRoutedEventArgs e) { viewModel.IsBusy = true; }
private void visualizeTab_PointerPressed(object sender, PointerRoutedEventArgs e) { LoadComboBoxItems(); }
private void onPointerUp(object sender, PointerRoutedEventArgs e) { }
private void predictedResultTab_PointerPressed(object sender, PointerRoutedEventArgs e) { viewModel.IsBusy = true; }
private void GridSplitter_PointerPressed(object sender, PointerRoutedEventArgs e) { _pressed = true; VisualStateManager.GoToState(this, "Pressed", true); }
protected override void OnPointerPressed(PointerRoutedEventArgs e) { CapturePointer(e.Pointer); base.OnPointerPressed(e); }
private void Button_PointerEntered(object sender, PointerRoutedEventArgs e) { (sender as Button).Background = _b2; }
private void EXIT_PointerPressed(object sender, PointerRoutedEventArgs e) { GlobalNodeHandler.settings.autoSaveMap(); Application.Current.Exit(); }
protected override void OnPointerExited(PointerRoutedEventArgs e) { base.OnPointerExited(e); VisualStateManager.GoToState(this, "Normal", true); }
protected override void OnPointerReleased(PointerRoutedEventArgs e) { base.OnPointerReleased(e); VisualStateManager.GoToState(this, "PointerOver", true); }
private void CarouselControl_PointerReleased(object sender, PointerRoutedEventArgs e) { Focus(FocusState.Pointer); e.Handled = true; }
private void DOCU_PointerPressed(object sender, PointerRoutedEventArgs e) { }
private void SHORTCUTS_PointerPressed(object sender, PointerRoutedEventArgs e) { }
/// <summary> /// Called before the PointerMoved event occurs. /// </summary> /// <param name="e">Event data for the event.</param> protected override void OnPointerMoved(PointerRoutedEventArgs e) { base.OnPointerMoved(e); if (e.Handled) { return; } if (e.Pointer.PointerDeviceType == PointerDeviceType.Mouse) { e.Handled = this.ActualController.HandleMouseMove(this, e.ToMouseEventArgs(this)); } // Note: don't handle touch here, this is also handled when moving over when a touch device }
private void Button_PointerExited(object sender, PointerRoutedEventArgs e) { (sender as Button).Background = new SolidColorBrush(Colors.Transparent); }
/// <summary> /// Called before the PointerReleased event occurs. /// </summary> /// <param name="e">Event data for the event.</param> protected override void OnPointerReleased(PointerRoutedEventArgs e) { base.OnPointerReleased(e); if (e.Handled) { return; } if (e.Pointer.PointerDeviceType == PointerDeviceType.Mouse) { this.ReleasePointerCapture(e.Pointer); e.Handled = this.ActualController.HandleMouseUp(this, e.ToMouseEventArgs(this)); } else if (e.Pointer.PointerDeviceType == PointerDeviceType.Touch) { e.Handled = this.ActualController.HandleTouchCompleted(this, e.ToTouchEventArgs(this)); } }
// 處理指標的 release 事件 private void HandleCanvasReleased(object sender, PointerRoutedEventArgs e) { _presentationModel.ReleasePointer(e.GetCurrentPoint(_canvas).Position.X, e.GetCurrentPoint(_canvas).Position.Y); }
private void GridSplitter_PointerReleased(object sender, PointerRoutedEventArgs e) { _pressed = false; VisualStateManager.GoToState(this, _pointerEntered ? "PointerOver" : "Normal", true); }
protected override void OnPointerReleased(PointerRoutedEventArgs e) { IsDropDownOpen = true; }
internal static Point GetPosition(this PointerRoutedEventArgs e, UIElement element) { return(e.GetCurrentPoint(element).Position); }
private void MyCanvas_PointerMoved(object sender, PointerRoutedEventArgs e) { SetBrushSize(value); if (e.Pointer.PointerId == _penID) { PointerPoint pt = e.GetCurrentPoint(MyCanvas); // Render a red line on the canvas as the pointer moves. // Distance() is an application-defined function that tests // whether the pointer has moved far enough to justify // drawing a new line. currentContactPt = pt.Position; x1 = _previousContactPt.X; y1 = _previousContactPt.Y; x2 = currentContactPt.X; y2 = currentContactPt.Y; if (Distance(x1, y1, x2, y2) > 0.0) // We need to developp this method now { l = new Line() { X1 = x1, Y1 = y1, X2 = x2, Y2 = y2, Fill = brush, StrokeThickness = pressureNorm, Stroke = brush, //StrokeLineJoin = PenLineJoin.Round, IsHoldingEnabled = true, StrokeStartLineCap = PenLineCap.Round, StrokeEndLineCap = PenLineCap.Round }; _previousContactPt = currentContactPt; // Draw the line on the canvas by adding the Line object as // a child of the Canvas object. MyCanvas.Children.Add(l); // Pass the pointer information to the InkManager. _inkKhaled.ProcessPointerUpdate(pt); } } else if (e.Pointer.PointerId == _touchID) { // Process touch input PointerPoint pt = e.GetCurrentPoint(MyCanvas); // Render a red line on the canvas as the pointer moves. // Distance() is an application-defined function that tests // whether the pointer has moved far enough to justify // drawing a new line. currentContactPt = pt.Position; x1 = _previousContactPt.X; y1 = _previousContactPt.Y; x2 = currentContactPt.X; y2 = currentContactPt.Y; if (Distance(x1, y1, x2, y2) > 0.0) // We need to developp this method now { l = new Line() { X1 = x1, Y1 = y1, X2 = x2, Y2 = y2, Fill = brush, StrokeThickness = pressureNorm, Stroke = brush, //StrokeLineJoin = PenLineJoin.Round, IsHoldingEnabled = true, StrokeStartLineCap = PenLineCap.Round, StrokeEndLineCap = PenLineCap.Round }; _previousContactPt = currentContactPt; // Draw the line on the canvas by adding the Line object as // a child of the Canvas object. MyCanvas.Children.Add(l); // Pass the pointer information to the InkManager. _inkKhaled.ProcessPointerUpdate(pt); } } }
private void onPointerExit(object sender, PointerRoutedEventArgs e) { GetController().SetOveredNode(null); Glow(false); }
private void OnPointerReleased(object sender, PointerRoutedEventArgs e) { OnPointerConcluded(TouchEventType.End, e); }
private void StackPanel_PointerPressed(object sender, PointerRoutedEventArgs e) { this.Frame.Navigate(typeof(Views.Paquete.Form)); }
private void OnPointerCaptureLost(object sender, PointerRoutedEventArgs e) { OnPointerConcluded(TouchEventType.Cancel, e); }
private void predictedResultTab_PointerReleased(object sender, PointerRoutedEventArgs e) { viewModel.IsBusy = false; }
private DependencyObject GetReactViewTarget(PointerRoutedEventArgs e) { // Ensure the original source is a DependencyObject var originalSource = e.OriginalSource as DependencyObject; if (originalSource == null) { return(null); } // Get the React view hierarchy from the original source. var enumerator = RootViewHelper.GetReactViewHierarchy(originalSource).GetEnumerator(); // Try to get the first React view. if (!enumerator.MoveNext()) { return(null); } // If the first React view has `pointerEvents: box-none`, revert // to using the `VisualTreeHelper` to find potentially occluded views. // This condition should be rare. if (enumerator.Current.GetPointerEvents() == PointerEvents.BoxNone) { var rootPoint = e.GetCurrentPoint(_view); var transform = _view.TransformToVisual(Window.Current.Content); var point = transform.TransformPoint(rootPoint.Position); var adjustedPoint = AdjustPointForStatusBar(point); // Get the first view in at the pointer point that is not `box-none`. // Note: Rounding related errors can keep the position outside all react views, hence using FirstOrDefault. var nonBoxOnlyView = VisualTreeHelper.FindElementsInHostCoordinates(adjustedPoint, _view) .FirstOrDefault(v => v.HasTag() && v.GetPointerEvents() != PointerEvents.BoxNone); // Update the enumerator for the non-`box-only` view. enumerator = RootViewHelper.GetReactViewHierarchy(nonBoxOnlyView).GetEnumerator(); if (!enumerator.MoveNext()) { return(null); } } // Views with `pointerEvents: none` are not hit test enabled, so we // will not encounter any view subtrees with this value. Given the // prior conditional for `pointerEvents: box-none`, we only need to // loop through the parents of the current React view target to // check for uses of `pointerEvents: box-only`. If found, the // parent becomes the new target. var source = enumerator.Current; while (enumerator.MoveNext()) { var current = enumerator.Current; if (source == null || current.GetPointerEvents() == PointerEvents.BoxOnly) { source = current; } } return(source); }
private void statisticsTab_PointerReleased(object sender, PointerRoutedEventArgs e) { viewModel.IsBusy = false; }
private void UpdatePointersInViews(UIElement reactView, PointerPoint rootPoint, PointerRoutedEventArgs e) { // Create list of react views that should be tracked based on the // view hierarchy starting from reactView, keeping in just the views that intersect the rootPoint var newViews = reactView != null ? new HashSet <DependencyObject>( RootViewHelper.GetReactViewHierarchy(reactView).Where((v) => { if (v is FrameworkElement element) { var viewPoint = e.GetCurrentPoint(element); return(viewPoint.Position.X >= 0 && viewPoint.Position.X < element.ActualWidth && viewPoint.Position.Y >= 0 && viewPoint.Position.Y < element.ActualHeight); } else { return(false); } })) : new HashSet <DependencyObject>(); // Get existing list of react views for the pointer id HashSet <DependencyObject> existingViews; if (!_pointersInViews.TryGetValue(e.Pointer.PointerId, out existingViews)) { existingViews = new HashSet <DependencyObject>(); } // Return quick if list didn't change if (newViews.SetEquals(existingViews)) { return; } // Notify the tags that disappeared from the list if: // - there's still a tag associated with the view (it hasn't been removed from tree) // - there's a need (driven by handlers hooked on the JS side) to send events foreach (var existingView in existingViews) { if (!newViews.Contains(existingView) && existingView.HasTag() && ShouldSendPointerEnterLeaveOverOutEvent(existingView, out var enterOrLeave, out var overOrOut)) { OnPointerEnteredExited(TouchEventType.Exited, (UIElement)existingView, rootPoint, e, enterOrLeave, overOrOut); } } // Notify the new views that showed up if: // - there's a need (driven by handlers hooked on the JS side) to send events foreach (var newView in newViews) { if (!existingViews.Contains(newView) && ShouldSendPointerEnterLeaveOverOutEvent(newView, out var enterOrLeave, out var overOrOut)) { OnPointerEnteredExited(TouchEventType.Entered, (UIElement)newView, rootPoint, e, enterOrLeave, overOrOut); } } _pointersInViews[e.Pointer.PointerId] = newViews; }
/// <summary> /// Called before the PointerExited event occurs. /// </summary> /// <param name="e">Event data for the event.</param> protected override void OnPointerExited(PointerRoutedEventArgs e) { base.OnPointerExited(e); if (e.Handled) { return; } e.Handled = this.ActualController.HandleMouseLeave(this, e.ToMouseEventArgs(this)); }
private ReactPointer CreateReactPointer(UIElement reactView, PointerPoint rootPoint, PointerRoutedEventArgs e, bool detectSubcomponent) { var viewPoint = e.GetCurrentPoint(reactView); var reactTag = detectSubcomponent ? reactView.GetReactCompoundView().GetReactTagAtPoint(reactView, viewPoint.Position) : reactView.GetTag(); var pointer = new ReactPointer { Target = reactTag, PointerId = e.Pointer.PointerId, Identifier = ++_pointerIDs, PointerType = e.Pointer.PointerDeviceType.GetPointerDeviceTypeName(), IsLeftButton = viewPoint.Properties.IsLeftButtonPressed, IsRightButton = viewPoint.Properties.IsRightButtonPressed, IsMiddleButton = viewPoint.Properties.IsMiddleButtonPressed, IsHorizontalMouseWheel = viewPoint.Properties.IsHorizontalMouseWheel, IsEraser = viewPoint.Properties.IsEraser, ReactView = reactView, }; UpdatePointerForEvent(pointer, rootPoint, viewPoint, e.KeyModifiers); return(pointer); }
/// <summary> /// Called before the PointerPressed event occurs. /// </summary> /// <param name="e">Event data for the event.</param> protected override void OnPointerPressed(PointerRoutedEventArgs e) { base.OnPointerPressed(e); if (e.Handled) { return; } if (e.Pointer.PointerDeviceType == PointerDeviceType.Mouse) { this.Focus(FocusState.Pointer); this.CapturePointer(e.Pointer); e.Handled = this.ActualController.HandleMouseDown(this, e.ToMouseDownEventArgs(this)); } else if (e.Pointer.PointerDeviceType == PointerDeviceType.Touch) { this.Focus(FocusState.Pointer); e.Handled = this.ActualController.HandleTouchStarted(this, e.ToTouchEventArgs(this)); } }
private void OnPointerEnteredExited(TouchEventType eventType, UIElement view, PointerPoint rootPoint, PointerRoutedEventArgs e, bool sendDirect, bool sendBubbled) { var pointer = CreateReactPointer(view, rootPoint, e, false); view.GetReactContext()? .GetNativeModule <UIManagerModule>() .EventDispatcher .DispatchEvent( new PointerEnterExitEvent(eventType, view.GetTag(), pointer, sendDirect, sendBubbled)); // Keeps resetting the identifier if no other non-moving pointer is present if (_pointers.Count == 0) { _pointerIDs = 0; } }
/// <summary> /// Called before the PointerWheelChanged event occurs. /// </summary> /// <param name="e">Event data for the event.</param> protected override void OnPointerWheelChanged(PointerRoutedEventArgs e) { base.OnPointerWheelChanged(e); if (e.Handled || !this.IsMouseWheelEnabled) { return; } e.Handled = this.ActualController.HandleMouseWheel(this, e.ToMouseWheelEventArgs(this)); }
private void CLOSE_PointerPressed(object sender, PointerRoutedEventArgs e) { GlobalNodeHandler.settings.autoSaveMap(); GlobalNodeHandler.settings.newMap(); repaint(this, new EventArgs()); }