Skip to content

Commit

Permalink
Merge branch 'master' into ff/lighting
Browse files Browse the repository at this point in the history
  • Loading branch information
ffreyer committed Oct 10, 2023
2 parents d05dde4 + ce5c214 commit 15daec1
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
- Refactored the `SurfaceLike` family of traits into `VertexBasedGrid`, `CellBasedGrid` and `ImageLike`. [#3106](https://github.com/MakieOrg/Makie.jl/pull/3106)
- Added `shading = :verbose` in GLMakie to allow for multiple light sources. Also added more light types, fixed light directions for the previous lighting model (now `shading = :fast`) and adjusted `backlight` to affect normals. [#3246](https://github.com/MakieOrg/Makie.jl/pull/3246)

- Fixed a bug where Axis still consumes scroll events when interactions are disabled [#3272](https://github.com/MakieOrg/Makie.jl/pull/3272)

## v0.19.11

- Setup automatic colorbars for volumeslices [#3253](https://github.com/MakieOrg/Makie.jl/pull/3253).
Expand Down
4 changes: 2 additions & 2 deletions src/makielayout/blocks/axis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ function register_events!(ax, scene)

on(scene, evs.scroll) do s
if is_mouseinside(scene)
scrollevents[] = ScrollEvent(s[1], s[2])
return Consume(true)
result = setindex!(scrollevents, ScrollEvent(s[1], s[2]))
return Consume(result)
end
return Consume(false)
end
Expand Down
43 changes: 43 additions & 0 deletions test/events.jl
Original file line number Diff line number Diff line change
Expand Up @@ -440,4 +440,47 @@ Base.:(==)(l::Or, r::Or) = l.left == r.left && l.right == r.right
@test eventlog[7].px == Point2f(400, 400)
empty!(eventlog)
end

# TODO: test more
@testset "Axis Interactions" begin
f = Figure(resolution = (400, 400))
a = Axis(f[1, 1])
e = events(f)

names = (:rectanglezoom, :dragpan, :limitreset, :scrollzoom)
@test keys(a.interactions) == Set(names)

types = (Makie.RectangleZoom, Makie.DragPan, Makie.LimitReset, Makie.ScrollZoom)
for (name, type) in zip(names, types)
@test a.interactions[name][1] == true
@test a.interactions[name][2] isa type
end

blocked = Observable(true)
on(x -> blocked[] = false, e.scroll, priority = typemin(Int))

@assert !is_mouseinside(a.scene)
e.scroll[] = (0.0, 0.0)
@test !blocked[]
blocked[] = true
e.scroll[] = (0.0, 1.0)
@test !blocked[]

blocked[] = true
e.mouseposition[] = (200, 200)
e.scroll[] = (0.0, 0.0)
@test blocked[] # TODO: should it block?
blocked[] = true
e.scroll[] = (0.0, 1.0)
@test blocked[]

deactivate_interaction!.((a,), names)

blocked[] = true
e.scroll[] = (0.0, 0.0)
@test !blocked[]
blocked[] = true
e.scroll[] = (0.0, 1.0)
@test !blocked[]
end
end

0 comments on commit 15daec1

Please sign in to comment.