Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion comfy-ldtk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,13 @@ impl LdtkLayerExtensions for LayerInstance {

fn px_to_world(&self, position: Vec2) -> Vec2 {
let grid = self.grid_size as f32;
let px_offset_x = self.px_total_offset_x as f32;
let px_offset_y = self.px_total_offset_y as f32;

vec2(position.x / grid, self.c_hei as f32 - position.y / grid - 1.0)
vec2(
(position.x + px_offset_x) / grid,
self.c_hei as f32 - (position.y + px_offset_y) / grid - 1.0,
)
}
}

Expand Down