Skip to content

Commit 88aafd0

Browse files
committed
Option to center camera zoom only
1 parent 202fb4d commit 88aafd0

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

src/editor/editor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ Editor::update(float dt_sec, const Controller& controller)
643643
camera.set_scale(m_new_scale);
644644

645645
// When zooming in, focus on the position of the mouse.
646-
if (zooming_in && !m_key_zoomed)
646+
if (zooming_in && !m_key_zoomed && !g_config->editor_zoom_centered)
647647
camera.move((m_mouse_pos - Vector(static_cast<float>(SCREEN_WIDTH - 128),
648648
static_cast<float>(SCREEN_HEIGHT - 32)) / 2.f) / CAMERA_ZOOM_FOCUS_PROGRESSION);
649649

src/supertux/gameconfig.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ Config::Config() :
113113
editor_invert_shift_scroll(true),
114114
editor_autotile_mode(false),
115115
editor_autotile_help(true),
116+
editor_zoom_centered(false),
116117
editor_autosave_frequency(5),
117118
editor_undo_tracking(true),
118119
editor_undo_stack_size(20),
@@ -253,6 +254,7 @@ Config::load()
253254
editor_mapping->get("render_grid", editor_render_grid);
254255
editor_mapping->get("render_lighting", editor_render_lighting);
255256
editor_mapping->get("invert_shift_scroll", editor_invert_shift_scroll);
257+
editor_mapping->get("zoom_centered", editor_zoom_centered);
256258
editor_mapping->get("selected_snap_grid_size", editor_selected_snap_grid_size);
257259
editor_mapping->get("snap_to_grid", editor_snap_to_grid);
258260
editor_mapping->get("undo_tracking", editor_undo_tracking);
@@ -534,6 +536,7 @@ Config::save()
534536
writer.write("render_grid", editor_render_grid);
535537
writer.write("render_lighting", editor_render_lighting);
536538
writer.write("invert_shift_scroll", editor_invert_shift_scroll);
539+
writer.write("zoom_centered", editor_zoom_centered);
537540
writer.write("selected_snap_grid_size", editor_selected_snap_grid_size);
538541
writer.write("snap_to_grid", editor_snap_to_grid);
539542
writer.write("undo_tracking", editor_undo_tracking);

src/supertux/gameconfig.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ class Config final
158158
bool editor_invert_shift_scroll;
159159
bool editor_autotile_mode;
160160
bool editor_autotile_help;
161+
bool editor_zoom_centered;
161162
int editor_autosave_frequency;
162163
bool editor_undo_tracking;
163164
int editor_undo_stack_size;

src/supertux/menu/editor_settings.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ EditorSettings::EditorSettings()
3939
add_toggle(-1, _("Render Light"), &(Compositor::s_render_lighting));
4040
add_toggle(-1, _("Render Animations"), &(g_config->editor_render_animations));
4141
add_toggle(-1, _("Invert Shift+Scroll"), &(g_config->editor_invert_shift_scroll));
42+
add_toggle(-1, _("Centered Zoom"), &(g_config->editor_zoom_centered));
4243
add_toggle(-1, _("Autotile Mode"), &(g_config->editor_autotile_mode));
4344
add_toggle(-1, _("Enable Autotile Help"), &(g_config->editor_autotile_help));
4445
add_toggle(-1, _("Enable Object Undo Tracking"), &(g_config->editor_undo_tracking));

0 commit comments

Comments
 (0)