mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-26 06:56:45 +01:00
Textbox improvement, camera blend mode
This commit is contained in:
parent
d33137233d
commit
77271b7de2
7 changed files with 233 additions and 129 deletions
|
@ -75,6 +75,9 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
|
||||||
inputs[| in_d3d + 21] = nodeValue("Round Normal", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 )
|
inputs[| in_d3d + 21] = nodeValue("Round Normal", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 )
|
||||||
.setWindows();
|
.setWindows();
|
||||||
|
|
||||||
|
inputs[| in_d3d + 22] = nodeValue("Blend mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 )
|
||||||
|
.setDisplay(VALUE_DISPLAY.enum_button, [ "Normal", "Additive" ]);
|
||||||
|
|
||||||
in_cam = ds_list_size(inputs);
|
in_cam = ds_list_size(inputs);
|
||||||
|
|
||||||
outputs[| 0] = nodeValue("Rendered", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone );
|
outputs[| 0] = nodeValue("Rendered", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone );
|
||||||
|
@ -89,7 +92,7 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
|
||||||
["Output", false], in_d3d + 2,
|
["Output", false], in_d3d + 2,
|
||||||
["Transform", false], in_d3d + 9, 0, 1, in_d3d + 10, in_d3d + 11, in_d3d + 12, in_d3d + 13, in_d3d + 14,
|
["Transform", false], in_d3d + 9, 0, 1, in_d3d + 10, in_d3d + 11, in_d3d + 12, in_d3d + 13, in_d3d + 14,
|
||||||
["Camera", true], in_d3d + 3, in_d3d + 0, in_d3d + 1, in_d3d + 8,
|
["Camera", true], in_d3d + 3, in_d3d + 0, in_d3d + 1, in_d3d + 8,
|
||||||
["Render", true], in_d3d + 5, in_d3d + 16, in_d3d + 6, in_d3d + 7, in_d3d + 15,
|
["Render", true], in_d3d + 5, in_d3d + 16, in_d3d + 6, in_d3d + 7, in_d3d + 15, in_d3d + 22,
|
||||||
["Ambient Occlusion", true], in_d3d + 17, in_d3d + 20, in_d3d + 18, in_d3d + 19,
|
["Ambient Occlusion", true], in_d3d + 17, in_d3d + 20, in_d3d + 18, in_d3d + 19,
|
||||||
["Effects", true], in_d3d + 21,
|
["Effects", true], in_d3d + 21,
|
||||||
];
|
];
|
||||||
|
@ -227,6 +230,7 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
|
||||||
var _aoSr = _data[in_d3d + 20];
|
var _aoSr = _data[in_d3d + 20];
|
||||||
|
|
||||||
var _nrmSmt = _data[in_d3d + 21];
|
var _nrmSmt = _data[in_d3d + 21];
|
||||||
|
var _blend = _data[in_d3d + 22];
|
||||||
|
|
||||||
var _qi1 = new BBMOD_Quaternion().FromAxisAngle(new BBMOD_Vec3(0, 1, 0), 90);
|
var _qi1 = new BBMOD_Quaternion().FromAxisAngle(new BBMOD_Vec3(0, 1, 0), 90);
|
||||||
var _qi2 = new BBMOD_Quaternion().FromAxisAngle(new BBMOD_Vec3(1, 0, 0), -90);
|
var _qi2 = new BBMOD_Quaternion().FromAxisAngle(new BBMOD_Vec3(1, 0, 0), -90);
|
||||||
|
@ -327,6 +331,11 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
|
||||||
gpu_set_ztestenable(true);
|
gpu_set_ztestenable(true);
|
||||||
gpu_set_cullmode(_back);
|
gpu_set_cullmode(_back);
|
||||||
|
|
||||||
|
if(_blend == 1) {
|
||||||
|
BLEND_ADD
|
||||||
|
gpu_set_ztestenable(false);
|
||||||
|
}
|
||||||
|
|
||||||
camera.applyCamera();
|
camera.applyCamera();
|
||||||
scene.reset();
|
scene.reset();
|
||||||
scene.submitShader(_sobj);
|
scene.submitShader(_sobj);
|
||||||
|
@ -335,6 +344,7 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
|
||||||
scene.apply(deferData);
|
scene.apply(deferData);
|
||||||
scene.submit(_sobj);
|
scene.submit(_sobj);
|
||||||
|
|
||||||
|
BLEND_NORMAL
|
||||||
surface_reset_target();
|
surface_reset_target();
|
||||||
|
|
||||||
camera.resetCamera();
|
camera.resetCamera();
|
||||||
|
|
|
@ -100,7 +100,8 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
||||||
|
|
||||||
inputs[| 31] = nodeValue("Auto amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
|
inputs[| 31] = nodeValue("Auto amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
|
||||||
|
|
||||||
inputs[| 32] = nodeValue("Alternate rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
|
inputs[| 32] = nodeValue("Twisting", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
||||||
|
.setDisplay(VALUE_DISPLAY.rotation);
|
||||||
|
|
||||||
inputs[| 33] = nodeValue("Random position", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0, 0, 0 ])
|
inputs[| 33] = nodeValue("Random position", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0, 0, 0 ])
|
||||||
.setDisplay(VALUE_DISPLAY.vector_range);
|
.setDisplay(VALUE_DISPLAY.vector_range);
|
||||||
|
@ -371,7 +372,7 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
||||||
} else {
|
} else {
|
||||||
var _ang = _acol * 360 / uniAmo[0];
|
var _ang = _acol * 360 / uniAmo[0];
|
||||||
var _rad = uniAmo[1] == 1? 0.5 : _arow / (uniAmo[1] - 1);
|
var _rad = uniAmo[1] == 1? 0.5 : _arow / (uniAmo[1] - 1);
|
||||||
if(uniRot) _ang += (_arow % 2) * 180 / uniAmo[0];
|
_ang += _arow * uniRot;
|
||||||
|
|
||||||
_x += _axc + lengthdir_x(_rad * _aw, _ang);
|
_x += _axc + lengthdir_x(_rad * _aw, _ang);
|
||||||
_y += _ayc + lengthdir_y(_rad * _ah, _ang);
|
_y += _ayc + lengthdir_y(_rad * _ah, _ang);
|
||||||
|
|
|
@ -1613,7 +1613,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
cache_value[1] = _time;
|
cache_value[1] = _time;
|
||||||
}
|
}
|
||||||
|
|
||||||
cache_value[2] = val;
|
cache_value[2] = variable_clone(val, 1);
|
||||||
cache_value[3] = applyUnit;
|
cache_value[3] = applyUnit;
|
||||||
updateColor(val);
|
updateColor(val);
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ function Panel_Text_Editor(_textArea, _inputFunc, _context) : PanelContent() con
|
||||||
self.inputFunc = method(self, _inputFunc);
|
self.inputFunc = method(self, _inputFunc);
|
||||||
self.context = _context;
|
self.context = _context;
|
||||||
|
|
||||||
shift_new_line = true;
|
shift_new_line = false;
|
||||||
|
|
||||||
function drawContent(panel) {
|
function drawContent(panel) {
|
||||||
draw_clear_alpha(COLORS.panel_bg_clear, 0);
|
draw_clear_alpha(COLORS.panel_bg_clear, 0);
|
||||||
|
@ -57,6 +57,7 @@ function Panel_Text_Editor(_textArea, _inputFunc, _context) : PanelContent() con
|
||||||
var th = h - ui(4 + 36 + 8);
|
var th = h - ui(4 + 36 + 8);
|
||||||
|
|
||||||
var _text = inputFunc();
|
var _text = inputFunc();
|
||||||
|
_textArea.setMaxHieght(th);
|
||||||
_textArea.register();
|
_textArea.register();
|
||||||
_textArea.setFocusHover(pFOCUS, pHOVER);
|
_textArea.setFocusHover(pFOCUS, pHOVER);
|
||||||
_textArea.shift_new_line = shift_new_line;
|
_textArea.shift_new_line = shift_new_line;
|
||||||
|
|
|
@ -122,11 +122,6 @@ function scrollPane(_w, _h, ondraw) : widget() constructor {
|
||||||
draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, scr_x, scr_y, scr_w, scr_h, bg_col, 1);
|
draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, scr_x, scr_y, scr_w, scr_h, bg_col, 1);
|
||||||
draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, bx0, by0, ww, hh, bar_col, 1);
|
draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, bx0, by0, ww, hh, bar_col, 1);
|
||||||
|
|
||||||
//draw_set_color(c_white);
|
|
||||||
//draw_rectangle(scr_x - 2, scr_y - 2, scr_x + scr_w + 2, scr_y + scr_h + 2, 0);
|
|
||||||
//draw_set_color(c_red);
|
|
||||||
//draw_circle(mx, my, 2, false);
|
|
||||||
|
|
||||||
if(active && point_in_rectangle(mx, my, scr_x - 2, scr_y - 2, scr_x + scr_w + 2, scr_y + scr_h + 2) || is_scrolling) {
|
if(active && point_in_rectangle(mx, my, scr_x - 2, scr_y - 2, scr_x + scr_w + 2, scr_y + scr_h + 2) || is_scrolling) {
|
||||||
draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, bar_x, bar_y, bar_w, bar_h, bar_hcol, 1);
|
draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, bar_x, bar_y, bar_w, bar_h, bar_hcol, 1);
|
||||||
if(mouse_press(mb_left, active)) {
|
if(mouse_press(mb_left, active)) {
|
||||||
|
|
|
@ -26,6 +26,7 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
||||||
|
|
||||||
min_lines = 0;
|
min_lines = 0;
|
||||||
line_width = 1000;
|
line_width = 1000;
|
||||||
|
max_height = -1;
|
||||||
|
|
||||||
cursor = 0;
|
cursor = 0;
|
||||||
cursor_tx = 0;
|
cursor_tx = 0;
|
||||||
|
@ -65,8 +66,22 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
||||||
undo_stack = ds_stack_create();
|
undo_stack = ds_stack_create();
|
||||||
redo_stack = ds_stack_create();
|
redo_stack = ds_stack_create();
|
||||||
|
|
||||||
|
text_surface = noone;
|
||||||
|
|
||||||
|
text_y = 0;
|
||||||
|
text_y_to = 0;
|
||||||
|
text_y_max = 0;
|
||||||
|
text_scrolling = false;
|
||||||
|
text_scroll_sy = 0;
|
||||||
|
text_scroll_my = 0;
|
||||||
|
|
||||||
_cl = -1;
|
_cl = -1;
|
||||||
|
|
||||||
|
static setMaxHieght = function(height) { #region
|
||||||
|
max_height = height;
|
||||||
|
return self;
|
||||||
|
} #endregion
|
||||||
|
|
||||||
static activate = function() { #region
|
static activate = function() { #region
|
||||||
WIDGET_CURRENT = self;
|
WIDGET_CURRENT = self;
|
||||||
WIDGET_CURRENT_SCROLL = parent;
|
WIDGET_CURRENT_SCROLL = parent;
|
||||||
|
@ -412,6 +427,7 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
||||||
} else if(keyboard_check_pressed(vk_tab)) {
|
} else if(keyboard_check_pressed(vk_tab)) {
|
||||||
} else if(keyboardEnter() == 2) {
|
} else if(keyboardEnter() == 2) {
|
||||||
var ch = "\n";
|
var ch = "\n";
|
||||||
|
|
||||||
if(cursor_select == -1) {
|
if(cursor_select == -1) {
|
||||||
var str_before = string_copy(_input_text, 1, cursor);
|
var str_before = string_copy(_input_text, 1, cursor);
|
||||||
var str_after = string_copy(_input_text, cursor + 1, string_length(_input_text) - cursor);
|
var str_after = string_copy(_input_text, cursor + 1, string_length(_input_text) - cursor);
|
||||||
|
@ -611,6 +627,8 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
||||||
var ch_y = _y;
|
var ch_y = _y;
|
||||||
var _str;
|
var _str;
|
||||||
|
|
||||||
|
text_y_max = 0;
|
||||||
|
|
||||||
if(_input_text != _text) {
|
if(_input_text != _text) {
|
||||||
_input_text = _text;
|
_input_text = _text;
|
||||||
cut_line();
|
cut_line();
|
||||||
|
@ -640,6 +658,7 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
||||||
}
|
}
|
||||||
|
|
||||||
ch_y += line_get_height();
|
ch_y += line_get_height();
|
||||||
|
text_y_max += line_get_height();
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_set_alpha(1);
|
draw_set_alpha(1);
|
||||||
|
@ -703,8 +722,12 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mouse_release(mb_left, active))
|
if(mouse_release(mb_left)) {
|
||||||
click_block = false;
|
click_block = false;
|
||||||
|
|
||||||
|
if(cursor_select == cursor)
|
||||||
|
cursor_select = -1;
|
||||||
|
}
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
static drawParam = function(params) { #region
|
static drawParam = function(params) { #region
|
||||||
|
@ -715,6 +738,8 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
static draw = function(_x, _y, _w, _h, _text, _m) { #region
|
static draw = function(_x, _y, _w, _h, _text, _m) { #region
|
||||||
|
_h = max_height == -1? _h : min(_h, max_height);
|
||||||
|
|
||||||
x = _x;
|
x = _x;
|
||||||
y = _y;
|
y = _y;
|
||||||
w = _w;
|
w = _w;
|
||||||
|
@ -726,10 +751,9 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
||||||
_current_text = _text;
|
_current_text = _text;
|
||||||
|
|
||||||
draw_set_font(font);
|
draw_set_font(font);
|
||||||
if(_stretch_width) {
|
if(_stretch_width) _w = string_width(self == WIDGET_CURRENT? _input_text : _text) + ui(16);
|
||||||
_w = string_width(self == WIDGET_CURRENT? _input_text : _text) + ui(16);
|
|
||||||
w = _w;
|
w = _w;
|
||||||
}
|
|
||||||
|
|
||||||
if(side_button && instanceof(side_button) == "buttonClass") {
|
if(side_button && instanceof(side_button) == "buttonClass") {
|
||||||
side_button.setFocusHover(active, hover);
|
side_button.setFocusHover(active, hover);
|
||||||
|
@ -737,7 +761,7 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
||||||
_w -= ui(40);
|
_w -= ui(40);
|
||||||
}
|
}
|
||||||
|
|
||||||
var tx = _x + ui(8);
|
var tx = ui(8);
|
||||||
var hh = _h;
|
var hh = _h;
|
||||||
var pl = line_width;
|
var pl = line_width;
|
||||||
|
|
||||||
|
@ -749,41 +773,59 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_stretch_width) line_width = 9999999;
|
if(_stretch_width) line_width = 9999999;
|
||||||
cursor_tx = tx;
|
cursor_tx = _x + tx;
|
||||||
|
|
||||||
var c_h = line_get_height();
|
var c_h = line_get_height();
|
||||||
var line_count = max(min_lines, array_length(_input_text_line));
|
var line_count = max(min_lines, array_length(_input_text_line));
|
||||||
|
|
||||||
hh = max(_h, ui(14) + c_h * line_count);
|
hh = max(_h, ui(14) + c_h * line_count);
|
||||||
|
if(max_height) hh = min(hh, max_height);
|
||||||
|
|
||||||
|
var _hw = _w;
|
||||||
|
if(max_height && text_y_max) {
|
||||||
|
_hw -= 16;
|
||||||
|
line_width -= 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
var hoverRect = point_in_rectangle(_m[0], _m[1], _x, _y, _x + _hw, _y + hh);
|
||||||
|
var tsw = _w;
|
||||||
|
var tsh = hh;
|
||||||
|
text_surface = surface_verify(text_surface, tsw, tsh);
|
||||||
|
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, hh, boxColor, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, hh, boxColor, 1);
|
||||||
|
|
||||||
|
surface_set_shader(text_surface, noone, true, BLEND.add);
|
||||||
if(isCodeFormat() && show_line_number) {
|
if(isCodeFormat() && show_line_number) {
|
||||||
draw_sprite_stretched_ext(THEME.textbox_code, 0, _x, _y, ui(code_line_width), hh, boxColor, 1);
|
draw_sprite_stretched_ext(THEME.textbox_code, 0, 0, 0, ui(code_line_width), hh, boxColor, 1);
|
||||||
draw_set_text(f_code, fa_right, fa_top, COLORS._main_text_sub);
|
draw_set_text(f_code, fa_right, fa_top, COLORS._main_text_sub);
|
||||||
|
|
||||||
var lx = _x + ui(code_line_width - 8);
|
var lx = ui(code_line_width - 8);
|
||||||
|
|
||||||
for( var i = 0; i < array_length(_input_text_line_index); i++ ) {
|
for( var i = 0; i < array_length(_input_text_line_index); i++ ) {
|
||||||
var ly = _y + ui(7) + i * c_h;
|
var ly = text_y + ui(7) + i * c_h;
|
||||||
draw_text_add(lx, ly, _input_text_line_index[i]);
|
draw_text_add(lx, ly, _input_text_line_index[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
surface_reset_shader();
|
||||||
var hoverRect = point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + hh);
|
|
||||||
|
|
||||||
if(selecting) {
|
if(selecting) {
|
||||||
WIDGET_TAB_BLOCK = true;
|
WIDGET_TAB_BLOCK = true;
|
||||||
|
|
||||||
draw_set_text(font, fa_left, fa_top, COLORS._main_text);
|
draw_set_text(font, fa_left, fa_top, COLORS._main_text);
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 2, _x, _y, _w, hh, COLORS._main_accent, 1);
|
|
||||||
editText();
|
editText();
|
||||||
|
|
||||||
#region draw
|
#region draw
|
||||||
|
var msx = _m[0] - _x;
|
||||||
|
var msy = _m[1] - _y;
|
||||||
|
|
||||||
|
surface_set_shader(text_surface, noone, false, BLEND.add);
|
||||||
draw_set_text(font, fa_left, fa_top, COLORS._main_text);
|
draw_set_text(font, fa_left, fa_top, COLORS._main_text);
|
||||||
|
|
||||||
#region draw cursor highlight
|
#region draw cursor highlight
|
||||||
var _l, _str;
|
var _l, _str;
|
||||||
|
|
||||||
var ch_x = tx;
|
var ch_x = tx;
|
||||||
var ch_y = _y + ui(7);
|
var ch_y = text_y + ui(7);
|
||||||
var ch_sel_min = -1;
|
var ch_sel_min = -1;
|
||||||
var ch_sel_max = -1;
|
var ch_sel_max = -1;
|
||||||
var char_line = 0;
|
var char_line = 0;
|
||||||
|
@ -859,7 +901,7 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
||||||
cursor_pos_y = cursor_pos_y == 0? cursor_pos_y_to : lerp_float(cursor_pos_y, cursor_pos_y_to, 2);
|
cursor_pos_y = cursor_pos_y == 0? cursor_pos_y_to : lerp_float(cursor_pos_y, cursor_pos_y_to, 2);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
display_text(tx, _y + ui(7), _input_text, _m[0], _m[1], hover && hoverRect);
|
display_text(tx, text_y + ui(7), _input_text, msx, msy, hover && hoverRect);
|
||||||
|
|
||||||
if(cursor_pos_y != 0 && cursor_pos_x != 0) {
|
if(cursor_pos_y != 0 && cursor_pos_x != 0) {
|
||||||
draw_set_color(COLORS._main_text_accent);
|
draw_set_color(COLORS._main_text_accent);
|
||||||
|
@ -867,13 +909,20 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
||||||
draw_line_width(cursor_pos_x, cursor_pos_y, cursor_pos_x, cursor_pos_y + c_h, 2);
|
draw_line_width(cursor_pos_x, cursor_pos_y, cursor_pos_x, cursor_pos_y + c_h, 2);
|
||||||
draw_set_alpha(1);
|
draw_set_alpha(1);
|
||||||
}
|
}
|
||||||
|
surface_reset_shader();
|
||||||
|
|
||||||
if(o_dialog_textbox_autocomplete.textbox == self) {
|
BLEND_ALPHA
|
||||||
o_dialog_textbox_autocomplete.dialog_x = rx + cursor_pos_x + 1;
|
draw_surface(text_surface, _x, _y);
|
||||||
o_dialog_textbox_autocomplete.dialog_y = ry + cursor_pos_y + line_get_height() + 1;
|
BLEND_NORMAL
|
||||||
}
|
|
||||||
|
|
||||||
if(typing) typing--;
|
if(typing) typing--;
|
||||||
|
|
||||||
|
draw_sprite_stretched_ext(THEME.textbox, 2, _x, _y, _w, hh, COLORS._main_accent, 1);
|
||||||
|
|
||||||
|
if(o_dialog_textbox_autocomplete.textbox == self) {
|
||||||
|
o_dialog_textbox_autocomplete.dialog_x = rx + _x + cursor_pos_x + 1;
|
||||||
|
o_dialog_textbox_autocomplete.dialog_y = ry + _y + cursor_pos_y + line_get_height() + 1;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
if(autocomplete_modi && PREFERENCES.widget_autocomplete_delay >= 0 && autocomplete_delay >= PREFERENCES.widget_autocomplete_delay) {
|
if(autocomplete_modi && PREFERENCES.widget_autocomplete_delay >= 0 && autocomplete_delay >= PREFERENCES.widget_autocomplete_delay) {
|
||||||
|
@ -881,10 +930,18 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
||||||
autocomplete_modi = false;
|
autocomplete_modi = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + hh) && mouse_press(mb_left) && HOVER != o_dialog_textbox_autocomplete.id) {
|
if(!point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + hh) && mouse_press(mb_left) && HOVER != o_dialog_textbox_autocomplete.id)
|
||||||
deactivate();
|
deactivate();
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
|
surface_set_shader(text_surface, noone, false, BLEND.add);
|
||||||
|
display_text(tx, text_y + ui(7), _text);
|
||||||
|
surface_reset_shader();
|
||||||
|
|
||||||
|
BLEND_ALPHA
|
||||||
|
draw_surface(text_surface, _x, _y);
|
||||||
|
BLEND_NORMAL
|
||||||
|
|
||||||
if(hover && hoverRect) {
|
if(hover && hoverRect) {
|
||||||
if(hide)
|
if(hide)
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 1, _x, _y, _w, hh, boxColor, 0.5);
|
draw_sprite_stretched_ext(THEME.textbox, 1, _x, _y, _w, hh, boxColor, 0.5);
|
||||||
|
@ -895,11 +952,51 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
||||||
} else if(!hide)
|
} else if(!hide)
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, hh, boxColor, 0.5 + 0.5 * interactable);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, hh, boxColor, 0.5 + 0.5 * interactable);
|
||||||
|
|
||||||
display_text(tx, _y + ui(7), _text);
|
|
||||||
|
|
||||||
o_dialog_textbox_autocomplete.deactivate(self);
|
o_dialog_textbox_autocomplete.deactivate(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region scroll height
|
||||||
|
if(max_height) {
|
||||||
|
var total_h = text_y_max;
|
||||||
|
text_y_max = max(0, total_h - hh + 16);
|
||||||
|
text_y = lerp_float(text_y, text_y_to, 5);
|
||||||
|
|
||||||
|
if(hover) {
|
||||||
|
if(mouse_wheel_down()) text_y_to = clamp(text_y_to - ui(64) * SCROLL_SPEED, -text_y_max, 0);
|
||||||
|
if(mouse_wheel_up()) text_y_to = clamp(text_y_to + ui(64) * SCROLL_SPEED, -text_y_max, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
var scr_w = ui(sprite_get_width(THEME.ui_scrollbar));
|
||||||
|
var scr_h = hh - (ui(12) - scr_w) * 2;
|
||||||
|
var scr_x = _x + _w - ui(12);
|
||||||
|
var scr_y = _y + ui(12) - scr_w;
|
||||||
|
|
||||||
|
var bar_h = hh / total_h * scr_h;
|
||||||
|
var bar_y = scr_y + (scr_h - bar_h) * abs(text_y / text_y_max);
|
||||||
|
|
||||||
|
if(text_scrolling) {
|
||||||
|
text_y_to = text_scroll_sy - (_m[1] - text_scroll_my) / bar_h * scr_h;
|
||||||
|
text_y_to = clamp(text_y_to, -text_y_max, 0);
|
||||||
|
|
||||||
|
if(mouse_release(mb_left))
|
||||||
|
text_scrolling = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(text_y_max) {
|
||||||
|
var hov = hover && point_in_rectangle(_m[0], _m[1], scr_x - 3, _y, _x + _w, _y + _h);
|
||||||
|
|
||||||
|
draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, scr_x, scr_y, scr_w, scr_h, COLORS.scrollbar_bg, 1);
|
||||||
|
draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, scr_x, bar_y, scr_w, bar_h, hov || text_scrolling? COLORS.scrollbar_hover : COLORS.scrollbar_idle, 1);
|
||||||
|
|
||||||
|
if(mouse_press(mb_left, hov && active)) {
|
||||||
|
text_scrolling = true;
|
||||||
|
text_scroll_sy = text_y;
|
||||||
|
text_scroll_my = _m[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
if(DRAGGING && (DRAGGING.type == "Text" || DRAGGING.type == "Number") && hover && hoverRect) {
|
if(DRAGGING && (DRAGGING.type == "Text" || DRAGGING.type == "Number") && hover && hoverRect) {
|
||||||
draw_sprite_stretched_ext(THEME.ui_panel_active, 0, _x, _y, _w, hh, COLORS._main_value_positive, 1);
|
draw_sprite_stretched_ext(THEME.ui_panel_active, 0, _x, _y, _w, hh, COLORS._main_value_positive, 1);
|
||||||
if(mouse_release(mb_left))
|
if(mouse_release(mb_left))
|
||||||
|
@ -907,8 +1004,8 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
||||||
}
|
}
|
||||||
|
|
||||||
selecting = self == WIDGET_CURRENT;
|
selecting = self == WIDGET_CURRENT;
|
||||||
resetFocus();
|
|
||||||
shift_new_line = true;
|
shift_new_line = true;
|
||||||
|
resetFocus();
|
||||||
|
|
||||||
return hh;
|
return hh;
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
Loading…
Reference in a new issue