Preview, Path Array, Canvas Fixes

- [Preview Panel] Fix right-side toolbar overlap with preview content.
- [Path Array Editor] Fix adding image not updating node automatically.
- [Canvas] Fix custom surface brush drawn incorrectly.
This commit is contained in:
Tanasart 2024-04-21 14:36:00 +07:00
parent 0759ff226a
commit 33ea9fd7e3
19 changed files with 473 additions and 41 deletions

View file

@ -0,0 +1,210 @@
// 2024-04-21 14:35:38
#event properties (no comments/etc. here are saved)
parent_index = _p_dialog;
uses_physics = false;
#event create
event_inherited();
#region data
destroy_on_click_out = true;
dialog_w = ui(648);
dialog_h = ui(640);
draggable = false;
dialog_resizable = false;
dialog_w_min = ui(400);
dialog_h_min = ui(400);
dialog_w_max = WIN_W;
dialog_h_max = WIN_H;
target = noone;
function onResize() {
sp_content.resize(dialog_w - ui(padding + padding), dialog_h - ui(title_height + padding));
}
#endregion
#region content
menuOn = -1;
dragging = -1;
drag_spr = -1;
sp_content = new scrollPane(dialog_w - ui(padding + padding), dialog_h - ui(title_height + padding), function(_y, _m) {
if(!target) return 0;
if(!struct_has(target, "spr")) return 0;
draw_clear_alpha(COLORS.dialog_array_edit_bg, 0);
var _h = ui(8);
var ww = ui(100);
var hh = ui(100);
var pad = ui(16);
var arr = target.getInputData(0);
if(array_length(arr) != array_length(target.spr))
target.updatePaths(arr);
var len = array_length(arr);
var col = floor((sp_content.surface_w - pad) / (ww + pad));
var row = ceil(len / col);
var yy = _y + ui(8);
var menu = -1;
var drag = -1;
var inb_hover = -1;
for( var i = 0; i < row; i++ ) {
var ch = hh;
for( var j = 0; j < col; j++ ) {
var index = i * col + j;
if(index >= len) break;
var xx = pad + (ww + pad) * j;
draw_sprite_stretched(THEME.ui_panel_bg, 0, xx, yy, ww, hh);
if(sHOVER && sp_content.hover && point_in_rectangle(_m[0], _m[1], xx, yy, xx + ww, yy + hh)) {
inb_hover = index;
if(dragging == -1)
draw_sprite_stretched_ext(THEME.ui_panel_active, 0, xx, yy, ww, hh, COLORS._main_accent, 1);
if(mouse_press(mb_left, sFOCUS))
dragging = index;
if(mouse_press(mb_right, sFOCUS)) {
menu = index;
menuOn = index;
}
}
var spr = array_safe_get_fast(target.spr, index, noone);
if(spr == noone || !sprite_exists(spr))
spr = s_texture_default;
var spr_w = sprite_get_width(spr);
var spr_h = sprite_get_height(spr);
var spr_s = min((ww - ui(16)) / spr_w, (hh - ui(16)) / spr_h);
var spr_x = xx + ww / 2 - spr_w * spr_s / 2;
var spr_y = yy + hh / 2 - spr_h * spr_s / 2;
var aa = dragging == -1? 1 : (dragging == index? 1 : 0.5);
draw_sprite_ext(spr, 0, spr_x, spr_y, spr_s, spr_s, 0, c_white, aa);
draw_set_text(f_p2, fa_center, fa_top, COLORS._main_text);
var path = arr[index];
var name = string_cut_line(string_replace(filename_name(path), filename_ext(path), ""), ww);
var txt_h = string_height_ext(name, -1, ww);
draw_text_line(xx + ww / 2, yy + hh + ui(16), name, -1, ww);
ch = max(ch, hh + txt_h + ui(32));
}
yy += ch;
_h += ch;
}
if(dragging != -1) {
if(inb_hover != -1) {
rearrange(dragging, inb_hover);
dragging = inb_hover;
}
if(mouse_release(mb_left))
dragging = -1;
}
if(menu > -1) {
menuCall("image_array_edit_menu",,, [
menuItem(__txt("Remove"), function() {
var arr = target.getInputData(0);
array_delete(arr, menuOn, 1);
target.inputs[| 0].setValue(arr);
target.triggerRender();
})
],, target );
}
return _h;
})
#endregion
#region function
function rearrange(oldindex, newindex) {
if(oldindex == newindex) return;
var arr = target.getInputData(0);
var val = arr[oldindex];
array_delete(arr, oldindex, 1);
array_insert(arr, newindex, val);
target.inputs[| 0].setValue(arr);
target.triggerRender();
}
sortAsc = true;
function sortByName() {
if(!target) return 0;
var arr = target.getInputData(0);
array_sort(arr, bool(sortAsc));
sortAsc = !sortAsc;
target.inputs[| 0].setValue(arr);
target.triggerRender();
}
#endregion
#event draw_gui init
if !ready exit;
if !target exit;
#region base UI
DIALOG_DRAW_BG
if(sFOCUS)
DIALOG_DRAW_FOCUS
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
draw_text(dialog_x + ui(padding), dialog_y + ui(20), __txtx("array_edit_title", "Image array edit"));
#endregion
#region content
var px = dialog_x + ui(padding);
var py = dialog_y + ui(title_height);
var pw = dialog_w - ui(padding + padding);
var ph = dialog_h - ui(title_height + padding);
draw_sprite_stretched(THEME.ui_panel_bg, 1, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
sp_content.setFocusHover(sFOCUS, sHOVER);
sp_content.draw(px, py);
#endregion
#region button
var bw = ui(28);
var bh = ui(28);
var bx = dialog_x + dialog_w - ui(padding - 8) - bw;
var by = dialog_y + ui(18);
if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sFOCUS, sHOVER, __txt("Add") + "...", THEME.add,, COLORS._main_value_positive) == 2) {
var path = get_open_filenames_compat("image|*.png;*.jpg", "");
key_release();
if(path != "") {
var paths = paths_to_array(path);
var arr = target.getInputData(0);
for( var i = 0, n = array_length(paths); i < n; i++ )
array_push(arr, paths[i]);
target.inputs[| 0].setValue(arr);
target.triggerRender();
}
}
bx -= ui(36);
if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sFOCUS, sHOVER, __txtx("array_edit_sort_name", "Sort by name"), THEME.text) == 2)
sortByName();
#endregion

View file

@ -0,0 +1,210 @@
// 2024-04-21 14:35:31
#event properties (no comments/etc. here are saved)
parent_index = _p_dialog;
uses_physics = false;
#event create
event_inherited();
#region data
destroy_on_click_out = true;
dialog_w = ui(648);
dialog_h = ui(640);
draggable = false;
dialog_resizable = false;
dialog_w_min = ui(400);
dialog_h_min = ui(400);
dialog_w_max = WIN_W;
dialog_h_max = WIN_H;
target = noone;
function onResize() {
sp_content.resize(dialog_w - ui(padding + padding), dialog_h - ui(title_height + padding));
}
#endregion
#region content
menuOn = -1;
dragging = -1;
drag_spr = -1;
sp_content = new scrollPane(dialog_w - ui(padding + padding), dialog_h - ui(title_height + padding), function(_y, _m) {
if(!target) return 0;
if(!struct_has(target, "spr")) return 0;
draw_clear_alpha(COLORS.dialog_array_edit_bg, 0);
var _h = ui(8);
var ww = ui(100);
var hh = ui(100);
var pad = ui(16);
var arr = target.getInputData(0);
if(array_length(arr) != array_length(target.spr))
target.updatePaths(arr);
var len = array_length(arr);
var col = floor((sp_content.surface_w - pad) / (ww + pad));
var row = ceil(len / col);
var yy = _y + ui(8);
var menu = -1;
var drag = -1;
var inb_hover = -1;
for( var i = 0; i < row; i++ ) {
var ch = hh;
for( var j = 0; j < col; j++ ) {
var index = i * col + j;
if(index >= len) break;
var xx = pad + (ww + pad) * j;
draw_sprite_stretched(THEME.ui_panel_bg, 0, xx, yy, ww, hh);
if(sHOVER && sp_content.hover && point_in_rectangle(_m[0], _m[1], xx, yy, xx + ww, yy + hh)) {
inb_hover = index;
if(dragging == -1)
draw_sprite_stretched_ext(THEME.ui_panel_active, 0, xx, yy, ww, hh, COLORS._main_accent, 1);
if(mouse_press(mb_left, sFOCUS))
dragging = index;
if(mouse_press(mb_right, sFOCUS)) {
menu = index;
menuOn = index;
}
}
var spr = array_safe_get_fast(target.spr, index, noone);
if(spr == noone || !sprite_exists(spr))
spr = s_texture_default;
var spr_w = sprite_get_width(spr);
var spr_h = sprite_get_height(spr);
var spr_s = min((ww - ui(16)) / spr_w, (hh - ui(16)) / spr_h);
var spr_x = xx + ww / 2 - spr_w * spr_s / 2;
var spr_y = yy + hh / 2 - spr_h * spr_s / 2;
var aa = dragging == -1? 1 : (dragging == index? 1 : 0.5);
draw_sprite_ext(spr, 0, spr_x, spr_y, spr_s, spr_s, 0, c_white, aa);
draw_set_text(f_p2, fa_center, fa_top, COLORS._main_text);
var path = arr[index];
var name = string_cut_line(string_replace(filename_name(path), filename_ext(path), ""), ww);
var txt_h = string_height_ext(name, -1, ww);
draw_text_line(xx + ww / 2, yy + hh + ui(16), name, -1, ww);
ch = max(ch, hh + txt_h + ui(32));
}
yy += ch;
_h += ch;
}
if(dragging != -1) {
if(inb_hover != -1) {
rearrange(dragging, inb_hover);
dragging = inb_hover;
}
if(mouse_release(mb_left))
dragging = -1;
}
if(menu > -1) {
menuCall("image_array_edit_menu",,, [
menuItem(__txt("Remove"), function() {
var arr = target.getInputData(0);
array_delete(arr, menuOn, 1);
target.inputs[| 0].setValue(arr);
target.triggerRender();
})
],, target );
}
return _h;
})
#endregion
#region function
function rearrange(oldindex, newindex) {
if(oldindex == newindex) return;
var arr = target.getInputData(0);
var val = arr[oldindex];
array_delete(arr, oldindex, 1);
array_insert(arr, newindex, val);
target.inputs[| 0].setValue(arr);
target.triggerRender();
}
sortAsc = true;
function sortByName() {
if(!target) return 0;
var arr = target.getInputData(0);
array_sort(arr, bool(sortAsc));
sortAsc = !sortAsc;
target.inputs[| 0].setValue(arr);
target.triggerRender();
}
#endregion
#event draw_gui init
if !ready exit;
if !target exit;
#region base UI
DIALOG_DRAW_BG
if(sFOCUS)
DIALOG_DRAW_FOCUS
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
draw_text(dialog_x + ui(padding), dialog_y + ui(20), __txtx("array_edit_title", "Image array edit"));
#endregion
#region content
var px = dialog_x + ui(padding);
var py = dialog_y + ui(title_height);
var pw = dialog_w - ui(padding + padding);
var ph = dialog_h - ui(title_height + padding);
draw_sprite_stretched(THEME.ui_panel_bg, 1, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
sp_content.setFocusHover(sFOCUS, sHOVER);
sp_content.draw(px, py);
#endregion
#region button
var bw = ui(28);
var bh = ui(28);
var bx = dialog_x + dialog_w - ui(padding - 8) - bw;
var by = dialog_y + ui(18);
if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sFOCUS, sHOVER, __txt("Add") + "...", THEME.add,, COLORS._main_value_positive) == 2) {
var path = get_open_filenames_compat("image|*.png;*.jpg", "");
key_release();
if(path != "") {
var paths = paths_to_array(path);
var arr = target.getInputData(0);
for( var i = 0, n = array_length(paths); i < n; i++ )
array_push(arr, paths[i]);
target.inputs[| 0].setValue(arr);
target.triggerRender();
}
}
bx -= ui(36);
if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sFOCUS, sHOVER, __txtx("array_edit_sort_name", "Sort by name"), THEME.text) == 2)
sortByName();
#endregion

View file

@ -1,4 +1,4 @@
// 2024-04-18 13:37:35
// 2024-04-21 14:31:51
function canvas_draw_point_brush(brush, _x, _y, _draw = false) { #region
if(brush.brush_surface == noone) {
@ -19,7 +19,7 @@ function canvas_draw_point_brush(brush, _x, _y, _draw = false) { #region
var _r = brush.brush_direction + angle_random_eval(brush.brush_rand_dir, brush.brush_seed);
var _p = point_rotate(-_sw / 2, -_sh / 2, 0, 0, _r);
draw_surface_ext_safe(brush.brush_surface, _x + _p[0], _y + _p[1], 1, 1, _r, draw_get_color(), draw_get_alpha());
draw_surface_ext_safe(brush.brush_surface, round(_x + _p[0]), round(_y + _p[1]), 1, 1, _r, draw_get_color(), draw_get_alpha());
if(_draw) brush.brush_seed = irandom_range(100000, 999999);
}

View file

@ -1,4 +1,4 @@
// 2024-04-18 13:37:22
// 2024-04-21 14:29:52
function canvas_draw_point_brush(brush, _x, _y, _draw = false) { #region
if(brush.brush_surface == noone) {
@ -19,7 +19,7 @@ function canvas_draw_point_brush(brush, _x, _y, _draw = false) { #region
var _r = brush.brush_direction + angle_random_eval(brush.brush_rand_dir, brush.brush_seed);
var _p = point_rotate(-_sw / 2, -_sh / 2, 0, 0, _r);
draw_surface_ext_safe(brush.brush_surface, _x + _p[0], _y + _p[1], 1, 1, _r, draw_get_color(), draw_get_alpha());
draw_surface_ext_safe(brush.brush_surface, round(_x + _p[0]), round(_y + _p[1]), 1, 1, _r, draw_get_color(), draw_get_alpha());
if(_draw) brush.brush_seed = irandom_range(100000, 999999);
}
@ -118,7 +118,7 @@ function canvas_draw_rect_brush(brush, _x0, _y0, _x1, _y1, _fill) { #region
}
} #endregion
function canvas_draw_ellp_size(brush, _x0, _y0, _x1, _y1, _fill) { #region
function canvas_draw_ellp_brush(brush, _x0, _y0, _x1, _y1, _fill) { #region
if(_x0 == _x1 && _y0 == _y1) {
canvas_draw_point_brush(brush, _x0, _y0);
return;

View file

@ -1,4 +1,4 @@
// 2024-04-18 15:44:33
// 2024-04-21 14:15:23
function canvas_tool_brush(brush, eraser = false) : canvas_tool() constructor {
self.brush = brush;
isEraser = eraser;
@ -34,7 +34,7 @@ function canvas_tool_brush(brush, eraser = false) : canvas_tool() constructor {
}
if(mouse_press(mb_left, active)) {
surface_set_shader(drawing_surface, noone);
canvas_draw_point_brush(brush, mouse_cur_x, mouse_cur_y, true);
surface_reset_shader();
@ -122,5 +122,4 @@ function canvas_tool_brush(brush, eraser = false) : canvas_tool() constructor {
draw_text(_x1 + 8, (_y0 + _y1) / 2, _h);
}
}
}

View file

@ -1,4 +1,4 @@
// 2024-04-18 15:43:04
// 2024-04-21 14:13:22
function canvas_tool_brush(brush, eraser = false) : canvas_tool() constructor {
self.brush = brush;
isEraser = eraser;
@ -102,7 +102,7 @@ function canvas_tool_brush(brush, eraser = false) : canvas_tool() constructor {
function drawPostOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
if(mouse_line_drawing && !brush.brush_sizing) {
if(mouse_line_drawing && !brush.brush_sizing && node.attributes.show_slope_check) {
var _x0 = _x + mouse_line_x0 * _s;
var _y0 = _y + mouse_line_y0 * _s;
var _x1 = _x + mouse_line_x1 * _s;
@ -122,5 +122,4 @@ function canvas_tool_brush(brush, eraser = false) : canvas_tool() constructor {
draw_text(_x1 + 8, (_y0 + _y1) / 2, _h);
}
}
}

View file

@ -1,4 +1,4 @@
// 2024-04-20 10:42:12
// 2024-04-21 14:12:32
function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Array";

View file

@ -1,4 +1,4 @@
// 2024-04-20 10:41:12
// 2024-04-21 12:50:40
function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Array";

View file

@ -1,4 +1,4 @@
// 2024-04-20 10:03:26
// 2024-04-21 14:29:32
function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Canvas";
color = COLORS.node_blend_canvas;
@ -863,7 +863,6 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
}
if(_tool) _tool.drawPostOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
#endregion
var _x0 = _x;

View file

@ -1,4 +1,4 @@
// 2024-04-20 08:26:31
// 2024-04-21 14:28:39
function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Canvas";
color = COLORS.node_blend_canvas;
@ -864,6 +864,7 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
if(_tool) _tool.drawPostOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
canvas_draw_point_brush(brush, _x, _y, true);
#endregion
var _x0 = _x;

View file

@ -1,4 +1,4 @@
// 2024-04-18 15:03:27
// 2024-04-21 14:21:07
#region funtion calls
function __fnInit_Preview() {
__registerFunction("preview_focus_content", panel_preview_focus_content);
@ -123,7 +123,8 @@ function Panel_Preview() : PanelContent() constructor {
toolbar_height = ui(40);
tool_hovering = false;
tool_side_drawing = false;
tool_side_draw_l = false;
tool_side_draw_r = false;
overlay_hovering = false;
sbChannel = new scrollBox([], function(index) { #region
@ -571,9 +572,11 @@ function Panel_Preview() : PanelContent() constructor {
if(node != noone) bbox = node.getPreviewBoundingBox();
if(bbox == noone) bbox = BBOX().fromWH(0, 0, PROJECT.attributes.surface_dimension[0], PROJECT.attributes.surface_dimension[1]);
var ss = min((w - 32 - tool_side_drawing * 40) / bbox.w, (h - 32 - toolbar_height * 2) / bbox.h);
var tl = tool_side_draw_l * 40;
var tr = tool_side_draw_r * 40;
var ss = min((w - 32 - tl - tr) / bbox.w, (h - 32 - toolbar_height * 2) / bbox.h);
canvas_s = ss;
canvas_x = w / 2 - bbox.w * canvas_s / 2 - bbox.x0 * canvas_s + (tool_side_drawing * 40 / 2);
canvas_x = w / 2 - bbox.w * canvas_s / 2 - bbox.x0 * canvas_s + (tl - tr) / 2;
canvas_y = h / 2 - bbox.h * canvas_s / 2 - bbox.y0 * canvas_s;
} #endregion
@ -1117,7 +1120,7 @@ function Panel_Preview() : PanelContent() constructor {
preview_x_max = 0;
if(array_length(pseq) > 1) {
var _xx = tool_side_drawing * ui(40);
var _xx = tool_side_draw_l * ui(40);
var xx = _xx + preview_x + ui(8);
var yy = h - toolbar_height - prev_size - ui(8);
@ -1195,7 +1198,8 @@ function Panel_Preview() : PanelContent() constructor {
var cy = canvas_y + _node.preview_y * canvas_s;
var _snx = 0, _sny = 0;
tool_side_drawing = _node.tools != -1;
tool_side_draw_l = _node.tools != -1;
tool_side_draw_r = _node.rightTools != -1;
if(_node.tools != -1 && point_in_rectangle(_mx, _my, 0, 0, toolbar_width, h)) {
isHover = false;

View file

@ -1,4 +1,4 @@
// 2024-04-18 15:02:59
// 2024-04-21 14:21:06
#region funtion calls
function __fnInit_Preview() {
__registerFunction("preview_focus_content", panel_preview_focus_content);
@ -123,7 +123,8 @@ function Panel_Preview() : PanelContent() constructor {
toolbar_height = ui(40);
tool_hovering = false;
tool_side_drawing = false;
tool_side_draw_l = false;
tool_side_draw_r = false;
overlay_hovering = false;
sbChannel = new scrollBox([], function(index) { #region
@ -571,9 +572,11 @@ function Panel_Preview() : PanelContent() constructor {
if(node != noone) bbox = node.getPreviewBoundingBox();
if(bbox == noone) bbox = BBOX().fromWH(0, 0, PROJECT.attributes.surface_dimension[0], PROJECT.attributes.surface_dimension[1]);
var ss = min((w - 32 - tool_side_drawing * 40) / bbox.w, (h - 32 - toolbar_height * 2) / bbox.h);
var tl = tool_side_draw_l * 40;
var tr = tool_side_draw_r * 40;
var ss = min((w - 32 - tl - tr) / bbox.w, (h - 32 - toolbar_height * 2) / bbox.h);
canvas_s = ss;
canvas_x = w / 2 - bbox.w * canvas_s / 2 - bbox.x0 * canvas_s + (tool_side_drawing * 40 / 2);
canvas_x = w / 2 - bbox.w * canvas_s / 2 - bbox.x0 * canvas_s + (tl - tr) / 2;
canvas_y = h / 2 - bbox.h * canvas_s / 2 - bbox.y0 * canvas_s;
} #endregion
@ -1117,7 +1120,7 @@ function Panel_Preview() : PanelContent() constructor {
preview_x_max = 0;
if(array_length(pseq) > 1) {
var _xx = tool_side_drawing * ui(40);
var _xx = tool_side_draw_l * ui(40);
var xx = _xx + preview_x + ui(8);
var yy = h - toolbar_height - prev_size - ui(8);
@ -1195,7 +1198,8 @@ function Panel_Preview() : PanelContent() constructor {
var cy = canvas_y + _node.preview_y * canvas_s;
var _snx = 0, _sny = 0;
tool_side_drawing = _node.tools != -1;
tool_side_draw_l = _node.tools != -1;
tool_side_draw_r = _node.rightTools != -1;
if(_node.tools != -1 && point_in_rectangle(_mx, _my, 0, 0, toolbar_width, h)) {
isHover = false;

View file

@ -116,7 +116,9 @@ event_inherited();
menuItem(__txt("Remove"), function() {
var arr = target.getInputData(0);
array_delete(arr, menuOn, 1);
target.inputs[| 0].setValue(arr);
target.triggerRender();
})
],, target );
}
@ -133,8 +135,9 @@ event_inherited();
var val = arr[oldindex];
array_delete(arr, oldindex, 1);
array_insert(arr, newindex, val);
target.inputs[| 0].setValue(arr);
target.doUpdate();
target.triggerRender();
}
sortAsc = true;
@ -146,6 +149,6 @@ event_inherited();
sortAsc = !sortAsc;
target.inputs[| 0].setValue(arr);
target.doUpdate();
target.triggerRender();
}
#endregion

View file

@ -39,6 +39,7 @@ if !target exit;
array_push(arr, paths[i]);
target.inputs[| 0].setValue(arr);
target.triggerRender();
}
}

View file

@ -18,7 +18,7 @@ function canvas_draw_point_brush(brush, _x, _y, _draw = false) { #region
var _r = brush.brush_direction + angle_random_eval(brush.brush_rand_dir, brush.brush_seed);
var _p = point_rotate(-_sw / 2, -_sh / 2, 0, 0, _r);
draw_surface_ext_safe(brush.brush_surface, _x + _p[0], _y + _p[1], 1, 1, _r, draw_get_color(), draw_get_alpha());
draw_surface_ext_safe(brush.brush_surface, round(_x + _p[0]), round(_y + _p[1]), 1, 1, _r, draw_get_color(), draw_get_alpha());
if(_draw) brush.brush_seed = irandom_range(100000, 999999);
}

View file

@ -33,7 +33,7 @@ function canvas_tool_brush(brush, eraser = false) : canvas_tool() constructor {
}
if(mouse_press(mb_left, active)) {
surface_set_shader(drawing_surface, noone);
canvas_draw_point_brush(brush, mouse_cur_x, mouse_cur_y, true);
surface_reset_shader();
@ -121,5 +121,4 @@ function canvas_tool_brush(brush, eraser = false) : canvas_tool() constructor {
draw_text(_x1 + 8, (_y0 + _y1) / 2, _h);
}
}
}

View file

@ -38,8 +38,8 @@
LATEST_VERSION = 11600;
VERSION = 11700;
SAVE_VERSION = 11690;
VERSION_STRING = "1.17.rc3";
BUILD_NUMBER = 11700;
VERSION_STRING = "1.17.rc4";
BUILD_NUMBER = 11704;
globalvar HOTKEYS, HOTKEY_CONTEXT;
HOTKEYS = ds_map_create();

View file

@ -862,7 +862,6 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
}
if(_tool) _tool.drawPostOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
#endregion
var _x0 = _x;

View file

@ -122,7 +122,8 @@ function Panel_Preview() : PanelContent() constructor {
toolbar_height = ui(40);
tool_hovering = false;
tool_side_drawing = false;
tool_side_draw_l = false;
tool_side_draw_r = false;
overlay_hovering = false;
sbChannel = new scrollBox([], function(index) { #region
@ -570,9 +571,11 @@ function Panel_Preview() : PanelContent() constructor {
if(node != noone) bbox = node.getPreviewBoundingBox();
if(bbox == noone) bbox = BBOX().fromWH(0, 0, PROJECT.attributes.surface_dimension[0], PROJECT.attributes.surface_dimension[1]);
var ss = min((w - 32 - tool_side_drawing * 40) / bbox.w, (h - 32 - toolbar_height * 2) / bbox.h);
var tl = tool_side_draw_l * 40;
var tr = tool_side_draw_r * 40;
var ss = min((w - 32 - tl - tr) / bbox.w, (h - 32 - toolbar_height * 2) / bbox.h);
canvas_s = ss;
canvas_x = w / 2 - bbox.w * canvas_s / 2 - bbox.x0 * canvas_s + (tool_side_drawing * 40 / 2);
canvas_x = w / 2 - bbox.w * canvas_s / 2 - bbox.x0 * canvas_s + (tl - tr) / 2;
canvas_y = h / 2 - bbox.h * canvas_s / 2 - bbox.y0 * canvas_s;
} #endregion
@ -1116,7 +1119,7 @@ function Panel_Preview() : PanelContent() constructor {
preview_x_max = 0;
if(array_length(pseq) > 1) {
var _xx = tool_side_drawing * ui(40);
var _xx = tool_side_draw_l * ui(40);
var xx = _xx + preview_x + ui(8);
var yy = h - toolbar_height - prev_size - ui(8);
@ -1194,7 +1197,8 @@ function Panel_Preview() : PanelContent() constructor {
var cy = canvas_y + _node.preview_y * canvas_s;
var _snx = 0, _sny = 0;
tool_side_drawing = _node.tools != -1;
tool_side_draw_l = _node.tools != -1;
tool_side_draw_r = _node.rightTools != -1;
if(_node.tools != -1 && point_in_rectangle(_mx, _my, 0, 0, toolbar_width, h)) {
isHover = false;