clip rendering of ScrollGroup to just the part of the canvas covered by the scroll group.
This stops tracks from appearing to scroll up under the rulers, among other things.
This commit is contained in:
parent
eec24b6287
commit
792fe016e7
@ -40,6 +40,8 @@ class LIBCANVAS_API ScrollGroup : public Group
|
||||
bool covers_canvas (Duple const& d) const;
|
||||
bool covers_window (Duple const& d) const;
|
||||
|
||||
void render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const;
|
||||
|
||||
private:
|
||||
ScrollSensitivity _scroll_sensitivity;
|
||||
Duple _scroll_offset;
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "pbd/compose.h"
|
||||
|
||||
#include "canvas/canvas.h"
|
||||
#include "canvas/debug.h"
|
||||
#include "canvas/scroll_group.h"
|
||||
|
||||
@ -38,6 +39,35 @@ ScrollGroup::ScrollGroup (Group* parent, Duple position, ScrollSensitivity s)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ScrollGroup::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
|
||||
{
|
||||
/* clip the draw to the area that this scroll group nominally occupies
|
||||
* WITHOUT scroll offsets in effect
|
||||
*/
|
||||
|
||||
boost::optional<Rect> r = bounding_box();
|
||||
|
||||
if (!r) {
|
||||
return;
|
||||
}
|
||||
|
||||
Rect self (_position.x, _position.y, _position.x + r.get().width(), _position.y + r.get().height());
|
||||
|
||||
self.x1 = min (_position.x + _canvas->width(), self.x1);
|
||||
self.y1 = min (_position.y + _canvas->height(), self.y1);
|
||||
|
||||
context->save ();
|
||||
context->rectangle (self.x0, self.y0, self.width(), self.height());
|
||||
context->clip ();
|
||||
|
||||
Group::render (area, context);
|
||||
|
||||
context->restore ();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
ScrollGroup::scroll_to (Duple const& d)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user