Ejemplo n.º 1
0
        protected void zoomAndPanControl_MouseWheel(object sender, MouseWheelEventArgs e)
        {
            e.Handled = true;
            Point curContentMousePoint = e.GetPosition(content);

            if (e.Delta > 0)
            {
                ZoomIn(curContentMousePoint);
            }
            else if (e.Delta < 0)
            {
                // don't allow zoomout les that original image
                if (ZoomAndPanControl.ContentScale - 0.1 > ZoomAndPanControl.FitScale())
                {
                    ZoomAndPanControl.ZoomOut(curContentMousePoint);
                }
                else
                {
                    ZoomAndPanControl.ScaleToFit();
                }
                ZoomOut(curContentMousePoint);
            }
            if (ZoomAndPanControl.ContentScale > ZoomAndPanControl.FitScale())
            {
                LoadFullRes();
                LayoutViewModel.FreeZoom = true;
            }
        }