Skip to content

Commit

Permalink
Finish implementation of downsampling slider, #219
Browse files Browse the repository at this point in the history
This time with a test :)
  • Loading branch information
fonsp committed Feb 15, 2023
1 parent 4f9a89c commit 62abfac
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PlutoUI"
uuid = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
authors = ["Fons van der Plas <[email protected]>"]
version = "0.7.49"
version = "0.7.50"

[deps]
AbstractPlutoDingetjes = "6e696c72-6542-2067-7265-42206c756150"
Expand Down
4 changes: 2 additions & 2 deletions src/Builtins.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### A Pluto.jl notebook ###
# v0.19.14
# v0.19.18

using Markdown
using InteractiveUtils
Expand Down Expand Up @@ -156,7 +156,7 @@ begin

function Slider(values::AbstractVector{T}; default=missing, show_value=false, max_steps=1_000) where T
new_values = downsample(values, max_steps)
Slider(values, (default === missing) ? first(new_values) : let
Slider(new_values, (default === missing) ? first(new_values) : let
d = default
d new_values ? convert(T, d) : closest(new_values, d)
end, show_value)
Expand Down
9 changes: 6 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,13 @@ transform(el, x) = AbstractPlutoDingetjes.Bonds.transform_value(el, x)
max_downsample_time = 0.001 # seconds
# this should take less than 0.1ms
@test max_downsample_time >= @elapsed PlutoUI.BuiltinsNotebook.downsample(x3, 100)




x4 = 1:9802439083
el = Slider(x4; default=2, show_value=true)

@test length(el.values) <= 1000
@test default(el) == 1

el = Scrubbable(60)
@test default(el) === 60
el = Scrubbable(60.0)
Expand Down

2 comments on commit 62abfac

@fonsp
Copy link
Member Author

@fonsp fonsp commented on 62abfac Feb 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/77721

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.7.50 -m "<description of version>" 62abfacb8ed1d6683eaaddc6095d249ec32b7952
git push origin v0.7.50

Please sign in to comment.