This commit is contained in:
Tanasart 2024-05-27 14:08:23 +07:00
parent e11d75c894
commit 0bb3af65a6
5 changed files with 24 additions and 15 deletions

View file

@ -43,8 +43,8 @@ event_inherited();
var hh = ui(32);
var _gs = sp_preset_size;
var yy = _y + ui(8);
var _height, pre_amo;
var _hover = sHOVER && sp_presets.hover;
var _height, pre_amo;
draw_clear_alpha(COLORS.panel_bg_clear, 0);
for(var i = -1; i < array_length(PALETTES); i++) {
@ -76,10 +76,8 @@ event_inherited();
draw_circle_prec(ui(16) + ui(4), yy + ui(16), ui(4), false);
}
if(preset_selecting == i)
drawPaletteGrid(pal.palette, ui(16), yy + ui(28), ww, _gs, selector.current_color);
else
drawPalette(pal.palette, ui(16), yy + ui(28), ww, ui(20));
if(preset_selecting == i) drawPaletteGrid(pal.palette, ui(16), yy + ui(28), ww, _gs, selector.current_color);
else drawPalette(pal.palette, ui(16), yy + ui(28), ww, ui(20));
if(!click_block && mouse_click(mb_left, interactable && sFOCUS)) {
if(preset_selecting == i && _hover && point_in_rectangle(_m[0], _m[1], ui(16), yy + ui(28), ui(16) + ww, yy + ui(28) + _height)) {

View file

@ -260,7 +260,8 @@ function drawPaletteGrid(_pal, _x, _y, _w, _gs = 24, c_color = -1) { #region
draw_sprite_stretched_ext(THEME.palette_mask, _i, _x0, _y0 + 1, _gs, _gs, _pal[i], 1);
if(c_color >= 0 && color_diff(c_color, _pal[i]) <= 0) {
var _same = (c_color & 0x00FFFFFF) == (_pal[i] & 0x00FFFFFF);
if(c_color >= 0 && _same) {
cx = _x0;
cy = _y0;
}

View file

@ -63,8 +63,8 @@
DOUBLE_CLICK_POS = [ 0, 0 ];
DOUBLE_CLICK = false;
FOCUS = noone;
FOCUS_STR = "";
FOCUS = noone;
FOCUS_STR = "";
HOVER = noone;
HOVERING_ELEMENT = noone;

View file

@ -510,8 +510,8 @@ function Panel(_parent, _x, _y, _w, _h) constructor { #region
if(i == content_index) {
foc = FOCUS == self;
var cc = FOCUS == self? COLORS._main_accent : COLORS.panel_tab;
draw_sprite_stretched_ext(THEME.ui_panel_tab, 1 + (FOCUS == self), _tbx, tby, tbw, _tdh, cc, 1);
var cc = foc? COLORS._main_accent : COLORS.panel_tab;
draw_sprite_stretched_ext(THEME.ui_panel_tab, 1 + foc, _tbx, tby, tbw, _tdh, cc, 1);
if(!foc)
tab_cover = BBOX().fromWH(tsx + _tbx, tsy + tby + tbh - ui(3), tbw, THEME_VALUE.panel_tab_extend);
} else {

View file

@ -331,6 +331,8 @@ function Panel_Preview() : PanelContent() constructor {
];
#endregion
////============ DATA ============
function setNodePreview(node) { #region
if(locked) return;
@ -398,6 +400,8 @@ function Panel_Preview() : PanelContent() constructor {
function onFocusBegin() { PANEL_PREVIEW = self; }
////============ VIEW ============
function dragCanvas() { #region
if(canvas_dragging) {
if(!MOUSE_WRAPPING) {
@ -604,10 +608,12 @@ function Panel_Preview() : PanelContent() constructor {
ww = max(ww, string_width(_node.outputs[| i].name) + ui(40));
}
sbChannel.data_list = chName;
sbChannel.setFocusHover(pFOCUS, pHOVER);
sbChannel.draw(_x - ww, _y - hh / 2, ww, hh, currName, [mx, my], x, y);
right_menu_y += ui(40);
if(!array_empty(chName)) {
sbChannel.data_list = chName;
sbChannel.setFocusHover(pFOCUS, pHOVER);
sbChannel.draw(_x - ww, _y - hh / 2, ww, hh, currName, [mx, my], x, y);
right_menu_y += ui(40);
}
} #endregion
function drawNodeChannel3D(_x, _y) { #region
@ -622,6 +628,10 @@ function Panel_Preview() : PanelContent() constructor {
right_menu_y += ui(40);
} #endregion
static onFullScreen = function() { run_in(1, fullView); }
////============ DRAW ============
function drawOnionSkin(node, psx, psy, ss) { #region
var _surf = preview_surfaces[0];
var _rang = PROJECT.onion_skin.range;
@ -1750,7 +1760,7 @@ function Panel_Preview() : PanelContent() constructor {
drawToolBar(tool);
} #endregion
static onFullScreen = function() { run_in(1, fullView); }
////=========== ACTION ===========
function copyCurrentFrame() { #region
var prevS = getNodePreviewSurface();