summaryrefslogtreecommitdiffhomepage
path: root/editor/camera.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-10-19 12:42:58 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-10-19 12:44:33 +0200
commit05f95737829c56032fd1adf25441be31aed3c685 (patch)
treed2aafa01e6e38f806b0c5f629f90b9211e96dfb2 /editor/camera.cpp
parent82eaa0e0de3a6057dab9ac0b2864f576c6ce6d5b (diff)
aa
Diffstat (limited to 'editor/camera.cpp')
-rw-r--r--editor/camera.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/editor/camera.cpp b/editor/camera.cpp
index f9299a35..eb641c95 100644
--- a/editor/camera.cpp
+++ b/editor/camera.cpp
@@ -140,13 +140,11 @@ void app::update_cursor_tile(const Optional<Vector2i>& pixel)
auto tile = global_coords{coord.chunk(), coord.local(), _z_level};
cursor.tile = tile;
- constexpr auto eps = 1e-6f;
- constexpr auto m = TILE_SIZE2 * Vector2(1-eps, 1-eps);
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 = m * Vector2(curchunk[0] < 0 ? 1 + subpixel_[0] : subpixel_[0],
- curchunk[1] < 0 ? 1 + subpixel_[1] : subpixel_[1]);
+ auto subpixel = TILE_SIZE2 * Vector2(curchunk[0] < 0 ? 1 + subpixel_[0] : subpixel_[0],
+ curchunk[1] < 0 ? 1 + subpixel_[1] : subpixel_[1]);
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);