diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2023-10-20 04:20:51 +0200 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-10-20 04:20:51 +0200 |
| commit | 9099eec2a638bcf61bf46e86740458d933197577 (patch) | |
| tree | dca1ae5c0f8fc89ebf55624b2988733d094af3bc /editor/camera.cpp | |
| parent | e8a7d188eb186204dc8d8e25aa732e14fac96594 (diff) | |
wip tests
Diffstat (limited to 'editor/camera.cpp')
| -rw-r--r-- | editor/camera.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/editor/camera.cpp b/editor/camera.cpp index 6dcaaa7d..42b81c82 100644 --- a/editor/camera.cpp +++ b/editor/camera.cpp @@ -142,9 +142,9 @@ void app::update_cursor_tile(const Optional<Vector2i>& pixel) const auto tile_ = Vector2(M->pixel_to_tile_(Vector2d(*pixel))); const auto curchunk = Vector2(tile.chunk()); - const auto subpixel_ = Vector2(std::fmod(tile_[0], 1.f), std::fmod(tile_[1], 1.f)); - auto subpixel = TILE_SIZE2 * Vector2(curchunk.x() < 0 ? 1 + subpixel_[0] : subpixel_[0], - curchunk.y() < 0 ? 1 + subpixel_[1] : subpixel_[1]); + const auto subpixel_ = Vector2(std::fmod(tile_.x(), 1.f), std::fmod(tile_.y(), 1.f)); + auto subpixel = TILE_SIZE2 * Vector2(curchunk.x() < 0 ? 1 + subpixel_.x() : subpixel_.x(), + curchunk.y() < 0 ? 1 + subpixel_.y() : subpixel_.y()); constexpr auto half_tile = Vector2(iTILE_SIZE2/2); subpixel -= half_tile; subpixel.x() = Math::clamp(std::round(subpixel.x()), -half_tile.x(), half_tile.x()-1); |
