I have no details, but i’d assume that current interaction is hard coded. As the code is largely uncommented, you should follow event processing in the backends.
I’m not sure how one would do this, but another common (and IMO useful) zoom for 2D plots is the “box zoom”: the user draws a rectangular box around the region of interest (by left clicking and dragging) and that region expands to take the whole space. Double-clicking brings it back to the original state: see Plotly for an example implementation. Not sure how easy/hard this is to implement and whether it should be a opt-in or default behavior (I tend to think this kind of things should be easy to access / default, as only advanced users will write code to customize mouse interaction).
and I do hope I wrote it in a way that it’s easily customizable… After all the camera is basically also just a recipe, which can be swapped out with your own code building up on the existing camera building blocks!
I think the “box zoom” code still needs some updating, I’m on master of AbstractPlotting and I get:
MethodError: no method matching ntuple(::getfield(AbstractPlotting, Symbol("##191#192")){Vec{2,Float32}}, ::Type{Val{2}})
Closest candidates are:
ntuple(::F, ::Integer) where F at tuple.jl:133
ntuple(::Any, ::Val{0}) at tuple.jl:155
ntuple(::Any, ::Val{1}) at tuple.jl:156
...
absrect(::GeometryTypes.HyperRectangle{2,Float32}) at /home/pietro/.julia/packages/AbstractPlotting/ZHerD/src/camera/camera2d.jl:143 31 2.8k 3d
Julia for live control of USB3.0 camera and DAC/ADC boards, with GUI? 1 Usage 11 208 5d
Too many ways to do the same thing in Julia 1 Usage 16 643 9d
Is it possible to override keyword arguments for specific types? 2
question
Usage 7 158 10d
There are 95 unread and 14 new topics remaining, or browse other topics in Visualization
sdanisch
Cool! Just two remarks:
I think the “box zoom” code still needs some updating, I’m on master of AbstractPlotting and I get:
MethodError: no method matching ntuple(::getfield(AbstractPlotting, Symbol("##191#192")){Vec{2,Float32}}, ::Type{Val{2}})
Closest candidates are:
ntuple(::F, ::Integer) where F at tuple.jl:133
ntuple(::Any, ::Val{0}) at tuple.jl:155
ntuple(::Any, ::Val{1}) at tuple.jl:156
...
absrect(::GeometryTypes.HyperRectangle{2,Float32}) at /home/pietro/.julia/packages/AbstractPlotting/ZHerD/src/camera/camera2d.jl:143
I think it’s important to have this easily customizable, esp. in the case of touch pad users. On many laptops there is a mechanism to block touch pad when typing so Space + Mouse Left is effectively disabled
I think it’s important to have this easily customizable, esp. in the case of touch pad users. On many laptops there is a mechanism to block touch pad when typing so Space + Mouse Left is effectively disabled
That’s why you can just change it It’s even themeable, so you can change it globally!
julia> p = scatter(rand(100), rand(100), cam2d = NT(selectionbutton=Mouse.left))
julia> p.theme[:cam2d].attributes
Dict{Symbol,Reactive.Signal} with 6 entries:
:padding => 5422: "padding" = 0.001 Any
:selectionbutton => 5421: "selectionbutton" = (space::Button = 32, left::Button = 0) Any
:zoomspeed => 5418: "zoomspeed" = 0.1 Any
:panbutton => 5420: "panbutton" = right Any
:area => 5417: "area" = GeometryTypes.HyperRectangle{2,Float32}(Float32[0.0, 0.0], Float32[1.0, 1.0]) Any
:zoombutton => 5419: "zoombutton" = nothing Any
But if I change it manually it works:
p.theme[:cam2d][:selectionbutton] = Mouse.left
But I think as soon as this is figured out, it definitely deserves a section in the docs, it’s really nice to be able to define custom interactive behavior at the single plot level or globally with a theme.