Skip to content

Commit

Permalink
Merge branch 'master' into as/cairomesh2d
Browse files Browse the repository at this point in the history
  • Loading branch information
ffreyer authored Oct 17, 2024
2 parents 952ad87 + c4e9eae commit 5e9f839
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Install Julia
uses: julia-actions/setup-julia@v2
with:
version: '1.10'
version: '1'
- uses: julia-actions/cache@v2
- name: Build and deploy docs
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
matrix:
version:
- '1.6'
- '1.10'
- '1'
os:
- ubuntu-20.04
arch:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/compilation-benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: sudo apt-get update && sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev
- uses: julia-actions/setup-julia@v2
with:
version: '1.10'
version: '1'
arch: x64
- uses: julia-actions/cache@v2
- name: Benchmark
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/reference_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
matrix:
version:
- '1.6'
- '1.10'
- '1'
os:
- ubuntu-20.04
arch:
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
matrix:
version:
- '1.6'
- '1.10'
- '1'
os:
- ubuntu-20.04
arch:
Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:
matrix:
version:
- '1.6'
- '1.10'
- '1'
os:
- ubuntu-20.04
arch:
Expand Down Expand Up @@ -172,15 +172,15 @@ jobs:
steps:
- uses: actions/download-artifact@v4
with:
name: ReferenceImages_WGLMakie_1.10
name: ReferenceImages_WGLMakie_1
path: ./ReferenceImages/WGLMakie
- uses: actions/download-artifact@v4
with:
name: ReferenceImages_CairoMakie_1.10
name: ReferenceImages_CairoMakie_1
path: ./ReferenceImages/CairoMakie
- uses: actions/download-artifact@v4
with:
name: ReferenceImages_GLMakie_1.10
name: ReferenceImages_GLMakie_1
path: ./ReferenceImages/GLMakie
- name: Consolidate reference image folders
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rprmakie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.10'
- '1'
os:
- ubuntu-20.04
arch:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Changed image, heatmap and surface picking indices to correctly index the relevant matrix arguments. [#4459](https://github.com/MakieOrg/Makie.jl/pull/4459)
- Improved performance of `record` by avoiding unnecessary copying in common cases [#4475](https://github.com/MakieOrg/Makie.jl/pull/4475).
- Fix usage of `AggMean()` and other aggregations operating on 3d data for `datashader` [#4346](https://github.com/MakieOrg/Makie.jl/pull/4346).
- Changed default for `circular_rotation` in Camera3D to false, so that the camera doesn't change rotation direction anymore [4492](https://github.com/MakieOrg/Makie.jl/pull/4492)
- Fixed `pick(scene, rect2)` in WGLMakie [#4488](https://github.com/MakieOrg/Makie.jl/pull/4488)

## [0.21.14] - 2024-10-11
Expand Down
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ ImageIO = "0.5, 0.6"
InteractiveUtils = "1.0, 1.6"
Interpolations = "0.14, 0.15.1"
IntervalSets = "0.3, 0.4, 0.5, 0.6, 0.7"
InverseFunctions = "0.1"
Isoband = "0.1"
KernelDensity = "0.5, 0.6"
LaTeXStrings = "1.2"
Expand All @@ -101,7 +102,7 @@ MathTeXEngine = "0.5, 0.6"
Observables = "0.5.5"
OffsetArrays = "1"
Packing = "0.5"
PlotUtils = "1"
PlotUtils = "1.4.2"
PolygonOps = "0.1.1"
PrecompileTools = "1.0"
Printf = "1.0, 1.6"
Expand Down
44 changes: 13 additions & 31 deletions src/camera/camera3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ struct Camera3D <: AbstractCamera3D
controls::Attributes

# Interactivity
pulser::Observable{Float64}
selected::Observable{Bool}

# view matrix
Expand Down Expand Up @@ -55,8 +54,7 @@ Settings include anything that isn't a mouse or keyboard button.
- `mouse_translationspeed = 0.5` sets the speed of mouse translations.
- `mouse_zoomspeed = 1.0` sets the speed of mouse zooming (mousewheel).
- `update_rate = 1/30` sets the rate at which keyboard based camera updates are evaluated.
- `circular_rotation = (true, true, true)` enables circular rotations for (fixed x, fixed y, fixed z) rotation axis. (This means drawing a circle with your mouse around the center of the scene will result in a continuous rotation.)
- `circular_rotation = (false, false, false)` enables circular rotations for (fixed x, fixed y, fixed z) rotation axis. (This means drawing a circle with your mouse around the center of the scene will result in a continuous rotation.)
## Controls
Expand Down Expand Up @@ -161,9 +159,8 @@ function Camera3D(scene::Scene; kwargs...)
mouse_zoomspeed = 1.0,

projectiontype = Makie.Perspective,
circular_rotation = (true, true, true),
circular_rotation = (false, false, false),
rotation_center = :lookat,
update_rate = 1/30,
zoom_shift_lookat = true,
fixed_axis = true,
cad = false,
Expand All @@ -185,7 +182,6 @@ function Camera3D(scene::Scene; kwargs...)
settings, controls,

# Internals - controls
Observable(-1.0),
Observable(true),

# Semi-Internal - view matrix
Expand All @@ -204,34 +200,12 @@ function Camera3D(scene::Scene; kwargs...)

# Keyboard controls
# ticks every so often to get consistent position updates.
on(camera(scene), cam.pulser) do prev_time
current_time = time()
active = on_pulse(scene, cam, current_time - prev_time)
@async if active && cam.selected[]
sleep(settings.update_rate[])
cam.pulser[] = current_time
else
cam.pulser.val = -1.0
on(camera(scene), events(scene).tick) do tick
if cam.selected[]
on_pulse(scene, cam, tick.delta_time)
end
end

keynames = (
:up_key, :down_key, :left_key, :right_key, :forward_key, :backward_key,
:zoom_in_key, :zoom_out_key, :increase_fov_key, :decrease_fov_key,
:pan_left_key, :pan_right_key, :tilt_up_key, :tilt_down_key,
:roll_clockwise_key, :roll_counterclockwise_key
)

# Start ticking if relevant keys are pressed
on(camera(scene), events(scene).keyboardbutton) do event
if event.action in (Keyboard.press, Keyboard.repeat) && cam.pulser[] == -1.0 &&
cam.selected[] && any(key -> ispressed(scene, controls[key][]), keynames)
cam.pulser[] = time()
return Consume(true)
end
return Consume(false)
end

# de/select plot on click outside/inside
# also deselect other cameras
deselect_all_cameras!(root(scene))
Expand Down Expand Up @@ -320,6 +294,14 @@ function on_pulse(scene, cam::Camera3D, timestep)
tilt_up_key, tilt_down_key, pan_left_key, pan_right_key, roll_counterclockwise_key, roll_clockwise_key,
zoom_out_key, zoom_in_key, increase_fov_key, decrease_fov_key
)

if !ispressed(scene, right_key | left_key | up_key | down_key | backward_key | forward_key |
tilt_up_key | tilt_down_key | pan_left_key | pan_right_key | roll_counterclockwise_key |
roll_clockwise_key | zoom_out_key | zoom_in_key | increase_fov_key | decrease_fov_key)

return
end

@extractvalue cam.settings (
keyboard_translationspeed, keyboard_rotationspeed, keyboard_zoomspeed, projectiontype
)
Expand Down

0 comments on commit 5e9f839

Please sign in to comment.