diff --git a/modules/v4d/include/opencv2/v4d/dialog.hpp b/modules/v4d/include/opencv2/v4d/dialog.hpp index 2384b33f6..4850cc6e1 100644 --- a/modules/v4d/include/opencv2/v4d/dialog.hpp +++ b/modules/v4d/include/opencv2/v4d/dialog.hpp @@ -22,7 +22,6 @@ using std::string; class CustomTheme : public nanogui::Theme { public: CustomTheme(NVGcontext *ctx) : nanogui::Theme(ctx) { - m_window_drop_shadow_size = 10; } virtual ~CustomTheme() { diff --git a/modules/v4d/src/detail/framebuffercontext.cpp b/modules/v4d/src/detail/framebuffercontext.cpp index e048c0d87..3a63cf51d 100644 --- a/modules/v4d/src/detail/framebuffercontext.cpp +++ b/modules/v4d/src/detail/framebuffercontext.cpp @@ -288,8 +288,7 @@ void FrameBufferContext::init() { glfwSetCursorPosCallback(getGLFWWindow(), [](GLFWwindow* glfwWin, double x, double y) { V4D* v4d = reinterpret_cast(glfwGetWindowUserPointer(glfwWin)); if(v4d->hasNguiCtx()) { - auto pt = v4d->fbCtx().toWindowCoord(cv::Point2f(x, y)); - v4d->nguiCtx().screen().cursor_pos_callback_event(pt.x, pt.y); + v4d->nguiCtx().screen().cursor_pos_callback_event(x, y); } #ifndef __EMSCRIPTEN__ auto cursor = v4d->getMousePosition(); @@ -337,8 +336,8 @@ void FrameBufferContext::init() { std::vector widgets; if(v4d->hasNguiCtx()) { for (auto* w : v4d->nguiCtx().screen().children()) { - auto pt = v4d->fbCtx().toWindowCoord(v4d->getMousePosition()); - auto mousePos = nanogui::Vector2i(pt[0] / v4d->pixelRatioX(), pt[1] / v4d->pixelRatioY()); + auto pt = v4d->getMousePosition(); + auto mousePos = nanogui::Vector2i(pt[0], pt[1]); if(cv::v4d::detail::contains_absolute(w, mousePos)) { v4d->nguiCtx().screen().scroll_callback_event(x, y); return; @@ -638,22 +637,6 @@ void FrameBufferContext::execute(std::function fn) { }); } -cv::Point2f FrameBufferContext::toWindowCoord(const cv::Point2f& pt) { -#ifdef __EMSCRIPTEN__ - return cv::Point2f(pt.x * pixelRatioX(), pt.y * pixelRatioY()); -#else - return cv::Point2f(pt.x, pt.y); -#endif -} - -cv::Vec2f FrameBufferContext::toWindowCoord(const cv::Vec2f& pt) { -#ifdef __EMSCRIPTEN__ - return cv::Point2f(pt[0] * pixelRatioX(), pt[1] * pixelRatioY()); -#else - return cv::Point2f(pt[0], pt[1]); -#endif -} - cv::ogl::Texture2D& FrameBufferContext::getTexture2D() { return *texture_; } diff --git a/modules/v4d/src/detail/framebuffercontext.hpp b/modules/v4d/src/detail/framebuffercontext.hpp index ef94077da..1592e9383 100644 --- a/modules/v4d/src/detail/framebuffercontext.hpp +++ b/modules/v4d/src/detail/framebuffercontext.hpp @@ -211,9 +211,6 @@ protected: */ cv::ogl::Texture2D& getTexture2D(); - cv::Point2f toWindowCoord(const cv::Point2f& pt); - cv::Vec2f toWindowCoord(const cv::Vec2f& pt); - GLFWwindow* getGLFWWindow(); #ifndef __EMSCRIPTEN__ diff --git a/modules/v4d/src/detail/nanoguicontext.cpp b/modules/v4d/src/detail/nanoguicontext.cpp index 3454edaf4..d9f40d062 100644 --- a/modules/v4d/src/detail/nanoguicontext.cpp +++ b/modules/v4d/src/detail/nanoguicontext.cpp @@ -29,10 +29,7 @@ NanoguiContext::NanoguiContext(FrameBufferContext& fbContext) : screen_ = new nanogui::Screen(true, true, false); screen_->initialize(fbCtx().getGLFWWindow(), false); Size winSize = fbContext.getV4D().getWindowSize(); -#ifndef __EMSCRIPTEN__ screen_->set_size({int(winSize.width / fbContext.getV4D().pixelRatioX()), int(winSize.height / fbContext.getV4D().pixelRatioY())}); -#endif - fbCtx().setWindowSize(fbCtx().size()); context_ = screen_->nvg_context(); form_ = new cv::v4d::FormHelper(screen_); if (!context_)