mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-17 13:20:45 +00:00
Fix preview of certain tools in tiled mode (fix #2145)
Fixes #2145 and https://community.aseprite.org/t/3833 Regression introduced in: 6a88713213403179fb04938a99085e60bad7e873
This commit is contained in:
parent
1c68c25594
commit
3e391670b9
@ -2692,6 +2692,26 @@ void Editor::expandRegionByTiledMode(gfx::Region& rgn,
|
||||
}
|
||||
}
|
||||
|
||||
void Editor::collapseRegionByTiledMode(gfx::Region& rgn) const
|
||||
{
|
||||
auto canvasSize = this->canvasSize();
|
||||
rgn &= gfx::Region(gfx::Rect(canvasSize));
|
||||
|
||||
const int sprW = m_sprite->width();
|
||||
const int sprH = m_sprite->height();
|
||||
|
||||
gfx::Region newRgn;
|
||||
for (int v=0; v<canvasSize.h; v+=sprH) {
|
||||
for (int u=0; u<canvasSize.w; u+=sprW) {
|
||||
gfx::Region tmp(gfx::Rect(u, v, sprW, sprH));
|
||||
tmp &= rgn;
|
||||
tmp.offset(-u, -v);
|
||||
newRgn |= tmp;
|
||||
}
|
||||
}
|
||||
rgn = newRgn;
|
||||
}
|
||||
|
||||
bool Editor::isMovingPixels() const
|
||||
{
|
||||
return (dynamic_cast<MovingPixelsState*>(m_state.get()) != nullptr);
|
||||
|
@ -192,6 +192,7 @@ namespace app {
|
||||
gfx::Point mainTilePosition() const;
|
||||
void expandRegionByTiledMode(gfx::Region& rgn,
|
||||
const bool withProj) const;
|
||||
void collapseRegionByTiledMode(gfx::Region& rgn) const;
|
||||
|
||||
// Changes the scroll to see the given point as the center of the editor.
|
||||
void centerInSpritePoint(const gfx::Point& spritePos);
|
||||
|
@ -279,8 +279,11 @@ public:
|
||||
for (auto e : UIContext::instance()->getAllEditorsIncludingPreview(m_document)) {
|
||||
gfx::Region viewportRegion;
|
||||
e->getDrawableRegion(viewportRegion, Widget::kCutTopWindows);
|
||||
for (auto rc : viewportRegion)
|
||||
allVisibleRgn |= gfx::Region(e->screenToEditor(rc).inflate(1, 1));
|
||||
for (auto rc : viewportRegion) {
|
||||
gfx::Region subrgn(e->screenToEditor(rc).inflate(1, 1));
|
||||
e->collapseRegionByTiledMode(subrgn);
|
||||
allVisibleRgn |= subrgn;
|
||||
}
|
||||
}
|
||||
|
||||
rgn &= allVisibleRgn;
|
||||
|
Loading…
x
Reference in New Issue
Block a user