mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-17 13:20:45 +00:00
Fix Editor::screenToEditor() for sprite positions < (0,0)
This commit is contained in:
parent
9966b48139
commit
8e47e507fd
@ -1419,9 +1419,6 @@ void Editor::setZoomAndCenterInMouse(Zoom zoom,
|
||||
if (subpixelPos.x >= 0.5-t && subpixelPos.x <= 0.5+t) subpixelPos.x = 0.5;
|
||||
if (subpixelPos.y >= 0.5-t && subpixelPos.y <= 0.5+t) subpixelPos.y = 0.5;
|
||||
}
|
||||
|
||||
ASSERT(subpixelPos.x >= -1.0 && subpixelPos.x <= 1.0);
|
||||
ASSERT(subpixelPos.y >= -1.0 && subpixelPos.y <= 1.0);
|
||||
}
|
||||
|
||||
gfx::Point padding = calcExtraPadding(zoom);
|
||||
|
@ -22,11 +22,18 @@ namespace render {
|
||||
|
||||
double scale() const { return static_cast<double>(m_num) / static_cast<double>(m_den); }
|
||||
|
||||
int apply(int x) const { return x * m_num / m_den; }
|
||||
int remove(int x) const { return x * m_den / m_num; }
|
||||
template<typename T>
|
||||
T apply(T x) const {
|
||||
return x * m_num / m_den;
|
||||
}
|
||||
|
||||
double apply(double x) const { return x * m_num / m_den; }
|
||||
double remove(double x) const { return x * m_den / m_num; }
|
||||
template<typename T>
|
||||
T remove(T x) const {
|
||||
if (x < 0)
|
||||
return (x * m_den / m_num) - 1;
|
||||
else
|
||||
return (x * m_den / m_num);
|
||||
}
|
||||
|
||||
gfx::Rect apply(const gfx::Rect& r) const {
|
||||
return gfx::Rect(
|
||||
|
Loading…
x
Reference in New Issue
Block a user