Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Conversation

@crabmusket
Copy link

Previously, the call to toFixed would turn numbers into strings, which was playing havoc with models bound to <input type="number"> elements.

Previously, the call to toFixed would turn numbers into strings, which
was playing havoc with models bound to <input type="number"> elements.
@crabmusket
Copy link
Author

Just realised this is an incorrect solution! I'll rebase the commit, but I'm actually stumped as to what solution you'd prefer. The problem is the toFixed call in roundStep. It results in a string, which is bad. However, it also allows the values bound to the bubbles (in, e.g., "translate({value: #{refLow}})") to have a fixed precision, which is good. I think the correct solution is to perform the rounding just before translation.

@crabmusket
Copy link
Author

I've ended up rewriting the default translation function:

scope.translate = (value) -> value.value?.toString()

This means that a provided translate function is responsible for ensuring it returns a string. This doesn't handle rounding, but I think that could be accomplished in this way, instead of calling toString.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant