horizontal selector

This commit is contained in:
Tanasart 2024-07-16 07:19:28 +07:00
parent b36013dc57
commit ba00cccd40
4 changed files with 19 additions and 13 deletions

View file

@ -61,8 +61,9 @@ event_inherited();
function setSize() {
var hght = line_get_height(font) + item_pad;
var sh = ui(40);
var _tpad = horizon? text_pad : ui(8);
var hght = line_get_height(font) + item_pad;
var sh = ui(40);
var ww = 0, tw;
var hh = 0;
@ -101,20 +102,20 @@ event_inherited();
_emp = false;
tw = string_width(txt) + _spr * (hght + text_pad * 2);
lw = max(lw, tw + text_pad * 2);
tw = string_width(txt) + _spr * (hght + _tpad * 2);
lw = max(lw, tw + _tpad * 2);
lh += hght;
}
if(horizon) {
dialog_w = max(scrollbox.w, ww) + text_pad * 2;
dialog_w = max(scrollbox.w, ww) + _tpad * 2;
dialog_h = min(max_h, sh + hh);
} else {
dialog_w = max(scrollbox.w, lw);
dialog_h = min(max_h, sh + lh);
}
sc_content.resize(dialog_w - text_pad * 2, dialog_h - ui(40));
sc_content.resize(dialog_w - _tpad * 2, dialog_h - ui(40));
resetPosition();
}
@ -127,8 +128,9 @@ event_inherited();
var _lw = 0;
var _lh = 0;
var _h = 0;
var hovering = "";
var _col = 0;
var hovering = "";
var _tpad = horizon? text_pad : ui(8);
for( var i = 0, n = array_length(data); i < n; i++ ) {
var _dw = horizon? widths[_col] : sc_content.surface_w;
@ -152,7 +154,7 @@ event_inherited();
} else if(_val == -1) {
draw_sprite_stretched(THEME.menu_separator, 0, ui(8), _ly, _dw - ui(16), ui(6));
_ly += ui(8);
_h += ui(8);
_lh += ui(8);
continue;
}
@ -194,7 +196,7 @@ event_inherited();
draw_text_add(_lx + _xc, _ly + hght / 2, txt);
} else if(align == fa_left)
draw_text_add(text_pad + _lx + _spr * (text_pad * 2 + hght), _ly + hght / 2, txt);
draw_text_add(_tpad + _lx + _spr * (_tpad * 2 + hght), _ly + hght / 2, txt);
if(_spr) draw_sprite_ext(_val.spr, _val.spr_ind, _lx + ui(8) + hght / 2, _ly + hght / 2, 1, 1, 0, _val.spr_blend, 1);
@ -202,6 +204,8 @@ event_inherited();
_lh += hght;
}
if(!horizon) _h = _lh + ui(8);
if(update_hover) {
UNDO_HOLDING = true;
if(hovering != "") scrollbox.onModify(array_find(scrollbox.data, hovering));

View file

@ -2,13 +2,15 @@
#region draw
draw_sprite_stretched(THEME.textbox, 3, dialog_x, dialog_y, dialog_w, dialog_h);
var _tpad = horizon? text_pad : ui(8);
WIDGET_CURRENT = tb_search;
tb_search.setFocusHover(true, true);
tb_search.draw(dialog_x + ui(8), dialog_y + ui(8), dialog_w - ui(16) - ui(24 + 4), ui(24), search_string);
tb_search.sprite_index = 0;
sc_content.setFocusHover(sFOCUS, sHOVER);
sc_content.draw(dialog_x + text_pad, dialog_y + ui(40));
sc_content.draw(dialog_x + _tpad, dialog_y + ui(40));
draw_sprite_stretched(THEME.textbox, 1, dialog_x, dialog_y, dialog_w, dialog_h);

View file

@ -38,7 +38,7 @@
LATEST_VERSION = 11700;
VERSION = 11770;
SAVE_VERSION = 11700;
VERSION_STRING = "1.17.8";
VERSION_STRING = "1.17.8.001";
BUILD_NUMBER = 11770;
globalvar HOTKEYS, HOTKEY_CONTEXT;

View file

@ -273,11 +273,11 @@ function Panel_Action_Create() : PanelContent() constructor {
var _hh = tb_tooltip.draw(_wx, _wy, _ww, _wh * 2, tooltip, [ mx, my ]); _wy += _hh + ui(8); _th += _hh + ui(8);
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text);
draw_text_add(_tx, _wy + _wh / 2, __txt("Categories"));
draw_text_add(_tx, _wy + _wh / 2, __txt("Category"));
var _hh = tb_location.draw(_wx, _wy, _ww, _wh, cat_index, [ mx, my ], x, y); _wy += _hh + ui(8); _th += _hh + ui(8);
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text);
draw_text_add(_tx, _wy + _wh / 2, __txt("Sprite"));
draw_text_add(_tx, _wy + _wh / 2, __txt("Icon"));
var spx = _wx;
var spy = _wy;