From be2ddb37a6ff6d637b0b7699d759a67ae931f54f Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 18 Apr 2022 16:31:10 +0200 Subject: [PATCH] Gui: fixes #6306: UI Rotation box can be dragged out of view --- src/Gui/NaviCube.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Gui/NaviCube.cpp b/src/Gui/NaviCube.cpp index d3106df764..8a8d400813 100644 --- a/src/Gui/NaviCube.cpp +++ b/src/Gui/NaviCube.cpp @@ -23,6 +23,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ +# include # include # ifdef FC_OS_WIN32 # include @@ -1566,7 +1567,6 @@ bool NaviCubeImplementation::inDragZone(short x, short y) { return abs(dx)m_View3DInventorViewer->width(); + int height = this->m_View3DInventorViewer->height(); + int len = m_CubeWidgetSize / 2; + m_CubeWidgetPosX = std::min(std::max(static_cast(x), len), width - len); + m_CubeWidgetPosY = std::min(std::max(static_cast(y), len), height - len); this->m_View3DInventorViewer->getSoRenderManager()->scheduleRedraw(); return true; }