Skip to content

Commit

Permalink
fix #16
Browse files Browse the repository at this point in the history
(cherry picked from commit b2a6831)
  • Loading branch information
dmandrioli committed Jun 4, 2014
1 parent 5940057 commit 383a47f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 31 deletions.
44 changes: 13 additions & 31 deletions RectangularGauge.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,46 +116,28 @@ define(["dojo/_base/declare", "./GaugeBase", "dojox/gfx/matrix"], function(decla
// tags:
// private
if(elements.length == 0){
return {
x: 0,
y: 0,
w: 0,
h: 0
};
return {x: 0, y: 0, w: 0, h: 0};
}
var res = {
x: -Infinity,
y: -Infinity,
w: 0,
h: 0
};
var bbox = null;
var minX, minY, maxX, maxY;
minX = minY = +Infinity;
maxX = maxY = -Infinity;
for(var i = 0; i < elements.length; i++){
bbox = this._computeBoundingBox(elements[i]._gfxGroup);
if(!bbox){
continue;
if(minX > bbox.x){
minX = bbox.x;
}
if(res.x < bbox.x){
res.x = bbox.x;
if(minY > bbox.y){
minY = bbox.y;
}
if(res.w < bbox.width){
res.w = bbox.width;
if(maxX < bbox.x + bbox.width){
maxX = bbox.x + bbox.width;
}
if(res.y < bbox.y){
res.y = bbox.y;
if(maxY < bbox.y + bbox.height){
maxY = bbox.y + bbox.height;
}
if(res.h < bbox.height){
res.h = bbox.height;
}
}
if(res.x == -Infinity){
res.x = 0;
}
if(res.y == -Infinity){
res.y = 0;
}

return res;
return {x: minX, y:minY, w: maxX-minX, h: maxY-minY};
},

refreshRendering: function(){
Expand Down
1 change: 1 addition & 0 deletions tests/gauges/SimpleRectangularGauge.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ define(["dojo/_base/lang", "dojo/_base/declare", "dojox/dgauges/RectangularGauge
}),
labelPosition: "trailing",
paddingTop: 15

});
this.addElement("scale", scale);

Expand Down

0 comments on commit 383a47f

Please sign in to comment.