[jasper/world/studio] Make Ctrl-A select the entire map
All checks were successful
Build / build (push) Successful in 3m18s
All checks were successful
Build / build (push) Successful in 3m18s
This commit is contained in:
parent
4a73a7c35a
commit
f6235304a0
@ -71,22 +71,6 @@ constexpr ox::Point fbPtToTileAddr(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
|
||||||
constexpr ox::Point fbPtToTileAddr(
|
|
||||||
ox::Point const&fbPt,
|
|
||||||
ox::Vec2 const&mapSz) noexcept {
|
|
||||||
return fbPtToTileAddr(static_cast<ox::Vec2>(fbPt), mapSz);
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]]
|
|
||||||
constexpr studio::Selection fbPtToTileAddr(
|
|
||||||
studio::Selection sel,
|
|
||||||
ox::Vec2 const&mapSz) noexcept {
|
|
||||||
sel.a = fbPtToTileAddr(sel.a, mapSz);
|
|
||||||
sel.b = fbPtToTileAddr(sel.b, mapSz);
|
|
||||||
return sel;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr bool inside(auto const val, int const min, int const max) noexcept {
|
constexpr bool inside(auto const val, int const min, int const max) noexcept {
|
||||||
auto const v = static_cast<int>(val);
|
auto const v = static_cast<int>(val);
|
||||||
@ -263,9 +247,13 @@ void WorldEditorImGui::handleSelection(ox::Size const&paneSz, float fbPaneScale)
|
|||||||
m_selTracker.finishSelection();
|
m_selTracker.finishSelection();
|
||||||
m_selection.emplace(m_selTracker.selection());
|
m_selection.emplace(m_selTracker.selection());
|
||||||
}
|
}
|
||||||
if (io.KeyCtrl && io.KeysDown[ImGuiKey_G]) {
|
if (io.KeyCtrl) {
|
||||||
m_selection.reset();
|
if (io.KeysDown[ImGuiKey_G]) {
|
||||||
m_view.clearSelection();
|
clearSelection();
|
||||||
|
} else if (io.KeysDown[ImGuiKey_A]) {
|
||||||
|
m_selection.emplace(ox::Point{0, 0}, ox::Point{m_doc.columns - 1, m_doc.rows - 1});
|
||||||
|
m_view.setSelection(*m_selection);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,4 +342,9 @@ bool WorldEditorImGui::tileSelected(ox::Point const&pt) const noexcept {
|
|||||||
return inside(pt.x, sel.a.x, sel.b.x) && inside(pt.y, sel.a.y, sel.b.y);
|
return inside(pt.x, sel.a.x, sel.b.x) && inside(pt.y, sel.a.y, sel.b.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WorldEditorImGui::clearSelection() noexcept {
|
||||||
|
m_selection.reset();
|
||||||
|
m_view.clearSelection();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -89,6 +89,8 @@ class WorldEditorImGui: public studio::Editor {
|
|||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
bool tileSelected(ox::Point const&pt) const noexcept;
|
bool tileSelected(ox::Point const&pt) const noexcept;
|
||||||
|
|
||||||
|
void clearSelection() noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user