Compare commits

...

2 Commits

Author SHA1 Message Date
Tanasart
76ac461738 - popup tooltip 2024-09-12 10:27:42 +07:00
Tanasart
f25eca1cab - window popup stuff 2024-09-12 10:08:48 +07:00
27 changed files with 233 additions and 113 deletions

View File

@ -15,6 +15,7 @@
{"name":"addons","order":142,"path":"folders/addons.yy",},
{"name":"animation_curve","order":143,"path":"folders/animation_curve.yy",},
{"name":"dialog","order":144,"path":"folders/dialog.yy",},
{"name":"Extensions","order":157,"path":"folders/Extensions.yy",},
{"name":"font","order":145,"path":"folders/font.yy",},
{"name":"functions","order":146,"path":"folders/functions.yy",},
{"name":"camera","order":7,"path":"folders/functions/3d/camera.yy",},

View File

@ -50,6 +50,7 @@
{"$GMFolder":"","%Name":"inspector","folderPath":"folders/dialog/inspector.yy","name":"inspector","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"menu","folderPath":"folders/dialog/menu.yy","name":"menu","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"widget","folderPath":"folders/dialog/widget.yy","name":"widget","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"Extensions","folderPath":"folders/Extensions.yy","name":"Extensions","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"font","folderPath":"folders/font.yy","name":"font","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"functions","folderPath":"folders/functions.yy","name":"functions","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"3d","folderPath":"folders/functions/3d.yy","name":"3d","resourceType":"GMFolder","resourceVersion":"2.0",},

View File

@ -24,6 +24,7 @@
_dialog_h = 320;
dialog_x = 0;
dialog_y = 0;
anchor = ANCHOR.none;
title = "dialog";
window = noone;
@ -40,7 +41,6 @@
destroy_on_escape = true;
destroy_on_click_out = false;
anchor = ANCHOR.none;
init_pressing = mouse_click(mb_left);
#endregion
@ -82,15 +82,8 @@
o_main.dialog_popup_y = mouse_my;
if(mouse_release(mb_left)) {
var _wconfig = new winwin_config();
_wconfig.kind = winwin_kind_borderless;
_wconfig.caption = title;
_wconfig.topmost = true;
_wconfig.per_pixel_alpha = true;
_wconfig.resize = true;
_wconfig.owner = winwin_main;
window = winwin_create(_wx + _dx, _wy + _dy, dialog_w, dialog_h, _wconfig);
var _cfg = winwin_config_ext(title, winwin_kind_borderless, false, true);
window = winwin_create_ext(_wx + _dx, _wy + _dy, dialog_w, dialog_h, _cfg);
dialog_x = 0;
dialog_y = 0;
}
@ -334,11 +327,13 @@
function checkMouse() {
if(!active) return;
if(!DIALOG_CLICK) return;
if(init_pressing) return;
WINDOW_ACTIVE = window;
if(!init_pressing && mouse_press(mb_any)) {
if(!isTop()) return;
if(MOUSE_POOL.lpress || MOUSE_POOL.rpress) { //print($"Closing {title}");
if(!isTop()) {
// print($" > Not close, not on top.")
return;
}
for( var i = 0, n = array_length(children); i < n; i++ )
if(instance_exists(children[i])) return;

View File

@ -4,6 +4,7 @@ event_inherited();
#region data
draggable = false;
title = "Add node";
node_target_x = 0;
node_target_y = 0;
node_target_x_raw = 0;
@ -60,6 +61,8 @@ event_inherited();
category_width = maxLen + ui(56);
#endregion
function isTop() { return true; }
function trigger_favourite() {
if(node_menu_selecting == noone) return;
@ -81,7 +84,7 @@ event_inherited();
menuItem(fav? __txtx("add_node_remove_favourite", "Remove from favourite") : __txtx("add_node_add_favourite", "Add to favourite"), trigger_favourite, THEME.star)
];
menuCall("add_node_window_manu", menu, 0, 0, fa_left, node_menu_selecting);
menuCall("add_node_window_menu", menu, 0, 0, fa_left);
}
function filtered(node) {

View File

@ -6,4 +6,25 @@ event_inherited();
dialog_w = ui(440);
dialog_h = ui(140);
function resetPosition() {
if(!active) return;
dialog_x = xstart - dialog_w / 2;
dialog_y = ystart - dialog_h / 2;
dialog_x = round(clamp(dialog_x, 2, WIN_SW - dialog_w - 2));
dialog_y = round(clamp(dialog_y, 2, WIN_SH - dialog_h - 2));
if(PREFERENCES.multi_window) {
var _wx = WIN_X + dialog_x;
var _wy = WIN_Y + dialog_y;
var _cfg = winwin_config_ext("Exit", winwin_kind_borderless, false, false);
window = winwin_create_ext(_wx, _wy, dialog_w, dialog_h, _cfg);
dialog_x = 0;
dialog_y = 0;
}
}
#endregion

View File

@ -0,0 +1,2 @@
/// @description Insert description here
event_inherited();

View File

@ -16,10 +16,12 @@ if !ready exit;
}
#endregion
#region base UI
DIALOG_PREDRAW
DIALOG_WINCLEAR
var _des = false;
DIALOG_DRAW_BG
if(sFOCUS) DIALOG_DRAW_FOCUS
#endregion
#region text
var py = dialog_y + ui(16);
@ -43,7 +45,7 @@ if !ready exit;
var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER);
draw_text(bx0 + bw / 2, by0 + bh / 2, __txt("Cancel"));
if(b == 2)
instance_destroy();
_des = true;
bx0 -= bw + ui(12);
var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER);
@ -51,7 +53,7 @@ if !ready exit;
if(b == 2) {
if(instance_number(o_dialog_exit) == 1)
close_program();
instance_destroy();
_des = true;
}
bx0 -= bw + ui(12);
@ -60,8 +62,12 @@ if !ready exit;
if(b == 2 && SAVE(project)) {
if(instance_number(o_dialog_exit) == 1)
close_program();
instance_destroy();
_des = true;
}
dialog_h = _dialog_h;
#endregion
DIALOG_POSTDRAW
if(_des) instance_destroy();

View File

@ -4,6 +4,7 @@
"eventList":[
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":1,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
],
"managed":true,
"name":"o_dialog_exit",

View File

@ -11,7 +11,7 @@ event_inherited();
menu_id = "";
alarm[0] = -1;
menu = 1;
font = f_p1;
font = f_p2;
hght = line_get_height(font, 10);
tooltips = [];
show_icon = false;
@ -19,7 +19,7 @@ event_inherited();
submenu = noone;
_hovering_ch = true;
init_pressing = false;
init_press_l = MOUSE_POOL.lpress;
setFocus(self.id);
@ -31,6 +31,7 @@ event_inherited();
function setMenu(_menu, align = fa_left) {
with(_p_dialog) { if(on_top) continue; other.depth = min(depth - 1, other.depth); }
title = menu_id;
menu = _menu;
dialog_x = x;
dialog_y = y;
@ -103,18 +104,10 @@ event_inherited();
var _wx = winwin_get_x_safe(WINDOW_ACTIVE) + dialog_x;
var _wy = winwin_get_y_safe(WINDOW_ACTIVE) + dialog_y;
if(window == noone) {
var _wconfig = new winwin_config();
_wconfig.kind = winwin_kind_borderless;
_wconfig.caption = "";
_wconfig.topmost = true;
_wconfig.per_pixel_alpha = true;
_wconfig.resize = false;
_wconfig.owner = winwin_main;
_wconfig.taskbar_button = false;
_wconfig.close_button = false;
if(window == noone || !winwin_exists(window)) {
var _cfg = winwin_config_ext("", winwin_kind_borderless, false, false);
window = winwin_create_ext(_wx, _wy, dialog_w, dialog_h, _cfg);
window = winwin_create(_wx, _wy, dialog_w, dialog_h, _wconfig);
} else {
winwin_set_position_safe(window, _wx, _wy);
winwin_set_size_safe(window, dialog_w, dialog_h);
@ -122,9 +115,6 @@ event_inherited();
dialog_x = 0;
dialog_y = 0;
} else if(winwin_exists(window)) {
winwin_destroy(window);
}
}
#endregion

View File

@ -73,23 +73,27 @@ winwin_draw_clear(COLORS.panel_bg_clear, 1);
};
if(_menuItem.isShelf) {
FOCUS_CONTENT = context;
var _res = _menuItem.func(_dat);
if(submenu) instance_destroy(submenu);
submenu = _res;
} else if(remove_parents) {
DIALOG_POSTDRAW
FOCUS_CONTENT = context;
if(_par == noone) _menuItem.func();
else _menuItem.func(_par);
DIALOG_POSTDRAW
instance_destroy(o_dialog_menubox); // close all
exit;
} else {
DIALOG_POSTDRAW
FOCUS_CONTENT = context;
if(_par == noone) _menuItem.func();
else _menuItem.func(_par);
DIALOG_POSTDRAW
instance_destroy();
exit;
}
@ -155,7 +159,7 @@ winwin_draw_clear(COLORS.panel_bg_clear, 1);
if(is_string(_sprs)) {
_str = _sprs;
draw_set_text(f_p2, fa_center, fa_center, COLORS._main_text);
draw_set_text(font, fa_center, fa_center, COLORS._main_text);
_sw = string_width(_str) + ui(12);
_sh = string_height(_str) + ui(8);
@ -177,9 +181,9 @@ winwin_draw_clear(COLORS.panel_bg_clear, 1);
draw_sprite_stretched_ext(THEME.textbox, 1, _bx - _sw / 2, _by - _sh / 2, _sw, _sh, COLORS.dialog_menubox_highlight, 1);
if(mouse_press(mb_left, sFOCUS)) {
_submenu[1](_dat);
DIALOG_POSTDRAW
_submenu[1](_dat);
instance_destroy(o_dialog_menubox);
exit;
}
@ -232,11 +236,10 @@ winwin_draw_clear(COLORS.panel_bg_clear, 1);
if(hk_editing == _menuItem) {
draw_set_color(COLORS._main_accent);
// draw_sprite_stretched_ext(THEME.ui_panel, 1, _bx, _by, _bw, _bh, COLORS._main_text_accent, .5);
if(_ktxt == "") _ktxt = "-";
} else if(_ktxt != "") {
draw_set_color(COLORS._main_text_sub);
// draw_sprite_stretched_ext(THEME.ui_panel, 1, _bx, _by, _bw, _bh, CDEF.main_dkgrey, .5);
}
draw_text(_hx, _hy - ui(2), _ktxt);

View File

@ -7,8 +7,14 @@ if(item_sel_submenu) {
exit;
}
if(init_press_l) {
if(MOUSE_POOL.lrelease)
init_press_l = false;
exit;
}
var hov = point_in(mouse_raw_x, mouse_raw_y);
if(submenu) hov |= submenu.point_in(mouse_raw_x, mouse_raw_y);
_hovering_ch = hov;
if(!hov && mouse_press(mb_left)) instance_destroy();
if(!hov && MOUSE_POOL.lpress) instance_destroy();

View File

@ -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

View File

@ -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;
@ -47,6 +48,8 @@ _FILE_DROPPED = false;
#region window & mouse
//if(keyboard_check_pressed(vk_f12)) DEBUG = !DEBUG;
global_mouse_pool_init();
if(_cursor != CURSOR) {
window_set_cursor(CURSOR);
_cursor = CURSOR;

View File

@ -5,7 +5,7 @@
FOCUS_BEFORE = noone;
#endregion
function menuCall(menu_id = "", menu = [], _x = 0, _y = 0, align = fa_left, context = noone) {
function menuCall(menu_id = "", menu = [], _x = 0, _y = 0, align = fa_left) {
if(array_empty(menu)) return noone;
FOCUS_BEFORE = FOCUS;
@ -22,13 +22,13 @@ function menuCall(menu_id = "", menu = [], _x = 0, _y = 0, align = fa_left, cont
array_append(menu, callbacks[i].populate());
}
dia.context = self;
dia.menu_id = menu_id;
dia.context = context;
dia.setMenu(menu, align);
return dia;
}
function pieMenuCall(menu_id = "", _x = mouse_mx, _y = mouse_my, menu = [], context = noone) {
function pieMenuCall(menu_id = "", _x = mouse_mx, _y = mouse_my, menu = []) {
var dia = instance_create(_x, _y, o_pie_menu);
if(menu_id != "" && ds_map_exists(CONTEXT_MENU_CALLBACK, menu_id)) {
var callbacks = CONTEXT_MENU_CALLBACK[? menu_id];
@ -37,8 +37,8 @@ function pieMenuCall(menu_id = "", _x = mouse_mx, _y = mouse_my, menu = [], cont
array_append(menu, callbacks[i].populate());
}
dia.context = self;
dia.menu_id = menu_id;
dia.context = context;
dia.setMenu(menu);
return dia;
}
@ -46,11 +46,12 @@ function pieMenuCall(menu_id = "", _x = mouse_mx, _y = mouse_my, menu = [], cont
function submenuCall(_data = undefined, menu = []) {
if(is_undefined(_data)) return menuCall("", menu);
var dia = instance_create_depth(_data.x - ui(4), _data.y, _data.depth - 1, o_dialog_menubox);
var _xx = _data.x - 1;
var dia = instance_create_depth(_xx, _data.y, _data.depth - 1, o_dialog_menubox);
dia.context = _data.context;
dia.setMenu(menu);
if(_data.x - ui(4) + dia.dialog_w > WIN_W - ui(2))
if(_xx + dia.dialog_w > WIN_W - ui(2))
dia.dialog_x = _data._x - dia.dialog_w + ui(4);
return dia;

View File

@ -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);

View File

@ -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
@ -97,6 +98,7 @@
#macro UI_SCALE PREFERENCES.display_scaling
#macro mouse_ui [mouse_mx, mouse_my]
#macro mouse_mx (PEN_USE? PEN_X : winwin_mouse_get_x_safe(WINDOW_ACTIVE))
#macro mouse_my (PEN_USE? PEN_Y : winwin_mouse_get_y_safe(WINDOW_ACTIVE))
@ -105,7 +107,6 @@
#macro mouse_raw_x display_mouse_get_x()
#macro mouse_raw_y display_mouse_get_y()
#macro mouse_ui [device_mouse_x_to_gui(0), device_mouse_y_to_gui(0)]
#macro sFOCUS (FOCUS == self.id)
#macro sHOVER (!CURSOR_IS_LOCK && (HOVER == self.id || (WINDOW_ACTIVE != noone && winwin_mouse_is_over_safe(WINDOW_ACTIVE))))

View File

@ -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));
////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -1,12 +1,18 @@
#region mouse global
globalvar CURSOR, CURSOR_LOCK, CURSOR_IS_LOCK, CURSOR_LOCK_X, CURSOR_LOCK_Y;
globalvar MOUSE_WRAP, MOUSE_WRAPPING, MOUSE_BLOCK, _MOUSE_BLOCK;
globalvar MOUSE_POOL;
MOUSE_WRAP = false;
MOUSE_WRAPPING = false;
MOUSE_BLOCK = false;
_MOUSE_BLOCK = false;
PEN_RELEASED = false;
MOUSE_POOL = {
lclick: false, lpress: false, lrelease: false,
rclick: false, rpress: false, rrelease: false,
mclick: false, mpress: false, mrelease: false,
}
#macro SCROLL_SPEED PREFERENCES.mouse_wheel_speed
#macro MOUSE_MOVED (window_mouse_get_delta_x() || window_mouse_get_delta_y())
@ -23,6 +29,37 @@
}
#endregion
function global_mouse_pool_init() {
MOUSE_POOL.lclick = mouse_check_button(mb_left);
MOUSE_POOL.rclick = mouse_check_button(mb_right);
MOUSE_POOL.mclick = mouse_check_button(mb_middle);
MOUSE_POOL.lpress = mouse_check_button_pressed(mb_left);
MOUSE_POOL.rpress = mouse_check_button_pressed(mb_right);
MOUSE_POOL.mpress = mouse_check_button_pressed(mb_middle);
MOUSE_POOL.lrelease = mouse_check_button_released(mb_left);
MOUSE_POOL.rrelease = mouse_check_button_released(mb_right);
MOUSE_POOL.mrelease = mouse_check_button_released(mb_middle);
for( var i = 0, n = array_length(global.winwin_all); i < n; i++ ) {
var ww = global.winwin_all[i];
if(!__ww_valid) continue;
MOUSE_POOL.lclick |= winwin_mouse_check_button(ww, mb_left);
MOUSE_POOL.rclick |= winwin_mouse_check_button(ww, mb_right);
MOUSE_POOL.mclick |= winwin_mouse_check_button(ww, mb_middle);
MOUSE_POOL.lpress |= winwin_mouse_check_button_pressed(ww, mb_left);
MOUSE_POOL.rpress |= winwin_mouse_check_button_pressed(ww, mb_right);
MOUSE_POOL.mpress |= winwin_mouse_check_button_pressed(ww, mb_middle);
MOUSE_POOL.lrelease |= winwin_mouse_check_button_released(ww, mb_left);
MOUSE_POOL.rrelease |= winwin_mouse_check_button_released(ww, mb_right);
MOUSE_POOL.mrelease |= winwin_mouse_check_button_released(ww, mb_middle);
}
}
function mouse_click(mouse, focus = true) {
INLINE
if(MOUSE_BLOCK) return false;

View File

@ -309,9 +309,11 @@
function create_preview_window(node) {
if(node == noone) return;
var win = new Panel_Preview_Window();
win.node_target = node;
win.preview_channel = node.preview_channel;
var dia = dialogPanelCall(win, mouse_mx, mouse_my);
dia.destroy_on_click_out = false;
}

View File

@ -963,7 +963,6 @@ function PanelContent() constructor {
if(pFOCUS) FOCUS_CONTENT = self;
}
drawContent(panel);
}

View File

@ -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));

View File

@ -811,7 +811,7 @@ function Panel_Inspector() : PanelContent() constructor {
if(mouse_press(mb_left, pFOCUS))
jun[@ 1] = !coll;
if(mouse_press(mb_right, pFOCUS))
menuCall("inspector_group_menu", group_menu, 0, 0, fa_left, _inspecting);
menuCall("inspector_group_menu", group_menu, 0, 0, fa_left);
} else
draw_sprite_stretched_ext(THEME.s_box_r5_clr, 0, lbx, yy, lbw, lbh, COLORS.panel_inspector_group_bg, 1);

View File

@ -170,7 +170,8 @@ function Panel_Preview_Window() : PanelContent() constructor {
array_push(_menu, menuItem(o.name, function(_dat) { changeChannel(_dat.index); }, noone, noone, noone, { index: _chan }));
_chan++;
}
menuCall("preview_window_menu", _menu, 0, 0, fa_left, node_target);
menuCall("preview_window_menu", _menu, 0, 0, fa_left);
}
}
}

View File

@ -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

View File

@ -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));

View File

@ -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));

View File

@ -1,9 +1,23 @@
global.__winwin_map = ds_map_create();
global.winwin_all = [];
function winwin(_ptr) constructor {
__ptr__ = _ptr;
}
function winwin_config_ext(caption = "", kind = winwin_kind_normal, topmost = false, resize = false, owner = winwin_main) {
var cnf = new winwin_config();
cnf.caption = caption;
cnf.kind = kind;
cnf.topmost = topmost;
cnf.resize = resize;
cnf.owner = owner;
cnf.per_pixel_alpha = true;
return cnf;
}
function winwin_config() constructor {
static caption = "Window";
static kind = winwin_kind_normal;
@ -22,6 +36,18 @@ function winwin_config() constructor {
#macro __ww_valid (ww != noone && winwin_exists(ww))
function winwin_create_ext(_x, _y, _w, _h, _conf) {
var window = winwin_create(_x, _y, _w, _h, _conf);
array_push(global.winwin_all, window);
return window;
}
function winwin_destroy_ext(ww) {
if(__ww_valid) winwin_destroy(_ww);
array_remove(global.winwin_all, window);
}
function winwin_get_x_safe(ww) { return __ww_valid? winwin_get_x(ww) : window_get_x(); }
function winwin_get_y_safe(ww) { return __ww_valid? winwin_get_y(ww) : window_get_y(); }