1
0
Fork 0

CanvasWidget: add auto-viewport property.

The auto-viewport property allows to disable automatic
update of the canvas viewport update upon resizing
the PUI canvas widget.
This commit is contained in:
Thomas Geymayer 2013-02-25 15:30:01 +01:00
parent 3a1709b31a
commit 045fc5b4ae
2 changed files with 10 additions and 3 deletions

View file

@ -29,7 +29,8 @@ CanvasWidget::CanvasWidget( int x, int y,
puObject(x, y, width, height),
_canvas_mgr( dynamic_cast<CanvasMgr*>(globals->get_subsystem("Canvas")) ),
_last_x(0),
_last_y(0)
_last_y(0),
_auto_viewport( props->getBoolValue("auto-viewport", true) )
{
if( !_canvas_mgr )
{
@ -185,8 +186,11 @@ void CanvasWidget::setSize(int w, int h)
{
puObject::setSize(w, h);
_canvas->getProps()->setIntValue("view[0]", w);
_canvas->getProps()->setIntValue("view[1]", h);
if( _auto_viewport )
{
_canvas->getProps()->setIntValue("view[0]", w);
_canvas->getProps()->setIntValue("view[1]", h);
}
}
//------------------------------------------------------------------------------

View file

@ -40,6 +40,9 @@ class CanvasWidget:
float _last_x,
_last_y;
bool _auto_viewport; //!< Set true to get the canvas view dimensions
// automatically resized if the size of the widget
// changes.
static SGPropertyNode_ptr _time,
_view_height;