Skip to content

Commit

Permalink
Add options to turn off labels and arrows in multimap.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Frantz committed Nov 18, 2018
1 parent 53c7d98 commit 07f1c8f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
13 changes: 9 additions & 4 deletions imwidget/multimap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ void MultiMap::DrawOne(const DrawLocation& dl) {
Vec2 pos = origin_ + Position(dl.node->pos());
Vec2 button_height(0, 24);
ImGui::SetCursorPos(pos);
if (ImGui::Button(maps_[dl.node->id()].name().c_str())) {
if (show_labels_ && ImGui::Button(maps_[dl.node->id()].name().c_str())) {
SimpleMap::Spawn(mapper_, maps_[map]);
}
pos += button_height;
Expand Down Expand Up @@ -310,6 +310,8 @@ bool MultiMap::Draw() {
ImGui::Checkbox("Pause Convergence while dragging", &pauseconv_);
ImGui::Checkbox("Converge before first draw", &preconverge_);
ImGui::Checkbox("Converge during draw", &continuous_converge_);
ImGui::Checkbox("Show labels", &show_labels_);
ImGui::Checkbox("Show arrows", &show_arrows_);
ImGui::EndPopup();
}

Expand Down Expand Up @@ -346,10 +348,13 @@ bool MultiMap::Draw() {
origin_ = -minv + ImGui::GetCursorPos();
absolute_ = -minv + ImGui::GetCursorScreenPos();

for(const auto& dl : location_)
DrawConnections(dl.second);
for(const auto& dl : location_)
if (show_arrows_) {
for(const auto& dl : location_)
DrawConnections(dl.second);
}
for(const auto& dl : location_) {
DrawOne(dl.second);
}

ImGui::EndChild();
ImGui::End();
Expand Down
5 changes: 4 additions & 1 deletion imwidget/multimap.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class MultiMap: public ImWindowBase {
MultiMap(Mapper* mapper, int world, int overworld, int subworld, int map)
: ImWindowBase(), mapper_(mapper), scale_(0.25),
world_(world), overworld_(overworld), subworld_(subworld),
start_(map), pauseconv_(true) {}
start_(map), pauseconv_(true), show_labels_(true), show_arrows_(true)
{}

void Init();
void Refresh() override { Init(); }
Expand Down Expand Up @@ -76,6 +77,8 @@ class MultiMap: public ImWindowBase {
Vec2 absolute_;
bool drag_;
bool pauseconv_;
bool show_labels_;
bool show_arrows_;

static float xs_;
static float ys_;
Expand Down

0 comments on commit 07f1c8f

Please sign in to comment.