/// <summary> /// Gets the expected duration of a flick as measured in seconds. /// A flick starts on <see cref="Windows.UI.Xaml.UIElement.ManipulationInertiaStarting"/> /// event and ends on <see cref="Windows.UI.Xaml.UIElement.ManipulationCompleted"/> event. /// </summary> /// <remarks> /// Note that the duration is estimated and may vary by a few percent based on testing. /// </remarks> /// <param name="e">The event argument from the <see cref="Windows.UI.Xaml.UIElement.ManipulationInertiaStarting"/> event.</param> /// <returns>The expected duration of the flick as measured in seconds.</returns> public static double GetExpectedDisplacementDuration(this ManipulationInertiaStartingRoutedEventArgs e) { var d = e.TranslationBehavior.DesiredDisplacement; double a; var vx = e.Velocities.Linear.X; var vy = e.Velocities.Linear.Y; var v = Math.Sqrt(vx * vx + vy * vy); if (double.IsNaN(d)) { a = e.TranslationBehavior.DesiredDeceleration; if (double.IsNaN(a)) { a = DefaultDeceleration; } } else { a = v * v / (2 * d); } return((v / a) * 0.001); }
/// <summary> /// Gets the Y component of the expected displacement vector at the end of the flick. /// A flick starts on /// <see cref="Windows.UI.Xaml.UIElement.ManipulationInertiaStarting"/> event and ends on /// <see cref="Windows.UI.Xaml.UIElement.ManipulationCompleted"/> event. /// The displacement is the vector from e.Cumulative.Translation at the beginning of the flick /// to the e.Cumulative.Translation at the end of the flick. /// </summary> /// <param name="e">The event argument from the /// <see cref="Windows.UI.Xaml.UIElement.ManipulationInertiaStarting"/> event. /// </param> /// <returns>The Y component of the displacement of the flick.</returns> public static double GetExpectedDisplacementY(this ManipulationInertiaStartingRoutedEventArgs e) { var vy = e.Velocities.Linear.Y; if (vy == 0) { return(0); } var vx = e.Velocities.Linear.X; var v = Math.Sqrt(vx * vx + vy * vy); var d = e.TranslationBehavior.DesiredDisplacement; if (double.IsNaN(d)) { var a = e.TranslationBehavior.DesiredDeceleration; if (double.IsNaN(a)) { a = DefaultDeceleration; } d = v * v / (2 * a); } var dy = d * vy / v; return(dy); }
/// <summary> /// Called before the ManipulationInertiaStarting event occurs. /// </summary> /// <param name="e">Event data for the event.</param> /// <remarks> /// This is used for touch scrolling. /// </remarks> protected override void OnManipulationInertiaStarting(ManipulationInertiaStartingRoutedEventArgs e) { this.scroller += e.Delta.Translation.Y; ProcessScroller(); e.Handled = true; base.OnManipulationInertiaStarting(e); }
void OnEllipseManipulationInertiaStarting(object sender, ManipulationInertiaStartingRoutedEventArgs args) { double maxVelocity = Math.Max(Math.Abs(args.Velocities.Linear.X), Math.Abs(args.Velocities.Linear.Y)); args.TranslationBehavior.DesiredDeceleration = maxVelocity / (1000 * slider.Value); }
/// <summary> /// [DOWN-4] On Manipulation Inertia Starting /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <remarks> /// Auto acceleration Starging /// </remarks> private void OnManipulationInertiaStarting(object sender, ManipulationInertiaStartingRoutedEventArgs e) { var po = _(e, this, "OnManipulationInertiaStarting"); //Debug.WriteLine(___(po)); IsOnManipulationInertiaStarting = true; }
private void InertiaStarting(object sender, ManipulationInertiaStartingRoutedEventArgs e) { _inertiaStart = DateTimeOffset.UtcNow.Ticks; //e.TranslationBehavior.DesiredDisplacement = 5; //e.TranslationBehavior.DesiredDeceleration = .00001; Log(@$ "[INERTIA] Inertia starting: {F(default, e.Delta, e.Cumulative, e.Velocities)} tr: ↘={e.TranslationBehavior.DesiredDeceleration} | ⌖={e.TranslationBehavior.DesiredDisplacement}
private void OnManipulationInertiaStarting(object sender, ManipulationInertiaStartingRoutedEventArgs e) { if (!_isImageLoaded) { return; } ProcessManipulationDelta(e.Cumulative, false); e.Handled = true; }
private void Image_ManipulationInertiaStarting(object sender, ManipulationInertiaStartingRoutedEventArgs e) { var element = e.OriginalSource as FrameworkElement; if (element == null) { return; } //Ball inertial speed based on the actual formula (m/s) e.TranslationBehavior.DesiredDeceleration = 20.0 * 96.0 / (1000.0 * 1000.0); }
void ManipulableScroll_ManipulationInertiaStarting(object sender, ManipulationInertiaStartingRoutedEventArgs e) { if (_isvertical) { e.TranslationBehavior.DesiredDeceleration = 20.0 * 96.0 / (1000.0 * 1000.0); } else { _forcemanipulation2end = true; } }
private void HandleManipulationInertiaStarting(Object sender, ManipulationInertiaStartingRoutedEventArgs args) { // Check to see if this kind of device is being ignored if (!IsValidDevice(args.PointerDeviceType)) { return; } // Changes here can include adjusting the deceleration value or setting a target end value // args.RotationBehavior.DesiredDeceleration = .000001; System.Diagnostics.Debug.WriteLine("ManipulationInertia"); }
void OnManipulationInertiaStarting(object sender, ManipulationInertiaStartingRoutedEventArgs e) { if (_dragStarted) { Point velocity = new Point(e.Velocities.Linear.X, e.Velocities.Linear.Y); double d = RaiseDragInertiaStarted(e, velocity, 0.00096); if (!double.IsNaN(d)) { e.TranslationBehavior.DesiredDeceleration = d; } } }
void Panel_ManipulationInertiaStarting_1(object sender, ManipulationInertiaStartingRoutedEventArgs e) { _isinertia = true; if (_manipulationenable) { if (_touches > 1) { e.TranslationBehavior.DesiredDeceleration = 300.0 * 96.0 / (1000.0 * 1000.0); e.ExpansionBehavior.DesiredDeceleration = 10.0 * 96.0 / (1000.0 * 1000.0); e.RotationBehavior.DesiredDeceleration = 300.0 * 96.0 / (1000.0 * 1000.0); } } }
private void OnManipulationInertiaStarting(object sender, ManipulationInertiaStartingRoutedEventArgs e) { DebugMethodName(2); DebugMessage("Element=[" + _xfElement + "]"); PointerDeviceTypeDebugMessage(e.PointerDeviceType); ManipulationDeltaDebugMessage(e.Delta, "Delta"); ManipulationDeltaDebugMessage(e.Cumulative, "Cumul"); VelocitiesDebugString(e.Velocities); ContainerDebugMessage(e.Container); DebugMessage("TranslationBehavioir: disp=[" + e.TranslationBehavior.DesiredDisplacement + "] decl=[" + e.TranslationBehavior.DesiredDeceleration + "]"); DebugMessage("RotationBehavior: rot=[" + e.RotationBehavior.DesiredRotation + "] decl=[" + e.RotationBehavior.DesiredDeceleration + "]"); DebugMessage("ExpansionBehavior: exp=[" + e.ExpansionBehavior.DesiredExpansion + "] decl=[" + e.ExpansionBehavior.DesiredDeceleration + "]"); HandledDebugString(e.Handled); }
private async void CatPlaceHolder_ManipulationInertiaStarting(object sender, ManipulationInertiaStartingRoutedEventArgs e) { if (e.Velocities.Linear.X > 0) { CatLove.Visibility = Windows.UI.Xaml.Visibility.Visible; Vote(10); } else if (e.Velocities.Linear.X < 0) { CatHater.Visibility = Windows.UI.Xaml.Visibility.Visible; Vote(1); } await NextCat(); }
/// <summary> /// Sets the desired displacement along the X axis. /// </summary> /// <param name="e">The <see cref="ManipulationInertiaStartingRoutedEventArgs"/> instance containing the event data.</param> /// <param name="desiredDisplacementX">The desired displacement along the X axis.</param> public static void SetDesiredDisplacementX(this ManipulationInertiaStartingRoutedEventArgs e, double desiredDisplacementX) { var vx = e.Velocities.Linear.X; var vy = e.Velocities.Linear.Y; if (vx == 0) { e.TranslationBehavior.DesiredDisplacement = desiredDisplacementX; return; //throw new InvalidOperationException("Can't adjust inertia angle - desired displacement X is unsupported."); } var v = Math.Sqrt(vx * vx + vy * vy); e.TranslationBehavior.DesiredDisplacement = desiredDisplacementX * v / vx; }
private void OnManipulationInertiaStarting(object sender, ManipulationInertiaStartingRoutedEventArgs e) { double velocity = e.Velocities.Linear.X; if (Math.Abs(velocity) > 2.0) { double offset = Math.Abs(_offset); if (Math.Sign(velocity) > 0) { e.TranslationBehavior.DesiredDisplacement = _slotWidth * this.MaxItems - offset; } else { e.TranslationBehavior.DesiredDisplacement = _slotWidth * (this.MaxItems - 1) + offset; } } }
private void VideoImage_ManipulationInertiaStarting(object sender, ManipulationInertiaStartingRoutedEventArgs e) { // Decrease the velocity of the Rectangle's movement by // 10 inches per second every second. // (10 inches * 96 pixels per inch / 1000ms^2) e.TranslationBehavior.DesiredDeceleration = 10.0 * 96.0 / (1000.0 * 1000.0); // Decrease the velocity of the Rectangle's resizing by // 0.1 inches per second every second. // (0.1 inches * 96 pixels per inch / (1000ms^2) e.ExpansionBehavior.DesiredDeceleration = 0.1 * 96 / (1000.0 * 1000.0); // Decrease the velocity of the Rectangle's rotation rate by // 2 rotations per second every second. // (2 * 360 degrees / (1000ms^2) e.RotationBehavior.DesiredDeceleration = 720 / (1000.0 * 1000.0); e.Handled = true; }
protected virtual void OnManipulationInertiaStarting(ManipulationInertiaStartingRoutedEventArgs e) { }
protected override void OnManipulationInertiaStarting(ManipulationInertiaStartingRoutedEventArgs e) { base.OnManipulationInertiaStarting(e); }
protected override void OnManipulationInertiaStarting(ManipulationInertiaStartingRoutedEventArgs e) { e.TranslationBehavior.DesiredDeceleration = FlickRotateDeceleration; e.Handled = true; }
// When a manipulation that's a result of inertia begins, change the color of the // the object to reflect that inertia has taken over void ManipulateMe_ManipulationInertiaStarting(object sender, ManipulationInertiaStartingRoutedEventArgs e) { manipulateMe.Background = new SolidColorBrush(Windows.UI.Colors.RoyalBlue); }
private void Slider_ManipulationInertiaStarting(object sender, ManipulationInertiaStartingRoutedEventArgs e) { ShowToolTip(); ManipulationInertiaStarting?.Invoke(this, e); }
private void ManipulateMe_ManipulationInertiaStarting( object sender, ManipulationInertiaStartingRoutedEventArgs e) { e.Handled = true; }
private void OnManipInertiaStarting(object sender, ManipulationInertiaStartingRoutedEventArgs e) => Write($"[Inertia] {F(new Point(-1, -1), e.Delta, e.Cumulative)}");
private void theCanvas_ManipulationInertiaStarting(object sender, ManipulationInertiaStartingRoutedEventArgs e) { //isInInertion = true; e.RotationBehavior.DesiredDeceleration = 0; e.RotationBehavior.DesiredRotation = int.MaxValue; }
private void ScrollContentPresenter_OnManipulationInertiaStarting(object sender, ManipulationInertiaStartingRoutedEventArgs e) { var tr = _presenter.RenderTransform as TranslateTransform; // 閾値に達していない状態で慣性スクロールが始まった場合引っ張って更新の計算をスキップする _inertiaIgnoring = tr.Y < Threshold && !_isRefreshing; }
private void Image_ManipulationInertiaStarting(object sender, ManipulationInertiaStartingRoutedEventArgs e) { e.TranslationBehavior.DesiredDeceleration = 1; }
/// <summary> /// Gets a reference to the object that raised the event. /// This is often a template part of a control rather than an element that was declared in your app UI. /// </summary> /// <param name="e">The requested <see cref="ManipulationInertiaStartingRoutedEventArgs"/>.</param> /// <returns>The object that raised the event.</returns> public static object OriginalSource(this ManipulationInertiaStartingRoutedEventArgs e) => Resolver.OriginalSource(e);
private static void OnManipulationInertiaStarting(object sender, ManipulationInertiaStartingRoutedEventArgs e) { e.TranslationBehavior.DesiredDeceleration = 25 * 96.0 / (1000.0 * 1000.0); }
void rectangle_ManipulationInertiaStarting(object sender, ManipulationInertiaStartingRoutedEventArgs e) { lblMsg.Text += "ManipulationInertiaStarting"; lblMsg.Text += Environment.NewLine; }