Esempio n. 1
0
 private void Workbench_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (e.ChangedButton == MouseButton.Left)
     {
         leftPressed = true;
         Workbench workbench = (Workbench)sender;
         startingPointMM = workbench.GetPointMMAtOffset(e.GetPosition((Workbench)sender));
     }
 }
Esempio 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);
        }