Draw layer bounds and cels auto guides in the main tile position

This commit is contained in:
David Capello 2017-11-09 16:06:22 -03:00
parent 45a2f1e1e1
commit 1229d3700b

View File

@ -1051,7 +1051,10 @@ void Editor::drawCelGuides(ui::Graphics* g, const Cel* cel, const Cel* mouseCel)
// Use whole canvas // Use whole canvas
else { else {
sprCmpBounds = m_sprite->bounds(); sprCmpBounds = m_sprite->bounds();
scrCmpBounds = editorToScreen(sprCmpBounds).offset(gfx::Point(-bounds().origin())); scrCmpBounds =
editorToScreen(
gfx::Rect(sprCmpBounds).offset(mainTilePosition()))
.offset(gfx::Point(-bounds().origin()));
} }
const int midX = scrCelBounds.x+scrCelBounds.w/2; const int midX = scrCelBounds.x+scrCelBounds.w/2;
@ -1169,12 +1172,20 @@ void Editor::drawCelVGuide(ui::Graphics* g,
gfx::Rect Editor::getCelScreenBounds(const Cel* cel) gfx::Rect Editor::getCelScreenBounds(const Cel* cel)
{ {
gfx::Point mainOffset(mainTilePosition());
gfx::Rect layerEdges; gfx::Rect layerEdges;
if (m_layer->isReference()) { if (m_layer->isReference()) {
layerEdges = editorToScreenF(cel->boundsF()).offset(gfx::PointF(-bounds().origin())); layerEdges =
editorToScreenF(
gfx::RectF(cel->boundsF()).offset(mainOffset.x,
mainOffset.y))
.offset(gfx::PointF(-bounds().origin()));
} }
else { else {
layerEdges = editorToScreen(cel->bounds()).offset(-bounds().origin()); layerEdges =
editorToScreen(
gfx::Rect(cel->bounds()).offset(mainOffset))
.offset(-bounds().origin());
} }
return layerEdges; return layerEdges;
} }