- [Graph Panel] Add double shift kets to select all junctions of the same io type in the same node as the dragging junction.

This commit is contained in:
Tanasart 2024-07-05 10:18:46 +07:00
parent 8442cc6f19
commit 414b356f4b
9 changed files with 88 additions and 70 deletions

View file

@ -10,7 +10,7 @@
gc_target_frame_time(100);
#endregion
#region window
#region window & IO
window_set_min_width(960);
window_set_min_height(600);
draw_set_circle_precision(64);
@ -47,6 +47,10 @@
kb_hold = false;
kb_hkey = 0;
kd_ctrl = 0;
kd_shift = 0;
kd_alt = 0;
fpss = array_create(10);
fpsr = 0;

View file

@ -197,35 +197,34 @@ FILE_DROPPED = false;
#endregion
#region modifiers
if(CTRL == KEYBOARD_STATUS.up) CTRL = KEYBOARD_STATUS.idle;
if(SHIFT == KEYBOARD_STATUS.up) SHIFT = KEYBOARD_STATUS.idle;
if(ALT == KEYBOARD_STATUS.up) ALT = KEYBOARD_STATUS.idle;
var _d = PREFERENCES.double_click_delay;
if(CTRL == KEYBOARD_STATUS.pressing && !keyboard_check(vk_control))
CTRL = KEYBOARD_STATUS.up;
kd_ctrl += DELTA_TIME;
if(CTRL == KEY_STAT.up) CTRL = KEY_STAT.idle;
if(CTRL == KEY_STAT.pressing && !keyboard_check(vk_control)) CTRL = KEY_STAT.up;
if(CTRL == KEY_STAT.down || CTRL == KEY_STAT.double) CTRL = KEY_STAT.pressing;
if(keyboard_check_pressed(vk_control)) { CTRL = kd_ctrl < _d? KEY_STAT.double : KEY_STAT.down; kd_ctrl = 0; }
if(keyboard_check_released(vk_control)) CTRL = KEY_STAT.up;
if(SHIFT == KEYBOARD_STATUS.pressing && !keyboard_check(vk_shift))
SHIFT = KEYBOARD_STATUS.up;
kd_shift += DELTA_TIME;
if(SHIFT == KEY_STAT.up) SHIFT = KEY_STAT.idle;
if(SHIFT == KEY_STAT.pressing && !keyboard_check(vk_shift)) SHIFT = KEY_STAT.up;
if(SHIFT == KEY_STAT.down || SHIFT == KEY_STAT.double) SHIFT = KEY_STAT.pressing;
if(keyboard_check_pressed(vk_shift)) { SHIFT = kd_shift < _d? KEY_STAT.double : KEY_STAT.down; kd_shift = 0; }
if(keyboard_check_released(vk_shift)) SHIFT = KEY_STAT.up;
if(ALT == KEYBOARD_STATUS.pressing && !keyboard_check(vk_alt))
ALT = KEYBOARD_STATUS.up;
if(CTRL == KEYBOARD_STATUS.down) CTRL = KEYBOARD_STATUS.pressing;
if(SHIFT == KEYBOARD_STATUS.down) SHIFT = KEYBOARD_STATUS.pressing;
if(ALT == KEYBOARD_STATUS.down) ALT = KEYBOARD_STATUS.pressing;
if(keyboard_check_pressed(vk_control)) CTRL = KEYBOARD_STATUS.down;
if(keyboard_check_pressed(vk_shift)) SHIFT = KEYBOARD_STATUS.down;
if(keyboard_check_pressed(vk_alt)) ALT = KEYBOARD_STATUS.down;
if(keyboard_check_released(vk_control)) CTRL = KEYBOARD_STATUS.up;
if(keyboard_check_released(vk_shift)) SHIFT = KEYBOARD_STATUS.up;
if(keyboard_check_released(vk_alt)) ALT = KEYBOARD_STATUS.up;
kd_alt += DELTA_TIME;
if(ALT == KEY_STAT.up) ALT = KEY_STAT.idle;
if(ALT == KEY_STAT.pressing && !keyboard_check(vk_alt)) ALT = KEY_STAT.up;
if(ALT == KEY_STAT.down || ALT == KEY_STAT.double) ALT = KEY_STAT.pressing;
if(keyboard_check_pressed(vk_alt)) { ALT = kd_alt < _d? KEY_STAT.double : KEY_STAT.down; kd_alt = 0; }
if(keyboard_check_released(vk_alt)) ALT = KEY_STAT.up;
HOTKEY_MOD = 0;
if(CTRL == KEYBOARD_STATUS.pressing) HOTKEY_MOD |= MOD_KEY.ctrl;
if(SHIFT == KEYBOARD_STATUS.pressing) HOTKEY_MOD |= MOD_KEY.shift;
if(ALT == KEYBOARD_STATUS.pressing) HOTKEY_MOD |= MOD_KEY.alt;
if(CTRL == KEY_STAT.pressing) HOTKEY_MOD |= MOD_KEY.ctrl;
if(SHIFT == KEY_STAT.pressing) HOTKEY_MOD |= MOD_KEY.shift;
if(ALT == KEY_STAT.pressing) HOTKEY_MOD |= MOD_KEY.alt;
#endregion
#region mouse wrap

View file

@ -2,25 +2,25 @@
"$GMObject":"",
"%Name":"o_main",
"eventList":[
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":2,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":5,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":2,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":3,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":4,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":20,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":60,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":62,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":68,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":69,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":70,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":75,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":75,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":9,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":10,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":2,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":5,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":2,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":3,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":4,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":20,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":60,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":62,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":68,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":69,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":70,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":75,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":75,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":9,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":10,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
],
"managed":true,
"name":"o_main",

View file

@ -7,11 +7,13 @@
#endregion
#region keyboard
enum KEYBOARD_STATUS {
enum KEY_STAT {
idle,
down,
pressing,
up
up,
double
}
globalvar KEYBOARD_STRING, KEYBOARD_PRESSED;
@ -19,16 +21,16 @@
WIDGET_ACTIVE = [];
KEYBOARD_PRESSED = vk_nokey;
CTRL = KEYBOARD_STATUS.idle;
ALT = KEYBOARD_STATUS.idle;
SHIFT = KEYBOARD_STATUS.idle;
CTRL = KEY_STAT.idle;
ALT = KEY_STAT.idle;
SHIFT = KEY_STAT.idle;
function key_release() {
INLINE
CTRL = KEYBOARD_STATUS.up;
ALT = KEYBOARD_STATUS.up;
SHIFT = KEYBOARD_STATUS.up;
CTRL = KEY_STAT.up;
ALT = KEY_STAT.up;
SHIFT = KEY_STAT.up;
keyboard_key_release(vk_control);
keyboard_key_release(vk_shift);
@ -37,18 +39,18 @@
function key_mod_press_any() {
INLINE
return CTRL == KEYBOARD_STATUS.pressing || ALT == KEYBOARD_STATUS.pressing || SHIFT == KEYBOARD_STATUS.pressing;
return CTRL == KEY_STAT.pressing || ALT == KEY_STAT.pressing || SHIFT == KEY_STAT.pressing;
}
function key_mod_down(key) { INLINE return key == KEYBOARD_STATUS.down; }
function key_mod_press(key) { INLINE return key == KEYBOARD_STATUS.pressing; }
function key_mod_down(key) { INLINE return key == KEY_STAT.down; }
function key_mod_double(key) { INLINE return key == KEY_STAT.double; }
function key_mod_press(key) { INLINE return key == KEY_STAT.pressing; }
function key_mod_presses(keys) {
INLINE
switch(argument_count) {
case 1 : return argument[0] == KEYBOARD_STATUS.pressing;
case 2 : return argument[0] == KEYBOARD_STATUS.pressing && argument[1] == KEYBOARD_STATUS.pressing;
case 3 : return argument[0] == KEYBOARD_STATUS.pressing && argument[1] == KEYBOARD_STATUS.pressing && argument[2] == KEYBOARD_STATUS.pressing;
case 1 : return argument[0] == KEY_STAT.pressing;
case 2 : return argument[0] == KEY_STAT.pressing && argument[1] == KEY_STAT.pressing;
case 3 : return argument[0] == KEY_STAT.pressing && argument[1] == KEY_STAT.pressing && argument[2] == KEY_STAT.pressing;
}
return false;
}
@ -57,9 +59,9 @@
INLINE
switch(keyindex) {
case MOD_KEY.alt : return ALT == KEYBOARD_STATUS.pressing;
case MOD_KEY.shift : return SHIFT == KEYBOARD_STATUS.pressing;
case MOD_KEY.ctrl : return CTRL == KEYBOARD_STATUS.pressing;
case MOD_KEY.alt : return ALT == KEY_STAT.pressing;
case MOD_KEY.shift : return SHIFT == KEY_STAT.pressing;
case MOD_KEY.ctrl : return CTRL == KEY_STAT.pressing;
}
return false;

View file

@ -540,8 +540,8 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
static drawNodeOverlay = function(xx, yy, _mx, _my, _s) {
if(_s < 0.75) return;
var _bx = xx + w * _s - 10;
var _by = yy + h * _s - 10;
var _bx = (xx + w / 2 * _s);
var _by = (yy + h * _s) - 10;
var _hv = PANEL_GRAPH.pHOVER && PANEL_GRAPH.node_hovering == self;
_hv &= point_in_circle(_mx, _my, _bx, _by, 8);

View file

@ -1200,7 +1200,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
return __draw_bbox.fromPoints(x0, y0, x1, y1);
} #endregion
static drawNodeName = function(xx, yy, _s) { #region
static drawNodeName = function(xx, yy, _s) {
var _name = renamed? display_name : name;
if(_name == "") return;
@ -1224,7 +1224,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
var _xpd = ui(8 + (icon != noone) * 16);
draw_text_cut(round(xx + _xpd), round(yy + ui(10)), _name, w * _s - _xpd, ts);
draw_set_alpha(1);
} #endregion
}
static drawJunctionWidget = function(_x, _y, _mx, _my, _s, _hover, _focus) { #region

View file

@ -1669,8 +1669,20 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
return;
}
if(key_mod_press(SHIFT)) {
array_push_unique(value_draggings, value_dragging)
if(key_mod_double(SHIFT)) {
var _n = value_dragging.node;
var _l = value_dragging.connect_type == JUNCTION_CONNECT.input? _n.inputs : _n.outputs;
var _i = value_dragging.connect_type == JUNCTION_CONNECT.input? _n.inputs_index : _n.outputs_index;
array_push_unique(value_draggings, value_dragging);
for (var i = 0, n = array_length(_i); i < n; i++) {
var _j = _l[| _i[i]];
array_push_unique(value_draggings, _j);
}
} else if(key_mod_press(SHIFT)) {
array_push_unique(value_draggings, value_dragging);
if(value_focus)
array_push_unique(value_draggings, value_focus);

View file

@ -41,6 +41,7 @@
PREFERENCES.keyboard_repeat_start = 0.50;
PREFERENCES.keyboard_repeat_speed = 0.10;
PREFERENCES.keyboard_double_delay = 0.25;
#endregion

View file

@ -1,5 +1,5 @@
{
"$GMScript":"v1",
"$GMScript":"",
"%Name":"preferences",
"isCompatibility":false,
"isDnD":false,