Author: rwhitcomb Date: Sat Feb 24 12:29:47 2018 New Revision: 1825229 URL: http://svn.apache.org/viewvc?rev=1825229&view=rev Log: PIVOT-1031: Properly use the stroke thickness to size the gauge drawing inside the bounding box (now that we fixed the demo to be able to see the varying thickness). Add a little padding to the demo.
Modified: pivot/trunk/tests/src/org/apache/pivot/tests/gauge_test.bxml pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraGaugeSkin.java Modified: pivot/trunk/tests/src/org/apache/pivot/tests/gauge_test.bxml URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/gauge_test.bxml?rev=1825229&r1=1825228&r2=1825229&view=diff ============================================================================== --- pivot/trunk/tests/src/org/apache/pivot/tests/gauge_test.bxml (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/gauge_test.bxml Sat Feb 24 12:29:47 2018 @@ -27,7 +27,7 @@ limitations under the License. <TablePane.Row height="-1"> <Border title="Speed" styles="{backgroundColor:10}"> <Gauge bxml:id="speedGauge" origin="SOUTH" type="Integer" minValue="0" maxValue="200" value="0" warningLevel="120" criticalLevel="180" - styles="{backgroundColor:10, criticalColor:23, font:{size:20}, thickness:10.0}"/> + styles="{backgroundColor:10, criticalColor:23, font:{size:20}, thickness:10.0, padding:4}"/> </Border> </TablePane.Row> <TablePane.Row height="-1"> Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraGaugeSkin.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraGaugeSkin.java?rev=1825229&r1=1825228&r2=1825229&view=diff ============================================================================== --- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraGaugeSkin.java (original) +++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraGaugeSkin.java Sat Feb 24 12:29:47 2018 @@ -146,8 +146,10 @@ public class TerraGaugeSkin<T extends Nu Dimensions size = gauge.getSize(); Origin origin = gauge.getOrigin(); + // The pen thickness is centered on the path, so we need to calculate the path diameter for the + // center of the stroke width (basically 1/2 the thickness on each side, or the thickness itself) float diameter = (float)(Math.min(size.width - padding.getWidth(), size.height - padding.getHeight())) - - (thickness * 2.0f); + - thickness; float x = ((float)size.width - diameter) / 2.0f; float y = ((float)size.height - diameter) / 2.0f;