static void OnLatitudePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { VEPushPin pin = d as VEPushPin; if (pin == null) { return; } if (e.NewValue == null) { return; } AnimateUtility.StopAnimation(pin, VEPushPin.DisplayLatitudeProperty); if (e.OldValue != null) { pin.DisplayLatitude = (double)e.OldValue; } if (pin.isNewPin) { pin.DisplayLatitude = (double)e.NewValue; } else { AnimateUtility.AnimateElementDouble(pin, VEPushPin.DisplayLatitudeProperty, (double)e.NewValue, 0, 2); } }
void LayoutRootCanvas_ManipulationDelta(object sender, ManipulationDeltaEventArgs e) { if (zoomElement == null || layoutRoot == null) { return; } if (this.doubleTapSequence == DoubleTapSequence.SecondTouchDown) { return; } if (this.CurrentView.HasAnimatedProperties) { AnimateUtility.StopAnimation(this.CurrentView, DisplayMatrix.CenterProperty); AnimateUtility.StopAnimation(this.CurrentView, DisplayMatrix.OrientationProperty); AnimateUtility.StopAnimation(this.CurrentView, DisplayMatrix.ScaleProperty); } //Get the deltas into World frame-of-reference Vector deltaTranslation = e.DeltaManipulation.Translation; double deltaRotation = e.DeltaManipulation.Rotation; Vector deltaScale = e.DeltaManipulation.Scale; Point manipulationOrigin = e.ManipulationOrigin; UpdateZoomView(deltaTranslation, deltaRotation, deltaScale, manipulationOrigin); //We took care of the event e.Handled = true; foreach (object item in this.Items) { ZoomCanvasItem child = GetZoomCanvasItem(item); if (child != null && !GetIsLocked(child) && child.AreAnyTouchesCaptured) { ShowView view = child.View; Vector scale = deltaScale; if (scale.X != 0) { scale.X = 1 / scale.X; } if (scale.Y != 0) { scale.Y = 1 / scale.Y; } ManipulationDelta deltaManipulation = new ManipulationDelta(-1 * deltaTranslation, -1 * deltaRotation, scale, new Vector()); UpdatePosition(view, deltaManipulation, manipulationOrigin, 1); PositionChild(child); if (dirtyItems.Contains(child)) { dirtyItems.Remove(child); } } } OnViewChanged(); }
private void StopFlyTo() { AnimateUtility.StopAnimation(this.ZoomMatrix, DisplayMatrix.CenterProperty); AnimateUtility.StopAnimation(this.ZoomMatrix, DisplayMatrix.ScaleProperty); AnimateUtility.StopAnimation(this.ZoomMatrix, DisplayMatrix.OrientationProperty); }
void ToggleDetailState() { if (cpContent == null) { pendingToggle = true; return; } cpContent.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); Size sizeTitle = cpContent.DesiredSize; Visibility original = cpDetails.Visibility; cpDetails.Visibility = Visibility.Visible; cpDetails.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); Size sizeDetails = cpDetails.DesiredSize; cpDetails.Visibility = original; pnlContainer.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); Size currentSize = pnlContainer.DesiredSize; AnimateUtility.StopAnimation(pnlContainer, Panel.WidthProperty); AnimateUtility.StopAnimation(pnlContainer, Panel.HeightProperty); pnlContainer.Width = currentSize.Width; pnlContainer.Height = currentSize.Height; Size expandedSize = new Size(sizeTitle.Width, sizeTitle.Height + sizeDetails.Height); if (sizeDetails.Width > sizeTitle.Width) { expandedSize.Width = sizeDetails.Width; } if (currentDetailState == ExpandingSurfaceVEPushPinDetailState.Full || currentDetailState == ExpandingSurfaceVEPushPinDetailState.Growing) { // Hide pp details. if (Map != null) { Map.SendToBack(this); } currentDetailState = ExpandingSurfaceVEPushPinDetailState.Shrinking; AnimateUtility.AnimateElementDouble(cpDetails, Panel.OpacityProperty, 0, 0, 1); AnimateUtility.AnimateElementDouble(pnlContainer, Panel.WidthProperty, sizeTitle.Width, 0, 1); AnimationClock shrinkClock = AnimateUtility.AnimateElementDouble(pnlContainer, Panel.HeightProperty, sizeTitle.Height, 0, 1); shrinkClock.CurrentTimeInvalidated += new EventHandler(currentTimeInvalidated); shrinkClock.Completed += new EventHandler(shrinkClock_Completed); SendOnCollapsing(); } else { // Show pp details. if (Map != null) { Map.SendToFront(this); } currentDetailState = ExpandingSurfaceVEPushPinDetailState.Growing; cpDetails.Visibility = Visibility.Visible; AnimateUtility.AnimateElementDouble(cpDetails, Panel.OpacityProperty, 1, 0, 1); AnimateUtility.AnimateElementDouble(pnlContainer, Panel.WidthProperty, expandedSize.Width, 0, 1); AnimationClock growClock = AnimateUtility.AnimateElementDouble(pnlContainer, Panel.HeightProperty, expandedSize.Height, 0, 1); growClock.CurrentTimeInvalidated += new EventHandler(currentTimeInvalidated); growClock.Completed += new EventHandler(growClock_Completed); SendOnExpanding(); } }