node ui and interaction improvements
This commit is contained in:
+13
-1
@@ -143,6 +143,9 @@ int main(){
|
||||
switch(istate){
|
||||
case InteractionState::HOVER_CANVAS:
|
||||
{
|
||||
for(auto &n : app.nm.nodes | std::ranges::views::values){
|
||||
n.hover_connect = false;
|
||||
}
|
||||
if(mouse_right_down) {
|
||||
camera.target = Vector2Add(camera.target, delta);
|
||||
}
|
||||
@@ -227,6 +230,7 @@ int main(){
|
||||
}
|
||||
case InteractionState::HOVER_CONNECTOR:
|
||||
{
|
||||
hovering_connectors.front().hover_connect = true;
|
||||
if(mouse_clicked) hovering_connectors.front().connecting = true;
|
||||
break;
|
||||
}
|
||||
@@ -286,10 +290,18 @@ int main(){
|
||||
|
||||
float wheel = GetMouseWheelMove();
|
||||
if(wheel != 0){
|
||||
if(!hovering_nodes.empty() && IsKeyDown(KEY_LEFT_CONTROL)){
|
||||
if(!hovering_nodes.empty() && IsKeyDown(KEY_LEFT_CONTROL) && !IsKeyDown(KEY_LEFT_ALT)){
|
||||
hovering_nodes.front().midi_note += wheel;
|
||||
if(hovering_nodes.front().midi_note < 0 ) hovering_nodes.front().midi_note = app.sm.midi.midiNotes.size()-1;
|
||||
if(hovering_nodes.front().midi_note >= app.sm.midi.midiNotes.size() ) hovering_nodes.front().midi_note = 0;
|
||||
} else if(!hovering_nodes.empty() && IsKeyDown(KEY_LEFT_SHIFT) && !IsKeyDown(KEY_LEFT_ALT)) {
|
||||
hovering_nodes.front().midi_velocity += wheel;
|
||||
if(hovering_nodes.front().midi_velocity < 0 ) hovering_nodes.front().midi_velocity = 127;
|
||||
if(hovering_nodes.front().midi_velocity > 127 ) hovering_nodes.front().midi_velocity = 0;
|
||||
} else if(!hovering_nodes.empty() && IsKeyDown(KEY_LEFT_ALT)) {
|
||||
float incr = (float)wheel * (IsKeyDown(KEY_LEFT_SHIFT) ? 100.0f : IsKeyDown(KEY_LEFT_CONTROL) ? 1000.0f : 10.0f);
|
||||
hovering_nodes.front().midi_gate += incr;
|
||||
if(hovering_nodes.front().midi_gate < 0 ) hovering_nodes.front().midi_gate = 0;
|
||||
} else {
|
||||
Vector2 mouseWorldPos = GetScreenToWorld2D(GetMousePosition(), camera);
|
||||
camera.offset = GetMousePosition();
|
||||
|
||||
Reference in New Issue
Block a user