paint: cleanup

This commit is contained in:
luboslenco
2026-05-07 13:24:49 +02:00
parent e607209f79
commit 8e6fe8b73e
5 changed files with 15 additions and 25 deletions
-3
View File
@@ -1130,7 +1130,6 @@ void ui_base_update(void *_) {
g_context->brush_radius += mouse_movement_x / 150.0;
g_context->brush_radius = math_max(0.01, math_min(4.0, g_context->brush_radius));
g_context->brush_radius = math_round(g_context->brush_radius * 100) / 100.0;
g_context->brush_radius_handle->f = g_context->brush_radius;
}
ui_header_handle->redraws = 2;
}
@@ -1225,13 +1224,11 @@ void ui_base_update(void *_) {
else if (operator_shortcut(any_map_get(config_keymap, "brush_radius_decrease"), SHORTCUT_TYPE_REPEAT)) {
g_context->brush_radius -= ui_base_get_radius_increment();
g_context->brush_radius = math_max(math_round(g_context->brush_radius * 100) / 100.0, 0.01);
g_context->brush_radius_handle->f = g_context->brush_radius;
ui_header_handle->redraws = 2;
}
else if (operator_shortcut(any_map_get(config_keymap, "brush_radius_increase"), SHORTCUT_TYPE_REPEAT)) {
g_context->brush_radius += ui_base_get_radius_increment();
g_context->brush_radius = math_round(g_context->brush_radius * 100) / 100.0;
g_context->brush_radius_handle->f = g_context->brush_radius;
ui_header_handle->redraws = 2;
}
else if (decal_mask) {
-2
View File
@@ -126,7 +126,6 @@ context_t *context_create() {
c->brush_nodes_angle = 0.0;
c->brush_nodes_hardness = 1.0;
c->brush_directional = false;
c->brush_radius_handle = ui_handle_create();
c->brush_scale_x = 1.0;
c->brush_decal_mask_radius = 0.5;
c->brush_decal_mask_radius_handle = ui_handle_create();
@@ -176,7 +175,6 @@ void context_init() {
g_context->tool = TOOL_TYPE_BRUSH;
g_context->color_picker_previous_tool = TOOL_TYPE_BRUSH;
g_context->brush_radius = 0.5;
g_context->brush_radius_handle->f = 0.5;
g_context->brush_hardness = 1.0;
}
+12 -18
View File
@@ -86,9 +86,14 @@ void tab_scripts_draw(ui_handle_t *htab) {
-70,
-70,
-140,
-90,
},
4);
3);
// #ifndef NDEBUG
// if (g_config->experimental) {
// f32_array_push(row, -90);
// }
// #endif
ui_row(row);
@@ -109,22 +114,11 @@ void tab_scripts_draw(ui_handle_t *htab) {
ui_handle_t *file_handle = ui_handle(__ID__);
ui_combo(file_handle, ar, tr("File"), false, UI_ALIGN_LEFT, true);
#ifndef NDEBUG
bool is_debug = true;
#else
bool is_debug = false;
#endif
if (!g_config->experimental || !is_debug) {
ui_end_element();
}
#ifndef NDEBUG
if (g_config->experimental && ui_icon_button("Run Tests", ICON_PLAY, UI_ALIGN_CENTER)) {
minic_tests();
}
#endif
// #ifndef NDEBUG
// if (g_config->experimental && ui_icon_button("Run Tests", ICON_PLAY, UI_ALIGN_CENTER)) {
// minic_tests();
// }
// #endif
ui_end_sticky();
-1
View File
@@ -327,7 +327,6 @@ typedef struct context {
f32 brush_nodes_hardness;
bool brush_directional;
f32 brush_radius;
struct ui_handle *brush_radius_handle;
f32 brush_scale_x;
f32 brush_decal_mask_radius;
struct ui_handle *brush_decal_mask_radius_handle;
+3 -1
View File
@@ -416,7 +416,9 @@ void ui_header_draw_tool_properties() {
}
}
else {
g_context->brush_radius = ui_slider(g_context->brush_radius_handle, tr("Radius"), 0.01, 2.0, true, 100.0, true, UI_ALIGN_RIGHT, true);
ui_handle_t *brush_radius_handle = ui_handle(__ID__);
brush_radius_handle->f = g_context->brush_radius;
g_context->brush_radius = ui_slider(brush_radius_handle, tr("Radius"), 0.01, 2.0, true, 100.0, true, UI_ALIGN_RIGHT, true);
if (ui->is_hovered) {
any_map_t *vars = any_map_create();
any_map_set(vars, "brush_radius", any_map_get(config_keymap, "brush_radius"));