Page 1 of 1

Bug with slider extent.

Posted: Mon Jul 19, 2010 19:27
by agamemnus
A horizontal Falagard slider:

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());

Re: Bug with slider extent.

Posted: Wed Jul 21, 2010 04:23
by agamemnus
I did manage to skirt this issue, for now, by removing the offsets from the thumb track area and moving the offsets to the main area, but it does cut off the slider image... barely noticeable in my case, though.

Re: Bug with slider extent.

Posted: Wed Jul 21, 2010 09:36
by CrazyEddie
I'll check it out, and get back to you, thanks.

CE.

Re: Bug with slider extent.

Posted: Tue Aug 10, 2010 12:09
by CrazyEddie
Ok, this one is fixed. branches/v0-7 @ r2587.

CE.

Re: Bug with slider extent.

Posted: Wed Aug 11, 2010 06:25
by agamemnus
Thanks... I'll try it out, soonish.