Exemplo n.º 1
0
 private void Workbench_MouseMove(object sender, MouseEventArgs e)
 {
     if (leftPressed)
     {
         Workbench workbench = (Workbench)sender;
         Point     offset    = e.GetPosition(workbench);
         Point     newOffset = workbench.GetOffsetAtPointMM(startingPointMM);
         workbench.Pan(new Vector(newOffset.X - offset.X, newOffset.Y - offset.Y));
     }
 }
Exemplo n.º 2
0
        private void Workbench_MouseWheel(object sender, MouseWheelEventArgs e)
        {
            Workbench workbench = (Workbench)sender;

            Point  offset     = e.GetPosition(workbench);
            Point  originalMM = workbench.GetPointMMAtOffset(offset);
            double newZoom    = workbench.ViewZoom * Math.Pow(2.0, e.Delta / 480.0);

            if (newZoom < Workbench.ZoomMin)
            {
                newZoom = Workbench.ZoomMin;
            }
            if (newZoom > Workbench.ZoomMax)
            {
                newZoom = Workbench.ZoomMax;
            }
            workbench.ViewZoom = newZoom;
            Point newOffset = workbench.GetOffsetAtPointMM(originalMM);

            workbench.Pan(newOffset - offset);
        }