tales / tales-client

Moved to https://gitlab.com/tales/tales-client
http://www.manasource.org/
GNU General Public License v2.0
13 stars 5 forks source link

Attribute rounding sometimes has a few too many digits #47

Closed Ablu closed 8 years ago

Ablu commented 8 years ago

screenshot_2015-09-27-08-08-24

See the movement speed value

bjorn commented 8 years ago

Strange, is this limiting of precision broken?

        AttributeLabel {
            name: qsTr("Movement speed")
            value: limitPrecision(playerAttributes.movementSpeed, 1)
        }
Ablu commented 8 years ago

See the fix. QML handeled this as typeof number which is a floating point number.

bjorn commented 8 years ago

Well, that's a funny fix. I understand that after the division, floating point inaccuracies may occur again, but why would toString() hide those inaccuracies while binding to the text of a label doesn't?

Ablu commented 8 years ago

Well if you print the number after the division it is still fine. It must be the string conversion somewhere in the qt quick engine. So I just do it in JavaScript.