static public bool Zoom(KeyboardState kbd, Zoom zoom, int msticks)
        {
            float adjustment = 1.0f + ((float)msticks * 0.002f);

            bool changed = false;

            if (kbd.IsCurrentlyPressed(Keys.Add, Keys.Z) != null)
            {
                zoom.Multiply(adjustment);
                changed = true;
            }

            if (kbd.IsCurrentlyPressed(Keys.Subtract, Keys.X) != null)
            {
                zoom.Multiply(1.0f / adjustment);
                changed = true;
            }

            float newzoom = 0;

            if (kbd.HasBeenPressed(Keys.D1))
            {
                newzoom = zoom.ZoomMax;
            }
            if (kbd.HasBeenPressed(Keys.D2))
            {
                newzoom = 100;                                                      // Factor 3 scale
            }
            if (kbd.HasBeenPressed(Keys.D3))
            {
                newzoom = 33;
            }
            if (kbd.HasBeenPressed(Keys.D4))
            {
                newzoom = 11F;
            }
            if (kbd.HasBeenPressed(Keys.D5))
            {
                newzoom = 3.7F;
            }
            if (kbd.HasBeenPressed(Keys.D6))
            {
                newzoom = 1.23F;
            }
            if (kbd.HasBeenPressed(Keys.D7))
            {
                newzoom = 0.4F;
            }
            if (kbd.HasBeenPressed(Keys.D8))
            {
                newzoom = 0.133F;
            }
            if (kbd.HasBeenPressed(Keys.D9))
            {
                newzoom = zoom.ZoomMin;
            }

            if (newzoom != 0)
            {
                System.Diagnostics.Debug.WriteLine("Zoom to " + newzoom);
                zoom.GoTo(newzoom, -1);
                changed = true;
            }

            return(changed);
        }
Exemple #2
0
        static public bool Zoom(KeyboardState kbd, Zoom zoom, int msticks)
        {
            float adjustment = 1.0f + ((float)msticks * 0.002f);

            bool changed = false;

            if (kbd.IsAnyPressed(Keys.Add, Keys.Z))
            {
                zoom.Multiply(adjustment);
                changed = true;
            }

            if (kbd.IsAnyPressed(Keys.Subtract, Keys.X))
            {
                zoom.Multiply(1.0f / adjustment);
                changed = true;
            }

            float newzoom = 0;

            if (kbd.IsPressed(Keys.D1))
            {
                newzoom = zoom.ZoomMax;
            }
            if (kbd.IsPressed(Keys.D2))
            {
                newzoom = 100;                                                      // Factor 3 scale
            }
            if (kbd.IsPressed(Keys.D3))
            {
                newzoom = 33;
            }
            if (kbd.IsPressed(Keys.D4))
            {
                newzoom = 11F;
            }
            if (kbd.IsPressed(Keys.D5))
            {
                newzoom = 3.7F;
            }
            if (kbd.IsPressed(Keys.D6))
            {
                newzoom = 1.23F;
            }
            if (kbd.IsPressed(Keys.D7))
            {
                newzoom = 0.4F;
            }
            if (kbd.IsPressed(Keys.D8))
            {
                newzoom = 0.133F;
            }
            if (kbd.IsPressed(Keys.D9))
            {
                newzoom = zoom.ZoomMin;
            }

            if (newzoom != 0)
            {
                zoom.GoTo(newzoom, -1);
                changed = true;
            }

            return(changed);
        }