mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-26 03:28:12 +08:00
Fixed rectangle box pack bounds
This commit is contained in:
committed by
Keavon Chambers
parent
fa3e6eeca9
commit
c78d07eeb0
@@ -857,6 +857,7 @@ async fn box_pack(
|
|||||||
// Add padding to the item size
|
// Add padding to the item size
|
||||||
let item_width = size.x + padding;
|
let item_width = size.x + padding;
|
||||||
let item_height = size.y + padding;
|
let item_height = size.y + padding;
|
||||||
|
let instance_size = DVec2::new(item_width, item_height);
|
||||||
|
|
||||||
// Check if we need to move to the next row
|
// Check if we need to move to the next row
|
||||||
if current_x + item_width > container_origin.x + container_size.x {
|
if current_x + item_width > container_origin.x + container_size.x {
|
||||||
@@ -884,7 +885,7 @@ async fn box_pack(
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Create a new transform that positions the instance correctly
|
// Create a new transform that positions the instance correctly
|
||||||
let new_transform = DAffine2::from_translation(position + instance_center);
|
let new_transform = DAffine2::from_translation(position - instance_center + instance_size * 0.5);
|
||||||
|
|
||||||
// Add to the result
|
// Add to the result
|
||||||
let pushed = result.push(instance);
|
let pushed = result.push(instance);
|
||||||
|
|||||||
Reference in New Issue
Block a user