1
0
Fork 0

canvas: update for new bounding box getters.

This commit is contained in:
Thomas Geymayer 2014-03-31 13:34:50 +02:00
parent 548a9741f5
commit a5401c19c7
2 changed files with 3 additions and 18 deletions

View file

@ -245,27 +245,12 @@ var Element = {
# @param color Vector of 3 or 4 values in [0, 1]
setColorFill: func me.set('fill', _getColor(arg)),
#
getBoundingBox: func()
{
var bb = me._node.getNode("bounding-box");
if( bb != nil )
{
var min_x = bb.getNode("min-x").getValue();
if( min_x != nil )
return [ min_x,
bb.getNode("min-y").getValue(),
bb.getNode("max-x").getValue(),
bb.getNode("max-y").getValue() ];
}
return [0, 0, 0, 0];
},
getTransformedBounds: func me.getTightBoundingBox(),
# Calculate the transformation center based on bounding box and center-offset
updateCenter: func
{
me.update();
var bb = me.getTransformedBounds();
var bb = me.getTightBoundingBox();
if( bb[0] > bb[2] or bb[1] > bb[3] )
return;

View file

@ -44,7 +44,7 @@ gui.widgets.ScrollArea = {
update: func()
{
# TODO only update on content resize
var bb = me.getContent().getTransformedBounds();
var bb = me.getContent().getTightBoundingBox();
if( bb[2] < bb[0] or bb[3] < bb[1] )
# Do nothing with invalid bounding box (probably no content yet)