Fix clipboard range feedback in Timeline when we copy layers/frames

kCels were already working, but the clipping was not correct
when the clipboard range type was kLayers or kFrames.
This commit is contained in:
David Capello 2018-03-29 16:21:43 -03:00
parent fac3574d02
commit bf0e5db391
2 changed files with 14 additions and 8 deletions

View File

@ -1791,7 +1791,7 @@ void Timeline::drawClipboardRange(ui::Graphics* g)
if (!m_clipboard_timer.isRunning())
m_clipboard_timer.start();
IntersectClip clip(g, getCelsBounds());
IntersectClip clip(g, getRangeClipBounds(clipboard_range));
if (clip) {
CheckedDrawMode checked(g, m_offset_count,
gfx::rgba(0, 0, 0, 255),
@ -2346,13 +2346,7 @@ void Timeline::drawRangeOutline(ui::Graphics* g)
{
auto& styles = skinTheme()->styles;
gfx::Rect clipBounds;
switch (m_range.type()) {
case Range::kCels: clipBounds = getCelsBounds(); break;
case Range::kFrames: clipBounds = getFrameHeadersBounds(); break;
case Range::kLayers: clipBounds = getLayerHeadersBounds(); break;
}
IntersectClip clip(g, clipBounds.enlarge(outlineWidth()));
IntersectClip clip(g, getRangeClipBounds(m_range).enlarge(outlineWidth()));
if (!clip)
return;
@ -2703,6 +2697,17 @@ gfx::Rect Timeline::getRangeBounds(const Range& range) const
return rc;
}
gfx::Rect Timeline::getRangeClipBounds(const Range& range) const
{
gfx::Rect clipBounds;
switch (range.type()) {
case Range::kCels: clipBounds = getCelsBounds(); break;
case Range::kFrames: clipBounds = getFrameHeadersBounds(); break;
case Range::kLayers: clipBounds = getLayerHeadersBounds(); break;
}
return clipBounds;
}
void Timeline::invalidateHit(const Hit& hit)
{
if (hit.band >= 0) {

View File

@ -261,6 +261,7 @@ namespace app {
gfx::Rect getCelsBounds() const;
gfx::Rect getPartBounds(const Hit& hit) const;
gfx::Rect getRangeBounds(const Range& range) const;
gfx::Rect getRangeClipBounds(const Range& range) const;
void invalidateHit(const Hit& hit);
void invalidateLayer(const Layer* layer);
void invalidateFrame(const frame_t frame);