Viewer: backspace jumps directly to the slide picker
Bug: skia: Change-Id: I8107358e49ef20bf26ddf6a6dbb21efc07f167e7 Reviewed-on: https://skia-review.googlesource.com/71460 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
76589f9b9b
commit
fce09c5c72
@ -265,6 +265,7 @@ Viewer::Viewer(int argc, char** argv, void* platformData)
|
||||
, fDisplayStats(false)
|
||||
, fRefresh(false)
|
||||
, fShowImGuiDebugWindow(false)
|
||||
, fShowSlidePicker(false)
|
||||
, fShowImGuiTestWindow(false)
|
||||
, fShowZoomWindow(false)
|
||||
, fLastImage(nullptr)
|
||||
@ -336,6 +337,18 @@ Viewer::Viewer(int argc, char** argv, void* platformData)
|
||||
this->fShowImGuiDebugWindow = !this->fShowImGuiDebugWindow;
|
||||
fWindow->inval();
|
||||
});
|
||||
// Command to jump directly to the slide picker and give it focus
|
||||
fCommands.addCommand('/', "GUI", "Jump to slide picker", [this]() {
|
||||
this->fShowImGuiDebugWindow = true;
|
||||
this->fShowSlidePicker = true;
|
||||
fWindow->inval();
|
||||
});
|
||||
// Alias that to Backspace, to match SampleApp
|
||||
fCommands.addCommand(Window::Key::kBack, "Backspace", "GUI", "Jump to slide picker", [this]() {
|
||||
this->fShowImGuiDebugWindow = true;
|
||||
this->fShowSlidePicker = true;
|
||||
fWindow->inval();
|
||||
});
|
||||
fCommands.addCommand('g', "GUI", "Toggle GUI Demo", [this]() {
|
||||
this->fShowImGuiTestWindow = !this->fShowImGuiTestWindow;
|
||||
fWindow->inval();
|
||||
@ -1218,11 +1231,20 @@ void Viewer::drawImGui(SkCanvas* canvas) {
|
||||
}
|
||||
}
|
||||
|
||||
if (fShowSlidePicker) {
|
||||
ImGui::SetNextTreeNodeOpen(true);
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("Slide")) {
|
||||
static ImGuiTextFilter filter;
|
||||
static ImVector<const char*> filteredSlideNames;
|
||||
static ImVector<int> filteredSlideIndices;
|
||||
|
||||
if (fShowSlidePicker) {
|
||||
ImGui::SetKeyboardFocusHere();
|
||||
fShowSlidePicker = false;
|
||||
}
|
||||
|
||||
filter.Draw();
|
||||
filteredSlideNames.clear();
|
||||
filteredSlideIndices.clear();
|
||||
|
@ -78,6 +78,7 @@ private:
|
||||
SkPaint fImGuiFontPaint;
|
||||
SkPaint fImGuiGamutPaint;
|
||||
bool fShowImGuiDebugWindow;
|
||||
bool fShowSlidePicker;
|
||||
bool fShowImGuiTestWindow;
|
||||
|
||||
bool fShowZoomWindow;
|
||||
|
Loading…
Reference in New Issue
Block a user