Beispiel #1
0
 private static void BeginTiltEffect(FrameworkElement element, Point touchPoint, Point centerPoint, Point centerDelta)
 {
     if (TiltEffect.tiltReturnStoryboard != null)
     {
         TiltEffect.StopTiltReturnStoryboardAndCleanup();
     }
     if (!TiltEffect.PrepareControlForTilt(element, centerDelta))
     {
         return;
     }
     TiltEffect.currentTiltElement       = element;
     TiltEffect.currentTiltElementCenter = centerPoint;
     TiltEffect.PrepareTiltReturnStoryboard(element);
     TiltEffect.ApplyTiltEffect(TiltEffect.currentTiltElement, touchPoint, TiltEffect.currentTiltElementCenter);
 }
Beispiel #2
0
        private static void ContinueTiltEffect(FrameworkElement element, ManipulationDeltaEventArgs e)
        {
            FrameworkElement frameworkElement = e.ManipulationContainer as FrameworkElement;

            if (frameworkElement == null || element == null)
            {
                return;
            }
            Point point = frameworkElement.TransformToVisual((UIElement)element).Transform(e.ManipulationOrigin);

            if (!new Rect(0.0, 0.0, TiltEffect.currentTiltElement.ActualWidth, TiltEffect.currentTiltElement.ActualHeight).Contains(point))
            {
                TiltEffect.PauseTiltEffect();
            }
            else
            {
                TiltEffect.ApplyTiltEffect(TiltEffect.currentTiltElement, point, TiltEffect.currentTiltElementCenter);
            }
        }
Beispiel #3
0
        private static void ContinueTiltEffect(FrameworkElement element, ManipulationDeltaEventArgs e)
        {
            FrameworkElement manipulationContainer = e.ManipulationContainer as FrameworkElement;

            if (manipulationContainer == null || element == null)
            {
                return;
            }
            Point touchPoint = ((UIElement)manipulationContainer).TransformToVisual((UIElement)element).Transform(e.ManipulationOrigin);
            Rect  rect       = new Rect(0.0, 0.0, TiltEffect.currentTiltElement.ActualWidth, TiltEffect.currentTiltElement.ActualHeight);

            // ISSUE: explicit reference operation
            if (!rect.Contains(touchPoint))
            {
                TiltEffect.PauseTiltEffect();
            }
            else
            {
                TiltEffect.ApplyTiltEffect(TiltEffect.currentTiltElement, touchPoint, TiltEffect.currentTiltElementCenter);
            }
        }