mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 14:06:23 +01:00
- Improve project loading speed.
- Compact mode
This commit is contained in:
parent
1573e3d1a6
commit
a1b8f26abd
14 changed files with 91 additions and 69 deletions
|
@ -46,7 +46,7 @@ event_inherited();
|
||||||
var name = __txt(cat.name);
|
var name = __txt(cat.name);
|
||||||
maxLen = max(maxLen, string_width(name));
|
maxLen = max(maxLen, string_width(name));
|
||||||
}
|
}
|
||||||
category_width = maxLen + ui(44);
|
category_width = maxLen + ui(48);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
function rightClick(node) { #region
|
function rightClick(node) { #region
|
||||||
|
@ -283,9 +283,9 @@ event_inherited();
|
||||||
|
|
||||||
BLEND_OVERRIDE;
|
BLEND_OVERRIDE;
|
||||||
if(i == ADD_NODE_PAGE) {
|
if(i == ADD_NODE_PAGE) {
|
||||||
draw_sprite_stretched(THEME.ui_panel_bg, 1, 0, _y + hh, category_width, hg);
|
draw_sprite_stretched(THEME.ui_panel_bg, 1, 0, _y + hh, category_width - ui(32), hg);
|
||||||
} else if(sHOVER && catagory_pane.hover && point_in_rectangle(_m[0], _m[1], 0, _y + hh, category_width - ui(32), _y + hh + hg - 1)) {
|
} else if(sHOVER && catagory_pane.hover && point_in_rectangle(_m[0], _m[1], 0, _y + hh, category_width - ui(32), _y + hh + hg - 1)) {
|
||||||
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, 0, _y + hh, category_width, hg, c_white, 0.75);
|
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, 0, _y + hh, category_width - ui(32), hg, CDEF.main_white, 1);
|
||||||
if(mouse_click(mb_left, sFOCUS)) {
|
if(mouse_click(mb_left, sFOCUS)) {
|
||||||
setPage(i);
|
setPage(i);
|
||||||
content_pane.scroll_y = 0;
|
content_pane.scroll_y = 0;
|
||||||
|
|
|
@ -12,8 +12,7 @@ if !ready exit;
|
||||||
|
|
||||||
#region base UI
|
#region base UI
|
||||||
draw_sprite_stretched(THEME.dialog_bg, 0, dialog_x, dialog_y, dialog_w, dialog_h);
|
draw_sprite_stretched(THEME.dialog_bg, 0, dialog_x, dialog_y, dialog_w, dialog_h);
|
||||||
if(sFOCUS)
|
if(sFOCUS) draw_sprite_stretched_ext(THEME.dialog_active, 0, dialog_x, dialog_y, dialog_w, dialog_h, COLORS._main_accent, 1);
|
||||||
draw_sprite_stretched_ext(THEME.dialog_active, 0, dialog_x, dialog_y, dialog_w, dialog_h, COLORS._main_accent, 1);
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region text
|
#region text
|
||||||
|
@ -29,7 +28,8 @@ if !ready exit;
|
||||||
|
|
||||||
draw_set_text(f_code, fa_left, fa_top, COLORS._main_text);
|
draw_set_text(f_code, fa_left, fa_top, COLORS._main_text);
|
||||||
var _hh = string_height_ext(ctxt[1], -1, dialog_w - ui(64));
|
var _hh = string_height_ext(ctxt[1], -1, dialog_w - ui(64));
|
||||||
draw_sprite_stretched(THEME.ui_panel_inner_bg, 0, dialog_x + ui(24), py - ui(8), dialog_w - ui(48), _hh + ui(16));
|
draw_sprite_stretched(THEME.ui_panel_inner_bg, 1, dialog_x + ui(24), py - ui(8), dialog_w - ui(48), _hh + ui(16));
|
||||||
|
|
||||||
draw_text_ext(dialog_x + ui(32), py, ctxt[1], -1, dialog_w - ui(64));
|
draw_text_ext(dialog_x + ui(32), py, ctxt[1], -1, dialog_w - ui(64));
|
||||||
py += _hh + ui(16);
|
py += _hh + ui(16);
|
||||||
|
|
||||||
|
|
|
@ -37,10 +37,10 @@ function __initAddon() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var _mSrt = json_load_struct(_meta);
|
var _mSrt = json_load_struct(_meta);
|
||||||
var _str = {
|
var _str = {
|
||||||
name: f,
|
name: f,
|
||||||
path: _path,
|
path: _path,
|
||||||
meta: _mSrt.meta,
|
meta: struct_try_get(_mSrt, "meta", {}),
|
||||||
|
|
||||||
open: false
|
open: false
|
||||||
};
|
};
|
||||||
|
|
|
@ -35,7 +35,7 @@ function json_load_struct(path) {
|
||||||
|
|
||||||
if(!file_exists(path)) return noone;
|
if(!file_exists(path)) return noone;
|
||||||
|
|
||||||
var s = file_read_all(path);
|
var s = file_read_all(path);
|
||||||
var js = json_try_parse(s);
|
var js = json_try_parse(s);
|
||||||
return js;
|
return js;
|
||||||
}
|
}
|
||||||
|
@ -44,11 +44,8 @@ function json_save_struct(path, struct, pretty = false) {
|
||||||
gml_pragma("forceinline");
|
gml_pragma("forceinline");
|
||||||
|
|
||||||
var s;
|
var s;
|
||||||
|
if(pretty) s = json_stringify(struct, true);
|
||||||
if(pretty)
|
else s = json_stringify_minify(struct);
|
||||||
s = json_stringify(struct, true);
|
|
||||||
else
|
|
||||||
s = json_stringify_minify(struct);
|
|
||||||
|
|
||||||
var f = file_text_open_write(path);
|
var f = file_text_open_write(path);
|
||||||
file_text_write_string(f, s);
|
file_text_write_string(f, s);
|
||||||
|
|
|
@ -4,7 +4,7 @@ function drawWidgetInit() {
|
||||||
visi_hold = noone;
|
visi_hold = noone;
|
||||||
|
|
||||||
min_w = ui(160);
|
min_w = ui(160);
|
||||||
lineBreak = true;
|
lineBreak = PREFERENCES.inspector_view_default;
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _focus = false, _scrollPane = noone, rx = 0, ry = 0) {
|
function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _focus = false, _scrollPane = noone, rx = 0, ry = 0) {
|
||||||
|
@ -12,13 +12,23 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
|
||||||
var xc = xx + ww / 2;
|
var xc = xx + ww / 2;
|
||||||
var _font = lineBreak? f_p0 : f_p1;
|
var _font = lineBreak? f_p0 : f_p1;
|
||||||
|
|
||||||
|
var breakLine = lineBreak || jun.expUse;
|
||||||
var lb_h = line_get_height(_font) + ui(8);
|
var lb_h = line_get_height(_font) + ui(8);
|
||||||
var lb_y = yy + lb_h / 2;
|
var lb_y = yy + lb_h / 2;
|
||||||
|
|
||||||
var breakLine = lineBreak || jun.expUse;
|
|
||||||
if(jun.type == VALUE_TYPE.text) breakLine = true;
|
|
||||||
|
|
||||||
var _name = jun.getName();
|
var _name = jun.getName();
|
||||||
|
var wid = jun.editWidget;
|
||||||
|
|
||||||
|
switch(instanceof(wid)) { #region
|
||||||
|
case "textArea" :
|
||||||
|
case "paddingBox" :
|
||||||
|
case "areaBox" :
|
||||||
|
case "controlPointBox" :
|
||||||
|
case "cornerBox" :
|
||||||
|
case "rotatorRandom" :
|
||||||
|
case "rotatorRange" :
|
||||||
|
breakLine = true;
|
||||||
|
} #endregion
|
||||||
|
|
||||||
var butx = xx;
|
var butx = xx;
|
||||||
if(jun.connect_type == JUNCTION_CONNECT.input && jun.isAnimable() && !jun.expUse) { #region animation
|
if(jun.connect_type == JUNCTION_CONNECT.input && jun.isAnimable() && !jun.expUse) { #region animation
|
||||||
|
@ -217,7 +227,6 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
|
||||||
|
|
||||||
var widH = breakLine? editBoxH : 0;
|
var widH = breakLine? editBoxH : 0;
|
||||||
var mbRight = true;
|
var mbRight = true;
|
||||||
var wid = jun.editWidget;
|
|
||||||
|
|
||||||
if(jun.expUse) { #region expression editor
|
if(jun.expUse) { #region expression editor
|
||||||
var expValid = jun.expTree != noone && jun.expTree.validate();
|
var expValid = jun.expTree != noone && jun.expTree.validate();
|
||||||
|
@ -257,8 +266,9 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
|
||||||
switch(jun.display_type) {
|
switch(jun.display_type) {
|
||||||
case VALUE_DISPLAY.padding : param.h = ui(192); break;
|
case VALUE_DISPLAY.padding : param.h = ui(192); break;
|
||||||
case VALUE_DISPLAY.corner : param.h = ui(192); break;
|
case VALUE_DISPLAY.corner : param.h = ui(192); break;
|
||||||
case VALUE_DISPLAY.area :
|
case VALUE_DISPLAY.area : param.h = ui(204); break;
|
||||||
param.h = ui(204);
|
case VALUE_DISPLAY.rotation :
|
||||||
|
param.halign = breakLine? fa_center : fa_left;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -266,15 +276,20 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
|
||||||
case VALUE_TYPE.boolean :
|
case VALUE_TYPE.boolean :
|
||||||
param.halign = breakLine? fa_left : fa_center;
|
param.halign = breakLine? fa_left : fa_center;
|
||||||
param.s = breakLine? ui(24) : editBoxH;
|
param.s = breakLine? ui(24) : editBoxH;
|
||||||
|
|
||||||
|
if(!breakLine) {
|
||||||
|
param.w = ui(128);
|
||||||
|
param.x = param.x + editBoxW - param.w;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VALUE_TYPE.d3Material :
|
case VALUE_TYPE.d3Material :
|
||||||
case VALUE_TYPE.surface :
|
case VALUE_TYPE.surface :
|
||||||
param.h = ui(96);
|
param.h = breakLine? ui(96) : ui(48);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VALUE_TYPE.curve :
|
case VALUE_TYPE.curve :
|
||||||
param.h = ui(160);
|
param.h = breakLine? ui(160) : ui(100);
|
||||||
if(point_in_rectangle(_m[0], _m[1], ui(32), _hsy, ui(32) + ww - ui(16), _hsy + param.h))
|
if(point_in_rectangle(_m[0], _m[1], ui(32), _hsy, ui(32) + ww - ui(16), _hsy + param.h))
|
||||||
mbRight = false;
|
mbRight = false;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -539,16 +539,16 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
||||||
if(!is_instanceof(self, Node_Collection)) setRenderStatus(true);
|
if(!is_instanceof(self, Node_Collection)) setRenderStatus(true);
|
||||||
} else {
|
} else {
|
||||||
render_cached = false;
|
render_cached = false;
|
||||||
var sBase = surface_get_target();
|
|
||||||
getInputs(frame);
|
getInputs(frame);
|
||||||
|
|
||||||
LOG_BLOCK_START();
|
LOG_BLOCK_START();
|
||||||
LOG_IF(global.FLAG.render == 1, $">>>>>>>>>> DoUpdate called from {INAME} <<<<<<<<<<");
|
LOG_IF(global.FLAG.render == 1, $">>>>>>>>>> DoUpdate called from {INAME} <<<<<<<<<<");
|
||||||
|
|
||||||
if(!is_instanceof(self, Node_Collection)) setRenderStatus(true);
|
if(!is_instanceof(self, Node_Collection)) setRenderStatus(true);
|
||||||
|
var sBase = surface_get_target();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
update(frame); // Update only if input hash differs from previous.
|
update(frame);
|
||||||
} catch(exception) {
|
} catch(exception) {
|
||||||
var sCurr = surface_get_target();
|
var sCurr = surface_get_target();
|
||||||
while(surface_get_target() != sBase)
|
while(surface_get_target() != sBase)
|
||||||
|
|
|
@ -255,17 +255,20 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
||||||
static getInputs = function() { #region
|
static getInputs = function() { #region
|
||||||
preGetInputs();
|
preGetInputs();
|
||||||
|
|
||||||
process_amount = 1;
|
var _len = ds_list_size(inputs);
|
||||||
inputs_data = array_verify(inputs_data, ds_list_size(inputs));
|
|
||||||
inputs_is_array = array_verify(inputs_is_array, ds_list_size(inputs));
|
|
||||||
process_length = array_verify(process_length, ds_list_size(inputs));
|
|
||||||
|
|
||||||
for(var i = 0; i < ds_list_size(inputs); i++) {
|
process_amount = 1;
|
||||||
|
inputs_data = array_verify(inputs_data, _len);
|
||||||
|
inputs_is_array = array_verify(inputs_is_array, _len);
|
||||||
|
process_length = array_verify(process_length, _len);
|
||||||
|
all_inputs = array_verify(all_inputs, _len);
|
||||||
|
|
||||||
|
for(var i = 0; i < _len; i++) {
|
||||||
var val = inputs[| i].getValue();
|
var val = inputs[| i].getValue();
|
||||||
var amo = inputs[| i].arrayLength(val);
|
var amo = inputs[| i].arrayLength(val);
|
||||||
|
|
||||||
if(amo == 0) val = noone; //empty array
|
if(amo == 0) val = noone; //empty array
|
||||||
if(amo == 1) val = val[0]; //spread single array
|
else if(amo == 1) val = val[0]; //spread single array
|
||||||
amo = max(1, amo);
|
amo = max(1, amo);
|
||||||
|
|
||||||
setInputData(i, val);
|
setInputData(i, val);
|
||||||
|
@ -287,16 +290,16 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
||||||
}
|
}
|
||||||
|
|
||||||
var amoMax = process_amount;
|
var amoMax = process_amount;
|
||||||
for( var i = 0, n = array_length(process_length); i < n; i++ ) {
|
for( var i = 0; i < _len; i++ ) {
|
||||||
amoMax /= process_length[i][0];
|
amoMax /= process_length[i][0];
|
||||||
process_length[i][1] = amoMax;
|
process_length[i][1] = amoMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(var i = 0; i < ds_list_size(inputs); i++)
|
for(var i = 0; i < _len; i++)
|
||||||
all_inputs[i] = array_create(process_amount);
|
all_inputs[i] = array_verify(all_inputs[i], process_amount);
|
||||||
|
|
||||||
for(var l = 0; l < process_amount; l++) #region input preparation
|
for(var l = 0; l < process_amount; l++) #region input preparation
|
||||||
for(var i = 0; i < ds_list_size(inputs); i++) {
|
for(var i = 0; i < _len; i++) {
|
||||||
var _in = inputs_data[i];
|
var _in = inputs_data[i];
|
||||||
|
|
||||||
if(!inputs_is_array[i]) {
|
if(!inputs_is_array[i]) {
|
||||||
|
|
|
@ -28,9 +28,10 @@ function Node_Solid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
|
||||||
var _msk = _data[3];
|
var _msk = _data[3];
|
||||||
var _msd = _data[4];
|
var _msd = _data[4];
|
||||||
|
|
||||||
inputs[| 4].setVisible(is_surface(_msk));
|
var _maskUse = is_surface(_msk);
|
||||||
if(is_surface(_msk) && _msd)
|
|
||||||
_dim = [ surface_get_width_safe(_msk), surface_get_height_safe(_msk) ];
|
inputs[| 4].setVisible(_maskUse);
|
||||||
|
if(_maskUse && _msd) _dim = [ surface_get_width_safe(_msk), surface_get_height_safe(_msk) ];
|
||||||
|
|
||||||
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
|
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
|
||||||
|
|
||||||
|
@ -41,15 +42,16 @@ function Node_Solid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
|
||||||
return _outSurf;
|
return _outSurf;
|
||||||
}
|
}
|
||||||
|
|
||||||
surface_set_target(_outSurf);
|
if(_maskUse) {
|
||||||
DRAW_CLEAR
|
surface_set_shader(_outSurf, sh_solid);
|
||||||
|
|
||||||
shader_set(sh_solid);
|
|
||||||
if(is_surface(_msk))
|
|
||||||
draw_surface_stretched_ext(_msk, 0, 0, _dim[0], _dim[1], _col, 1);
|
draw_surface_stretched_ext(_msk, 0, 0, _dim[0], _dim[1], _col, 1);
|
||||||
else
|
surface_reset_shader();
|
||||||
draw_sprite_stretched_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], _col, 1);
|
|
||||||
shader_reset();
|
return _outSurf;
|
||||||
|
}
|
||||||
|
|
||||||
|
surface_set_target(_outSurf);
|
||||||
|
draw_clear(_col);
|
||||||
surface_reset_target();
|
surface_reset_target();
|
||||||
|
|
||||||
return _outSurf;
|
return _outSurf;
|
||||||
|
|
|
@ -480,28 +480,28 @@ function Panel_Inspector() : PanelContent() constructor {
|
||||||
} else {
|
} else {
|
||||||
if(i >= array_length(_inspecting.input_display_list)) break;
|
if(i >= array_length(_inspecting.input_display_list)) break;
|
||||||
var jun_disp = _inspecting.input_display_list[i];
|
var jun_disp = _inspecting.input_display_list[i];
|
||||||
if(is_array(jun_disp)) {
|
if(is_array(jun_disp)) { // LABEL
|
||||||
var txt = __txt(jun_disp[0]);
|
var txt = __txt(jun_disp[0]);
|
||||||
var coll = jun_disp[1] && filter_text == "";
|
var coll = jun_disp[1] && filter_text == "";
|
||||||
|
var lbh = lineBreak? ui(32) : ui(26);
|
||||||
if(_hover && point_in_rectangle(_m[0], _m[1], 0, yy, con_w, yy + ui(32))) {
|
|
||||||
draw_sprite_stretched_ext(THEME.group_label, 0, 0, yy, con_w, ui(32), COLORS.panel_inspector_group_hover, 1);
|
if(_hover && point_in_rectangle(_m[0], _m[1], 0, yy, con_w, yy + lbh)) {
|
||||||
|
draw_sprite_stretched_ext(THEME.group_label, 0, 0, yy, con_w, lbh, COLORS.panel_inspector_group_hover, 1);
|
||||||
|
|
||||||
if(mouse_press(mb_left, pFOCUS))
|
if(mouse_press(mb_left, pFOCUS))
|
||||||
jun_disp[@ 1] = !coll;
|
jun_disp[@ 1] = !coll;
|
||||||
if(mouse_press(mb_right, pFOCUS))
|
if(mouse_press(mb_right, pFOCUS))
|
||||||
menuCall("inspector_group_menu",,, group_menu,, _inspecting);
|
menuCall("inspector_group_menu",,, group_menu,, _inspecting);
|
||||||
} else
|
} else
|
||||||
draw_sprite_stretched_ext(THEME.group_label, 0, 0, yy, con_w, ui(32), COLORS.panel_inspector_group_bg, 1);
|
draw_sprite_stretched_ext(THEME.group_label, 0, 0, yy, con_w, lbh, COLORS.panel_inspector_group_bg, 1);
|
||||||
|
|
||||||
if(filter_text == "") {
|
if(filter_text == "")
|
||||||
draw_sprite_ui(THEME.arrow, 0, ui(16), yy + ui(32) / 2, 1, 1, -90 + coll * 90, COLORS.panel_inspector_group_bg, 1);
|
draw_sprite_ui(THEME.arrow, 0, ui(16), yy + lbh / 2, 1, 1, -90 + coll * 90, COLORS.panel_inspector_group_bg, 1);
|
||||||
}
|
|
||||||
|
|
||||||
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text);
|
draw_set_text(lineBreak? f_p0 : f_p1, fa_left, fa_center, COLORS._main_text);
|
||||||
draw_text_add(ui(32), yy + ui(32) / 2, txt);
|
draw_text_add(ui(32), yy + lbh / 2, txt);
|
||||||
|
|
||||||
hh += ui(32 + 8);
|
hh += lbh + ui(lineBreak? 8 : 6);
|
||||||
|
|
||||||
if(coll) {
|
if(coll) {
|
||||||
var j = i + 1;
|
var j = i + 1;
|
||||||
|
@ -757,8 +757,10 @@ function Panel_Inspector() : PanelContent() constructor {
|
||||||
|
|
||||||
by += ui(36);
|
by += ui(36);
|
||||||
view_mode_tooltip.index = lineBreak;
|
view_mode_tooltip.index = lineBreak;
|
||||||
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, view_mode_tooltip, THEME.inspector_view, lineBreak) == 2)
|
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, view_mode_tooltip, THEME.inspector_view, lineBreak) == 2) {
|
||||||
lineBreak = !lineBreak;
|
lineBreak = !lineBreak;
|
||||||
|
PREFERENCES.inspector_view_default = lineBreak;
|
||||||
|
}
|
||||||
|
|
||||||
var bx = w - ui(44);
|
var bx = w - ui(44);
|
||||||
var by = ui(12);
|
var by = ui(12);
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
PREFERENCES.panel_preview_dragging = MOD_KEY.alt;
|
PREFERENCES.panel_preview_dragging = MOD_KEY.alt;
|
||||||
|
|
||||||
PREFERENCES.inspector_focus_on_double_click = true;
|
PREFERENCES.inspector_focus_on_double_click = true;
|
||||||
|
PREFERENCES.inspector_view_default = 1;
|
||||||
|
|
||||||
PREFERENCES.node_show_render_status = false;
|
PREFERENCES.node_show_render_status = false;
|
||||||
PREFERENCES.node_show_time = true;
|
PREFERENCES.node_show_time = true;
|
||||||
|
|
|
@ -15,6 +15,8 @@ function rotator(_onModify, _step = -1) : widget() constructor {
|
||||||
tb_value.slidable = true;
|
tb_value.slidable = true;
|
||||||
tb_value.slide_speed = 1;
|
tb_value.slide_speed = 1;
|
||||||
|
|
||||||
|
halign = fa_center;
|
||||||
|
|
||||||
static setInteract = function(interactable = noone) {
|
static setInteract = function(interactable = noone) {
|
||||||
self.interactable = interactable;
|
self.interactable = interactable;
|
||||||
tb_value.interactable = interactable;
|
tb_value.interactable = interactable;
|
||||||
|
@ -25,6 +27,7 @@ function rotator(_onModify, _step = -1) : widget() constructor {
|
||||||
}
|
}
|
||||||
|
|
||||||
static drawParam = function(params) {
|
static drawParam = function(params) {
|
||||||
|
halign = params.halign;
|
||||||
return draw(params.x, params.y, params.w, params.data, params.m);
|
return draw(params.x, params.y, params.w, params.data, params.m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,18 +37,22 @@ function rotator(_onModify, _step = -1) : widget() constructor {
|
||||||
w = _w;
|
w = _w;
|
||||||
h = ui(64);
|
h = ui(64);
|
||||||
|
|
||||||
_x += _w / 2;
|
var _r = ui(28);
|
||||||
|
|
||||||
|
switch(halign) {
|
||||||
|
case fa_left : _x += _r; break;
|
||||||
|
case fa_center : _x += _w / 2; break;
|
||||||
|
}
|
||||||
|
|
||||||
if(!is_real(_data)) return;
|
if(!is_real(_data)) return;
|
||||||
var knob_y = _y + h / 2;
|
var knob_y = _y + h / 2;
|
||||||
var _r = ui(28);
|
|
||||||
|
|
||||||
if(draw_tb) {
|
if(draw_tb) {
|
||||||
tb_value.setFocusHover(active, hover);
|
tb_value.setFocusHover(active, hover);
|
||||||
tb_value.draw(_x + ui(64), knob_y - ui(17), ui(64), TEXTBOX_HEIGHT, _data, _m);
|
tb_value.draw(_x + ui(64), knob_y - ui(17), ui(64), TEXTBOX_HEIGHT, _data, _m);
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_sprite(spr_bg, 0, _x, knob_y);
|
draw_sprite(spr_bg, 0, round(_x), round(knob_y));
|
||||||
|
|
||||||
draw_set_color(COLORS.widget_rotator_guide);
|
draw_set_color(COLORS.widget_rotator_guide);
|
||||||
draw_line(_x, knob_y, _x + lengthdir_x(ui(20), _data) - 1, knob_y + lengthdir_y(ui(20), _data) - 1);
|
draw_line(_x, knob_y, _x + lengthdir_x(ui(20), _data) - 1, knob_y + lengthdir_y(ui(20), _data) - 1);
|
||||||
|
@ -88,9 +95,6 @@ function rotator(_onModify, _step = -1) : widget() constructor {
|
||||||
draw_sprite(spr_knob, 0, px, py);
|
draw_sprite(spr_knob, 0, px, py);
|
||||||
}
|
}
|
||||||
|
|
||||||
//draw_set_text(f_p0, fa_center, fa_center, COLORS._main_text);
|
|
||||||
//draw_text(_x, knob_y, string(_data));
|
|
||||||
|
|
||||||
resetFocus();
|
resetFocus();
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
|
|
|
@ -53,7 +53,7 @@ function rotatorRandom(_onModify) : widget() constructor {
|
||||||
var kny = _y + h / 2;
|
var kny = _y + h / 2;
|
||||||
var px, py, _r = ui(28);
|
var px, py, _r = ui(28);
|
||||||
|
|
||||||
draw_sprite(THEME.rotator_bg, 0, _x, kny);
|
draw_sprite(THEME.rotator_bg, 0, round(_x), round(kny));
|
||||||
|
|
||||||
tooltip.index = mode;
|
tooltip.index = mode;
|
||||||
if(buttonInstant(THEME.button_hide_circle_28, knx - ui(28 / 2), kny - ui(28 / 2), ui(28), ui(28), _m, active, hover, tooltip, THEME.rotator_random_mode, mode) == 2) { #region
|
if(buttonInstant(THEME.button_hide_circle_28, knx - ui(28 / 2), kny - ui(28 / 2), ui(28), ui(28), _m, active, hover, tooltip, THEME.rotator_random_mode, mode) == 2) { #region
|
||||||
|
|
|
@ -55,7 +55,7 @@ function rotatorRange(_onModify) : widget() constructor {
|
||||||
py[i] = knob_y + lengthdir_y(_r, _data[i]);
|
py[i] = knob_y + lengthdir_y(_r, _data[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_sprite(THEME.rotator_bg, 0, _x, knob_y);
|
draw_sprite(THEME.rotator_bg, 0, round(_x), round(knob_y));
|
||||||
|
|
||||||
draw_set_color(COLORS.widget_rotator_guide);
|
draw_set_color(COLORS.widget_rotator_guide);
|
||||||
draw_line(_x, knob_y, _x + lengthdir_x(ui(20), _data[0]) - 1, knob_y + lengthdir_y(ui(20), _data[0]) - 1);
|
draw_line(_x, knob_y, _x + lengthdir_x(ui(20), _data[0]) - 1, knob_y + lengthdir_y(ui(20), _data[0]) - 1);
|
||||||
|
|
|
@ -32,8 +32,6 @@ function surfaceBox(_onModify, def_path = "") : widget() constructor {
|
||||||
}
|
}
|
||||||
|
|
||||||
static draw = function(_x, _y, _w, _h, _surface, _display_data, _m, _rx, _ry) {
|
static draw = function(_x, _y, _w, _h, _surface, _display_data, _m, _rx, _ry) {
|
||||||
_h = ui(96);
|
|
||||||
|
|
||||||
x = _x;
|
x = _x;
|
||||||
y = _y;
|
y = _y;
|
||||||
w = _w;
|
w = _w;
|
||||||
|
|
Loading…
Reference in a new issue