Skip to content
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

Open
PGimenez opened this issue Dec 11, 2024 · 5 comments
Open

Using decimal step sizes in range #137

PGimenez opened this issue Dec 11, 2024 · 5 comments

Comments

@PGimenez
Copy link
Member

PGimenez commented Dec 11, 2024

It seems it is not possible to have decimal range step size. Here's a MWE with what I've tried:

using GenieFramework
@genietools

@app begin
  @in range= RangeData(UnitRange(0.0,1.0))
  @in qrange= StippleUI.Ranges.QRange(0.0,0.1,1.0)
  @onchange range begin
    @show range
  end
  @onchange qrange begin
    @show qrange
  end
end
ui() = range(0:0.1:1.0,:range)*range(0:0.1:1.0,:qrange)

@page("/", ui)

This is the HTML that's generated:

<q-range :min=0.0 v-model="range" :max=1.0 :step=0.1>
</q-range><q-range :min=0.0 v-model="qrange" :max=1.0 :step=0.1></q-range>

The RangeDatatype does not directly accept floats, so you have to pass a UnitRangeto it. However, the range does not work the browser and the console shows an error:

CleanShot 2024-12-11 at 10 49 24

On the other hand the q-range bound to the QRange object does nothing, the handler is not triggered.

@essenciary
Copy link
Member

@PGimenez Does Quasar support it? If it does, then we can do it too...

@essenciary
Copy link
Member

Yes, quasar does support it - so we can add it.

@hhaensel
Copy link
Member

hhaensel commented Dec 20, 2024

Why do you want RangeData to contain steps?
Wouldn't it be sufficient to have

mutable struct RangeData{QRangeType}
    min::QRangeType
    max::QRangeType
end

That does work.

@hhaensel
Copy link
Member

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.

@hhaensel
Copy link
Member

hhaensel commented Jan 2, 2025

Would be nice to have this fixed before the next release...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants