mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 14:06:23 +01:00
- [Preview Panel] Fix error with padding area type.
This commit is contained in:
parent
7770730b14
commit
c2c6305b5b
5 changed files with 46 additions and 52 deletions
|
@ -581,7 +581,7 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
miny = min(miny, _ny); maxy = max(maxy, _ny);
|
||||
|
||||
if(j) {
|
||||
if((key_mod_press(CTRL) || isUsingTool(1)) && distance_to_line(_mx, _my, _ox, _oy, _nx, _ny) < 4)
|
||||
if(hover && (key_mod_press(CTRL) || isUsingTool(1)) && distance_to_line(_mx, _my, _ox, _oy, _nx, _ny) < 4)
|
||||
_line_hover = i;
|
||||
draw_line_width(_ox, _oy, _nx, _ny, 1 + 2 * (line_hover == i));
|
||||
}
|
||||
|
@ -592,7 +592,7 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
} #endregion
|
||||
|
||||
#region draw anchor
|
||||
if(!isUsingTool(0))
|
||||
if(hover != -1 && !isUsingTool(0))
|
||||
for(var i = 0; i < ansize; i++) {
|
||||
var _a = anchors[i];
|
||||
var xx = _x + _a[0] * _s;
|
||||
|
@ -624,15 +624,18 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
|
||||
if(drag_point == i) {
|
||||
draw_sprite_colored(THEME.anchor_selector, 1, xx, yy);
|
||||
} else if(point_in_circle(_mx, _my, xx, yy, 8)) {
|
||||
|
||||
} else if(hover && point_in_circle(_mx, _my, xx, yy, 8)) {
|
||||
draw_sprite_colored(THEME.anchor_selector, 1, xx, yy);
|
||||
anchor_hover = i;
|
||||
hover_type = 0;
|
||||
} else if(cont && point_in_circle(_mx, _my, _ax0, _ay0, 8)) {
|
||||
|
||||
} else if(cont && hover && point_in_circle(_mx, _my, _ax0, _ay0, 8)) {
|
||||
draw_sprite_colored(THEME.anchor_selector, 0, _ax0, _ay0);
|
||||
anchor_hover = i;
|
||||
hover_type = 1;
|
||||
} else if(cont && point_in_circle(_mx, _my, _ax1, _ay1, 8)) {
|
||||
|
||||
} else if(cont && hover && point_in_circle(_mx, _my, _ax1, _ay1, 8)) {
|
||||
draw_sprite_colored(THEME.anchor_selector, 0, _ax1, _ay1);
|
||||
anchor_hover = i;
|
||||
hover_type = -1;
|
||||
|
@ -641,17 +644,18 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
#endregion
|
||||
}
|
||||
|
||||
if(hover == -1) return;
|
||||
line_hover = _line_hover;
|
||||
|
||||
/////////////////////////////////////////////////////// TOOLS ///////////////////////////////////////////////////////
|
||||
|
||||
if(isUsingTool(0)) { #region transform tools
|
||||
var hov = 0;
|
||||
if(point_in_circle(_mx, _my, minx, miny, 8)) hov = 1;
|
||||
else if(point_in_circle(_mx, _my, maxx, miny, 8)) hov = 2;
|
||||
else if(point_in_circle(_mx, _my, minx, maxy, 8)) hov = 3;
|
||||
else if(point_in_circle(_mx, _my, maxx, maxy, 8)) hov = 4;
|
||||
else if(point_in_rectangle(_mx, _my, minx, miny, maxx, maxy)) hov = 5;
|
||||
if(hover && point_in_circle(_mx, _my, minx, miny, 8)) hov = 1;
|
||||
else if(hover && point_in_circle(_mx, _my, maxx, miny, 8)) hov = 2;
|
||||
else if(hover && point_in_circle(_mx, _my, minx, maxy, 8)) hov = 3;
|
||||
else if(hover && point_in_circle(_mx, _my, maxx, maxy, 8)) hov = 4;
|
||||
else if(hover && point_in_rectangle(_mx, _my, minx, miny, maxx, maxy)) hov = 5;
|
||||
|
||||
draw_set_color(COLORS._main_accent);
|
||||
draw_rectangle_border(minx, miny, maxx, maxy, 1 + (hov == 5));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
function Node_Path_Transform(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||
name = "Transform Path";
|
||||
setDimension(96, 48);;
|
||||
setDimension(96, 48);
|
||||
|
||||
inputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.pathnode, noone)
|
||||
.setVisible(true, true);
|
||||
|
@ -21,38 +21,27 @@ function Node_Path_Transform(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
|||
|
||||
cached_pos = ds_map_create();
|
||||
|
||||
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
||||
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
||||
var pth = getInputData(0);
|
||||
var pos = getInputData(4);
|
||||
var px = _x + pos[0] * _s;
|
||||
var py = _y + pos[1] * _s;
|
||||
|
||||
// if(pth) pth.drawOverlay(-1, false, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
|
||||
active &= !inputs[| 1].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
active &= !inputs[| 2].drawOverlay(hover, active, px, py, _s, _mx, _my, _snx, _sny);
|
||||
active &= !inputs[| 4].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny );
|
||||
} #endregion
|
||||
|
||||
static getLineCount = function() { #region
|
||||
var _path = getInputData(0);
|
||||
return struct_has(_path, "getLineCount")? _path.getLineCount() : 1;
|
||||
} #endregion
|
||||
|
||||
static getSegmentCount = function(ind = 0) { #region
|
||||
var _path = getInputData(0);
|
||||
return struct_has(_path, "getSegmentCount")? _path.getSegmentCount(ind) : 0;
|
||||
} #endregion
|
||||
|
||||
static getLength = function(ind = 0) { #region
|
||||
var _path = getInputData(0);
|
||||
return struct_has(_path, "getLength")? _path.getLength(ind) : 0;
|
||||
} #endregion
|
||||
|
||||
static getAccuLength = function(ind = 0) { #region
|
||||
var _path = getInputData(0);
|
||||
return struct_has(_path, "getAccuLength")? _path.getAccuLength(ind) : [];
|
||||
} #endregion
|
||||
|
||||
static getBoundary = function(ind = 0) { #region
|
||||
inputs[| 4].overlay_draw_text = false;
|
||||
active &= !inputs[| 4].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny, 1);
|
||||
}
|
||||
|
||||
static getLineCount = function() { var _path = getInputData(0); return struct_has(_path, "getLineCount")? _path.getLineCount() : 1; }
|
||||
static getSegmentCount = function(ind = 0) { var _path = getInputData(0); return struct_has(_path, "getSegmentCount")? _path.getSegmentCount(ind) : 0; }
|
||||
static getLength = function(ind = 0) { var _path = getInputData(0); return struct_has(_path, "getLength")? _path.getLength(ind) : 0; }
|
||||
static getAccuLength = function(ind = 0) { var _path = getInputData(0); return struct_has(_path, "getAccuLength")? _path.getAccuLength(ind) : []; }
|
||||
|
||||
static getBoundary = function(ind = 0) {
|
||||
var _path = getInputData(0);
|
||||
if(!struct_has(_path, "getBoundary"))
|
||||
return new BoundingBox( 0, 0, 1, 1 );
|
||||
|
@ -82,9 +71,9 @@ function Node_Path_Transform(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
|||
var _maxy = max(b.miny, b.maxy);
|
||||
|
||||
return new BoundingBox(_minx, _miny, _maxx, _maxy);
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static getPointRatio = function(_rat, ind = 0, out = undefined) { #region
|
||||
static getPointRatio = function(_rat, ind = 0, out = undefined) {
|
||||
if(out == undefined) out = new __vec2(); else { out.x = 0; out.y = 0; }
|
||||
|
||||
var _cKey = $"{_rat},{ind}";
|
||||
|
@ -122,11 +111,11 @@ function Node_Path_Transform(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
|||
cached_pos[? _cKey] = out.clone();
|
||||
|
||||
return out;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static getPointDistance = function(_dist, ind = 0, out = undefined) { return getPointRatio(_dist / getLength(), ind, out); }
|
||||
|
||||
static getBoundary = function(ind = 0) { #region
|
||||
static getBoundary = function(ind = 0) {
|
||||
var _path = getInputData(0);
|
||||
var _pos = getInputData(1);
|
||||
var _rot = getInputData(2);
|
||||
|
@ -143,15 +132,15 @@ function Node_Path_Transform(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
|||
_b[1] = cy + (_b[1] - cy) * _sca[1];
|
||||
_b[2] = cx + (_b[2] - cx) * _sca[0];
|
||||
_b[3] = cy + (_b[3] - cy) * _sca[1];
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static update = function() { #region
|
||||
static update = function() {
|
||||
ds_map_clear(cached_pos);
|
||||
outputs[| 0].setValue(self);
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
draw_sprite_fit(s_node_path_transform, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
|
||||
} #endregion
|
||||
}
|
||||
}
|
|
@ -1836,6 +1836,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
_cbg = merge_color(draw_blend_color, _cbg, draw_blend);
|
||||
|
||||
__draw_sprite_ext(THEME.node_junction_inspector, is_hover, x, y, _s, _s, 0, _cbg, 1);
|
||||
|
||||
} else {
|
||||
var _cbg = draw_bg;
|
||||
var _cfg = draw_fg;
|
||||
|
|
|
@ -43,9 +43,9 @@ function preview_overlay_area_padding(interact, active, _x, _y, _s, _mx, _my, _s
|
|||
}
|
||||
}
|
||||
|
||||
var _hov = [ 0, 0, 0, 0 ], _hovPos = 0;
|
||||
|
||||
if(interact) {
|
||||
var _hov = [ 0, 0, 0, 0 ], _hovPos = 0;
|
||||
|
||||
if(drag_type == 1) _r = value_snap(drag_sx - (_mx - drag_mx) / _s, _snx);
|
||||
else if(drag_type == 2) _t = value_snap(drag_sy + (_my - drag_my) / _s, _sny);
|
||||
else if(drag_type == 3) _l = value_snap(drag_sx + (_mx - drag_mx) / _s, _snx);
|
||||
|
@ -164,10 +164,10 @@ function preview_overlay_area_two_point(interact, active, _x, _y, _s, _mx, _my,
|
|||
}
|
||||
}
|
||||
|
||||
var _hov = [ 0, 0, 0 ];
|
||||
var _r = 10;
|
||||
|
||||
if(interact) {
|
||||
var _hov = [ 0, 0, 0 ];
|
||||
var _r = 10;
|
||||
|
||||
if(drag_type) {
|
||||
var _sval = array_clone(showValue());
|
||||
if(unit.mode == VALUE_UNIT.reference) {
|
||||
|
|
|
@ -252,9 +252,9 @@ function Theme() constructor {
|
|||
node_junction_inspector = s_node_junction_inspector;
|
||||
|
||||
node_junctions_single = s_node_junctions_single;
|
||||
node_junctions_bg_x2 = s_node_junctions_bg;
|
||||
node_junctions_outline_x2 = s_node_junctions_outline;
|
||||
node_junctions_outline_hover_x2 = s_node_junctions_outline_hover;
|
||||
node_junctions_bg_x2 = s_node_junctions_bg_2x;
|
||||
node_junctions_outline_x2 = s_node_junctions_outline_2x;
|
||||
node_junctions_outline_hover_x2 = s_node_junctions_outline_hover_2x;
|
||||
node_junctions_bg = s_node_junctions_bg;
|
||||
node_junctions_outline = s_node_junctions_outline;
|
||||
node_junctions_outline_hover = s_node_junctions_outline_hover;
|
||||
|
|
Loading…
Reference in a new issue