Ejemplo n.º 1
0
        /// <summary>
        /// Handler for KeyPress events
        /// </summary>
        /// <param name="key">the NPlot key enumeration</param>
        /// <param name="ps">the InteractivePlotSurface2D</param>
        /// <returns></returns>
        public override bool DoKeyPress(Modifier keys, InteractivePlotSurface2D ps)
        {
            double factor = Sensitivity;

            if (((keys & Modifier.Alt) != 0))
            {
                factor *= altFactor;
            }
            if ((keys & Modifier.Home) != 0)
            {
                ps.SetOriginalDimensions();
                return(true);
            }
            if ((keys & Modifier.Left) != 0)
            {
                ps.CacheAxes();
                ps.TranslateXAxes(left * factor);
                return(true);
            }
            if ((keys & Modifier.Right) != 0)
            {
                ps.CacheAxes();
                ps.TranslateXAxes(right * factor);
                return(true);
            }
            if ((keys & Modifier.Up) != 0)
            {
                ps.CacheAxes();
                ps.TranslateYAxes(up * factor);
                return(true);
            }
            if ((keys & Modifier.Down) != 0)
            {
                ps.CacheAxes();
                ps.TranslateYAxes(down * factor);
                return(true);
            }
            if ((keys & Modifier.Plus) != 0)
            {
                ps.CacheAxes();
                ps.ZoomXAxes(zoomIn * factor, symmetrical);
                ps.ZoomYAxes(zoomIn * factor, symmetrical);
                return(true);
            }
            if ((keys & Modifier.Minus) != 0)
            {
                ps.CacheAxes();
                ps.ZoomXAxes(zoomOut * factor, symmetrical);
                ps.ZoomYAxes(zoomOut * factor, symmetrical);
                return(true);
            }
            return(false);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Handler for KeyPress events
 /// </summary>
 /// <param name="key">the NPlot key enumeration</param>
 /// <param name="ps">the InteractivePlotSurface2D</param>
 /// <returns></returns>
 public override bool DoKeyPress(Modifier keys, InteractivePlotSurface2D ps)
 {
     double factor = Sensitivity;
     if (((keys & Modifier.Alt) != 0))
     {
         factor *= altFactor;
     }
     if ((keys & Modifier.Home) != 0)
     {
         ps.SetOriginalDimensions();
         return true;
     }
     if ((keys & Modifier.Left) != 0)
     {
         ps.CacheAxes();
         ps.TranslateXAxes(left * factor);
         return true;
     }
     if ((keys & Modifier.Right) != 0)
     {
         ps.CacheAxes();
         ps.TranslateXAxes(right * factor);
         return true;
     }
     if ((keys & Modifier.Up) != 0)
     {
         ps.CacheAxes();
         ps.TranslateYAxes(up * factor);
         return true;
     }
     if ((keys & Modifier.Down) != 0)
     {
         ps.CacheAxes();
         ps.TranslateYAxes(down * factor);
         return true;
     }
     if ((keys & Modifier.Plus) != 0)
     {
         ps.CacheAxes();
         ps.ZoomXAxes(zoomIn * factor, symmetrical);
         ps.ZoomYAxes(zoomIn * factor, symmetrical);
         return true;
     }
     if ((keys & Modifier.Minus) != 0)
     {
         ps.CacheAxes();
         ps.ZoomXAxes(zoomOut * factor, symmetrical);
         ps.ZoomYAxes(zoomOut * factor, symmetrical);
         return true;
     }
     return false;
 }