mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 20:06:33 +00:00
Fix shape positioning on layer LED selection change
This commit is contained in:
1 parent
5a44e5fbe8
commit
0794966e38
14 files changed
+89
-50
No files matched your search
@@ -105,7 +105,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
||||
|
||||
Execute.PostToUIThread(() =>
|
||||
{
|
||||
var rect = _layerEditorService.GetShapeRenderRect(Layer.LayerShape);
|
||||
var rect = _layerEditorService.GetShapeUntransformedRect(Layer.LayerShape);
|
||||
var shapeGeometry = Geometry.Empty;
|
||||
switch (Layer.LayerShape)
|
||||
{
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
||||
ShapeAnchor = _layerEditorService.GetLayerAnchor(layer, true);
|
||||
Execute.PostToUIThread(() =>
|
||||
{
|
||||
var shapeGeometry = new RectangleGeometry(_layerEditorService.GetShapeRenderRect(layer.LayerShape))
|
||||
var shapeGeometry = new RectangleGeometry(_layerEditorService.GetShapeUntransformedRect(layer.LayerShape))
|
||||
{
|
||||
Transform = _layerEditorService.GetLayerTransformGroup(layer)
|
||||
};
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
||||
layer.LayerShape = new Ellipse(layer);
|
||||
|
||||
// Apply the drag rectangle
|
||||
_layerEditorService.SetShapeRenderRect(layer.LayerShape, DragRectangle);
|
||||
_layerEditorService.SetShapeBaseFromRectangle(layer.LayerShape, DragRectangle);
|
||||
ProfileEditorService.UpdateSelectedProfileElement();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
||||
layer.LayerShape = new Fill(layer);
|
||||
|
||||
// Apply the full layer rectangle
|
||||
_layerEditorService.SetShapeRenderRect(layer.LayerShape, _layerEditorService.GetLayerRect(layer));
|
||||
_layerEditorService.SetShapeBaseFromRectangle(layer.LayerShape, _layerEditorService.GetLayerRect(layer));
|
||||
ProfileEditorService.UpdateSelectedProfileElement();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
||||
layer.LayerShape = new Rectangle(layer);
|
||||
|
||||
// Apply the drag rectangle
|
||||
_layerEditorService.SetShapeRenderRect(layer.LayerShape, DragRectangle);
|
||||
_layerEditorService.SetShapeBaseFromRectangle(layer.LayerShape, DragRectangle);
|
||||
ProfileEditorService.UpdateSelectedProfileElement();
|
||||
}
|
||||
}
|
||||
|
||||
+8
-5
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
@@ -9,6 +10,8 @@ using Artemis.UI.Extensions;
|
||||
using Artemis.UI.Properties;
|
||||
using Artemis.UI.Services;
|
||||
using Artemis.UI.Services.Interfaces;
|
||||
using SkiaSharp;
|
||||
using SkiaSharp.Views.WPF;
|
||||
|
||||
namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
||||
{
|
||||
@@ -52,18 +55,18 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
||||
if (ProfileEditorService.SelectedProfileElement is Layer layer)
|
||||
{
|
||||
// If the layer has a shape, save it's size
|
||||
var shapeSize = Rect.Empty;
|
||||
var shapeSize = SKRect.Empty;
|
||||
if (layer.LayerShape != null)
|
||||
shapeSize = _layerEditorService.GetShapeRenderRect(layer.LayerShape);
|
||||
shapeSize = layer.LayerShape.GetUnscaledRectangle();
|
||||
|
||||
var remainingLeds = layer.Leds.Except(selectedLeds).ToList();
|
||||
layer.ClearLeds();
|
||||
layer.AddLeds(remainingLeds);
|
||||
|
||||
|
||||
// Restore the saved size
|
||||
if (layer.LayerShape != null)
|
||||
_layerEditorService.SetShapeRenderRect(layer.LayerShape, shapeSize);
|
||||
|
||||
layer.LayerShape.SetFromUnscaledRectangle(shapeSize);
|
||||
|
||||
ProfileEditorService.UpdateSelectedProfileElement();
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -53,9 +53,9 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
||||
if (ProfileEditorService.SelectedProfileElement is Layer layer)
|
||||
{
|
||||
// If the layer has a shape, save it's size
|
||||
var shapeSize = Rect.Empty;
|
||||
var shapeSize = SKRect.Empty;
|
||||
if (layer.LayerShape != null)
|
||||
shapeSize = _layerEditorService.GetShapeRenderRect(layer.LayerShape);
|
||||
shapeSize = layer.LayerShape.GetUnscaledRectangle();
|
||||
|
||||
// If shift is held down, add to the selection instead of replacing it
|
||||
if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))
|
||||
@@ -68,7 +68,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
||||
|
||||
// Restore the saved size
|
||||
if (layer.LayerShape != null)
|
||||
_layerEditorService.SetShapeRenderRect(layer.LayerShape, shapeSize);
|
||||
layer.LayerShape.SetFromUnscaledRectangle(shapeSize);
|
||||
|
||||
ProfileEditorService.UpdateSelectedProfileElement();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user