Quellcode durchsuchen

GUI: grid bugs fixed

Herman Schoenfeld vor 7 Jahren
Ursprung
Commit
79960e6dc4
1 geänderte Dateien mit 10 neuen und 1 gelöschten Zeilen
  1. 10 1
      src/libraries/sphere10/UVisualGrid.pas

+ 10 - 1
src/libraries/sphere10/UVisualGrid.pas

@@ -2586,6 +2586,7 @@ begin
               UpdateSelection(FSelectionType, true);
       end;
     dtDefault, dtNone:
+      if FDrawGrid.MouseToGridZone(X, Y) = gzNormal then
       case Button of
         mbLeft: UpdateSelection(FSelectionType, true);
       end;
@@ -2672,8 +2673,16 @@ begin
 
     if not SelectionsEquals(FLastSelectionEvent, LSelection) then
     begin
-      FOnSelection(Self, LSelection);
+      FIgnoreSelectionEvent := true;
       FLastSelectionEvent := LSelection;
+      FOnSelection(Self, LSelection);
+      // maybe inside FOnSelection was called ClearSelection, we can handle this
+      if not SelectionsEquals(FLastSelection, LSelection) then
+      begin
+        FLastSelectionEvent := FLastSelection;
+        FOnSelection(Self, FLastSelection);
+      end;
+      FIgnoreSelectionEvent := false;
     end;
   end;
 end;