mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 14:06:23 +01:00
- popup tooltip
This commit is contained in:
parent
f25eca1cab
commit
76ac461738
9 changed files with 59 additions and 36 deletions
|
@ -3,6 +3,12 @@ if(winMan_isMinimized()) exit;
|
|||
|
||||
#region tooltip
|
||||
if(!_MOUSE_BLOCK) {
|
||||
if(TOOLTIP_WINDOW != noone) {
|
||||
winwin_set_topmost(TOOLTIP_WINDOW, true);
|
||||
winwin_draw_begin(TOOLTIP_WINDOW);
|
||||
winwin_draw_clear(0, 0);
|
||||
}
|
||||
|
||||
if(is_struct(TOOLTIP)) {
|
||||
if(struct_has(TOOLTIP, "drawTooltip"))
|
||||
TOOLTIP.drawTooltip();
|
||||
|
@ -103,6 +109,10 @@ if(winMan_isMinimized()) exit;
|
|||
}
|
||||
} else if(TOOLTIP != "")
|
||||
draw_tooltip_text(TOOLTIP);
|
||||
|
||||
if(TOOLTIP_WINDOW != noone) {
|
||||
winwin_draw_end();
|
||||
}
|
||||
}
|
||||
TOOLTIP = "";
|
||||
#endregion
|
||||
|
|
|
@ -25,7 +25,8 @@ _FILE_DROPPED = false;
|
|||
}
|
||||
|
||||
var foc = window_has_focus();
|
||||
if(HOVER && instance_exists(HOVER) && HOVER.window != noone) foc = true;
|
||||
//if(HOVER && instance_exists(HOVER) && HOVER.window != noone)
|
||||
foc = true;
|
||||
|
||||
game_set_speed(foc || IS_PLAYING? PREFERENCES.ui_framerate : PREFERENCES.ui_framerate_non_focus, gamespeed_fps);
|
||||
WINDOW_ACTIVE = noone;
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
#macro __mouse_tx (PREFERENCES.multi_window? mouse_raw_x : mouse_mxs)
|
||||
#macro __mouse_ty (PREFERENCES.multi_window? mouse_raw_y : mouse_mys)
|
||||
#macro __win_tw (PREFERENCES.multi_window? display_get_width() : WIN_W)
|
||||
#macro __win_th (PREFERENCES.multi_window? display_get_height() : WIN_H)
|
||||
|
||||
function draw_tooltip_text(txt) {
|
||||
txt = array_to_string(txt);
|
||||
|
||||
|
@ -10,8 +15,8 @@ function draw_tooltip_text(txt) {
|
|||
var th = string_height_ext(txt, -1, tw);
|
||||
|
||||
var pd = ui(8);
|
||||
var mx = min(mouse_mxs + ui(16), WIN_W - (tw + pd * 2));
|
||||
var my = min(mouse_mys + ui(16), WIN_H - (th + pd * 2));
|
||||
var mx = min(__mouse_tx + ui(16), __win_tw - (tw + pd * 2));
|
||||
var my = min(__mouse_ty + ui(16), __win_th - (th + pd * 2));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, tw + pd * 2, th + pd * 2);
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, tw + pd * 2, th + pd * 2);
|
||||
|
@ -28,8 +33,8 @@ function draw_tooltip_color(clr) {
|
|||
var hh = ui(32);
|
||||
|
||||
var pd = ui(4);
|
||||
var mx = min(mouse_mxs + ui(16), WIN_W - (ww + pd * 2));
|
||||
var my = min(mouse_mys + ui(16), WIN_H - (hh + pd * 2));
|
||||
var mx = min(__mouse_tx + ui(16), __win_tw - (ww + pd * 2));
|
||||
var my = min(__mouse_ty + ui(16), __win_th - (hh + pd * 2));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
|
@ -52,8 +57,8 @@ function draw_tooltip_palette(clr) {
|
|||
var hh = array_length(clr) * ph;
|
||||
|
||||
var pd = ui(4);
|
||||
var mx = min(mouse_mxs + ui(16), WIN_W - (ww + pd * 2));
|
||||
var my = min(mouse_mys + ui(16), WIN_H - (hh + pd * 2));
|
||||
var mx = min(__mouse_tx + ui(16), __win_tw - (ww + pd * 2));
|
||||
var my = min(__mouse_ty + ui(16), __win_th - (hh + pd * 2));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
|
@ -75,8 +80,8 @@ function draw_tooltip_gradient(clr) {
|
|||
var hh = array_length(clr) * gh;
|
||||
|
||||
var pd = ui(4);
|
||||
var mx = min(mouse_mxs + ui(16), WIN_W - (ww + pd * 2));
|
||||
var my = min(mouse_mys + ui(16), WIN_H - (hh + pd * 2));
|
||||
var mx = min(__mouse_tx + ui(16), __win_tw - (ww + pd * 2));
|
||||
var my = min(__mouse_ty + ui(16), __win_th - (hh + pd * 2));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
|
@ -108,8 +113,8 @@ function draw_tooltip_surface_array(surf) {
|
|||
var hh = sh * row;
|
||||
|
||||
var pd = ui(4);
|
||||
var mx = min(mouse_mxs + ui(16), WIN_W - (ww + pd * 2));
|
||||
var my = min(mouse_mys + ui(16), WIN_H - (hh + pd * 2));
|
||||
var mx = min(__mouse_tx + ui(16), __win_tw - (ww + pd * 2));
|
||||
var my = min(__mouse_ty + ui(16), __win_th - (hh + pd * 2));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
|
@ -154,8 +159,8 @@ function draw_tooltip_surface(surf) {
|
|||
var hh = sh * ss;
|
||||
|
||||
var pd = ui(4);
|
||||
var mx = min(mouse_mxs + ui(16), WIN_W - (ww + pd * 2));
|
||||
var my = min(mouse_mys + ui(16), WIN_H - (hh + pd * 2));
|
||||
var mx = min(__mouse_tx + ui(16), __win_tw - (ww + pd * 2));
|
||||
var my = min(__mouse_ty + ui(16), __win_th - (hh + pd * 2));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
|
@ -179,8 +184,8 @@ function draw_tooltip_sprite(spr) {
|
|||
var hh = sh * ss + ui(16);
|
||||
|
||||
var pd = ui(4);
|
||||
var mx = min(mouse_mxs + ui(16), WIN_W - (ww + pd * 2));
|
||||
var my = min(mouse_mys + ui(16), WIN_H - (hh + pd * 2));
|
||||
var mx = min(__mouse_tx + ui(16), __win_tw - (ww + pd * 2));
|
||||
var my = min(__mouse_ty + ui(16), __win_th - (hh + pd * 2));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
|
@ -205,8 +210,8 @@ function draw_tooltip_atlas(atlas) {
|
|||
if(amo && is_array(atlas[0])) return;
|
||||
|
||||
var pd = ui(4);
|
||||
var mx = min(mouse_mxs + ui(16), WIN_W - (ww + pd * 2));
|
||||
var my = min(mouse_mys + ui(16), WIN_H - (hh + pd * 2));
|
||||
var mx = min(__mouse_tx + ui(16), __win_tw - (ww + pd * 2));
|
||||
var my = min(__mouse_ty + ui(16), __win_th - (hh + pd * 2));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
|
@ -258,8 +263,8 @@ function draw_tooltip_buffer(buff) {
|
|||
th += string_height(" ");
|
||||
|
||||
var pd = ui(8);
|
||||
var mx = min(mouse_mxs + ui(16), WIN_W - (tw + pd * 2));
|
||||
var my = min(mouse_mys + ui(16), WIN_H - (th + pd * 2));
|
||||
var mx = min(__mouse_tx + ui(16), __win_tw - (tw + pd * 2));
|
||||
var my = min(__mouse_ty + ui(16), __win_th - (th + pd * 2));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, tw + pd * 2, th + pd * 2);
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, tw + pd * 2, th + pd * 2);
|
||||
|
@ -277,8 +282,8 @@ function draw_tooltip_curve(curve) {
|
|||
var hh = ui(160);
|
||||
|
||||
var pd = ui(8);
|
||||
var mx = min(mouse_mxs + ui(16), WIN_W - (ww + pd * 2));
|
||||
var my = min(mouse_mys + ui(16), WIN_H - (hh + pd * 2));
|
||||
var mx = min(__mouse_tx + ui(16), __win_tw - (ww + pd * 2));
|
||||
var my = min(__mouse_ty + ui(16), __win_th - (hh + pd * 2));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
globalvar FOCUS, FOCUS_STR, FOCUS_CONTENT, HOVER, HOVERING_ELEMENT, _HOVERING_ELEMENT;
|
||||
globalvar DOUBLE_CLICK, DOUBLE_CLICK_POS;
|
||||
globalvar DIALOG_CLICK;
|
||||
globalvar WINDOW_ACTIVE;
|
||||
globalvar WINDOW_ACTIVE, TOOLTIP_WINDOW;
|
||||
|
||||
DOUBLE_CLICK_POS = [ 0, 0 ];
|
||||
DOUBLE_CLICK = false;
|
||||
|
@ -80,6 +80,7 @@
|
|||
ADD_NODE_PAGE = 0;
|
||||
ADD_NODE_SCROLL = 0;
|
||||
WINDOW_ACTIVE = noone;
|
||||
TOOLTIP_WINDOW = noone;
|
||||
#endregion
|
||||
|
||||
#region macro
|
||||
|
|
|
@ -86,8 +86,8 @@ function MetaDataManager() constructor {
|
|||
_h = string_height(name);
|
||||
_w = string_width(name);
|
||||
|
||||
var mx = min(mouse_mx + _pd * 2, WIN_W - (_w + _pd * 2));
|
||||
var my = min(mouse_my + _pd * 2, WIN_H - (_h + _pd * 2));
|
||||
var mx = min(__mouse_tx + _pd * 2, __win_tw - (_w + _pd * 2));
|
||||
var my = min(__mouse_ty + _pd * 2, __win_th - (_h + _pd * 2));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, _w + _pd * 2, _h + _pd * 2);
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, _w + _pd * 2, _h + _pd * 2);
|
||||
|
@ -152,8 +152,8 @@ function MetaDataManager() constructor {
|
|||
_h += th;
|
||||
}
|
||||
|
||||
var mx = min(mouse_mx + _pd * 2, WIN_W - (_w + _pd * 2));
|
||||
var my = min(mouse_my + _pd * 2, WIN_H - (_h + _pd * 2));
|
||||
var mx = min(__mouse_tx + _pd * 2, __win_tw - (_w + _pd * 2));
|
||||
var my = min(__mouse_ty + _pd * 2, __win_th - (_h + _pd * 2));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -3295,8 +3295,8 @@ function Panel_Graph_Drop_tooltip(panel) constructor {
|
|||
var tw = max(w1, w2);
|
||||
var th = h1 + ui(8) + h2;
|
||||
|
||||
var mx = min(mouse_mxs + ui(16), WIN_W - (tw + ui(16)));
|
||||
var my = min(mouse_mys + ui(16), WIN_H - (th + ui(16)));
|
||||
var mx = min(__mouse_tx + ui(16), __win_tw - (tw + ui(16)));
|
||||
var my = min(__mouse_ty + ui(16), __win_th - (th + ui(16)));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, tw + ui(16), th + ui(16));
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, tw + ui(16), th + ui(16));
|
||||
|
|
|
@ -386,5 +386,11 @@
|
|||
|
||||
var grav = struct_try_get(PREFERENCES, "physics_gravity", [ 0, 10 ]);
|
||||
physics_world_gravity(array_safe_get_fast(grav, 0, 0), array_safe_get_fast(grav, 1, 10));
|
||||
|
||||
if(PREFERENCES.multi_window) {
|
||||
var _cfg = winwin_config_ext("", winwin_kind_borderless, true, false, winwin_main);
|
||||
_cfg.clickthrough = true;
|
||||
TOOLTIP_WINDOW = winwin_create(0, 0, display_get_width(), display_get_height(), _cfg);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
|
|
@ -15,11 +15,11 @@ function tooltipHotkey(text, context = "", name = "") constructor {
|
|||
draw_set_font(f_p1);
|
||||
var _w2 = string_width(keyStr);
|
||||
|
||||
var tw = min(WIN_W - ui(32), _w1 + ui(24) + _w2);
|
||||
var tw = min(__win_tw - ui(32), _w1 + ui(24) + _w2);
|
||||
var th = string_height_ext(text, -1, tw);
|
||||
|
||||
var mx = min(mouse_mx + ui(16), WIN_W - (tw + ui(16)));
|
||||
var my = min(mouse_my + ui(16), WIN_H - (th + ui(16)));
|
||||
var mx = min(__mouse_tx + ui(16), __win_tw - (tw + ui(16)));
|
||||
var my = min(__mouse_ty + ui(16), __win_th - (th + ui(16)));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, tw + ui(16), th + ui(16));
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, tw + ui(16), th + ui(16));
|
||||
|
@ -57,9 +57,9 @@ function tooltipHotkey_assign(text, hotkey = "") constructor {
|
|||
th += string_height(_ts);
|
||||
}
|
||||
|
||||
var tw = min(WIN_W - ui(32), _w1 + ui(24) + _w2);
|
||||
var mx = min(mouse_mx + ui(16), WIN_W - (tw + ui(16)));
|
||||
var my = min(mouse_my + ui(16), WIN_H - (th + ui(16)));
|
||||
var tw = min(__win_tw - ui(32), _w1 + ui(24) + _w2);
|
||||
var mx = min(__mouse_tx + ui(16), __win_tw - (tw + ui(16)));
|
||||
var my = min(__mouse_ty + ui(16), __win_th - (th + ui(16)));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, tw + ui(16), th + ui(16));
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, tw + ui(16), th + ui(16));
|
||||
|
|
|
@ -19,8 +19,8 @@ function tooltipSelector(title, data, index = 0) constructor {
|
|||
for( var i = 0, n = array_length(data); i < n; i++ )
|
||||
_w = max(_w, ui(8 + 16) + string_width(data[i]));
|
||||
|
||||
var mx = min(mouse_mx + ui(16), WIN_W - (_w + ui(16) + ui(4)));
|
||||
var my = min(mouse_my + ui(16), WIN_H - (_h + ui(16) + ui(4)));
|
||||
var mx = min(__mouse_tx + ui(16), __win_tw - (_w + ui(16) + ui(4)));
|
||||
var my = min(__mouse_ty + ui(16), __win_th - (_h + ui(16) + ui(4)));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, _w + ui(16), _h + ui(16));
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, _w + ui(16), _h + ui(16));
|
||||
|
|
Loading…
Reference in a new issue