Selection working partially. Needs global z-index hovering to work reliably.
This commit is contained in:
+19
-1
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
#include "datatypes.h"
|
||||
#include "state.h"
|
||||
#include "vmath.h"
|
||||
#include "raylib.h"
|
||||
#include "raymath.h"
|
||||
@@ -44,8 +45,12 @@ namespace VISEQ::GRAPH {
|
||||
EDGES::VEC_SPTR_Edge remove_edges;
|
||||
EDGES::VEC_SPTR_Edge split_edges;
|
||||
|
||||
VEC_SPTR_Node selected_nodes;
|
||||
|
||||
std::map<NODES::SPTR_Node, int> counter;
|
||||
|
||||
std::shared_ptr<APP::State> state = APP::State::get();
|
||||
|
||||
NODES::SPTR_Node getRandomNode(){
|
||||
VEC_SPTR_GraphItem o;
|
||||
std::ranges::sample(nodes, std::back_inserter(o), 1, std::mt19937{std::random_device{}()});
|
||||
@@ -294,13 +299,26 @@ namespace VISEQ::GRAPH {
|
||||
Vec2Df nb_position = nb->position - ((nb->position - node->position)).norm() * 20.0f;
|
||||
DrawLineV(n_position, nb_position, VS_COLOR_PINK);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void drawNodes(Vec2Df mouse_pos, Camera2D camera){
|
||||
for(auto n : nodes){
|
||||
if(CheckCollisionPointRec(n->position, state->selection)) {
|
||||
n->in_selection_rect = true;
|
||||
} else {
|
||||
n->in_selection_rect = false;
|
||||
}
|
||||
if(state->istate == APP::InteractionState::DRAW_SELECTION && state->mouse_left.released){
|
||||
if(CheckCollisionPointRec(n->position, state->selection)) {
|
||||
n->selected = true;
|
||||
n->in_selection_rect = false;
|
||||
} else {
|
||||
if(!state->keys_down.shift) n->selected = false;
|
||||
}
|
||||
state->selection = (Rectangle){0,0,0,0};
|
||||
}
|
||||
n->update();
|
||||
if(n->picked_up) drawNeighborLines(n, mouse_pos, camera);
|
||||
n->draw(mouse_pos, camera);
|
||||
|
||||
Reference in New Issue
Block a user