mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 14:36:13 +01:00
- [Pack Sprite] Fix error when packing array containing invalid surfaces.
This commit is contained in:
parent
94853648c7
commit
6d352c7c71
2 changed files with 15 additions and 6 deletions
|
@ -58,17 +58,21 @@ function Node_Pack_Sprites(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
||||||
|
|
||||||
if(!is_array(_inpt) || array_length(_inpt) == 0) return;
|
if(!is_array(_inpt) || array_length(_inpt) == 0) return;
|
||||||
|
|
||||||
var _rects = [];
|
var _rects = [], _ind = 0;
|
||||||
|
|
||||||
for( var i = 0, n = array_length(_inpt); i < n; i++ ) {
|
for( var i = 0, n = array_length(_inpt); i < n; i++ ) {
|
||||||
var s = _inpt[i];
|
var s = _inpt[i];
|
||||||
if(!is_surface(s)) continue;
|
if(!is_surface(s)) continue;
|
||||||
|
|
||||||
_rects[i] = new SurfaceAtlas(s);
|
_rects[_ind] = new SurfaceAtlas(s);
|
||||||
_rects[i].w = surface_get_width_safe(s) + _spac * 2;
|
_rects[_ind].w = surface_get_width_safe(s) + _spac * 2;
|
||||||
_rects[i].h = surface_get_height_safe(s) + _spac * 2;
|
_rects[_ind].h = surface_get_height_safe(s) + _spac * 2;
|
||||||
|
|
||||||
|
_ind++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
array_resize(_rects, _ind);
|
||||||
|
|
||||||
var pack;
|
var pack;
|
||||||
|
|
||||||
switch(_algo) {
|
switch(_algo) {
|
||||||
|
|
|
@ -1095,9 +1095,11 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
||||||
|
|
||||||
#region ++++++++++++ interaction ++++++++++++
|
#region ++++++++++++ interaction ++++++++++++
|
||||||
if(mouse_on_graph && pHOVER) {
|
if(mouse_on_graph && pHOVER) {
|
||||||
if(mouse_press(mb_left, _focus)) nodes_select_anchor = noone;
|
|
||||||
|
|
||||||
#region select
|
#region select
|
||||||
|
var _anc = nodes_select_anchor;
|
||||||
|
if(mouse_press(mb_left, _focus)) _anc = noone;
|
||||||
|
|
||||||
if(NODE_DROPPER_TARGET != noone && node_hovering) {
|
if(NODE_DROPPER_TARGET != noone && node_hovering) {
|
||||||
node_hovering.draw_droppable = true;
|
node_hovering.draw_droppable = true;
|
||||||
if(mouse_press(mb_left, NODE_DROPPER_TARGET_CAN)) {
|
if(mouse_press(mb_left, NODE_DROPPER_TARGET_CAN)) {
|
||||||
|
@ -1160,13 +1162,16 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
||||||
if(!hover_selected)
|
if(!hover_selected)
|
||||||
nodes_selecting = [ node_hovering ];
|
nodes_selecting = [ node_hovering ];
|
||||||
|
|
||||||
nodes_select_anchor = nodes_select_anchor == node_hovering? noone : node_hovering;
|
if(array_length(nodes_selecting) > 1)
|
||||||
|
_anc = nodes_select_anchor == node_hovering? noone : node_hovering;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(WIDGET_CURRENT) WIDGET_CURRENT.deactivate();
|
if(WIDGET_CURRENT) WIDGET_CURRENT.deactivate();
|
||||||
array_foreach(nodes_selecting, function(node) { bringNodeToFront(node); });
|
array_foreach(nodes_selecting, function(node) { bringNodeToFront(node); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nodes_select_anchor = _anc;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
if(mouse_press(mb_right, _focus)) { #region
|
if(mouse_press(mb_right, _focus)) { #region
|
||||||
|
|
Loading…
Reference in a new issue