public void Zoom(float f, bool changezoomslider = true) { float maxzoom = Settings.Default.SuperZoom ? 200 : 24; if ((Track.Zoom >= maxzoom && f > 0) || (Track.Zoom <= 0.1f && f < 0) || Math.Abs(f) < 0.001) { return; } Track.Zoom += f; if (Track.Zoom < 0.1f) { Track.Zoom = 0.1f; } if (Track.Zoom > maxzoom) { Track.Zoom = maxzoom; } Invalidate(); VerticalSlider vslider = (VerticalSlider)Canvas.FindChildByName("vslider", true); if (changezoomslider) { if (vslider != null) { vslider.Value = Track.Zoom; } } vslider.SetToolTipText(Math.Round(Track.Zoom, 2) + "x"); }
public void SetZoom(float val, bool changezoomslider = true) { float maxzoom = Settings.SuperZoom ? 200 : 24; Track.Zoom = MathHelper.Clamp(val, 0.1f, maxzoom); VerticalSlider vslider = (VerticalSlider)Canvas.FindChildByName("vslider", true); if (changezoomslider) { if (vslider != null) { vslider.Value = Track.Zoom; } } vslider.SetToolTipText(Math.Round(Track.Zoom, 2) + "x"); Invalidate(); }