Double connections fixed
This commit is contained in:
+13
-12
@@ -63,7 +63,6 @@ namespace VISEQ::INTERACTION{
|
||||
std::shared_ptr<ScaleHandle> scale_handle = std::make_shared<ScaleHandle>();
|
||||
|
||||
void update(){
|
||||
doInteraction();
|
||||
if(KEYS_DOWN.ctrl && IsKeyPressed(KEY_C)){
|
||||
VEC_SPTR_Node selected_nodes = gm->getSelection();
|
||||
if(!selected_nodes.empty()) cb.pushNodes(selected_nodes);
|
||||
@@ -82,7 +81,15 @@ namespace VISEQ::INTERACTION{
|
||||
state->node_mode = (state->node_mode + 1) % 3;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void draw(){
|
||||
doInteraction();
|
||||
scaleSelection();
|
||||
if(!gm->selected_nodes.empty()){
|
||||
DrawRectangleRoundedLines(state->bounding_box, 0.1f, 3, VS_COLOR_LIGHTGREY);
|
||||
scale_handle->draw();
|
||||
}
|
||||
}
|
||||
|
||||
void removeNodes(VEC_SPTR_Node nodes){
|
||||
@@ -170,31 +177,31 @@ namespace VISEQ::INTERACTION{
|
||||
void doInteraction(){
|
||||
bool exit = false;
|
||||
bool once = false;
|
||||
bool connect_once = false;
|
||||
|
||||
state->mouse_z = canvas->z_index;
|
||||
|
||||
while(APP::event_queue.size() > 0 && !exit){
|
||||
auto e = APP::event_queue.front();
|
||||
std::cout << e.item->getType() << " " << e.action << std::endl;
|
||||
//std::cout << e.item->getType() << " " << e.action << std::endl;
|
||||
|
||||
if(e.action == APP::Interaction::CONNECT){
|
||||
if(!connect_once && e.action == APP::Interaction::CONNECT){
|
||||
auto connector = std::dynamic_pointer_cast<Connector>(e.item);
|
||||
auto connector_to = std::dynamic_pointer_cast<Connector>(connector->partner);
|
||||
gm->addConnection(std::dynamic_pointer_cast<Node>(connector->parent), std::dynamic_pointer_cast<Node>(connector_to->parent));
|
||||
connect_once = true;
|
||||
}
|
||||
|
||||
if(e.action == APP::Interaction::HOVER){
|
||||
state->mouse_z = e.item->z_index;
|
||||
std::cout << state->mouse_z << std::endl;
|
||||
}
|
||||
|
||||
if(e.item->getType() == GraphItemType::CANVAS) {
|
||||
if(e.action == APP::Interaction::SELECT) {
|
||||
gm->select();
|
||||
std::cout << "app canvas select" << std::endl;
|
||||
canvas->clearSelectionRect();
|
||||
}
|
||||
if(e.action == APP::Interaction::DESELECT) {
|
||||
std::cout << "app canvas deselect" << std::endl;
|
||||
gm->deselect();
|
||||
}
|
||||
}
|
||||
@@ -264,11 +271,5 @@ namespace VISEQ::INTERACTION{
|
||||
APP::event_queue.clear();
|
||||
}
|
||||
|
||||
void draw(){
|
||||
if(!gm->selected_nodes.empty()){
|
||||
DrawRectangleRoundedLines(state->bounding_box, 0.1f, 3, VS_COLOR_LIGHTGREY);
|
||||
scale_handle->draw();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user