mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-11-10 20:45:35 +01:00
- [Color Panel] Improve UI visibility.
This commit is contained in:
parent
8f3027a315
commit
e568a59f5a
@ -134,10 +134,14 @@ function Panel_Color() : PanelContent() constructor {
|
||||
_y1 = alp_y - ui(8);
|
||||
}
|
||||
|
||||
var cont_x = ui(padding);
|
||||
var cont_y = ui(padding);
|
||||
var cont_w = w - ui(padding + padding) - ui(16 + 8);
|
||||
var cont_h = _y1 - cont_y;
|
||||
var sel_w = ui(16);
|
||||
var sel_pd = ui(12);
|
||||
|
||||
var _selPad = ui(12);
|
||||
var cont_x = _selPad;
|
||||
var cont_y = _selPad;
|
||||
var cont_w = w - _selPad * 2 - sel_w - sel_pd;
|
||||
var cont_h = _y1 - ui(4) - cont_y;
|
||||
|
||||
shader_set(sh_color_select_content);
|
||||
shader_set_i("mode", mode);
|
||||
@ -145,9 +149,8 @@ function Panel_Color() : PanelContent() constructor {
|
||||
shader_set_f("val", val);
|
||||
draw_sprite_stretched(s_fx_pixel, 0, cont_x, cont_y, cont_w, cont_h);
|
||||
|
||||
var sel_x = cont_x + cont_w + ui(8);
|
||||
var sel_y = ui(padding);
|
||||
var sel_w = ui(16);
|
||||
var sel_x = cont_x + cont_w + sel_pd;
|
||||
var sel_y = _selPad;
|
||||
var sel_h = cont_h;
|
||||
|
||||
shader_set(sh_color_select_side);
|
||||
@ -191,19 +194,46 @@ function Panel_Color() : PanelContent() constructor {
|
||||
drag_sel = true;
|
||||
}
|
||||
|
||||
var _bar_s = ui(12);
|
||||
var _sd_w = ui(16 + 6);
|
||||
|
||||
if(mode == 0) {
|
||||
var hy = sel_y + hue * sel_h;
|
||||
var cx = cont_x + sat * cont_w - ui(6);
|
||||
var cy = cont_y + (1 - val) * cont_h - ui(6);
|
||||
draw_sprite_stretched_ext(s_ui_base_white, 0, sel_x - ui(3), hy - ui(6), ui(16 + 6), ui(10), make_color_hsv(hue * 255, 255, 255), 1);
|
||||
draw_sprite_stretched_ext(s_ui_base_white, 0, cx, cy, ui(12), ui(12), CURRENT_COLOR, 1);
|
||||
var cx = cont_x + sat * cont_w - _bar_s / 2;
|
||||
var cy = cont_y + (1 - val) * cont_h - _bar_s / 2;
|
||||
|
||||
var _sd_x = sel_x - ui(3);
|
||||
var _sd_y = hy - _bar_s / 2;
|
||||
|
||||
draw_sprite_stretched_ext(THEME.menu_button_mask, 0, cx - 1, cy - 1, _bar_s + 2, _bar_s + 2, c_black, 1);
|
||||
draw_sprite_stretched_ext(THEME.menu_button_mask, 0, _sd_x - 1, _sd_y - 1, _sd_w + 2, _bar_s + 2, c_black, 1);
|
||||
|
||||
draw_sprite_stretched_ext(THEME.menu_button_mask, 0, _sd_x, _sd_y, _sd_w, _bar_s, make_color_hsv(hue * 255, 255, 255), 1);
|
||||
draw_sprite_stretched_ext(THEME.menu_button_mask, 0, cx, cy, _bar_s, _bar_s, CURRENT_COLOR, 1);
|
||||
|
||||
BLEND_ADD
|
||||
draw_sprite_stretched_ext(THEME.menu_button_mask, 1, _sd_x, _sd_y, _sd_w, _bar_s, c_white, 0.75);
|
||||
draw_sprite_stretched_ext(THEME.menu_button_mask, 1, cx, cy, _bar_s, _bar_s, c_white, 0.75);
|
||||
BLEND_NORMAL
|
||||
|
||||
} else if(mode == 1) {
|
||||
var vy = sel_y + (1 - val) * sel_h;
|
||||
var cx = cont_x + hue * cont_w - ui(6);
|
||||
var cy = cont_y + (1 - sat) * cont_h - ui(6);
|
||||
draw_sprite_stretched_ext(s_ui_base_white, 0, sel_x - ui(3), vy - ui(6), ui(16 + 6), ui(10), make_color_hsv(hue * 255, 255, val * 255), 1);
|
||||
draw_sprite_stretched_ext(s_ui_base_white, 0, cx, cy, ui(12), ui(12), CURRENT_COLOR, 1);
|
||||
var cx = cont_x + hue * cont_w - _bar_s / 2;
|
||||
var cy = cont_y + (1 - sat) * cont_h - _bar_s / 2;
|
||||
|
||||
var _sd_x = sel_x - ui(3);
|
||||
var _sd_y = vy - _bar_s / 2;
|
||||
|
||||
draw_sprite_stretched_ext(THEME.menu_button_mask, 0, cx - 1, cy - 1, _bar_s + 2, _bar_s + 2, c_black, 1);
|
||||
draw_sprite_stretched_ext(THEME.menu_button_mask, 0, _sd_x - 1, _sd_y - 1, _sd_w + 2, _bar_s + 2, c_black, 1);
|
||||
|
||||
draw_sprite_stretched_ext(THEME.menu_button_mask, 0, _sd_x, _sd_y, _sd_w, _bar_s, make_color_hsv(hue * 255, 255, val * 255), 1);
|
||||
draw_sprite_stretched_ext(THEME.menu_button_mask, 0, cx, cy, _bar_s, _bar_s, CURRENT_COLOR, 1);
|
||||
|
||||
BLEND_ADD
|
||||
draw_sprite_stretched_ext(THEME.menu_button_mask, 1, _sd_x, _sd_y, _sd_w, _bar_s, c_white, 0.75);
|
||||
draw_sprite_stretched_ext(THEME.menu_button_mask, 1, cx, cy, _bar_s, _bar_s, c_white, 0.75);
|
||||
BLEND_NORMAL
|
||||
}
|
||||
|
||||
if(DRAGGING && DRAGGING.type == "Color" && pHOVER) {
|
||||
|
@ -78,8 +78,8 @@ function Panel_Palette_Mixer() : PanelContent() constructor {
|
||||
var _connections = palette_data.connections;
|
||||
var _blends = palette_data.blends;
|
||||
|
||||
if(key_mod_press(SHIFT)) shade_mode = lerp_float(shade_mode, 1, 5);
|
||||
else shade_mode = lerp_float(shade_mode, 0, 5);
|
||||
if(key_mod_press(SHIFT)) shade_mode = lerp_float(shade_mode, 1, 10);
|
||||
else shade_mode = lerp_float(shade_mode, 0, 10);
|
||||
|
||||
if(!in_dialog) draw_sprite_stretched(THEME.ui_panel_bg, 1, 0, 0, w, h);
|
||||
|
||||
@ -233,7 +233,7 @@ function Panel_Palette_Mixer() : PanelContent() constructor {
|
||||
surface_set_target(connect_surf)
|
||||
DRAW_CLEAR
|
||||
|
||||
var _gs = shade_mode > 0? ui(12) : node_size;
|
||||
var _gs = key_mod_press(SHIFT)? ui(12) : node_size;
|
||||
var _gs2 = _gs / 2;
|
||||
var _ind = noone;
|
||||
var _hov = node_hovering;
|
||||
@ -275,7 +275,7 @@ function Panel_Palette_Mixer() : PanelContent() constructor {
|
||||
}
|
||||
}
|
||||
|
||||
var _bs = shade_mode > 0? ui(12) : node_size * 0.75;
|
||||
var _bs = key_mod_press(SHIFT)? ui(12) : node_size * 0.75;
|
||||
for (var i = 0, n = array_length(_blends); i < n; i++) {
|
||||
var _blend = _blends[i];
|
||||
|
||||
|
@ -15,8 +15,10 @@ vec3 hsv2rgb(vec3 c) {
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 col = texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
|
||||
if(mode == 0)
|
||||
gl_FragColor = vec4(hsv2rgb(vec3(hue, v_vTexcoord.x, 1. - v_vTexcoord.y)), 1.);
|
||||
gl_FragColor = vec4(hsv2rgb(vec3(hue, v_vTexcoord.x, 1. - v_vTexcoord.y)), col.a);
|
||||
else if(mode == 1)
|
||||
gl_FragColor = vec4(hsv2rgb(vec3(v_vTexcoord.x, 1. - v_vTexcoord.y, val)), 1.);
|
||||
gl_FragColor = vec4(hsv2rgb(vec3(v_vTexcoord.x, 1. - v_vTexcoord.y, val)), col.a);
|
||||
}
|
||||
|
@ -32,19 +32,18 @@ void main() {
|
||||
}
|
||||
|
||||
float dist = distance(v_vTexcoord, pos);
|
||||
minDist = min(minDist, dist);
|
||||
|
||||
dist = 1. / pow(dist, influence);
|
||||
|
||||
cc += pal * dist;
|
||||
w += dist;
|
||||
|
||||
minDist = min(minDist, dist);
|
||||
}
|
||||
|
||||
if(w > 0.) cc /= w;
|
||||
|
||||
if(progress < 1.) {
|
||||
cc.a = smoothstep(0., cc.a, progress * minDist);
|
||||
}
|
||||
if(progress < 1.)
|
||||
cc.a *= smoothstep(progress * 1.5, progress * 0.5, minDist);
|
||||
|
||||
gl_FragColor = cc;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user