From 5f46e3183643fc37d2d2a6c2dda5a7ba6259e62e Mon Sep 17 00:00:00 2001 From: Anshul Singhvi Date: Wed, 31 Jul 2019 20:26:56 +0530 Subject: [PATCH 1/4] slider & button docstring --- src/AbstractPlotting.jl | 1 + src/interaction/gui.jl | 30 ++++++++++++++++++++++-------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/AbstractPlotting.jl b/src/AbstractPlotting.jl index 7f56cd63e..849597105 100644 --- a/src/AbstractPlotting.jl +++ b/src/AbstractPlotting.jl @@ -129,6 +129,7 @@ export textslider # gui export slider, button, playbutton +export move! # Raymarching algorithms export RaymarchAlgorithm, IsoValue, Absorption, MaximumIntensityProjection, AbsorptionRGBA, IndexedAbsorptionRGBA diff --git a/src/interaction/gui.jl b/src/interaction/gui.jl index 290cc69d2..0d256f5b5 100644 --- a/src/interaction/gui.jl +++ b/src/interaction/gui.jl @@ -30,10 +30,17 @@ julia> -5:5 .|> exp .|> sig_printer sig_printer(v::Real) = @sprintf "%0.2e" v """ - Slider + slider(range; kwargs...) -TODO add function signatures -TODO add description +Creates a slider which slides through the selected range; sliders are discrete. +The Slider's value can be accessed through its `value` field. For example: + +```julia +scene = slider(1:10) +lift(scene[end].value) do val + # your function here +end +``` ## Theme $(ATTRIBUTES) @@ -166,13 +173,20 @@ function move!(x::Slider, idx::Integer) return end -export move! - """ - Button + button(text) -TODO add function signatures -TODO add description +Creates a button which can be clicked. +On click, the button increments its `clicks` field by one. + +For example: + +```julia +scene = button("click me please") +lift(scene[end].clicks) do clicks + # your function here +end +``` ## Theme $(ATTRIBUTES) From 72f588845a6634b3dd9e07ecebc8fc8d05dc3ac5 Mon Sep 17 00:00:00 2001 From: Anshul Singhvi Date: Wed, 31 Jul 2019 23:06:15 +0530 Subject: [PATCH 2/4] fix slider not working --- src/camera/camera2d.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/camera/camera2d.jl b/src/camera/camera2d.jl index 1e7026d86..5c480445a 100644 --- a/src/camera/camera2d.jl +++ b/src/camera/camera2d.jl @@ -19,7 +19,7 @@ function cam2d!(scene::SceneLike; kw_args...) area = node(:area, FRect(0, 0, 1, 1)), zoomspeed = 0.10f0, zoombutton = nothing, - panbutton = Mouse.left, + panbutton = Mouse.right, selectionbutton = (Keyboard.space, Mouse.left), padding = 0.001, last_area = Vec(size(scene)), From 419e559a391c8bef5d9b467ff3f0adb23a5a6feb Mon Sep 17 00:00:00 2001 From: Anshul Singhvi Date: Wed, 31 Jul 2019 23:12:01 +0530 Subject: [PATCH 3/4] change 2D pan trigger to ctrl-click --- src/camera/camera2d.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/camera/camera2d.jl b/src/camera/camera2d.jl index 5c480445a..354c52325 100644 --- a/src/camera/camera2d.jl +++ b/src/camera/camera2d.jl @@ -19,7 +19,7 @@ function cam2d!(scene::SceneLike; kw_args...) area = node(:area, FRect(0, 0, 1, 1)), zoomspeed = 0.10f0, zoombutton = nothing, - panbutton = Mouse.right, + panbutton = (Keyboard.ctrl, Mouse.left), selectionbutton = (Keyboard.space, Mouse.left), padding = 0.001, last_area = Vec(size(scene)), From fb3d2ad80cfe349039d7d295e76f85d116281a56 Mon Sep 17 00:00:00 2001 From: Anshul Singhvi Date: Wed, 31 Jul 2019 23:45:03 +0530 Subject: [PATCH 4/4] ctrl + lclick -> right --- src/camera/camera2d.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/camera/camera2d.jl b/src/camera/camera2d.jl index 354c52325..85dd7bb09 100644 --- a/src/camera/camera2d.jl +++ b/src/camera/camera2d.jl @@ -2,7 +2,7 @@ struct Camera2D <: AbstractCamera area::Node{FRect2D} zoomspeed::Node{Float32} zoombutton::Node{ButtonTypes} - panbutton::Node{ButtonTypes} + panbutton::Node{Union{ButtonTypes, Vector{ButtonTypes}}} padding::Node{Float32} last_area::Node{Vec{2, Int}} update_limits::Node{Bool} @@ -19,7 +19,7 @@ function cam2d!(scene::SceneLike; kw_args...) area = node(:area, FRect(0, 0, 1, 1)), zoomspeed = 0.10f0, zoombutton = nothing, - panbutton = (Keyboard.ctrl, Mouse.left), + panbutton = Mouse.right, selectionbutton = (Keyboard.space, Mouse.left), padding = 0.001, last_area = Vec(size(scene)),