From 21a4305ee1dcbe8daa02ab03e66f9066aaaa4879 Mon Sep 17 00:00:00 2001 From: whitequark Date: Sun, 9 Oct 2016 22:26:36 +0000 Subject: [PATCH] Add "Zoom to Fit" to context menu. --- src/mouse.cpp | 9 +++++++++ src/ui.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/mouse.cpp b/src/mouse.cpp index ae98c7f..e2cf3df 100644 --- a/src/mouse.cpp +++ b/src/mouse.cpp @@ -634,6 +634,11 @@ void GraphicsWindow::MouseRightUp(double x, double y) { AddContextMenuItem("Unselect Hovered", ContextCommand::UNSELECT_HOVERED); } + if(itemsSelected) { + AddContextMenuItem(NULL, ContextCommand::SEPARATOR); + AddContextMenuItem("Zoom to Fit", ContextCommand::ZOOM_TO_FIT); + } + ContextCommand ret = ShowContextMenu(); switch(ret) { case ContextCommand::CANCELLED: @@ -710,6 +715,10 @@ void GraphicsWindow::MouseRightUp(double x, double y) { MenuRequest(Command::CONSTRUCTION); break; + case ContextCommand::ZOOM_TO_FIT: + MenuView(Command::ZOOM_TO_FIT); + break; + case ContextCommand::SELECT_ALL: MenuEdit(Command::SELECT_ALL); break; diff --git a/src/ui.h b/src/ui.h index cb7eac6..1aace05 100644 --- a/src/ui.h +++ b/src/ui.h @@ -140,6 +140,7 @@ enum class ContextCommand : uint32_t { REMOVE_SPLINE_PT, ADD_SPLINE_PT, CONSTRUCTION, + ZOOM_TO_FIT, SELECT_ALL, FIRST_STYLE = 0x40000000 };