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

range and RangeData in Range.jl #4

Open
hhaensel opened this issue Sep 3, 2020 · 3 comments
Open

range and RangeData in Range.jl #4

hhaensel opened this issue Sep 3, 2020 · 3 comments
Assignees

Comments

@hhaensel
Copy link
Member

hhaensel commented Sep 3, 2020

Some comments on Range.jl

  • The function name range() collides with Base.range(). Why not renaming it to rangeslider() (similar to plotly)?
  • You may want to rename the module to Slider.jl
  • Why do you use UnitRange for RangeData? Are you aware that stop is modified by the colon operator to have a spacing of 1?
julia> ur = UnitRange(2.3, 3.7)
2.3:3.3
julia> ur.stop
3.3
@hhaensel
Copy link
Member Author

hhaensel commented Sep 3, 2020

I currently don't see where you need it, but the respective functions using RangeData should probably be modified to look like

function Stipple.render(rd::AbstractRange{T}, fieldname::Union{Symbol,Nothing} = nothing) where {T,R}
  Dict(:min => first(rd), :max => last(rd), :step => step(rd))
end

function Base.parse(::Type{AbstractRange{T}}, d::Dict) where T <: Real
  st = get(d, "step", 1)
  d["min"]:step:d["max"]
end

@essenciary
Copy link
Member

@hhaensel Sorry, somehow this slipped through.

I'd rather be more tempted to specialize Base.range with our own method.

I can't remember exactly why I went with the custom UnitRange, but there was an issue with using Julia's ranges.

The changes in render and parse would not be needed as the step is not outputted in the Vue model, only in the HTML:
https://quasar.dev/vue-components/range#With-step

@essenciary essenciary self-assigned this Oct 16, 2020
@hhaensel
Copy link
Member Author

I think this is solved, right?

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

No branches or pull requests

2 participants