Code: Select all
// pixel extent of total available area the thumb moves in
float slideExtent = area.getWidth() - theThumb->getPixelSize().d_width;
// calculate value represented by current thumb position
float thumbValue = (theThumb->getXPosition().asAbsolute(w->getPixelSize().d_width) - area.d_left) / (slideExtent / w->getMaxValue());
This does not take into account the thumb track area parameters; the logical and physical extent slider extent and value are the same. This isn't correct.
Code: Select all
<NamedArea name="ThumbTrackArea">
<Area>
<Dim type="LeftEdge"><AbsoluteDim value="3"/></Dim>
<Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
<Dim type="RightEdge" >
<UnifiedDim scale="1.0" type="RightEdge">
<DimOperator op="Subtract"><AbsoluteDim value="3" /></DimOperator>
</UnifiedDim>
</Dim>
<Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
</Area>
</NamedArea>
With this, the minimum slider value is 3. However, the logical minimum value should (theoretically) always be 0.
I don't know how get the values of ThumbTrackArea in code, but this is (I think) the theoretical code: (should also apply to the vertical slider)
Code: Select all
// pixel extent of total available area the thumb moves in
float slideExtent = area.getWidth() - theThumb->getPixelSize().d_width - ThumbTrackArea.leftEdgeInPixels() - (area.getWidth() - ThumbTrackArea.rightEdgeInPixels());
// calculate value represented by current thumb position
float thumbValue = (theThumb->getXPosition().asAbsolute(w->getPixelSize().d_width) - area.d_left - ThumbTrackArea.leftEdgeInPixels() ) / (slideExtent / w->getMaxValue());