paint: camera pivot fixes

This commit is contained in:
luboslenco
2026-03-31 13:25:01 +02:00
parent 84c96d93ef
commit d6c5370fcc
4 changed files with 11 additions and 9 deletions
+2 -2
View File
@@ -71,8 +71,8 @@ static void camera_orbit_action(bool modif, bool default_keymap) {
camera->base->transform->loc.y = pivot_y + offset.y;
camera->base->transform->loc.z = pivot_z + offset.z;
camera_object_build_mat(camera);
return;
}
return;
}
f32 dist = camera_distance();
@@ -133,8 +133,8 @@ static void camera_rotate_action(bool modif, bool default_keymap) {
t->loc.y = pivot_y + offset.y;
t->loc.z = pivot_z + offset.z;
transform_build_matrix(t);
return;
}
return;
}
transform_rotate(t, up, (mouse_movement_x / 120.0) * config_raw->camera_rotation_speed);
+1 -1
View File
@@ -208,7 +208,7 @@ void config_init() {
config_raw->zoom_direction = ZOOM_DIRECTION_VERTICAL;
config_raw->displace_strength = 0.0;
config_raw->wrap_mouse = false;
config_raw->camera_pivot = CAMERA_PIVOT_CURSOR;
config_raw->camera_pivot = CAMERA_PIVOT_CENTER;
config_raw->camera_controls = CAMERA_CONTROLS_ORBIT;
config_raw->layer_res = TEXTURE_RES_RES2048;
#if defined(IRON_ANDROID) || defined(IRON_IOS)
+2 -2
View File
@@ -168,8 +168,8 @@ typedef enum {
} camera_controls_t;
typedef enum {
CAMERA_PIVOT_CURSOR = 0,
CAMERA_PIVOT_CAMERA_CENTER = 1,
CAMERA_PIVOT_CURSOR = 0,
CAMERA_PIVOT_CENTER = 1,
} camera_pivot_t;
typedef enum {
+6 -4
View File
@@ -370,7 +370,7 @@ void ui_menubar_draw_category_items() {
project_save_as(false);
}
ui->changed = false;
ui->changed = false;
ui_handle_t *h_pack_assets = ui_handle(__ID__);
h_pack_assets->b = context_raw->pack_assets_on_save;
context_raw->pack_assets_on_save = ui_check(h_pack_assets, tr("Pack Assets"), "");
@@ -758,13 +758,15 @@ void ui_menubar_draw_category_items() {
ui_menu_align();
ui_menu_label(tr("Pivot"), any_map_get(config_keymap, "view_pivot_center"));
ui_menu_align();
ui_handle_t *h = ui_handle(__ID__);
ui_handle_t *camera_pivot_handle = ui_handle(__ID__);
camera_pivot_handle->i = context_raw->camera_pivot;
string_t_array_t *pivot_center_items = any_array_create_from_raw(
(void *[]){
tr("Cursor"), tr("Center"),
tr("Cursor"),
tr("Center"),
},
2);
context_raw->camera_pivot = ui_inline_radio(h, pivot_center_items, UI_ALIGN_LEFT);
context_raw->camera_pivot = ui_inline_radio(camera_pivot_handle, pivot_center_items, UI_ALIGN_LEFT);
ui_menu_separator();
ui_menu_align();