-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using decimal step sizes in range #137
Comments
@PGimenez Does Quasar support it? If it does, then we can do it too... |
Yes, quasar does support it - so we can add it. |
Why do you want RangeData to contain steps? mutable struct RangeData{QRangeType}
min::QRangeType
max::QRangeType
end That does work. |
If you want to coerce the result to the step size you would need RangeData to contain upper bound, lower bound, step and lower range and upper range., e.g. struct RangeData{QRangeType}
min::QRangeType
max::QRangeType
step::QRangeType
range_min::QRangeType
range_max::QRangeType
end Then you can parse the result and round to the nearest step with a Stipple.convertvalue() routine. |
Would be nice to have this fixed before the next release... |
I'd probably go with the first version. |
There was some confusion about what a UnitRange is (on my end). It has a start and a stop field and doesn't contain any stepsize. That's correct and desired, because the step size is not transmitted, as stated already above. The problem was actually with the parser. Strangely, UnitRange(1.2, 3.4) is displayed as The title is a bit confusing, because the problem is not the decimal step size but the decimal min/max values. With the latest fixes the following app works correctly. @app begin
@in range = RangeData(0.0, 1.0)
@onchange range begin
@show range
end
end
ui() = range(0:0.1:1.0, :range)
@page("/", ui) Will be released soon. BTW, there are new ways to define RangeData: RangeData(min, max) # equivalent to RangeData(UnitRange(min, max))
RangeData(min:step:max) # coerce the max value to the least possible value with the given min and step size.
RangeData(min:max) # equivalent to RangeData(min:1:max) |
It seems it is not possible to have decimal range step size. Here's a MWE with what I've tried:
This is the HTML that's generated:
The
RangeData
type does not directly accept floats, so you have to pass aUnitRange
to it. However, the range does not work the browser and the console shows an error:On the other hand the
q-range
bound to theQRange
object does nothing, the handler is not triggered.The text was updated successfully, but these errors were encountered: