Beispiel #1
0
        private void UpdateIsOpen()
        {
            if (IsOpen)
            {
                VisualStateManager.GoToState(this, "IsOpen", false);

                if (m_tracker != null)
                {
                    m_tracker.TryUpdatePositionWithAnimation(OpenAnimation);
                    //m_tracker.TryUpdatePositionWithAdditionalVelocity(new Vector3(0f,1000f, 0f));
                }
            }
            else
            {
                if (m_tracker != null)
                {
                    m_tracker.TryUpdatePositionWithAnimation(CloseAnimation);
                    //m_tracker.TryUpdatePositionWithAdditionalVelocity(new Vector3(0f,-1000f, 0f));
                }
                else
                {
                    VisualStateManager.GoToState(this, "IsNotOpen", false);
                }
            }
        }
        private void BttnLeft_Tapped(object sender, TappedRoutedEventArgs e)
        {
            e.Handled = true;
            MoveLeft();

            var animation = _compositor.CreateVector3KeyFrameAnimation();

            animation.InsertKeyFrame(1, new Vector3(itemsRendered.SelectedIndex * _itemWidth, 0, 0), _cubicBezierEasingFunction);
            animation.Duration = animationDuration;
            _tracker.TryUpdatePositionWithAnimation(animation);
        }
Beispiel #3
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            LayoutRoot   = (Grid)GetTemplateChild("LayoutRoot");
            ITRoot       = (Grid)GetTemplateChild("ITRoot");
            Layer        = (Border)GetTemplateChild("Layer");
            ModalContent = (StackPanel)GetTemplateChild("ModalContent");
            TitleBar     = (Grid)GetTemplateChild("TitleBar");
            CloseButton  = (Button)GetTemplateChild("CloseButton");

            DebugText1 = (TextBlock)GetTemplateChild("DebugText1");
            DebugText2 = (TextBlock)GetTemplateChild("DebugText2");
            DebugText3 = (TextBlock)GetTemplateChild("DebugText3");

            Resize();
            Window.Current.SizeChanged += (a, b) => { Resize(b.Size); };
            Loaded += (a, b) => {
                Resize(); // resize popup and layoutroot
                SetupModal();
                _tracker.TryUpdatePosition(new Vector3(0, _tracker.MinPosition.Y + 1, 0));
                OpenHalf();
            };
            ITRoot.PointerPressed += (a, b) => {
                try {
                    _is.TryRedirectForManipulation(b.GetCurrentPoint(this));
                } catch (Exception ex) {
                    Debug.WriteLine("TryRedirectForManipulation: " + ex.ToString());
                }
            };
            ITRoot.PointerWheelChanged += (a, b) => {
                var   o = b.GetCurrentPoint(a as UIElement);
                int   z = o.Properties.MouseWheelDelta;
                float d = (float)z * 1.5f;
                DebugText3.Text = $"Wheel: {z}\nDelta: {d}";
                if (d != 0 && _tracker.Position.Y >= _tracker.MinPosition.Y + StartHeight && _tracker.Position.Y <= _tracker.MaxPosition.Y)
                {
                    if (_tracker.Position.Y == _tracker.MaxPosition.Y && d < 0)
                    {
                        return;
                    }
                    _tracker.TryUpdatePositionWithAnimation(GetScrollKFA(new Vector3(0, _tracker.Position.Y - d, 0)));
                }
            };
            CloseButton.Click += (a, b) => {
                Hide();
            };
            WasShowed = true;
        }
Beispiel #4
0
        private void TryNavigateToScenario(int num)
        {
            foreach (Scenario scenario in _scenarios)
            {
                if (scenario.Identifier == num && _currentScenario != scenario)
                {
                    var oldScenario = _currentScenario;
                    _currentScenario = scenario;

                    var newOffset  = _scenarioContainersMapping[scenario].Offset;
                    var currOffset = _tracker.Position;

                    // Offset animation
                    Vector3KeyFrameAnimation offsetAnimation = _compositor.CreateVector3KeyFrameAnimation();
                    offsetAnimation.InsertKeyFrame(0.0f, currOffset);
                    offsetAnimation.InsertKeyFrame(1.0f, newOffset);
                    offsetAnimation.Duration = ConfigurationConstants.FocusAnimationDuration;
                    offsetAnimation.Target   = "Position";

                    _tracker.TryUpdatePositionWithAnimation(offsetAnimation);

                    UpdateActiveScenarioIndicator(oldScenario);

                    break;
                }
            }
        }
Beispiel #5
0
        /// <summary>
        /// Opens the left drawer if closed.
        /// </summary>
        public void OpenLeft()
        {
            CompositionEasingFunction cubicBezier = _compositor.CreateCubicBezierEasingFunction(new Vector2(.45f, 1.5f), new Vector2(.45f, 1f));
            Vector3KeyFrameAnimation  kfa         = _compositor.CreateVector3KeyFrameAnimation();

            kfa.Duration = TimeSpan.FromSeconds(0.5);
            kfa.InsertKeyFrame(1.0f, _tracker.MinPosition, cubicBezier);
            _tracker.TryUpdatePositionWithAnimation(kfa);
        }
Beispiel #6
0
 private void GotoIndex(int index, bool UseAnimation = true)
 {
     if (index < 0)
     {
         return;
     }
     if (UseAnimation)
     {
         OffsetAnimation.InsertKeyFrame(1f, new Vector3((float)(this.ActualWidth * index), 0f, 0f));
         m_tracker.TryUpdatePositionWithAnimation(OffsetAnimation);
         //PanelVisual.StartAnimation("Offset", OffsetAnimation);
     }
     else
     {
         m_tracker.TryUpdatePosition(new Vector3((float)(this.ActualWidth * index), 0f, 0f));
         //PanelVisual.Offset = new Vector3((float)(-this.ActualWidth * index), 0f, 0f);
     }
 }
        public void InertiaStateEntered(InteractionTracker sender, InteractionTrackerInertiaStateEnteredArgs args)
        {
            var position = _tracker.Position;

            if (position.X >= 72 && _canGoNext || position.X <= -72 && _canGoPrev)
            {
                var main = this.Ancestors <MainPage>().FirstOrDefault();
                if (main == null)
                {
                    return;
                }

                var offset  = Window.Current.Compositor.CreateVector3KeyFrameAnimation();
                var opacity = Window.Current.Compositor.CreateScalarKeyFrameAnimation();

                if (position.X >= 72 && _canGoNext)
                {
                    offset.InsertKeyFrame(0, new Vector3(-72, 0, 0));
                    offset.InsertKeyFrame(1, new Vector3(0));

                    main.ScrollFolder(+1, true);
                }
                else if (position.X <= -72 && _canGoPrev)
                {
                    offset.InsertKeyFrame(0, new Vector3(72, 0, 0));
                    offset.InsertKeyFrame(1, new Vector3(0));

                    main.ScrollFolder(-1, true);
                }

                offset.Duration = TimeSpan.FromMilliseconds(250);
                sender.TryUpdatePositionWithAnimation(offset);

                opacity.InsertKeyFrame(0, 0);
                opacity.InsertKeyFrame(1, 1);
                opacity.Duration = TimeSpan.FromMilliseconds(250);

                _visual.StartAnimation("Opacity", opacity);
            }
        }
Beispiel #8
0
 private void changeViewTo(bool hideGdInfo, bool disableAnimation)
 {
     if (isGdInfoHide == hideGdInfo && !disableAnimation)
     {
         return;
     }
     if (tracker is null)
     {
         return;
     }
     isGdInfoHideDef = hideGdInfo;
     if (disableAnimation)
     {
         tracker.TryUpdatePosition(hideGdInfo ? tracker.MaxPosition : tracker.MinPosition);
     }
     else
     {
         var ani = compositor.CreateVector3KeyFrameAnimation();
         ani.InsertKeyFrame(1, hideGdInfo ? tracker.MaxPosition : tracker.MinPosition);
         tracker.TryUpdatePositionWithAnimation(ani);
     }
 }
 /// <summary> Tries to update the InteractionTracker's position by applying an animation. </summary>
 /// <param name="expressionNode">The root ExpressionNode that represents the ExpressionAnimation to apply to the InteractionTracker's position.</param>
 public static void TryUpdatePositionWithAnimation(this InteractionTracker tracker, ExpressionNode expressionNode)
 {
     tracker.TryUpdatePositionWithAnimation(CreateExpressionAnimationFromNode(tracker.Compositor, expressionNode));
 }
Beispiel #10
0
 private void Button_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
 {
     _tracker.TryUpdatePositionWithAnimation(_openAnimation);
 }