Collection tooltip, graph focus

This commit is contained in:
Tanasart 2023-11-24 20:48:19 +07:00
parent b6f7088dbd
commit 01346307c7
6 changed files with 42 additions and 30 deletions

View file

@ -95,7 +95,7 @@ event_inherited();
var ly = recent_thumbnail? _y + hg - (line_get_height(f_p0b) + line_get_height(f_p1)) - ui(8) : _y + ui(8);
draw_set_text(f_p0b, fa_left, fa_top, COLORS._main_text_inner);
draw_text(fx + ui(12), ly, filename_name(_rec));
draw_text(fx + ui(12), ly, filename_name_only(_rec));
ly += line_get_height(, ui(4));
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text_sub);

View file

@ -69,6 +69,8 @@ function MetaDataManager() constructor {
}
static drawTooltip = function() {
var _pd = ui(10);
var ww = ui(320), _w = 0;
var _h = 0;
@ -77,18 +79,20 @@ function MetaDataManager() constructor {
_h = string_height(name);
_w = string_width(name);
var mx = min(mouse_mx + ui(16), WIN_W - (_w + ui(16)));
var my = min(mouse_my + ui(16), WIN_H - (_h + ui(16)));
var mx = min(mouse_mx + _pd * 2, WIN_W - (_w + _pd * 2));
var my = min(mouse_my + _pd * 2, WIN_H - (_h + _pd * 2));
draw_sprite_stretched(THEME.textbox, 3, mx, my, _w + ui(16), _h + ui(16));
draw_sprite_stretched(THEME.textbox, 0, mx, my, _w + ui(16), _h + ui(16));
draw_sprite_stretched(THEME.textbox, 3, mx, my, _w + _pd * 2, _h + _pd * 2);
draw_sprite_stretched(THEME.textbox, 0, mx, my, _w + _pd * 2, _h + _pd * 2);
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text);
draw_text(mx + ui(8), my + ui(8), name);
draw_text(mx + _pd, my + _pd, name);
return;
}
var _aut = __txt("By") + " " + author;
var _own = author_steam_id == STEAM_USER_ID;
var _ont = "Your creation";
var _aut = $"{__txt("By")} {author}";
var _ver = version < SAVE_VERSION? __txtx("meta_old_version", "Created on an older version") : __txtx("meta_new_version", "Created on a newer version");
draw_set_font(f_h5);
@ -97,11 +101,11 @@ function MetaDataManager() constructor {
draw_set_font(f_p1);
_h += string_height_ext(_aut, -1, ww);
_w = max(_w, string_width_ext(_aut, -1, ww));
_w = max(_w, string_width_ext(_aut, -1, ww) + _own * (ui(24) + string_width(_ont)));
if(contact != "") {
draw_set_font(f_p2);
_h += string_height_ext(contact, -1, ww) + ui(-2);
_h += string_height_ext(contact, -1, ww);
_w = max(_w, string_width_ext(contact, -1, ww));
}
@ -141,47 +145,57 @@ function MetaDataManager() constructor {
_h += th;
}
var mx = min(mouse_mx + ui(16), WIN_W - (_w + ui(16)));
var my = min(mouse_my + ui(16), WIN_H - (_h + ui(16)));
var mx = min(mouse_mx + _pd * 2, WIN_W - (_w + _pd * 2));
var my = min(mouse_my + _pd * 2, WIN_H - (_h + _pd * 2));
////////////////////////////////////////////////////////////////////////////////////////////////////
draw_sprite_stretched(THEME.textbox, 3, mx, my, _w + ui(16), _h + ui(16));
draw_sprite_stretched(THEME.textbox, 0, mx, my, _w + ui(16), _h + ui(16));
draw_sprite_stretched(THEME.textbox, 3, mx, my, _w + _pd * 2, _h + _pd * 2);
draw_sprite_stretched(THEME.textbox, 0, mx, my, _w + _pd * 2, _h + _pd * 2);
var ty = my + ui(8);
draw_set_text(f_h5, fa_left, fa_top, COLORS._main_text);
draw_text_line(mx + ui(8), ty, name, -1, _w);
draw_text_line(mx + _pd, ty, name, -1, _w);
ty += string_height_ext(name, -1, _w) - ui(4);
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text_sub);
draw_text_line(mx + ui(8), ty, _aut, -1, _w);
draw_text_line(mx + _pd, ty, _aut, -1, _w);
if(_own) {
var _owX = mx + _pd + string_width_ext(_aut, -1, _w) + ui(12);
draw_set_font(f_p2);
var _owW = string_width( _ont);
var _owH = string_height(_ont);
draw_sprite_stretched_ext(THEME.menu_button_mask, 0, _owX - ui(4), ty + ui(1) - ui(2), _owW + ui(8), _owH + ui(4), COLORS._main_icon_dark, 1);
draw_set_color(COLORS._main_text_accent);
draw_text_line(_owX, ty + ui(1), _ont, -1, _w);
}
ty += string_height_ext(_aut, -1, _w);
if(contact != "") {
ty += ui(-2);
draw_set_text(f_p2, fa_left, fa_top, COLORS._main_text_sub);
draw_text_line(mx + ui(8), ty, contact, -1, _w);
draw_text_line(mx + _pd, ty, contact, -1, _w);
ty += string_height_ext(contact, -1, _w);
}
ty += ui(8);
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text);
draw_text_line(mx + ui(8), ty, description, -1, _w);
draw_text_line(mx + _pd, ty, description, -1, _w);
ty += string_height_ext(description, -1, _w);
if(alias != "") {
ty += ui(16);
draw_set_text(f_p2, fa_left, fa_top, COLORS._main_text_sub);
draw_text_line(mx + ui(8), ty, alias, -1, _w);
draw_text_line(mx + _pd, ty, alias, -1, _w);
ty += string_height_ext(alias, -1, _w);
}
if(version != SAVE_VERSION) {
ty += ui(8);
draw_set_text(f_p2, fa_left, fa_top, COLORS._main_accent);
draw_text_line(mx + ui(8), ty, _ver, -1, _w);
draw_text_line(mx + _pd, ty, _ver, -1, _w);
ty += string_height_ext(_ver, -1, _w);
}

View file

@ -96,8 +96,8 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
if(global_var) {
if(string_pos(" ", _name)) cc = COLORS._main_value_negative;
} else {
if(jun.hasJunctionFrom()) cc = COLORS._main_accent;
if(jun.is_anim) cc = COLORS._main_value_positive;
if(jun.hasJunctionFrom()) cc = COLORS._main_accent;
}
draw_set_text(_font, fa_left, fa_center, cc);
@ -204,9 +204,11 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
var by = lb_y;
bx -= ui(28);
if(jun.is_modified && buttonInstant(THEME.button_hide, bx - ui(12), by - ui(12), ui(24), ui(24), _m, _focus, _hover, __txtx("panel_inspector_reset", "Reset value"), THEME.refresh_s, 0, COLORS._main_icon) == 2) {
jun.resetValue();
}
if(jun.is_modified) {
if(buttonInstant(THEME.button_hide, bx - ui(12), by - ui(12), ui(24), ui(24), _m, _focus, _hover, __txtx("panel_inspector_reset", "Reset value"), THEME.refresh_s, 0, COLORS._main_icon) == 2)
jun.resetValue();
} else
draw_sprite_ui(THEME.refresh_s, 0, bx, by,,,, COLORS._main_icon, 0.5);
bx -= ui(28);
var ic_b = jun.expUse? c_white : COLORS._main_icon;

View file

@ -58,7 +58,7 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
inputs[| 9] = nodeValue("Output dimension type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, OUTPUT_SCALING.same_as_input)
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Same as input", "Constant", "Relative to input", "Transformed" ]);
inputs[| 10] = nodeValue("Round position", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Round position to the closest integer value to avoid jittering.");
inputs[| 10] = nodeValue("Round position", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Round position to the nearest integer value to avoid jittering.");
inputs[| 11] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
active_index = 11;

View file

@ -235,11 +235,8 @@ function Panel_Collection() : PanelContent() constructor {
if(meta != noone && mode == 0) {
if(struct_try_get(meta, "steam")) {
draw_sprite_ui_uniform(THEME.steam, 0, _boxx + ui(12), yy + ui(12), 1, COLORS._main_icon_dark, 1);
if(meta.author_steam_id == STEAM_USER_ID) {
if(meta.author_steam_id == STEAM_USER_ID)
draw_sprite_ui_uniform(THEME.steam_creator, 0, _boxx + grid_size - ui(8), yy + ui(12), 1, COLORS._main_icon_dark, 1);
if(point_in_rectangle(_m[0], _m[1], gr_x1 - ui(24), yy, gr_x1, yy + ui(24)))
TOOLTIP = __txtx("panel_collection_you_created", "You created this item");
}
}
if(meta.version != SAVE_VERSION) {

View file

@ -1292,7 +1292,6 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
nodes_selecting = [ _nodeFocus ];
var _l = ds_list_create_from_array(nodes_selecting)
print(ds_list_size(_l));
toCenterNode(_l);
ds_list_destroy(_l);
break;