mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 14:06:23 +01:00
canvas, preview panels
This commit is contained in:
parent
32ad8789bd
commit
586fa1fe66
6 changed files with 20 additions and 14 deletions
|
@ -122,6 +122,7 @@ function canvas_tool_curve_bezier(brush) : canvas_tool() constructor {
|
||||||
|
|
||||||
function drawPreview(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
function drawPreview(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
||||||
draw_surface_ext_safe(drawing_surface, _x, _y, _s, _s);
|
draw_surface_ext_safe(drawing_surface, _x, _y, _s, _s);
|
||||||
|
canvas_draw_point_brush(brush, mouse_cur_x, mouse_cur_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawMask(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
function drawMask(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
||||||
|
|
|
@ -198,12 +198,14 @@ function canvas_tool_selection(selector = noone) : canvas_tool() constructor {
|
||||||
var sel_h = surface_get_height_safe(selection_surface);
|
var sel_h = surface_get_height_safe(selection_surface);
|
||||||
|
|
||||||
if(point_in_rectangle(mouse_cur_x, mouse_cur_y, pos_x, pos_y, pos_x + sel_w, pos_y + sel_h)) {
|
if(point_in_rectangle(mouse_cur_x, mouse_cur_y, pos_x, pos_y, pos_x + sel_w, pos_y + sel_h)) {
|
||||||
is_select_drag = true;
|
var _c = surface_getpixel_ext(selection_mask, mouse_cur_x - pos_x, mouse_cur_y - pos_y);
|
||||||
selection_sx = pos_x;
|
if(_c > 0) {
|
||||||
selection_sy = pos_y;
|
is_select_drag = true;
|
||||||
selection_mx = mouse_cur_x;
|
selection_sx = pos_x;
|
||||||
selection_my = mouse_cur_y;
|
selection_sy = pos_y;
|
||||||
|
selection_mx = mouse_cur_x;
|
||||||
|
selection_my = mouse_cur_y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
"Eraser": new hotkeySimple("E"),
|
"Eraser": new hotkeySimple("E"),
|
||||||
"Rectangle": new hotkeySimple("N"),
|
"Rectangle": new hotkeySimple("N"),
|
||||||
"Ellipse": new hotkeySimple("M"),
|
"Ellipse": new hotkeySimple("M"),
|
||||||
"Fill": new hotkeySimple("F"),
|
"Fill": new hotkeySimple("G"),
|
||||||
"Freeform": new hotkeySimple("Q"),
|
"Freeform": new hotkeySimple("Q"),
|
||||||
},
|
},
|
||||||
"Node_Mesh_Warp": {
|
"Node_Mesh_Warp": {
|
||||||
|
|
|
@ -26,12 +26,10 @@ function NodeTool(name, spr, context = instanceof(other)) constructor {
|
||||||
static getToolObject = function() { return is_array(toolObject)? toolObject[selecting] : toolObject; }
|
static getToolObject = function() { return is_array(toolObject)? toolObject[selecting] : toolObject; }
|
||||||
|
|
||||||
static getDisplayName = function(index = 0) {
|
static getDisplayName = function(index = 0) {
|
||||||
|
var _nme = getName(index);
|
||||||
var _key = checkHotkey();
|
var _key = checkHotkey();
|
||||||
|
|
||||||
var _nme = getName(index);
|
return _key == ""? _nme : new tooltipHotkey(_nme).setKey(_key);
|
||||||
if(_key != "") _nme += $" ({_key})";
|
|
||||||
|
|
||||||
return _nme;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static setSetting = function(sets) { array_push(settings, sets); return self; }
|
static setSetting = function(sets) { array_push(settings, sets); return self; }
|
||||||
|
|
|
@ -1109,14 +1109,17 @@ function Panel_Preview() : PanelContent() constructor {
|
||||||
|
|
||||||
mouse_pos_string = "";
|
mouse_pos_string = "";
|
||||||
|
|
||||||
right_menu_x = w - ui(8);
|
if(_node == noone) {
|
||||||
if(_node == noone) return;
|
right_menu_x = w - ui(8);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
right_menu_y += string_height("l");
|
right_menu_y += string_height("l");
|
||||||
var txt = $"{canvas_w} x {canvas_h}px";
|
var txt = $"{canvas_w} x {canvas_h}px";
|
||||||
if(canvas_a) txt = $"{canvas_a} x {txt}";
|
if(canvas_a) txt = $"{canvas_a} x {txt}";
|
||||||
draw_text(right_menu_x, right_menu_y, txt);
|
draw_text(right_menu_x, right_menu_y, txt);
|
||||||
|
|
||||||
|
right_menu_x = w - ui(8);
|
||||||
right_menu_y += string_height("l");
|
right_menu_y += string_height("l");
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
function tooltipHotkey(text, context, name) constructor {
|
function tooltipHotkey(text, context = "", name = "") constructor {
|
||||||
self.text = text;
|
self.text = text;
|
||||||
self.hotkey = find_hotkey(context, name);
|
self.hotkey = find_hotkey(context, name);
|
||||||
|
|
||||||
keyStr = hotkey? key_get_name(hotkey.key, hotkey.modi) : "";
|
keyStr = hotkey? key_get_name(hotkey.key, hotkey.modi) : "";
|
||||||
|
|
||||||
|
static setKey = function(key) { keyStr = key; return self; }
|
||||||
|
|
||||||
static drawTooltip = function() {
|
static drawTooltip = function() {
|
||||||
draw_set_font(f_p0);
|
draw_set_font(f_p0);
|
||||||
var _w1 = string_width(text);
|
var _w1 = string_width(text);
|
||||||
|
|
Loading…
Reference in a new issue