Pixel-Composer/objects/o_dialog_output_visibility/Create_0.gml

49 lines
1.3 KiB
Text
Raw Normal View History

2023-02-14 02:48:33 +01:00
/// @description init
event_inherited();
#region data
dialog_w = ui(240);
dialog_h = ui(320);
node = noone;
destroy_on_click_out = true;
2023-02-28 09:43:01 +01:00
2023-02-14 02:48:33 +01:00
anchor = ANCHOR.left | ANCHOR.top;
hold = false;
#endregion
#region content
2023-02-28 09:43:01 +01:00
sc_outputs = new scrollPane(dialog_w - ui(padding + padding), dialog_h - ui(title_height + padding), function(_y, _m) {
2023-02-14 02:48:33 +01:00
draw_clear_alpha(COLORS._main_text, 0);
if(node == noone) return 0;
var hh = line_height() + ui(8);
var _h = ds_list_size(node.outputs) * hh;
for( var i = 0; i < ds_list_size(node.outputs); i++ ) {
var output = node.outputs[| i];
var _yy = _y + hh * i;
if(sHOVER && sc_outputs.hover && point_in_rectangle(_m[0], _m[1], 0, _yy, sc_outputs.w, _yy + hh - 1)) {
BLEND_OVERRIDE;
draw_sprite_stretched(THEME.node_bg, 0, ui(2), _yy + ui(2), ui(32 - 4), hh - ui(4));
BLEND_NORMAL;
if(mouse_press(mb_left, sFOCUS)) {
hold = !output.visible
output.visible = hold;
}
if(mouse_click(mb_left, sFOCUS))
output.visible = hold;
}
draw_sprite_ui(THEME.visible, output.visible, ui(16), _yy + hh / 2, 0.6, 0.6, 0, output.visible? COLORS._main_icon_light : COLORS._main_icon);
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text);
draw_text_over(ui(36), _yy + hh / 2, output.name);
}
return _h;
})
#endregion