Procházet zdrojové kódy

Don't clamp mouse coordinates until they're fully outside the containing area

A window 1920x1080 pixels wide at 125% scaling will have a width and height of 1536x864, but at pixel (1919,1079) the mouse coordinate will be (1535.2,863.2), which is within the bounds of 1536x864, but larger than (1535,863).
Sam Lantinga před 2 roky
rodič
revize
b9773be3b3
1 změnil soubory, kde provedl 2 přidání a 2 odebrání
  1. 2 2
      src/events/SDL_mouse.c

+ 2 - 2
src/events/SDL_mouse.c

@@ -553,14 +553,14 @@ static int SDL_PrivateSendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL_
             }
         }
 
-        if (mouse->x > (float)x_max) {
+        if (mouse->x >= (float)(x_max + 1)) {
             mouse->x = (float)x_max;
         }
         if (mouse->x < (float)x_min) {
             mouse->x = (float)x_min;
         }
 
-        if (mouse->y > (float)y_max) {
+        if (mouse->y >= (float)(y_max + 1)) {
             mouse->y = (float)y_max;
         }
         if (mouse->y < (float)y_min) {