diff --git a/OpenDreamClient/Interface/Controls/ControlMap.cs b/OpenDreamClient/Interface/Controls/ControlMap.cs index c163b1d364..4d9ba1d91a 100644 --- a/OpenDreamClient/Interface/Controls/ControlMap.cs +++ b/OpenDreamClient/Interface/Controls/ControlMap.cs @@ -16,6 +16,21 @@ public sealed class ControlMap : InterfaceControl { public ControlMap(ControlDescriptor controlDescriptor, ControlWindow window) : base(controlDescriptor, window) { } + protected override void UpdateElementDescriptor() { + base.UpdateElementDescriptor(); + + ControlDescriptorMap mapDescriptor = (ControlDescriptorMap)ElementDescriptor; + + Viewport.StretchMode = mapDescriptor.ZoomMode switch { + "blur" => ScalingViewportStretchMode.Bilinear, + "distort" => ScalingViewportStretchMode.Nearest, + + // TODO: "tries to keep the look of individual pixels, + // but will adjust to non-integer zooms (like 1.1x) by blending neighboring pixels" + "normal" or _ => ScalingViewportStretchMode.Nearest + }; + } + public void UpdateViewRange(ViewRange view) { Viewport.ViewportSize = (Math.Max(view.Width, 1) * 32, Math.Max(view.Height, 1) * 32); } diff --git a/OpenDreamClient/Interface/Descriptors/ControlDescriptors.cs b/OpenDreamClient/Interface/Descriptors/ControlDescriptors.cs index 748150c46d..147aaa40ea 100644 --- a/OpenDreamClient/Interface/Descriptors/ControlDescriptors.cs +++ b/OpenDreamClient/Interface/Descriptors/ControlDescriptors.cs @@ -138,6 +138,8 @@ public sealed partial class ControlDescriptorInfo : ControlDescriptor { } public sealed partial class ControlDescriptorMap : ControlDescriptor { + [DataField("zoom-mode")] + public string ZoomMode = "normal"; } public sealed partial class ControlDescriptorBrowser : ControlDescriptor {