Esempio n. 1
0
        /// <summary>
        /// StartRestoreViewTo is a helper method that is called by ZoomExtentsWithGesture to
        /// return the viewport back to it's "home" view.
        /// </summary>
        private void StartRestoreViewTo(Rhino.DocObjects.ViewportInfo targetPosition)
        {
            if (Camera == null)
            {
                return;
            }

            IsInAnimatedRestoreView = true;

            View.UserInteractionEnabled = false;
            RestoreViewStartTime        = DateTime.Now;
            RestoreViewTotalTime        = new TimeSpan(0, 0, 0, 0, 500);

            RestoreViewStartViewport  = new ViewportInfo(Camera);            // start from current position
            RestoreViewFinishViewport = new ViewportInfo(targetPosition);    // end on the target position

            // fix frustum aspect to match current screen aspect
            RestoreViewFinishViewport.FrustumAspect = Camera.FrustumAspect;

            AnimationTimer = NSTimer.CreateScheduledTimer(0.0, this, new Selector("AnimateRestoreView"), null, true);
            AnimationTimer.Fire();
        }