소스 검색

some checks

flabbet 1 년 전
부모
커밋
6357a76cad

+ 1 - 1
src/PixiEditor.DrawingApi.Core/Surfaces/Pixmap.cs

@@ -41,7 +41,7 @@ public class Pixmap : NativeObject
         DrawingBackendApi.Current.PixmapImplementation.Dispose(ObjectPointer);
     }
 
-    public Color GetPixelColor(int x, int y) => GetPixelColor(new VecI(x, y));
+    public Color GetPixelColor(int x, int y) => GetPixelColor(new VecI(Math.Clamp(x, 0, Width), Math.Clamp(y, 0, Height)));
     
     public Color GetPixelColor(VecI position)
     {

+ 11 - 3
src/PixiEditor/Views/Palettes/PaletteColorControl.axaml.cs

@@ -56,9 +56,17 @@ internal partial class PaletteColorControl : UserControl
             float length = (float)Math.Sqrt(movedDistance.X * movedDistance.X + movedDistance.Y * movedDistance.Y);
             if (length > 10)
             {
-                DataObject data = new DataObject();
-                data.Set(PaletteColorDaoFormat, colorControl.Color.ToString());
-                DragDrop.DoDragDrop(e, data, DragDropEffects.Move);
+                try
+                {
+                    DataObject data = new DataObject();
+                    data.Set(PaletteColorDaoFormat, colorControl.Color.ToString());
+                    DragDrop.DoDragDrop(e, data, DragDropEffects.Move);
+                }
+                catch
+                {
+                    // ignored
+                }
+
                 e.Handled = true;
             }
         }

+ 1 - 0
src/PixiEditor/Views/Palettes/PaletteViewer.axaml.cs

@@ -286,6 +286,7 @@ internal partial class PaletteViewer : UserControl
                     Colors.RemoveAt(currIndex);
                     Colors.Insert(newIndex, paletteColor);
                     int indexOfSource = Colors.IndexOf(paletteColorControl.Color);
+                    if(indexOfSource < 0) return;
                     Colors.Move(indexOfSource, currIndex);
                 }
             }