diff --git a/Project.toml b/Project.toml index ec37483..1adce7b 100644 --- a/Project.toml +++ b/Project.toml @@ -10,7 +10,7 @@ Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" [compat] GeometryBasics = "0.4" -Makie = "0.19" +Makie = "0.20" Tables = "1" julia = "1.6" diff --git a/src/geometry_canvas.jl b/src/geometry_canvas.jl index 57b54d3..c39c32a 100644 --- a/src/geometry_canvas.jl +++ b/src/geometry_canvas.jl @@ -432,7 +432,7 @@ function add_events!(c::GeometryCanvas{<:Point}; # Add points with left click if event.action == Mouse.press - if Makie.mouseposition_px(fig.scene) in ax.scene.px_area[] + if Makie.mouseposition_px(fig.scene) in ax.scene.viewport[] # Set how close to a point we have to be to select it idx = c.current_point # Get mouse position in the axis and figure @@ -534,7 +534,7 @@ function add_events!(c::GeometryCanvas{T}; axis_pos = Makie.mouseposition(ax.scene) # Add points with left click - if event.action == Mouse.press && Makie.mouseposition_px(fig.scene) in ax.scene.px_area[] + if event.action == Mouse.press && Makie.mouseposition_px(fig.scene) in ax.scene.viewport[] insert = false if _is_alt_pressed(fig) deleting[] = true @@ -715,7 +715,7 @@ end # Get pixel click accuracy from the size of the visable heatmap. function _accuracy(ax::Axis, accuracy_scale) lift(ax.finallimits) do fl - sum(maximum(fl.widths) ./ ax.scene.px_area[].widths) / accuracy_scale * 4 + sum(maximum(fl.widths) ./ ax.scene.viewport[].widths) / accuracy_scale * 4 end end diff --git a/src/paint_canvas.jl b/src/paint_canvas.jl index e70abd8..b6770d5 100644 --- a/src/paint_canvas.jl +++ b/src/paint_canvas.jl @@ -46,7 +46,7 @@ mutable struct PaintCanvas{T,Fu,D,M<:AbstractMatrix{T},Fi,A} <: AbstractCanvas on_mouse_events::Function end function PaintCanvas(data::AbstractMatrix; - f=(axis, xs, ys, v) -> image!(axis, xs, ys, v; interpolate=false, colormap=:inferno), + f=(axis, xs, ys, v) -> image!(axis, (first(xs), last(xs)), (first(ys), last(ys)), v; interpolate=false, colormap=:inferno), drawing=Observable{Bool}(false), drawbutton=Observable{Any}(Mouse.left), active=Observable{Bool}(true), @@ -92,7 +92,7 @@ function add_mouse_events!(fig::Figure, ax::Axis, c::PaintCanvas) # Add points with left click if event.action == Mouse.press - if !(fig_pos in ax.scene.px_area[]) + if !(fig_pos in ax.scene.viewport[]) drawing[] = false return Consume(false) end @@ -126,7 +126,7 @@ function add_mouse_events!(fig::Figure, ax::Axis, c::PaintCanvas) if drawing[] fig_pos = Makie.mouseposition_px(fig.scene) axis_pos = Makie.mouseposition(ax.scene) - if !(fig_pos in ax.scene.px_area[]) + if !(fig_pos in ax.scene.viewport[]) drawing[] = false return Consume(false) end