void BeginManipulation(object sender, ManipulationStartingEventArgs args) { if (args.Mode.HasFlag(ManipulationModes.TranslateX)) { timer.IsEnabled = false; } else { args.Cancel(); } }
private void image_ManipulationStarting(object sender, ManipulationStartingEventArgs e) { // Set the container (used for coordinates.) e.ManipulationContainer = canvas; // Choose what manipulations to allow. e.Mode = ManipulationModes.All; }
private void centerImageView_ManipulationStarting(object sender, System.Windows.Input.ManipulationStartingEventArgs e) { e.ManipulationContainer = this; e.Handled = true; }
internal void ReportFrame(ICollection <IManipulator> manipulators) { Int64 timestamp = GetCurrentTimestamp(); LastTimestamp = (int)timestamp; // InputEventArgs timestamps are Int32 while the processors take Int64 int numManipulators = manipulators.Count; if (IsInertiaActive && (numManipulators > 0)) { // Inertia is active but now there are fingers, stop inertia _inertiaProcessor.Complete(timestamp); PushEventsToDevice(); } if (!IsManipulationActive && (numManipulators > 0)) { // Time to start a new manipulation ManipulationStartingEventArgs startingArgs = RaiseStarting(); if (!startingArgs.RequestedCancel && (startingArgs.Mode != ManipulationModes.None)) { // Determine if we allow single-finger manipulation if (startingArgs.IsSingleTouchEnabled || (numManipulators >= 2)) { SetContainer(startingArgs.ManipulationContainer); _mode = startingArgs.Mode; _pivot = startingArgs.Pivot; IList <ManipulationParameters2D> parameters = startingArgs.Parameters; _manipulationProcessor = new ManipulationProcessor2D(ConvertMode(_mode), ConvertPivot(_pivot)); if (parameters != null) { int count = parameters.Count; for (int i = 0; i < parameters.Count; i++) { _manipulationProcessor.SetParameters(parameters[i]); } } _manipulationProcessor.Started += OnManipulationStarted; _manipulationProcessor.Delta += OnManipulationDelta; _manipulationProcessor.Completed += OnManipulationCompleted; _currentManipulators.Clear(); } } } if (IsManipulationActive) { // A manipulation process is available to process this frame of manipulators UpdateManipulators(manipulators); _manipulationProcessor.ProcessManipulators(timestamp, CurrentManipulators); PushEventsToDevice(); } }
private void Window_ManipulationStarting( object sender, ManipulationStartingEventArgs e ) { e.ManipulationContainer = this; e.Handled = true; var element = e.OriginalSource as FrameworkElement; Canvas.SetZIndex( element, maxZIndex++ ); }
override public void ManipulationStarting(object sender, ManipulationStartingEventArgs e) { TouchManip = true; SetMarkers(); // VdSegmentUtil.ShowMarkers(selMarker1, selMarker2); base.ManipulationStarting(sender, e); }
private void SomeControl_ManipulationStarting(object sender, ManipulationStartingEventArgs e) { var control = sender as System.Windows.Controls.Control; if (control != null) { e.ManipulationContainer = WorkCanvas; } }
private ManipulationStartingEventArgs RaiseStarting() { ManipulationStartingEventArgs starting = new ManipulationStartingEventArgs(_manipulationDevice, Environment.TickCount); starting.ManipulationContainer = _manipulationDevice.Target; _manipulationDevice.ProcessManipulationInput(starting); return(starting); }
protected override void OnManipulationStarting(ManipulationStartingEventArgs args) { args.ManipulationContainer = this; args.Mode = currentMode; // Adjust Z-order FrameworkElement element = args.Source as FrameworkElement; Panel pnl = element.Parent as Panel; for (int i = 0; i < pnl.Children.Count; i++) Panel.SetZIndex(pnl.Children[i], pnl.Children[i] == element ? pnl.Children.Count : i); args.Handled = true; base.OnManipulationStarting(args); }
void element_ManipulationStarting(object sender, System.Windows.Input.ManipulationStartingEventArgs args) { if (this.Element == null) { args.Cancel(); return; } //apply gestures Gestures.ForEach(a => a.ManipulationStarting(args)); //get element to top this.OnWantToTop(); //Debug.WriteLine("OnManipulationStarting"); args.ManipulationContainer = this.ManipulationContainer; args.Handled = true; }
protected override void OnManipulationStarting(ManipulationStartingEventArgs args) { args.ManipulationContainer = this; args.Mode = currentMode; // Adjust Z-order FrameworkElement element = args.Source as FrameworkElement; Panel pnl = element.Parent as Panel; for (int i = 0; i < pnl.Children.Count; i++) Panel.SetZIndex(pnl.Children[i], pnl.Children[i] == element ? pnl.Children.Count : i); // Set Pivot Point center = new Point(element.ActualWidth / 2, element.ActualHeight / 2); center = element.TranslatePoint(center, this); args.Pivot = new ManipulationPivot(center, 48); args.Handled = true; base.OnManipulationStarting(args); }
public virtual void ManipulationStarting(object sender, ManipulationStartingEventArgs e) { _manipulationGoing = true; }
public virtual void ManipulationStarting(System.Windows.Input.ManipulationStartingEventArgs args) { }
///// <summary> ///// 按钮手势开始 ///// </summary> ///// <param name="sender"></param> ///// <param name="e"></param> private void button_ManipulationStarting(object sender, ManipulationStartingEventArgs e) { e.ManipulationContainer = detailWindow; e.Mode = ManipulationModes.All; }
public virtual void OnManipulationStarting(object sender, ManipulationStartingEventArgs e) { }
void c_ManipulationStarting(object sender, ManipulationStartingEventArgs e) { e.Handled = true; }
protected override void OnManipulationStarting(ManipulationStartingEventArgs e) { e.ManipulationContainer = this; // Adjust Z-order Card element = e.Source as Card; if (element.ZIndex < this.Children.Count - 1) { foreach (FrameworkElement child in this.Children) { Card c = child as Card; if (element.ZIndex < c.ZIndex) { Canvas.SetZIndex(c, --c.ZIndex); } } Canvas.SetZIndex(element, this.Children.Count - 1); element.ZIndex = this.Children.Count - 1; } e.Handled = true; base.OnManipulationStarting(e); }
private bool ShouldManipulateScroll(ManipulationStartingEventArgs e, ScrollContentPresenter viewport) { // If the original source is not from the same PresentationSource as of ScrollViewer, // then do not start the manipulation. if (!PresentationSource.UnderSamePresentationSource(e.OriginalSource as DependencyObject, this)) { return false; } if (viewport == null) { // If there is no ScrollContentPresenter, then always start Manipulation return true; } // Dont start the manipulation if any of the manipulator positions // does not lie inside the viewport. GeneralTransform viewportTransform = TransformToDescendant(viewport); double viewportWidth = viewport.ActualWidth; double viewportHeight = viewport.ActualHeight; foreach (IManipulator manipulator in e.Manipulators) { Point manipulatorPosition = viewportTransform.Transform(manipulator.GetPosition(this)); if (DoubleUtil.LessThan(manipulatorPosition.X, 0) || DoubleUtil.LessThan(manipulatorPosition.Y, 0) || DoubleUtil.GreaterThan(manipulatorPosition.X, viewportWidth) || DoubleUtil.GreaterThan(manipulatorPosition.Y, viewportHeight)) { return false; } } return true; }
void TouchableThing_ManipulationStarting(object sender, ManipulationStartingEventArgs e) { e.ManipulationContainer = this; }
protected override void OnManipulationStarting(ManipulationStartingEventArgs args) { args.ManipulationContainer = this; args.Handled = true; base.OnManipulationStarting(args); }
//Translate and Zoom supported private void initManipulationTranslationScale(object sender, ManipulationStartingEventArgs e) { e.ManipulationContainer = scene; e.Mode = ManipulationModes.All; noRotate = true; e.Handled = true; }
//No manipulations supported private void initManipulationNone(object sender, ManipulationStartingEventArgs e) { e.ManipulationContainer = scene; e.Mode = ManipulationModes.None; e.Handled = true; }
private void HandleManipulationStarting(object sender, ManipulationStartingEventArgs e) { sender.AsOption<UIElement>().Do( el => { e.ManipulationContainer = el; e.Mode = ManipulationModes.All; if (_gestureSurfaceTouchRegistry.ContainsKey(el)) { _gestureSurfaceTouchRegistry[el] = new Dictionary<int, int>(); } }); }
private ManipulationStartingEventArgs RaiseStarting() { ManipulationStartingEventArgs starting = new ManipulationStartingEventArgs(_manipulationDevice, Environment.TickCount); starting.ManipulationContainer = _manipulationDevice.Target; _manipulationDevice.ProcessManipulationInput(starting); return starting; }
private void Canvas_ManipulationStarting(object sender, ManipulationStartingEventArgs e) { e.ManipulationContainer = App.Window; //setup single finger rotation if (this.ProtoDefinition.RotateManipulation.OneFingerRotationEnabled) { Point center = new Point(this.ActualWidth / 2, this.ActualHeight / 2); center = this.TranslatePoint(center, App.Window); e.Pivot = new ManipulationPivot(center, 48); } this.IsInertialTranslation = false; this.IsInertialRotation = false; this.IsInertialScaling = false; e.Handled = true; }
protected override void OnManipulationStarting(ManipulationStartingEventArgs e) { _panningInfo = null; PanningMode panningMode = PanningMode; if (panningMode != PanningMode.None) { CompleteScrollManipulation = false; ScrollContentPresenter viewport = GetTemplateChild(ScrollContentPresenterTemplateName) as ScrollContentPresenter; if (ShouldManipulateScroll(e, viewport)) { // Set Manipulation mode and container if (panningMode == PanningMode.HorizontalOnly) { e.Mode = ManipulationModes.TranslateX; } else if (panningMode == PanningMode.VerticalOnly) { e.Mode = ManipulationModes.TranslateY; } else { e.Mode = ManipulationModes.Translate; } e.ManipulationContainer = this; // initialize _panningInfo _panningInfo = new PanningInfo() { OriginalHorizontalOffset = HorizontalOffset, OriginalVerticalOffset = VerticalOffset, PanningMode = panningMode }; // Determine pixels per offset value. This is useful when performing non-pixel scrolling. double viewportWidth = ViewportWidth + 1d; // Using +1 to account for last partially visible item in viewport double viewportHeight = ViewportHeight + 1d; // Using +1 to account for last partially visible item in viewport if (viewport != null) { _panningInfo.DeltaPerHorizontalOffet = (DoubleUtil.AreClose(viewportWidth, 0) ? 0 : viewport.ActualWidth / viewportWidth); _panningInfo.DeltaPerVerticalOffset = (DoubleUtil.AreClose(viewportHeight, 0) ? 0 : viewport.ActualHeight / viewportHeight); } else { _panningInfo.DeltaPerHorizontalOffet = (DoubleUtil.AreClose(viewportWidth, 0) ? 0 : ActualWidth / viewportWidth); _panningInfo.DeltaPerVerticalOffset = (DoubleUtil.AreClose(viewportHeight, 0) ? 0 : ActualHeight / viewportHeight); } // Template bind other Scroll Manipulation properties if needed. if (!ManipulationBindingsInitialized) { BindToTemplatedParent(PanningDecelerationProperty); BindToTemplatedParent(PanningRatioProperty); ManipulationBindingsInitialized = true; } } else { e.Cancel(); ForceNextManipulationComplete = false; } e.Handled = true; } }
private void PostProcessInput(object sender, ProcessInputEventArgs e) { InputEventArgs inputEventArgs = e.StagingItem.Input; if (inputEventArgs.Device == this) { RoutedEvent routedEvent = inputEventArgs.RoutedEvent; if (routedEvent == Manipulation.ManipulationDeltaEvent) { ManipulationDeltaEventArgs deltaEventArgs = inputEventArgs as ManipulationDeltaEventArgs; if (deltaEventArgs != null) { // During deltas, see if panning feedback is needed on the window ManipulationDelta unusedManipulation = deltaEventArgs.UnusedManipulation; _manipulationLogic.RaiseBoundaryFeedback(unusedManipulation, deltaEventArgs.RequestedComplete); _manipulationLogic.PushEventsToDevice(); // If a Complete is requested, then pass it along to the manipulation processor if (deltaEventArgs.RequestedComplete) { _manipulationLogic.Complete(/* withInertia = */ deltaEventArgs.RequestedInertia); _manipulationLogic.PushEventsToDevice(); } else if (deltaEventArgs.RequestedCancel) { Debug.Assert(!deltaEventArgs.IsInertial); OnManipulationCancel(); } } } else if (routedEvent == Manipulation.ManipulationStartingEvent) { ManipulationStartingEventArgs startingEventArgs = inputEventArgs as ManipulationStartingEventArgs; if (startingEventArgs != null && startingEventArgs.RequestedCancel) { OnManipulationCancel(); } } else if (routedEvent == Manipulation.ManipulationStartedEvent) { ManipulationStartedEventArgs startedEventArgs = inputEventArgs as ManipulationStartedEventArgs; if (startedEventArgs != null) { if (startedEventArgs.RequestedComplete) { // If a Complete is requested, pass it along to the manipulation processor _manipulationLogic.Complete(/* withInertia = */ false); _manipulationLogic.PushEventsToDevice(); } else if (startedEventArgs.RequestedCancel) { OnManipulationCancel(); } else { // Start ticking to produce delta events ResumeAllTicking(); // Resumes the ticking of all the suspended devices on the thread StartTicking(); // Ensures that we continue ticking or restart ticking for this device } } } else if (routedEvent == Manipulation.ManipulationInertiaStartingEvent) { // Switching from using rendering for ticking to a timer at lower priority (handled by ManipulationLogic) StopTicking(); // Remove all the manipulators so that we dont re-start manipulations accidentally RemoveAllManipulators(); // Initialize inertia ManipulationInertiaStartingEventArgs inertiaEventArgs = inputEventArgs as ManipulationInertiaStartingEventArgs; if (inertiaEventArgs != null) { if (inertiaEventArgs.RequestedCancel) { OnManipulationCancel(); } else { _manipulationLogic.BeginInertia(inertiaEventArgs); } } } else if (routedEvent == Manipulation.ManipulationCompletedEvent) { _manipulationLogic.OnCompleted(); ManipulationCompletedEventArgs completedEventArgs = inputEventArgs as ManipulationCompletedEventArgs; if (completedEventArgs != null) { if (completedEventArgs.RequestedCancel) { Debug.Assert(!completedEventArgs.IsInertial); OnManipulationCancel(); } else if (!(completedEventArgs.IsInertial && _ticking)) { // Remove the manipulation device only if // another manipulation didnot start OnManipulationComplete(); } } } else if (routedEvent == Manipulation.ManipulationBoundaryFeedbackEvent) { ManipulationBoundaryFeedbackEventArgs boundaryEventArgs = inputEventArgs as ManipulationBoundaryFeedbackEventArgs; if (boundaryEventArgs != null) { _compensateForBoundaryFeedback = boundaryEventArgs.CompensateForBoundaryFeedback; } } } }
void ManipulationElement_ManipulationStarting(object sender, ManipulationStartingEventArgs e) { foreach (var m in mouseProcessors) { if (e.Handled) break; m.PreprocessManipulationStarting(e); } if (!e.Handled) defaultMouseProcessor.OnManipulationStarting(sender, e); foreach (var m in mouseProcessors) m.PostprocessManipulationStarting(e); }
protected virtual void OnManipulationStarting(ManipulationStartingEventArgs e);
public void OnManipulationStarting(object sender, System.Windows.Input.ManipulationStartingEventArgs e) { Console.WriteLine("ViewerContext got manipulation started event."); }
private void canvas_ManipulationStarting(object sender, ManipulationStartingEventArgs e) { e.ManipulationContainer = this; e.Mode = ManipulationModes.Scale | ManipulationModes.Translate; e.Handled = true; }
void Window_ManipulationStarting(object sender, ManipulationStartingEventArgs e) { // Debug.WriteLine("Window_ManipulationStarting"); e.ManipulationContainer = this; e.Handled = true; }
private void imgPlant_ManipulationStarting(object sender, ManipulationStartingEventArgs e) { }
protected override void OnManipulationStarting(ManipulationStartingEventArgs e) { base.OnManipulationStarting(e); e.ManipulationContainer = this; e.Handled = true; }
private void BFocusTimeManipulationStarting(object sender, ManipulationStartingEventArgs e) { e.ManipulationContainer = cTimeLine; isMouseDownBm = true; }
private void Window_ManipulationStarting_1(object sender, ManipulationStartingEventArgs e) { e.ManipulationContainer = this; e.Handled = true; }
private void cTimeLine_ManipulationStarting(object sender, ManipulationStartingEventArgs e) { if (!Timeline.CanChangeTimeInterval) return; e.ManipulationContainer = LayoutRoot; }