From ab34081dbb45e9250cdaa7e7417943e3433c7e87 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 14 Nov 2024 23:21:04 +0100 Subject: [PATCH] raw_mouse changed to screen_mouse --- src/draggable.h | 2 +- src/midi-node.h | 2 +- src/node.h | 2 +- src/state.h | 6 +++++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/draggable.h b/src/draggable.h index e5ff1cd..29cb51a 100644 --- a/src/draggable.h +++ b/src/draggable.h @@ -19,7 +19,7 @@ namespace VISEQ::BASE { virtual bool pickedUp() { if(clicked() && held()) { picked_up = true; - drag_offset = position - state->raw_mouse; + drag_offset = position - state->screen_mouse; } return picked_up; } diff --git a/src/midi-node.h b/src/midi-node.h index 6fa487f..461163e 100644 --- a/src/midi-node.h +++ b/src/midi-node.h @@ -136,7 +136,7 @@ namespace VISEQ::GRAPH::NODES { void draw(Vec2Df mouse, Camera2D cam) override { Node::draw(); - interact(); + if(hovering()) interact(); last = time; time = GetTime(); diff --git a/src/node.h b/src/node.h index bf46703..f0539db 100644 --- a/src/node.h +++ b/src/node.h @@ -54,7 +54,7 @@ namespace VISEQ::GRAPH::NODES { virtual void trigger() {}; virtual bool hovering() override { - return CheckCollisionPointCircle(state->raw_mouse, position, radius); + return CheckCollisionPointCircle(state->screen_mouse, position, radius); } void update() override{ diff --git a/src/state.h b/src/state.h index be55939..e05cfdb 100644 --- a/src/state.h +++ b/src/state.h @@ -16,6 +16,8 @@ namespace VISEQ::APP{ }; NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(AppSettings, width, height, grid, bpm, fps, speed, gui_selected_midi_out) + enum InteractionState {HOVER_CANVAS, HOVER_NODE, HOVER_CONNECTOR, ADD_NODES_MENU, DRAG_NODE, CONNECT_NODE, DRAW_SELECTION, SCALE_SELECTION, DELETE_SELECTED_NODES, COPY_SELECTED_NODES, PASTE_SELECTED_NODES}; + class State{ public: State(){} @@ -28,8 +30,10 @@ namespace VISEQ::APP{ Vec2Df screen_mouse; Vec2Df mod_mouse; + InteractionState istate = HOVER_CANVAS; + int node_mode = 0; - + inline static std::shared_ptr instance; static std::shared_ptr get() { if(!instance){