Skip to content

Commit

Permalink
Fix gfx drag preview not snapping to pixels
Browse files Browse the repository at this point in the history
  • Loading branch information
sirjuddington committed Dec 17, 2023
1 parent a3fd9c3 commit 23a6f57
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/UI/Canvas/GfxCanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
#include "Graphics/Translation.h"
#include "OpenGL/Drawing.h"
#include "OpenGL/GLTexture.h"
#include "UI/SBrush.h"
#include "UI/Controls/ZoomControl.h"
#include "UI/SBrush.h"
#include "Utility/MathStuff.h"

using namespace slade;
Expand Down Expand Up @@ -255,8 +255,8 @@ void GfxCanvas::drawImage()
drawing::drawTexture(tex_image_);

// Draw the dragged image
const auto off_x = static_cast<double>(drag_pos_.x - drag_origin_.x) / scale_;
const auto off_y = static_cast<double>(drag_pos_.y - drag_origin_.y) / scale_;
const auto off_x = static_cast<int>((drag_pos_.x - drag_origin_.x) / scale_);
const auto off_y = static_cast<int>((drag_pos_.y - drag_origin_.y) / scale_);
glTranslated(off_x, off_y, 0);
gl::setColour(255, 255, 255, 255, gl::Blend::Normal);
drawing::drawTexture(tex_image_);
Expand Down

0 comments on commit 23a6f57

Please sign in to comment.