private void animateSelection(double x, double y, SlideElem obj) { if (obj.Equals(SlideElem.upperRightHotCorner)) { if (topRT == null) { InitializeRT(); } topRT.BeginAnimation(RotateTransform.AngleProperty, topDA); } if (obj.Equals(SlideElem.lowerLeftHotCorner)) { if (lowerRT == null) { InitializeRT(); } lowerRT.BeginAnimation(RotateTransform.AngleProperty, lowerDA); } //da.RepeatBehavior = RepeatBehavior.Forever; //rt.BeginAnimation(RotateTransform.AngleProperty, da); var animateRelatedItem = Resources["AnimateRelatedItem"] as Storyboard; var animatePlayButton = Resources["AnimatePlayButton"] as Storyboard; if (relatedItemsDown && y < RelatedItems.ActualHeight) { //double SLIDE_WIDTH = 220; int relatedSlideIndex = ((int)(x) / (int)SLIDE_WIDTH); if (relatedSlideIndex < p.getCurrentSlide().getAllAssociated().Count) //TEMPORARY.... SHOULD BE < 5 { Canvas.SetLeft(relatedImageOverlay, SLIDE_WIDTH * relatedSlideIndex - 10 * (relatedSlideIndex)); if (animateRelatedItem != null) { animateRelatedItem.Begin(this, true); } } } else if (p.getCurrentSlide().hasVideo() && isInPlayButton(x, y)) { if (animatePlayButton != null) { animatePlayButton.Begin(this, true); } } else { if (animatePlayButton != null) { animateRelatedItem.Stop(this); animatePlayButton.Stop(this); animatePlayButton.FillBehavior = FillBehavior.Stop; } } }
//Returns true if the newest point is within APPROX_VALUE distance of the current x, y private bool SetNewSelectionPoint(double x, double y) { SlideElem newObj = SlideElem.none; if (p.getCurrentSlide().hasVideo() && isInPlayButton(x,y)) newObj = SlideElem.playButton; else if (relatedItemsDown && y < RelatedItems.ActualHeight && !inAnnotationMode) { newObj = (SlideElem)((int)(x) / (int)SLIDE_WIDTH); } else if (SetLowerHotspot(x, y)) { newObj = SlideElem.lowerLeftHotCorner; } else if (!inAnnotationMode && SetUpperHotspot(x, y)) { newObj = SlideElem.upperRightHotCorner; } if (!currObj.Equals(newObj)) { justSelectedHotspot = false; if(currObj.Equals(SlideElem.upperRightHotCorner)) { topRT.BeginAnimation(RotateTransform.AngleProperty, null); } else if(currObj.Equals(SlideElem.lowerLeftHotCorner)) { lowerRT.BeginAnimation(RotateTransform.AngleProperty, null); } currObj = newObj; animateSelection(x, y, currObj); return true; } return false; }