mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-01-26 04:48:17 +01:00
[Collections] Add setting to hide labels.
This commit is contained in:
parent
558249e742
commit
5c46be3fc0
7 changed files with 145 additions and 116 deletions
|
@ -43,22 +43,22 @@ event_inherited();
|
|||
#region surface
|
||||
folderW = ui(200);
|
||||
folderW_dragging = false;
|
||||
folderW_drag_mx = 0;
|
||||
folderW_drag_sx = 0;
|
||||
folderW_drag_mx = 0;
|
||||
folderW_drag_sx = 0;
|
||||
|
||||
content_w = dialog_w - ui(38) - folderW;
|
||||
content_h = dialog_h - ui(32);
|
||||
content_w = dialog_w - ui(26) - folderW;
|
||||
content_h = dialog_h - ui(24);
|
||||
|
||||
function onResize() {
|
||||
content_w = dialog_w - ui(38) - folderW;
|
||||
content_h = dialog_h - ui(32);
|
||||
content_w = dialog_w - ui(26) - folderW;
|
||||
content_h = dialog_h - ui(24);
|
||||
|
||||
contentPane.resize(content_w, content_h);
|
||||
folderPane.resize(folderW - ui(12), content_h - ui(32));
|
||||
}
|
||||
|
||||
folderPane = new scrollPane(folderW - ui(12), content_h - ui(32), function(_y, _m) {
|
||||
draw_clear_alpha(COLORS.panel_bg_clear, 0);
|
||||
draw_clear_alpha(COLORS.panel_bg_clear, 1);
|
||||
var hh = 8;
|
||||
|
||||
for(var i = 0; i < ds_list_size(global.ASSETS.subDir); i++) {
|
||||
|
@ -74,14 +74,15 @@ event_inherited();
|
|||
|
||||
return hh + 8;
|
||||
});
|
||||
|
||||
folderPane.scroll_color_bg = CDEF.main_mdblack;
|
||||
|
||||
contentPane = new scrollPane(content_w, content_h, function(_y, _m) {
|
||||
draw_clear_alpha(c_white, 0);
|
||||
|
||||
var contents = context.content;
|
||||
var amo = ds_list_size(contents);
|
||||
var amo = ds_list_size(contents);
|
||||
var hh = 0;
|
||||
var surfh = contentPane.surface_h + 4;
|
||||
var frame = current_time * PREFERENCES.collection_preview_speed / 8000;
|
||||
|
||||
var grid_size = ui(64);
|
||||
|
@ -90,60 +91,65 @@ event_inherited();
|
|||
var col = max(1, floor(contentPane.surface_w / (grid_size + grid_space)));
|
||||
var row = ceil(amo / col);
|
||||
var yy = _y + grid_space;
|
||||
|
||||
hh += grid_space;
|
||||
var hght = grid_size + grid_space;
|
||||
|
||||
hh += grid_space + hght * row;
|
||||
|
||||
for(var i = 0; i < row; i++) {
|
||||
if(yy + grid_size < -4) {
|
||||
yy += hght;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(yy > surfh) break;
|
||||
|
||||
for(var j = 0; j < col; j++) {
|
||||
var index = i * col + j;
|
||||
if(index < amo) {
|
||||
var content = contents[| index];
|
||||
var xx = grid_space + (grid_size + grid_space) * j;
|
||||
if(index >= amo) break;
|
||||
|
||||
var content = contents[| index];
|
||||
var xx = grid_space + (grid_size + grid_space) * j;
|
||||
|
||||
BLEND_OVERRIDE;
|
||||
draw_sprite_stretched(THEME.node_bg, 0, xx, yy, grid_size, grid_size);
|
||||
BLEND_NORMAL;
|
||||
|
||||
var spr = content.getSpr();
|
||||
if(sprite_exists(spr)) {
|
||||
var sw = sprite_get_width(spr);
|
||||
var sh = sprite_get_height(spr);
|
||||
var ss = img_size / max(sw, sh);
|
||||
var sx = xx + (grid_size - sw * ss) / 2;
|
||||
var sy = yy + (grid_size - sh * ss) / 2;
|
||||
var sn = sprite_get_number(spr);
|
||||
|
||||
BLEND_OVERRIDE;
|
||||
draw_sprite_stretched(THEME.node_bg, 0, xx, yy, grid_size, grid_size);
|
||||
BLEND_NORMAL;
|
||||
draw_sprite_ext(spr, frame, sx, sy, ss, ss, 0, c_white, 1);
|
||||
|
||||
var spr = content.getSpr();
|
||||
if(sprite_exists(spr)) {
|
||||
var sw = sprite_get_width(spr);
|
||||
var sh = sprite_get_height(spr);
|
||||
var ss = img_size / max(sw, sh);
|
||||
var sx = xx + (grid_size - sw * ss) / 2;
|
||||
var sy = yy + (grid_size - sh * ss) / 2;
|
||||
var sn = sprite_get_number(spr);
|
||||
|
||||
draw_sprite_ext(spr, frame, sx, sy, ss, ss, 0, c_white, 1);
|
||||
|
||||
var _txt = $"{sw}x{sh}";
|
||||
if(sn) _txt = $"[{sn}] " + _txt;
|
||||
|
||||
draw_set_text(_f_p4, fa_right, fa_bottom, COLORS._main_text_inner);
|
||||
var _tw = string_width(_txt) + ui(6);
|
||||
var _th = 14;
|
||||
var _nx = xx + grid_size - 1 - _tw;
|
||||
var _ny = yy + grid_size - _th;
|
||||
|
||||
draw_sprite_stretched_ext(THEME.ui_panel, 0, _nx, _ny, _tw, _th - 1, COLORS.panel_bg_clear_inner, 0.85);
|
||||
draw_text_add(xx + grid_size - ui(3), yy + grid_size - ui(2), _txt);
|
||||
var _txt = $"{sw}x{sh}";
|
||||
if(sn) _txt = $"[{sn}] " + _txt;
|
||||
|
||||
draw_set_text(_f_p4, fa_right, fa_bottom, COLORS._main_text_inner);
|
||||
var _tw = string_width(_txt) + ui(6);
|
||||
var _th = 14;
|
||||
var _nx = xx + grid_size - 1 - _tw;
|
||||
var _ny = yy + grid_size - _th;
|
||||
|
||||
draw_sprite_stretched_ext(THEME.ui_panel, 0, _nx, _ny, _tw, _th - 1, COLORS.panel_bg_clear_inner, 0.85);
|
||||
draw_text_add(xx + grid_size - ui(3), yy + grid_size - ui(2), _txt);
|
||||
}
|
||||
|
||||
if(sHOVER && contentPane.hover && point_in_rectangle(_m[0], _m[1], xx, yy, xx + grid_size, yy + grid_size)) {
|
||||
contentPane.hover_content = true;
|
||||
TOOLTIP = [ spr, "sprite" ];
|
||||
|
||||
draw_sprite_stretched_ext(THEME.node_bg, 1, xx, yy, grid_size, grid_size, COLORS._main_accent, 1);
|
||||
if(mouse_press(mb_left, sFOCUS)) {
|
||||
target.onModify(content.path);
|
||||
instance_destroy();
|
||||
}
|
||||
|
||||
if(sHOVER && contentPane.hover && point_in_rectangle(_m[0], _m[1], xx, yy, xx + grid_size, yy + grid_size)) {
|
||||
contentPane.hover_content = true;
|
||||
TOOLTIP = [ spr, "sprite" ];
|
||||
|
||||
draw_sprite_stretched_ext(THEME.node_bg, 1, xx, yy, grid_size, grid_size, COLORS._main_accent, 1);
|
||||
if(mouse_press(mb_left, sFOCUS)) {
|
||||
target.onModify(content.path);
|
||||
instance_destroy();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
var hght = grid_size + grid_space;
|
||||
hh += hght;
|
||||
yy += hght;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#region draw
|
||||
if(folderW_dragging) {
|
||||
var w = folderW_drag_sx + (mouse_mx - folderW_drag_mx);
|
||||
w = clamp(w, ui(200), dialog_w - ui(128));
|
||||
w = clamp(w, ui(128), dialog_w - ui(128));
|
||||
|
||||
folderW = w;
|
||||
onResize();
|
||||
|
@ -17,13 +17,15 @@
|
|||
}
|
||||
|
||||
draw_set_text(f_p0b, fa_left, fa_top, COLORS._main_text);
|
||||
draw_text(dialog_x + ui(16), dialog_y + ui(16), __txt("Assets"));
|
||||
draw_text(dialog_x + ui(24), dialog_y + ui(16), __txt("Assets"));
|
||||
|
||||
//draw_sprite_stretched(THEME.ui_panel_bg, 1, dialog_x + ui(16), dialog_y + ui(48), folderW - ui(24), dialog_h - ui(64));
|
||||
draw_sprite_stretched(THEME.ui_panel_bg, 1, dialog_x + ui(12 - 4) + folderW, dialog_y + ui(16), dialog_w - ui(28) - folderW, dialog_h - ui(32));
|
||||
var _fld_x = dialog_x + ui(12);
|
||||
folderPane.setFocusHover(sFOCUS, sHOVER);
|
||||
folderPane.draw(_fld_x, dialog_y + ui(48));
|
||||
|
||||
var dx0 = dialog_x + ui(16) + folderW - ui(8);
|
||||
var dx1 = dialog_x + ui(16) + folderW;
|
||||
var _cnt_x = _fld_x + folderW - ui(4);
|
||||
var dx0 = _cnt_x - ui(8);
|
||||
var dx1 = _cnt_x;
|
||||
var dy0 = dialog_y + ui(48);
|
||||
var dy1 = dialog_y + dialog_h - ui(16);
|
||||
|
||||
|
@ -36,9 +38,8 @@
|
|||
}
|
||||
}
|
||||
|
||||
folderPane.setFocusHover(sFOCUS, sHOVER);
|
||||
folderPane.draw(dialog_x + ui(12), dialog_y + ui(48));
|
||||
draw_sprite_stretched(THEME.ui_panel_bg, 1, _cnt_x, dialog_y + ui(12), content_w + ui(6), dialog_h - ui(24));
|
||||
|
||||
contentPane.setFocusHover(sFOCUS, sHOVER);
|
||||
contentPane.draw(dialog_x + ui(12 - 4) + folderW, dialog_y + ui(16));
|
||||
contentPane.draw(_cnt_x, dialog_y + ui(12));
|
||||
#endregion
|
|
@ -7,7 +7,8 @@ function FileObject(_name, _path) constructor {
|
|||
spr = -1;
|
||||
sprFetchID = noone;
|
||||
|
||||
content = -1;
|
||||
size = file_size(path);
|
||||
content = -1;
|
||||
|
||||
var _mdir = filename_dir(path);
|
||||
var _mname = filename_name_only(path);
|
||||
|
@ -15,8 +16,7 @@ function FileObject(_name, _path) constructor {
|
|||
meta = noone;
|
||||
type = FILE_TYPE.assets;
|
||||
|
||||
var _ext = filename_ext_raw(path);
|
||||
switch(_ext) {
|
||||
switch(filename_ext_raw(path)) {
|
||||
case "png" :
|
||||
case "jpg" :
|
||||
case "gif" :
|
||||
|
@ -37,7 +37,6 @@ function FileObject(_name, _path) constructor {
|
|||
retrive_data = false;
|
||||
thumbnail_data = -1;
|
||||
thumbnail = noone;
|
||||
size = file_size(path);
|
||||
|
||||
static getName = function() { return name; }
|
||||
|
||||
|
@ -73,20 +72,20 @@ function FileObject(_name, _path) constructor {
|
|||
return spr;
|
||||
}
|
||||
|
||||
var path = array_safe_get_fast(spr_path, 0);
|
||||
var amo = array_safe_get_fast(spr_path, 1);
|
||||
var _path = array_safe_get_fast(spr_path, 0);
|
||||
var _amo = array_safe_get_fast(spr_path, 1);
|
||||
|
||||
if(!file_exists_empty(path)) return -1;
|
||||
if(!file_exists_empty(_path)) return -1;
|
||||
|
||||
if(loadThumbnailAsync) {
|
||||
sprFetchID = sprite_add_ext(path, amo, 0, 0, true);
|
||||
sprFetchID = sprite_add_ext(_path, _amo, 0, 0, true);
|
||||
IMAGE_FETCH_MAP[? sprFetchID] = function(load_result) {
|
||||
spr = load_result[? "id"];
|
||||
if(spr && array_safe_get_fast(spr_path, 2))
|
||||
sprite_set_offset(spr, sprite_get_width(spr) / 2, sprite_get_height(spr) / 2);
|
||||
}
|
||||
} else {
|
||||
spr = sprite_add(path, amo, 0, 0, 0, 0);
|
||||
spr = sprite_add(_path, _amo, 0, 0, 0, 0);
|
||||
if(spr && array_safe_get_fast(spr_path, 2))
|
||||
sprite_set_offset(spr, sprite_get_width(spr) / 2, sprite_get_height(spr) / 2);
|
||||
}
|
||||
|
@ -197,12 +196,11 @@ function DirectoryObject(name, path) constructor {
|
|||
}
|
||||
|
||||
static draw = function(parent, _x, _y, _m, _w, _hover, _focus, _homedir, _params = {}) {
|
||||
var hg = ui(28);
|
||||
var hh = 0;
|
||||
var font = struct_try_get(_params, "font", f_p1);
|
||||
var hg = line_get_height(font, 5);
|
||||
var hh = 0;
|
||||
|
||||
var font = struct_try_get(_params, "font", f_p0);
|
||||
|
||||
if(!ds_list_empty(subDir) && _hover && point_in_rectangle(_m[0], _m[1], _x, _y, ui(32), _y + hg - 1)) {
|
||||
if(!ds_list_empty(subDir) && _hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + ui(32), _y + hg - 1)) {
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, _x, _y, ui(32), hg, CDEF.main_white, 1);
|
||||
if(mouse_press(mb_left, _focus)) {
|
||||
open = !open;
|
||||
|
@ -210,14 +208,14 @@ function DirectoryObject(name, path) constructor {
|
|||
}
|
||||
}
|
||||
|
||||
var _bx = _x + ui(28);
|
||||
var _bx = _x + ui(32);
|
||||
var _bw = _w - ui(36);
|
||||
|
||||
if(_hover && point_in_rectangle(_m[0], _m[1], _bx, _y, _bx + _bw, _y + hg - 1)) {
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, _bx, _y, _bw, hg, CDEF.main_white, 1);
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, _bx - ui(4), _y, _bw + ui(4), hg, CDEF.main_white, 1);
|
||||
if(!triggered && mouse_press(mb_left, _focus)) {
|
||||
if(!ds_list_empty(subDir)) {
|
||||
open = !open;
|
||||
if(!ds_list_empty(subDir) && !open) {
|
||||
open = true;
|
||||
MOUSE_BLOCK = true;
|
||||
}
|
||||
|
||||
|
@ -230,8 +228,12 @@ function DirectoryObject(name, path) constructor {
|
|||
if(triggered && mouse_release(mb_left))
|
||||
triggered = false;
|
||||
|
||||
if(ds_list_empty(subDir)) draw_sprite_ui_uniform(THEME.folder_content, parent.context == self, _x + ui(16), _y + hg / 2 - 1, 1, COLORS.collection_folder_empty);
|
||||
else draw_sprite_ui_uniform(THEME.folder_content, open, _x + ui(16), _y + hg / 2 - 1, 1, COLORS.collection_folder_nonempty);
|
||||
gpu_set_texfilter(true);
|
||||
var _spr_ind = ds_list_empty(subDir)? parent.context == self : open;
|
||||
var _spr_bld = ds_list_empty(subDir)? COLORS.collection_folder_empty : COLORS.collection_folder_nonempty;
|
||||
var _spr_sca = (hg - ui(5)) / 24;
|
||||
draw_sprite_ui_uniform(THEME.folder_content, _spr_ind, _x + ui(16), _y + hg / 2 - 1, _spr_sca, _spr_bld);
|
||||
gpu_set_texfilter(false);
|
||||
|
||||
draw_set_text(font, fa_left, fa_center, path == parent.context.path? COLORS._main_text_accent : COLORS._main_text_inner);
|
||||
draw_text_add(_x + ui(32), _y + hg / 2, name);
|
||||
|
@ -242,8 +244,6 @@ function DirectoryObject(name, path) constructor {
|
|||
var l_y = _y;
|
||||
for(var i = 0; i < ds_list_size(subDir); i++) {
|
||||
var _hg = subDir[| i].draw(parent, _x + ui(16), _y, _m, _w - ui(16), _hover, _focus, _homedir, _params);
|
||||
// draw_set_color(COLORS.collection_tree_line);
|
||||
// draw_line(_x + ui(12), _y + hg / 2, _x + ui(16), _y + hg / 2);
|
||||
|
||||
hh += _hg;
|
||||
_y += _hg;
|
||||
|
|
|
@ -28,7 +28,7 @@ function Node_Gradient(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
newInput(8, nodeValue_Surface("Mask", self));
|
||||
|
||||
newInput(9, nodeValue_Float("Scale", self, 1))
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 2, 0.01] })
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 5, 0.01] })
|
||||
.setMappable(13);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -322,7 +322,7 @@ function Panel_Collection() : PanelContent() constructor {
|
|||
var hh = 0;
|
||||
|
||||
if(contentView == 0) {
|
||||
var grid_width = round(grid_size * 1.25);
|
||||
var grid_width = PREFERENCES.collection_label? round(grid_size * 1.25) : grid_size;
|
||||
if(grid_width > ui(80)) grid_width = grid_size;
|
||||
|
||||
var grid_space = round(grid_size * 0.1875);
|
||||
|
@ -393,18 +393,16 @@ function Panel_Collection() : PanelContent() constructor {
|
|||
if(sprite_exists(_node.spr)) {
|
||||
var sw = sprite_get_width(_node.spr);
|
||||
var sh = sprite_get_height(_node.spr);
|
||||
var ss = (grid_size - ui(12)) * PREFERENCES.collection_scale / max(sw, sh);
|
||||
var ss = (grid_size * .8) * PREFERENCES.collection_scale / max(sw, sh);
|
||||
|
||||
var xo = (sprite_get_xoffset(_node.spr) - sw / 2) * ss;
|
||||
var yo = (sprite_get_yoffset(_node.spr) - sh / 2) * ss;
|
||||
var sx = _boxx + grid_size / 2 + xo;
|
||||
var sy = yy + grid_size / 2 + yo;
|
||||
|
||||
gpu_set_texfilter(true);
|
||||
BLEND_ALPHA_MULP
|
||||
draw_sprite_ext(_node.spr, frame, sx, sy, ss, ss, 0, c_white, 1);
|
||||
BLEND_NORMAL
|
||||
gpu_set_texfilter(false);
|
||||
BLEND_ALPHA_MULP
|
||||
draw_sprite_ext(_node.spr, frame, sx, sy, ss, ss, 0, c_white, 1);
|
||||
BLEND_NORMAL
|
||||
} else
|
||||
draw_sprite_ui_uniform(THEME.group, 0, _boxx + grid_size / 2, yy + grid_size / 2, 1, c_white);
|
||||
|
||||
|
@ -422,9 +420,12 @@ function Panel_Collection() : PanelContent() constructor {
|
|||
}
|
||||
}
|
||||
|
||||
draw_set_text(f_p3, fa_center, fa_top, COLORS._main_text_inner);
|
||||
var _txtH = draw_text_ext_add(_boxx + grid_size / 2, yy + grid_size + ui(4), _node.name, -1, grid_width, 1, true);
|
||||
name_height = max(name_height, _txtH + 8);
|
||||
if(PREFERENCES.collection_label) {
|
||||
draw_set_text(f_p3, fa_center, fa_top, COLORS._main_text_inner);
|
||||
var _txtH = draw_text_ext_add(_boxx + grid_size / 2, yy + grid_size + ui(4), _node.name, -1, grid_width, 1, true);
|
||||
name_height = max(name_height, _txtH + 8);
|
||||
} else
|
||||
name_height = 0;
|
||||
}
|
||||
|
||||
var hght = grid_size + name_height + ui(8);
|
||||
|
@ -517,11 +518,8 @@ function Panel_Collection() : PanelContent() constructor {
|
|||
draw_set_alpha(1);
|
||||
_y += ui(24);
|
||||
|
||||
var _font = f_p0;
|
||||
var _param = { font : _font };
|
||||
|
||||
for(var i = 0; i < ds_list_size(root.subDir); i++) {
|
||||
var hg = root.subDir[| i].draw(self, ui(8 + in_dialog * 8), _y, _m, folderPane.w - ui(20), pHOVER && folderPane.hover, pFOCUS, root, _param);
|
||||
var hg = root.subDir[| i].draw(self, ui(8 + in_dialog * 8), _y, _m, folderPane.w - ui(20), pHOVER && folderPane.hover, pFOCUS, root);
|
||||
hh += hg;
|
||||
_y += hg;
|
||||
}
|
||||
|
@ -619,7 +617,7 @@ function Panel_Collection() : PanelContent() constructor {
|
|||
_list = node_temp_list;
|
||||
}
|
||||
|
||||
var grid_width = max(ui(40), round(grid_size * 1.25));
|
||||
var grid_width = PREFERENCES.collection_label? max(ui(40), round(grid_size * 1.25)) : grid_size;
|
||||
var node_count = ds_list_size(_list);
|
||||
var grid_space = round(grid_size * 0.1875);
|
||||
|
||||
|
@ -660,6 +658,7 @@ function Panel_Collection() : PanelContent() constructor {
|
|||
BLEND_NORMAL;
|
||||
|
||||
if(_hover && point_in_rectangle(_m[0], _m[1], _nx, yy, _nx + grid_width, yy + grid_size)) {
|
||||
TOOLTIP = _node.name;
|
||||
nodecontentPane.hover_content = true;
|
||||
draw_sprite_stretched_ext(THEME.node_bg, 1, _boxx, yy, grid_size, grid_size, COLORS._main_accent, 1);
|
||||
|
||||
|
@ -669,7 +668,7 @@ function Panel_Collection() : PanelContent() constructor {
|
|||
}
|
||||
}
|
||||
|
||||
var ss = (grid_size - ui(16)) / max(sprite_get_width(_node.spr), sprite_get_height(_node.spr));
|
||||
var ss = (grid_size * .8) / max(sprite_get_width(_node.spr), sprite_get_height(_node.spr));
|
||||
var sx = _boxx + grid_size / 2;
|
||||
var sy = yy + grid_size / 2;
|
||||
|
||||
|
@ -684,9 +683,12 @@ function Panel_Collection() : PanelContent() constructor {
|
|||
|
||||
}
|
||||
|
||||
draw_set_text(font, fa_center, fa_top, COLORS._main_text_inner);
|
||||
var _txtH = draw_text_ext_add(_boxx + grid_size / 2, yy + grid_size + ui(4), _node.name, -1, grid_width);
|
||||
name_height = max(name_height, _txtH + 8);
|
||||
if(PREFERENCES.collection_label) {
|
||||
draw_set_text(font, fa_center, fa_top, COLORS._main_text_inner);
|
||||
var _txtH = draw_text_ext_add(_boxx + grid_size / 2, yy + grid_size + ui(4), _node.name, -1, grid_width);
|
||||
name_height = max(name_height, _txtH + 8);
|
||||
} else
|
||||
name_height = 0;
|
||||
|
||||
if(j == col - 1) {
|
||||
var hght = grid_size + name_height + ui(8);
|
||||
|
@ -882,14 +884,29 @@ function Panel_Collection() : PanelContent() constructor {
|
|||
if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [mx, my], pHOVER, pFOCUS, txt, THEME.refresh_icon) == 2)
|
||||
refreshContext();
|
||||
bx -= ui(36);
|
||||
|
||||
if(bx < rootx) return;
|
||||
var txt = __txt("Settings");
|
||||
if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [mx, my], pHOVER, pFOCUS, txt, THEME.gear) == 2)
|
||||
dialogPanelCall(new Panel_Collections_Setting(), x + bx, y + by - 8, { anchor: ANCHOR.bottom | ANCHOR.left });
|
||||
bx -= ui(36);
|
||||
|
||||
}
|
||||
|
||||
if(bx < rootx) return;
|
||||
var txt = __txt("Settings");
|
||||
if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [mx, my], pHOVER, pFOCUS, txt, THEME.gear) == 2)
|
||||
dialogPanelCall(new Panel_Collections_Setting(), x + bx, y + by - 8, { anchor: ANCHOR.bottom | ANCHOR.left });
|
||||
bx -= ui(36);
|
||||
}
|
||||
|
||||
static serialize = function() {
|
||||
_map = {
|
||||
page,
|
||||
};
|
||||
|
||||
return _map;
|
||||
}
|
||||
|
||||
static deserialize = function(data) {
|
||||
var p = struct_try_get(data, "page", 0);
|
||||
setPage(p);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,28 +1,32 @@
|
|||
function Panel_Collections_Setting() : Panel_Linear_Setting() constructor {
|
||||
title = __txtx("collection_settings", "Collection Settings");
|
||||
|
||||
w = ui(380);
|
||||
w = ui(380);
|
||||
|
||||
properties = [
|
||||
new __Panel_Linear_Setting_Item(
|
||||
__txt("View"),
|
||||
new buttonGroup([ "Grid", "List" ], function(i) { PANEL_COLLECTION.contentView = i; }),
|
||||
new buttonGroup([ "Grid", "List" ], function(i) /*=>*/ { PANEL_COLLECTION.contentView = i; }),
|
||||
function() /*=>*/ {return PANEL_COLLECTION.contentView},
|
||||
),
|
||||
new __Panel_Linear_Setting_Item_Preference(
|
||||
__txt("Show label"),
|
||||
"collection_label",
|
||||
new checkBox(function() /*=>*/ { PREFERENCES.collection_label = !PREFERENCES.collection_label; PREF_SAVE(); }),
|
||||
),
|
||||
new __Panel_Linear_Setting_Item_Preference(
|
||||
__txtx("coll_animated", "Animated thumbnail"),
|
||||
"collection_animated",
|
||||
new checkBox(function() { PREFERENCES.collection_animated = !PREFERENCES.collection_animated; PREF_SAVE(); }),
|
||||
new checkBox(function() /*=>*/ { PREFERENCES.collection_animated = !PREFERENCES.collection_animated; PREF_SAVE(); }),
|
||||
),
|
||||
new __Panel_Linear_Setting_Item_Preference(
|
||||
__txtx("coll_animated_speed", "Animation speed"),
|
||||
"collection_preview_speed",
|
||||
new textBox(TEXTBOX_INPUT.number, function(val) { PREFERENCES.collection_preview_speed = val; PREF_SAVE(); }),
|
||||
new textBox(TEXTBOX_INPUT.number, function(val) /*=>*/ { PREFERENCES.collection_preview_speed = val; PREF_SAVE(); }),
|
||||
),
|
||||
new __Panel_Linear_Setting_Item_Preference(
|
||||
__txtx("coll_thumbnail_scale", "Thumbnail scale"),
|
||||
"collection_scale",
|
||||
slider(0, 1, 0.01, function(val) { PREFERENCES.collection_scale = clamp(val, 0.1, 1); PREF_SAVE(); }),
|
||||
slider(0, 1, 0.01, function(val) /*=>*/ { PREFERENCES.collection_scale = clamp(val, 0.1, 1); PREF_SAVE(); }),
|
||||
),
|
||||
];
|
||||
|
||||
|
|
|
@ -113,6 +113,7 @@
|
|||
PREFERENCES.curve_connection_line = 1;
|
||||
|
||||
PREFERENCES.collection_animated = true;
|
||||
PREFERENCES.collection_label = true;
|
||||
PREFERENCES.collection_preview_speed = 60;
|
||||
PREFERENCES.collection_scale = 1;
|
||||
|
||||
|
|
Loading…
Reference in a new issue