mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-01 01:20:25 +00:00
Show symmetry lines in the main tile
This commit is contained in:
parent
1229d3700b
commit
ee3ade44b8
@ -781,8 +781,8 @@ void Editor::drawSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& _rc)
|
||||
if (x > 0) {
|
||||
gfx::Color color = color_utils::color_for_ui(m_docPref.grid.color());
|
||||
g->drawVLine(color,
|
||||
spriteRect.x + int(m_proj.applyX<double>(x)),
|
||||
enclosingRect.y + mainTilePosition().y,
|
||||
spriteRect.x + m_proj.applyX(mainTilePosition().x) + int(m_proj.applyX<double>(x)),
|
||||
enclosingRect.y,
|
||||
enclosingRect.h);
|
||||
}
|
||||
}
|
||||
@ -791,8 +791,8 @@ void Editor::drawSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& _rc)
|
||||
if (y > 0) {
|
||||
gfx::Color color = color_utils::color_for_ui(m_docPref.grid.color());
|
||||
g->drawHLine(color,
|
||||
enclosingRect.x + mainTilePosition().x,
|
||||
spriteRect.y + int(m_proj.applyY<double>(y)),
|
||||
enclosingRect.x,
|
||||
spriteRect.y + m_proj.applyY(mainTilePosition().y) + int(m_proj.applyY<double>(y)),
|
||||
enclosingRect.w);
|
||||
}
|
||||
}
|
||||
|
@ -177,6 +177,7 @@ namespace app {
|
||||
// Returns the visible area of the active sprite.
|
||||
gfx::Rect getVisibleSpriteBounds();
|
||||
|
||||
gfx::Size canvasSize() const;
|
||||
gfx::Point mainTilePosition() const;
|
||||
|
||||
// Changes the scroll to see the given point as the center of the editor.
|
||||
@ -324,7 +325,6 @@ namespace app {
|
||||
void drawOneSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& rc, int dx, int dy);
|
||||
|
||||
gfx::Point calcExtraPadding(const render::Projection& proj);
|
||||
gfx::Size canvasSize() const;
|
||||
|
||||
void invalidateIfActive();
|
||||
bool showAutoCelGuides();
|
||||
|
@ -981,8 +981,11 @@ bool StandbyState::Decorator::getSymmetryHandles(Editor* editor, Handles& handle
|
||||
const auto& symmetry = Preferences::instance().document(editor->document()).symmetry;
|
||||
auto mode = symmetry.mode();
|
||||
if (mode != app::gen::SymmetryMode::NONE) {
|
||||
gfx::RectF spriteBounds = gfx::RectF(editor->sprite()->bounds());
|
||||
gfx::RectF editorViewport = gfx::RectF(View::getView(editor)->viewportBounds());
|
||||
gfx::Rect mainTileBounds(editor->mainTilePosition(),
|
||||
editor->sprite()->bounds().size());
|
||||
gfx::Rect canvasBounds(gfx::Point(0, 0),
|
||||
editor->canvasSize());
|
||||
gfx::RectF editorViewport(View::getView(editor)->viewportBounds());
|
||||
skin::SkinTheme* theme = static_cast<skin::SkinTheme*>(ui::get_theme());
|
||||
she::Surface* part = theme->parts.transformationHandle()->bitmap(0);
|
||||
|
||||
@ -990,9 +993,9 @@ bool StandbyState::Decorator::getSymmetryHandles(Editor* editor, Handles& handle
|
||||
double pos = symmetry.xAxis();
|
||||
gfx::PointF pt1, pt2;
|
||||
|
||||
pt1 = gfx::PointF(spriteBounds.x+pos, spriteBounds.y);
|
||||
pt1 = gfx::PointF(mainTileBounds.x+pos, canvasBounds.y);
|
||||
pt1 = editor->editorToScreenF(pt1);
|
||||
pt2 = gfx::PointF(spriteBounds.x+pos, spriteBounds.y+spriteBounds.h);
|
||||
pt2 = gfx::PointF(mainTileBounds.x+pos, canvasBounds.y2());
|
||||
pt2 = editor->editorToScreenF(pt2);
|
||||
pt1.y = std::max(pt1.y-part->height(), editorViewport.y);
|
||||
pt2.y = std::min(pt2.y, editorViewport.point2().y-part->height());
|
||||
@ -1011,9 +1014,9 @@ bool StandbyState::Decorator::getSymmetryHandles(Editor* editor, Handles& handle
|
||||
double pos = symmetry.yAxis();
|
||||
gfx::PointF pt1, pt2;
|
||||
|
||||
pt1 = gfx::PointF(spriteBounds.x, spriteBounds.y+pos);
|
||||
pt1 = gfx::PointF(canvasBounds.x, mainTileBounds.y+pos);
|
||||
pt1 = editor->editorToScreenF(pt1);
|
||||
pt2 = gfx::PointF(spriteBounds.x+spriteBounds.w, spriteBounds.y+pos);
|
||||
pt2 = gfx::PointF(canvasBounds.x2(), mainTileBounds.y+pos);
|
||||
pt2 = editor->editorToScreenF(pt2);
|
||||
pt1.x = std::max(pt1.x-part->width(), editorViewport.x);
|
||||
pt2.x = std::min(pt2.x, editorViewport.point2().x-part->width());
|
||||
|
Loading…
x
Reference in New Issue
Block a user