From f77afa08e3ab168eb8f594a67e3836b7c852ab6a Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sat, 4 Sep 2021 11:05:02 -0400 Subject: [PATCH] Add Scene::getMousePos(). --- include/app/Scene.hpp | 1 + src/app/Scene.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/app/Scene.hpp b/include/app/Scene.hpp index 2f578bec..f6d1c647 100644 --- a/include/app/Scene.hpp +++ b/include/app/Scene.hpp @@ -25,6 +25,7 @@ struct Scene : widget::OpaqueWidget { Scene(); ~Scene(); + math::Vec getMousePos(); void step() override; void draw(const DrawArgs& args) override; void onHover(const HoverEvent& e) override; diff --git a/src/app/Scene.cpp b/src/app/Scene.cpp index 024f91da..a8288d7d 100644 --- a/src/app/Scene.cpp +++ b/src/app/Scene.cpp @@ -73,10 +73,17 @@ Scene::Scene() { addChild(internal->resizeHandle); } + Scene::~Scene() { delete internal; } + +math::Vec Scene::getMousePos() { + return mousePos; +} + + void Scene::step() { if (APP->window->isFullScreen()) { // Expand RackScrollWidget to cover entire screen if fullscreen @@ -107,10 +114,12 @@ void Scene::step() { Widget::step(); } + void Scene::draw(const DrawArgs& args) { Widget::draw(args); } + void Scene::onHover(const HoverEvent& e) { mousePos = e.pos; if (mousePos.y < menuBar->box.size.y) { @@ -119,11 +128,13 @@ void Scene::onHover(const HoverEvent& e) { OpaqueWidget::onHover(e); } + void Scene::onDragHover(const DragHoverEvent& e) { mousePos = e.pos; OpaqueWidget::onDragHover(e); } + void Scene::onHoverKey(const HoverKeyEvent& e) { if (e.action == GLFW_PRESS || e.action == GLFW_REPEAT) { // DEBUG("key '%d '%c' scancode %d '%c' keyName '%s'", e.key, e.key, e.scancode, e.scancode, e.keyName.c_str()); @@ -298,6 +309,7 @@ void Scene::onHoverKey(const HoverKeyEvent& e) { OpaqueWidget::onHoverKey(e); } + void Scene::onPathDrop(const PathDropEvent& e) { if (e.paths.size() >= 1) { const std::string& path = e.paths[0];