Some progress on selecting, hovering but still buggy and not a good design really.
This commit is contained in:
+23
-4
@@ -7,6 +7,7 @@
|
||||
#include "datatypes.h"
|
||||
#include "draggable.h"
|
||||
#include "graph-item.h"
|
||||
#include "state.h"
|
||||
#include "vmath.h"
|
||||
|
||||
namespace VISEQ::GRAPH::EDGES{
|
||||
@@ -56,13 +57,30 @@ namespace VISEQ::GRAPH::NODES {
|
||||
virtual void trigger() {};
|
||||
|
||||
virtual bool hovering() override {
|
||||
return CheckCollisionPointCircle(state->screen_mouse, position, radius);
|
||||
return state->istate != APP::InteractionState::DRAW_SELECTION && CheckCollisionPointCircle(state->screen_mouse, position, radius);
|
||||
}
|
||||
|
||||
virtual bool entered() override {
|
||||
return !is_hovering && hovering();
|
||||
}
|
||||
|
||||
virtual bool exited() override {
|
||||
return is_hovering && !hovering();
|
||||
}
|
||||
|
||||
void update() override{
|
||||
if(hovering()) state->hovering = true;
|
||||
if(pickedUp() || selected) drag();
|
||||
if(released()) putDown();
|
||||
if((held() && !picked_up) || (clicked() && !state->keys_down.shift)) select();
|
||||
if(entered()) state->istate = APP::InteractionState::HOVER_NODE;
|
||||
if(exited()) state->istate = APP::InteractionState::HOVER_CANVAS;
|
||||
if(pickedUp()){
|
||||
drag();
|
||||
state->istate = APP::InteractionState::DRAG_NODE;
|
||||
}
|
||||
if(released() && picked_up){
|
||||
putDown();
|
||||
state->istate = APP::InteractionState::HOVER_CANVAS;
|
||||
}
|
||||
|
||||
int free_connectors = 0;
|
||||
for(auto c : connectors){
|
||||
if(!c->partner) free_connectors++;
|
||||
@@ -70,6 +88,7 @@ namespace VISEQ::GRAPH::NODES {
|
||||
c->update();
|
||||
}
|
||||
if(free_connectors == 0) addConnector();
|
||||
is_hovering = hovering();
|
||||
}
|
||||
|
||||
void draw(Vec2Df mp, Camera2D cam) override {}
|
||||
|
||||
Reference in New Issue
Block a user