[Graph Panel] Fix opening custom junction color reset connection opacity to zero.

This commit is contained in:
Tanasart 2024-09-26 09:27:52 +07:00
parent 731630c0bd
commit cb6ab49aa6
5 changed files with 30 additions and 10 deletions

View File

@ -22,14 +22,13 @@ function refreshCollections() {
COLLECTIONS.open = true;
}
function searchCollection(_list, _search_str, _clear_list = true) {
function searchCollection(_list, _search_str, _toList = true) {
if(_search_str == "") return;
var search_lower = string_lower(_search_str);
var st = ds_stack_create();
var ll = ds_priority_create();
var ll = _toList? ds_priority_create() : _list;
ds_list_clear(_list);
ds_stack_push(st, COLLECTIONS);
while(!ds_stack_empty(st)) {
@ -47,10 +46,13 @@ function searchCollection(_list, _search_str, _clear_list = true) {
ds_stack_push(st, _st.subDir[| i]);
}
if(_toList) {
repeat(ds_priority_size(ll))
ds_list_add(_list, ds_priority_delete_max(ll));
ds_priority_destroy(ll);
}
ds_stack_destroy(st);
}

View File

@ -2,6 +2,8 @@
function cola(color, alpha = 1) { INLINE return int64((color & 0xFFFFFF) + (round(alpha * 255) << 24)); }
function _cola(color, alpha) { INLINE return int64((color & 0xFFFFFF) + (alpha << 24)); }
function color_real(color) { INLINE return make_color_rgb(color_get_red(color), color_get_green(color), color_get_blue(color)); }
function color_get_alpha(color) { INLINE return (color & (0xFF << 24)) >> 24; }
function _color_get_alpha(color) { INLINE return color_get_alpha(color) / 255; }

View File

@ -18,6 +18,20 @@ function Node_Pin(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
newOutput(0, nodeValue_Output("Out", self, VALUE_TYPE.any, 0));
inputs[0].setColor = function(_color) {
inputs[0].color = color_real(_color); outputs[0].color = color_real(_color);
inputs[0].updateColor(); outputs[0].updateColor();
return inputs[0];
}
outputs[0].setColor = function(_color) {
inputs[0].color = color_real(_color); outputs[0].color = color_real(_color);
inputs[0].updateColor(); outputs[0].updateColor();
return outputs[0];
}
static update = function() {
if(inputs[0].value_from != noone) {

View File

@ -1800,7 +1800,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
/////============= DRAW =============
static setColor = function(_color) {
color = _color;
color = color_real(_color);
updateColor();
return self;
}
@ -2505,6 +2505,8 @@ function drawJuncConnection(from, to, params) {
break;
}
}
draw_set_alpha(1);
#endregion
return hovering;

View File

@ -171,7 +171,7 @@
for( var i = 0, n = array_length(_clrs); i < n; i++ ) {
_item[i] = [
[ THEME.timeline_color, i > 0, _clrs[i] ],
function(_data) { PANEL_GRAPH.setSelectingNodeColor(_data.color); }, "", { color: i == 0? -1 : _clrs[i] }
function(_data) /*=>*/ { PANEL_GRAPH.setSelectingNodeColor(_data.color); }, "", { color: i == 0? -1 : _clrs[i] }
];
}
@ -188,7 +188,7 @@
for( var i = 0, n = array_length(_clrs); i < n; i++ ) {
_item[i] = [
[ THEME.timeline_color, i > 0, _clrs[i] ],
function(_data) { PANEL_GRAPH.setSelectingJuncColor(_data.color); }, "", { color: i == 0? -1 : _clrs[i] }
function(_data) /*=>*/ { PANEL_GRAPH.setSelectingJuncColor(_data.color); }, "", { color: i == 0? -1 : _clrs[i] }
];
}