Stay zoomed when image doesn't fit in client area

This commit is contained in:
Eric Tetz 2022-01-31 20:31:34 -07:00
parent 992e462383
commit 778eec1188

View file

@ -791,15 +791,15 @@ protected override void OnPaint(PaintEventArgs e)
Graphics g = e.Graphics;
g.PixelOffsetMode = PixelOffsetMode.HighSpeed;
g.InterpolationMode = InterpolationMode.NearestNeighbor;
if (IsEditorMode && !CanvasRectangle.Contains(ClientArea))
if (IsEditorMode)
{
g.ScaleTransform(ZoomFactor, ZoomFactor);
if (!CanvasRectangle.Contains(ClientArea))
{
g.Clear(canvasBackgroundColor);
g.DrawRectangleProper(canvasBorderPen, CanvasRectangle.Offset(1));
}
}
DrawBackground(g);
DrawShapes(g);
@ -820,8 +820,8 @@ protected override void OnPaint(PaintEventArgs e)
private void DrawBackground(Graphics g)
{
// TODO: dynamically adjust scaling quality when zoom != 1 based on FPS
// Quality is more important when scaling down than up.
// TODO: dynamically improved scaling quality when zoom != 1 if FPS is high
// especially when scaling down
g.PixelOffsetMode = PixelOffsetMode.HighSpeed;
g.InterpolationMode = InterpolationMode.NearestNeighbor;
g.SmoothingMode = SmoothingMode.HighSpeed;