Ejemplo n.º 1
0
 public override void Update(GUIControlContext Context, double Time)
 {
     MouseState ms = Context.MouseState;
     if (ms != null)
     {
         // Zoom and stuff
         double scroll = ms.Scroll;
         if (scroll != 0.0)
         {
             double zoom = Math.Pow(2.0, -scroll / 40.0);
             Rectangle win = this._Window;
             Point mousepos = new Rectangle(this.Size).ToRelative(ms.Position);
             mousepos.Y = 1.0 - mousepos.Y;
             Point nwinsize = win.Size * zoom;
             Point nwinpos = win.Location + mousepos.Scale(win.Size) - mousepos.Scale(nwinsize);
             this._Window = new Rectangle(nwinpos, nwinsize).Intersection(this.Domain);
         }
     }
 }