mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 00:53:52 +00:00
feat(editor): scroll wheel zoom, clickable minimap navigation
- Scroll wheel now zooms camera (moves along look direction) instead of adjusting speed. Much more intuitive for terrain editing. - Shift+scroll adjusts camera speed (old behavior preserved) - Click on minimap to teleport camera to that location on the terrain - Zoom speed scales with current camera speed for consistent feel
This commit is contained in:
parent
f891bd02a5
commit
12acbfb2d5
4 changed files with 23 additions and 4 deletions
|
|
@ -1134,6 +1134,19 @@ void EditorUI::renderMinimap(EditorApp& app) {
|
|||
}
|
||||
|
||||
ImGui::Dummy(ImVec2(avail.x, 16 * cellH));
|
||||
// Click minimap to move camera
|
||||
if (ImGui::IsWindowHovered() && ImGui::IsMouseClicked(0)) {
|
||||
ImVec2 mousePos = ImGui::GetMousePos();
|
||||
float mu = (mousePos.y - origin.y) / (16 * cellH);
|
||||
float mv = (mousePos.x - origin.x) / avail.x;
|
||||
if (mu >= 0 && mu <= 1 && mv >= 0 && mv <= 1) {
|
||||
float wx = tileNW_X - mu * 533.33333f;
|
||||
float wy = tileNW_Y - mv * 533.33333f;
|
||||
app.getEditorCamera().setPosition(glm::vec3(wx, wy,
|
||||
app.getEditorCamera().getCamera().getPosition().z));
|
||||
}
|
||||
}
|
||||
|
||||
// Camera indicator as white cross
|
||||
auto camPos = app.getEditorCamera().getCamera().getPosition();
|
||||
float camU = (tileNW_X - camPos.x) / 533.33333f;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue