mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-26 15:06:22 +01:00
- [Graph Panel] Fix to center not working correctly with inline groups.
This commit is contained in:
parent
ac6a604465
commit
20af174ed2
5 changed files with 25 additions and 16 deletions
|
@ -473,7 +473,6 @@
|
||||||
{"$GMIncludedFile":"","%Name":"Tree sway.pxc","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Tree sway.pxc","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
{"$GMIncludedFile":"","%Name":"Tree sway.pxc","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Tree sway.pxc","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||||
{"$GMIncludedFile":"","%Name":"Canvas.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Templates","name":"Canvas.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
{"$GMIncludedFile":"","%Name":"Canvas.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Templates","name":"Canvas.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||||
{"$GMIncludedFile":"","%Name":"Canvas.pxc","CopyToMask":-1,"filePath":"datafiles/Welcome files/Templates","name":"Canvas.pxc","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
{"$GMIncludedFile":"","%Name":"Canvas.pxc","CopyToMask":-1,"filePath":"datafiles/Welcome files/Templates","name":"Canvas.pxc","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||||
{"$GMIncludedFile":"","%Name":"Canvas.pxc1","CopyToMask":-1,"filePath":"datafiles/Welcome files/Templates","name":"Canvas.pxc1","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
|
||||||
{"$GMIncludedFile":"","%Name":"Welcome files.zip","CopyToMask":-1,"filePath":"datafiles/Welcome files","name":"Welcome files.zip","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
{"$GMIncludedFile":"","%Name":"Welcome files.zip","CopyToMask":-1,"filePath":"datafiles/Welcome files","name":"Welcome files.zip","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||||
],
|
],
|
||||||
"isEcma":false,
|
"isEcma":false,
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -315,9 +315,12 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
||||||
|
|
||||||
toolbar_height = ui(40);
|
toolbar_height = ui(40);
|
||||||
|
|
||||||
function toCenterNode(_arr = nodes_list) { #region
|
function toCenterNode(_arr = nodes_list) {
|
||||||
if(!project.active) return;
|
if(!project.active) return;
|
||||||
|
|
||||||
|
graph_s = 1;
|
||||||
|
graph_s_to = 1;
|
||||||
|
|
||||||
if(array_empty(_arr)) {
|
if(array_empty(_arr)) {
|
||||||
graph_x = round(w / 2 / graph_s);
|
graph_x = round(w / 2 / graph_s);
|
||||||
graph_y = round(h / 2 / graph_s);
|
graph_y = round(h / 2 / graph_s);
|
||||||
|
@ -331,22 +334,30 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
||||||
|
|
||||||
for(var i = 0; i < array_length(_arr); i++) {
|
for(var i = 0; i < array_length(_arr); i++) {
|
||||||
var _node = _arr[i];
|
var _node = _arr[i];
|
||||||
if(!is_struct(_node) || !is_instanceof(_node, Node) || !_node.active)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
minx = min(_node.x - 32, minx);
|
if(!is_instanceof(_node, Node)) continue;
|
||||||
maxx = max(_node.x + _node.w + 32, maxx);
|
if(is_instanceof(_node, Node_Collection_Inline)) continue;
|
||||||
|
if(is_instanceof(_node, Node_Feedback_Inline)) continue;
|
||||||
|
if(!_node.active) continue;
|
||||||
|
|
||||||
miny = min(_node.y - 32, miny);
|
minx = min(minx, _node.x - 32);
|
||||||
maxy = max(_node.y + _node.h + 32, maxy);
|
maxx = max(maxx, _node.x + _node.w + 32);
|
||||||
|
|
||||||
|
miny = min(miny, _node.y - 32);
|
||||||
|
maxy = max(maxy, _node.y + _node.h + 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
graph_x = w / 2 / graph_s - (minx + maxx) / 2;
|
var cx = (minx + maxx) / 2;
|
||||||
graph_y = (h - toolbar_height) / 2 / graph_s - (miny + maxy) / 2;
|
var cy = (miny + maxy) / 2;
|
||||||
|
|
||||||
graph_x = round(graph_x);
|
graph_x = (w ) / 2 - cx;
|
||||||
graph_y = round(graph_y);
|
graph_y = (h - toolbar_height) / 2 - cy;
|
||||||
} #endregion
|
|
||||||
|
graph_x = round(graph_x * graph_s);
|
||||||
|
graph_y = round(graph_y * graph_s);
|
||||||
|
|
||||||
|
// print($"{cx}, {cy} / {graph_x}, {graph_y}");
|
||||||
|
}
|
||||||
|
|
||||||
function initSize() { toCenterNode(); } initSize();
|
function initSize() { toCenterNode(); } initSize();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue