mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Editor - Fixed layer visualization with new render scaling
UI - Changed default render scale to 25% (won't affect existing installations)
This commit is contained in:
parent
55cfa65bb5
commit
23b14c6365
@ -36,7 +36,7 @@ namespace Artemis.Core.Services
|
||||
_pluginManagementService = pluginManagementService;
|
||||
_deviceRepository = deviceRepository;
|
||||
_targetFrameRateSetting = settingsService.GetSetting("Core.TargetFrameRate", 25);
|
||||
_renderScaleSetting = settingsService.GetSetting("Core.RenderScale", 0.5);
|
||||
_renderScaleSetting = settingsService.GetSetting("Core.RenderScale", 0.25);
|
||||
|
||||
Surface = new RGBSurface();
|
||||
Utilities.RenderScaleMultiplier = (int) (1 / _renderScaleSetting.Value);
|
||||
|
||||
@ -216,11 +216,11 @@ namespace Artemis.UI.Screens.Settings.Tabs.General
|
||||
|
||||
public double RenderScale
|
||||
{
|
||||
get => _settingsService.GetSetting("Core.RenderScale", 0.5).Value;
|
||||
get => _settingsService.GetSetting("Core.RenderScale", 0.25).Value;
|
||||
set
|
||||
{
|
||||
_settingsService.GetSetting("Core.RenderScale", 0.5).Value = value;
|
||||
_settingsService.GetSetting("Core.RenderScale", 0.5).Save();
|
||||
_settingsService.GetSetting("Core.RenderScale", 0.25).Value = value;
|
||||
_settingsService.GetSetting("Core.RenderScale", 0.25).Save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -108,7 +108,7 @@ namespace Artemis.UI.Screens.SurfaceEditor
|
||||
set => SetAndNotify(ref _colorFirstLedOnly, value);
|
||||
}
|
||||
|
||||
public double MaxTextureSize => 4096 / _settingsService.GetSetting("Core.RenderScale", 0.5).Value;
|
||||
public double MaxTextureSize => 4096 / _settingsService.GetSetting("Core.RenderScale", 0.25).Value;
|
||||
public double MaxTextureSizeIndicatorThickness => 2 / PanZoomViewModel.Zoom;
|
||||
|
||||
public void OpenHyperlink(object sender, RequestNavigateEventArgs e)
|
||||
|
||||
@ -103,7 +103,7 @@ namespace Artemis.UI.Screens.SurfaceEditor.Visualization
|
||||
if (x < 0 || y < 0)
|
||||
return false;
|
||||
|
||||
double maxTextureSize = 4096 / _settingsService.GetSetting("Core.RenderScale", 0.5).Value;
|
||||
double maxTextureSize = 4096 / _settingsService.GetSetting("Core.RenderScale", 0.25).Value;
|
||||
if (x + Device.Rectangle.Width > maxTextureSize || y + Device.Rectangle.Height > maxTextureSize)
|
||||
return false;
|
||||
|
||||
|
||||
@ -1,9 +1,12 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Artemis.Core;
|
||||
using RGB.NET.Core;
|
||||
using SkiaSharp;
|
||||
using SkiaSharp.Views.WPF;
|
||||
using Point = System.Windows.Point;
|
||||
|
||||
namespace Artemis.UI.Services
|
||||
{
|
||||
@ -12,12 +15,15 @@ namespace Artemis.UI.Services
|
||||
/// <inheritdoc />
|
||||
public Rect GetLayerBounds(Layer layer)
|
||||
{
|
||||
// Adjust the render rectangle for the difference in render scale
|
||||
return new(
|
||||
layer.Bounds.Left,
|
||||
layer.Bounds.Top,
|
||||
Math.Max(0, layer.Bounds.Width),
|
||||
Math.Max(0, layer.Bounds.Height)
|
||||
return new Rect(
|
||||
new Point(
|
||||
layer.Leds.Min(l => l.RgbLed.AbsoluteBoundary.Location.X),
|
||||
layer.Leds.Min(l => l.RgbLed.AbsoluteBoundary.Location.Y
|
||||
)),
|
||||
new Point(
|
||||
layer.Leds.Max(l => l.RgbLed.AbsoluteBoundary.Location.X + l.RgbLed.AbsoluteBoundary.Size.Width),
|
||||
layer.Leds.Max(l => l.RgbLed.AbsoluteBoundary.Location.Y + l.RgbLed.AbsoluteBoundary.Size.Height
|
||||
))
|
||||
);
|
||||
}
|
||||
|
||||
@ -94,15 +100,16 @@ namespace Artemis.UI.Services
|
||||
/// <inheritdoc />
|
||||
public SKPoint GetScaledPoint(Layer layer, SKPoint point, bool absolute)
|
||||
{
|
||||
SKRect bounds = GetLayerBounds(layer).ToSKRect();
|
||||
if (absolute)
|
||||
return new SKPoint(
|
||||
100f / layer.Bounds.Width * (point.X - layer.Bounds.Left) / 100f,
|
||||
100f / layer.Bounds.Height * (point.Y - layer.Bounds.Top) / 100f
|
||||
100 / bounds.Width * (point.X - bounds.Left) / 100,
|
||||
100 / bounds.Height * (point.Y - bounds.Top) / 100
|
||||
);
|
||||
|
||||
return new SKPoint(
|
||||
100f / layer.Bounds.Width * point.X / 100f,
|
||||
100f / layer.Bounds.Height * point.Y / 100f
|
||||
100 / bounds.Width * point.X / 100,
|
||||
100 / bounds.Height * point.Y / 100
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user