fixed bug with rotating elements twice in editor with pressed Shift key
authorHolger Schemel <info@artsoft.org>
Fri, 24 Feb 2023 20:22:57 +0000 (21:22 +0100)
committerHolger Schemel <info@artsoft.org>
Fri, 24 Feb 2023 20:22:57 +0000 (21:22 +0100)
src/editor.c

index 644294a4e7122333b1c9d136a5aa606e27ba4064..7bc6dcd7bcaaa71674b799b08fc1fb64c0fb76ee 100644 (file)
@@ -13009,6 +13009,10 @@ static void CopyLevelTemplateToUserLevelSet(char *levelset_subdir)
 static void HandleDrawingAreas(struct GadgetInfo *gi)
 {
   static boolean started_inside_drawing_area = FALSE;
+  static int last_sx = -1;
+  static int last_sy = -1;
+  static int last_sx2 = -1;
+  static int last_sy2 = -1;
   int id = gi->custom_id;
   int type_id = gi->custom_type_id;
   boolean button_press_event;
@@ -13072,10 +13076,6 @@ static void HandleDrawingAreas(struct GadgetInfo *gi)
 
   if (!button_press_event && !button_release_event)
   {
-    static int last_sx = -1;
-    static int last_sy = -1;
-    static int last_sx2 = -1;
-    static int last_sy2 = -1;
     int old_element = (IN_LEV_FIELD(lx, ly) ? Tile[lx][ly] : EL_UNDEFINED);
     boolean hires_drawing = (level.game_engine_type == GAME_ENGINE_TYPE_MM &&
                             isHiresTileElement(old_element) &&
@@ -13085,13 +13085,13 @@ static void HandleDrawingAreas(struct GadgetInfo *gi)
     if ((sx == last_sx && sy == last_sy && !hires_drawing) ||
        (sx2 == last_sx2 && sy2 == last_sy2))
       return;
-
-    last_sx = sx;
-    last_sy = sy;
-    last_sx2 = sx2;
-    last_sy2 = sy2;
   }
 
+  last_sx = sx;
+  last_sy = sy;
+  last_sx2 = sx2;
+  last_sy2 = sy2;
+
   if (button_press_event)
     started_inside_drawing_area = inside_drawing_area;