]> git.mcshandy.xyz Git - picker/commitdiff
Update widgets on palette change via click
authorRandy McShandy <randy@mcshandy.xyz>
Tue, 22 Apr 2025 03:46:55 +0000 (22:46 -0500)
committerRandy McShandy <randy@mcshandy.xyz>
Tue, 22 Apr 2025 03:46:55 +0000 (22:46 -0500)
source/rendering.c
source/structs.h

index f7353cb5f0b846224d1c3d6ba4839afcb823f43d..c37b11e48ba7111d818b487c85383dc778d1cd9f 100644 (file)
@@ -183,6 +183,7 @@ int32_t render_palette(Runtime_Info* runtime, SDL_FRect* container)
                if (mouse_click_in_container(runtime, &item, M_LEFT))
                {
                        runtime->active_palette = p;
+      runtime->active_hsl = runtime->layout.palette_color[p];
                }
                if (mouse_click_in_container(runtime, &item, M_RIGHT))
                {
@@ -503,7 +504,6 @@ int32_t check_inputs(Runtime_Info* runtime)
                                        {
                                                runtime->active_palette = new_palette;
                                                runtime->active_hsl = runtime->layout.palette_color[new_palette];
-                                               runtime->active_rgb = hsl_to_rgb(runtime->active_hsl);
                                        }
                                } break;
 
index affbaa3596433f67ac5aeae536e29c592f67dba2..c997e2e3521a937d7cefb9ea491f09f5a129a6d1 100644 (file)
@@ -78,6 +78,7 @@ typedef struct
 typedef enum
 {
        M_LEFT = SDL_BUTTON_LMASK,
+       M_MIDDLE = SDL_BUTTON_MMASK,
        M_RIGHT = SDL_BUTTON_RMASK,
        M_COUNT
 } mouse_button;