From d5a6b2bef87e8a3e92c18c1edc2bb2b02e202c5a Mon Sep 17 00:00:00 2001 From: PhantornRU Date: Fri, 4 Oct 2024 05:59:05 +1000 Subject: [PATCH] Fix annoying mirror bug --- Controllers/DrawController.cs | 22 +++++----------------- Helpers/UndoSaves.cs | 2 +- Resources/DataPixelStorage.cs | 4 ++++ 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/Controllers/DrawController.cs b/Controllers/DrawController.cs index fdf45ba..0fb5e9c 100644 --- a/Controllers/DrawController.cs +++ b/Controllers/DrawController.cs @@ -138,7 +138,6 @@ public static void SetStoragePoints() foreach (var stateDirection in stateDirections) { if (pointsStorage.ContainsKey(stateDirection) == false) continue; - Point[] points = GetStoragePoints(stateDirection); WriteableBitmap bitmapPreview = EnvironmentController.GetPreviewBMP(stateDirection, StateImageSideType.Left); WriteableBitmap bitmapOverlayPreview = EnvironmentController.GetOverlayBMP(stateDirection, StateImageSideType.Left); @@ -148,9 +147,6 @@ public static void SetStoragePoints() foreach (var point in pointsStorage[stateDirection]) { - //var tempPoint = CorrectMousePositionPoint(stateDirection, point.Key, cellsSize); - //var storagePoint = point.Value; - // Pixel Shift Point tempPoint = CorrectMousePositionPoint(stateDirection, point.Key, cellsSize); @@ -158,8 +154,7 @@ public static void SetStoragePoints() Point selectedPoint = new Point(tempPoint.X + pointOffset.X, tempPoint.Y + pointOffset.Y); selectedPoint = CorrectMousePositionPoint(stateDirection, selectedPoint, cellsSize); - Point storagePoint = pointsStorage[stateDirection][point.Key]; - storagePoint = CorrectMousePositionPoint(stateDirection, storagePoint, cellsSize); + Point storagePoint = point.Value; // Update Data Pixel Storage if (StatesController.isLandmarkEditable) @@ -180,7 +175,6 @@ public static void UpdateStoragePoints(Point[] points) { var stateDirections = StatesController.GetStateDirections(); var cellsSize = EnvironmentController.dataImageState.imageCellsSize; - pointsStorage = pointsStorage ?? new Dictionary>(); foreach (var stateDirection in stateDirections) @@ -188,12 +182,10 @@ public static void UpdateStoragePoints(Point[] points) pointsStorage[stateDirection] = new Dictionary(); foreach (var point in points) { - Point tempPoint = CorrectMousePositionPoint(stateDirection, point, cellsSize); - Point storagePoint = EnvironmentController.dataPixelStorage.GetPointStorage(stateDirection, point); - pointsStorage[stateDirection][tempPoint] = storagePoint; + Point newPoint = CorrectMousePositionPoint(stateDirection, point, cellsSize); + Point storagePoint = EnvironmentController.dataPixelStorage.GetPointStorage(stateDirection, newPoint); + pointsStorage[stateDirection][newPoint] = storagePoint; } - //string pointStoragePoints = string.Join(", ", GetStoragePoints(stateDirection)); - //Debug.WriteLine($"StoragePoints: {stateDirection}: {pointStoragePoints}"); } } @@ -231,10 +223,6 @@ public static void ViewSelectedPoints(Point[] points) Point selectedPoint = new Point(point.X - pointOffset.X, point.Y - pointOffset.Y); selectedPoint = CorrectMousePositionPoint(stateDirection, selectedPoint, cellsSize); Point storagePoint = pointsStorage[stateDirection][selectedPoint]; - storagePoint = CorrectMousePositionPoint(stateDirection, storagePoint, cellsSize); - - //Point curPos = MouseController.currentMousePosition; - //Debug.WriteLine($"curPos: {curPos}, point: {point}, temp: {tempPoint}, selected: {selectedPoint}, storage: {storagePoint}, --- offset: {pointOffset}"); // Pixel Color Color color = GetPointColor(bitmapOverlayPreview, storagePoint); @@ -773,7 +761,7 @@ public static void UpdatePointOffsetBounds(Point point1, Point point2) pointOffsetMax.X = Math.Max(point1.X, point2.X); pointOffsetMax.Y = Math.Max(point1.Y, point2.Y); - Debug.WriteLine($"Update Point Offset Bounds, min: {pointOffsetMin}, max: {pointOffsetMax}. pointOffset: {pointOffset}, Down: {pointOffsetDown}, Last: {pointOffsetLast}"); + //Debug.WriteLine($"Update Point Offset Bounds, min: {pointOffsetMin}, max: {pointOffsetMax}. pointOffset: {pointOffset}, Down: {pointOffsetDown}, Last: {pointOffsetLast}"); } /// diff --git a/Helpers/UndoSaves.cs b/Helpers/UndoSaves.cs index 1493abf..803008e 100644 --- a/Helpers/UndoSaves.cs +++ b/Helpers/UndoSaves.cs @@ -56,7 +56,7 @@ public static void SaveStorage(ConcurrentDictionary