|
|
|
@ -19,6 +19,7 @@ namespace Perspex.Controls.Platform |
|
|
|
=> PerspexLocator.Current.GetService<IPlatformSettings>(); |
|
|
|
|
|
|
|
static bool s_designerMode; |
|
|
|
private static double _designerScalingFactor = 1; |
|
|
|
|
|
|
|
public static IRenderTarget CreateRenderTarget(ITopLevelImpl window) |
|
|
|
{ |
|
|
|
@ -33,6 +34,14 @@ namespace Perspex.Controls.Platform |
|
|
|
return Disposable.Create(() => s_designerMode = false); |
|
|
|
} |
|
|
|
|
|
|
|
public static void SetDesignerScalingFactor(double factor) |
|
|
|
{ |
|
|
|
_designerScalingFactor = factor; |
|
|
|
} |
|
|
|
|
|
|
|
static double RenderScalingFactor => (GetSettings()?.RenderScalingFactor ?? 1)*_designerScalingFactor; |
|
|
|
static double LayoutScalingFactor => (GetSettings()?.LayoutScalingFactor ?? 1) * _designerScalingFactor; |
|
|
|
|
|
|
|
class RenderTargetDecorator : IRenderTarget |
|
|
|
{ |
|
|
|
private readonly IRenderTarget _target; |
|
|
|
@ -53,7 +62,7 @@ namespace Perspex.Controls.Platform |
|
|
|
{ |
|
|
|
var cs = _window.ClientSize; |
|
|
|
var ctx = _target.CreateDrawingContext(); |
|
|
|
var factor = GetSettings()?.RenderScalingFactor ?? 1; |
|
|
|
var factor = RenderScalingFactor; |
|
|
|
if (factor != 1) |
|
|
|
{ |
|
|
|
ctx.PushPostTransform(Matrix.CreateScale(factor, factor)); |
|
|
|
@ -70,7 +79,7 @@ namespace Perspex.Controls.Platform |
|
|
|
private readonly IPopupImpl _popup; |
|
|
|
|
|
|
|
public ITopLevelImpl TopLevel => _tl; |
|
|
|
double ScalingFactor => GetSettings()?.LayoutScalingFactor ?? 1; |
|
|
|
double ScalingFactor => LayoutScalingFactor; |
|
|
|
|
|
|
|
public WindowDecorator(ITopLevelImpl tl) |
|
|
|
{ |
|
|
|
|