mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 14:36:13 +01:00
40 lines
No EOL
1.1 KiB
Text
40 lines
No EOL
1.1 KiB
Text
function scrollBox(_data, _onModify) constructor {
|
|
onModify = _onModify;
|
|
data_list = _data;
|
|
|
|
active = false;
|
|
hover = false;
|
|
open = false;
|
|
|
|
align = fa_center;
|
|
|
|
static draw = function(_x, _y, _w, _h, _text, _m = mouse_ui, _rx = 0, _ry = 0) {
|
|
if(!open) {
|
|
if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + _h)) {
|
|
draw_sprite_stretched(THEME.textbox, 1, _x, _y, _w, _h);
|
|
if(mouse_press(mb_left, active)) {
|
|
open = true;
|
|
with(dialogCall(o_dialog_scrollbox, _x + _rx, _y + _ry)) {
|
|
scrollbox = other;
|
|
dialog_w = _w;
|
|
align = other.align;
|
|
}
|
|
}
|
|
if(mouse_click(mb_left, active))
|
|
draw_sprite_stretched(THEME.textbox, 2, _x, _y, _w, _h);
|
|
} else {
|
|
draw_sprite_stretched(THEME.textbox, 0, _x, _y, _w, _h);
|
|
}
|
|
|
|
draw_set_text(f_p0, align, fa_center, COLORS._main_text);
|
|
if(align == fa_center)
|
|
draw_text(_x + _w / 2, _y + _h / 2 - ui(2), _text);
|
|
else if(align == fa_left)
|
|
draw_text(_x + ui(8), _y + _h / 2 - ui(2), _text);
|
|
draw_sprite_ui_uniform(THEME.scroll_box_arrow, 0, _x + _w - 20, _y + _h / 2, 1, COLORS._main_icon);
|
|
}
|
|
|
|
hover = false;
|
|
active = false;
|
|
}
|
|
} |