From b6ab8254069b073c9b7597d72c454e89b7924ffa Mon Sep 17 00:00:00 2001 From: SimonDanisch Date: Tue, 10 Dec 2019 14:04:35 +0100 Subject: [PATCH] implement plot deletion --- src/scenes.jl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/scenes.jl b/src/scenes.jl index 4575de889..ecdeb2b08 100644 --- a/src/scenes.jl +++ b/src/scenes.jl @@ -343,6 +343,21 @@ function Base.push!(scene::Scene, plot::AbstractPlot) # update!(scene) end +function Base.delete!(screen::AbstractScreen, scene::Scene, plot::AbstractPlot) + @warn "Deleting plots not implemented for backend: $(typeof(screen))" +end + +function Base.delete!(scene::Scene, plot::AbstractPlot) + len = length(scene.plots) + filter!(x-> x !== plot, scene.plots) + if length(scene.plots) == len + error("$(typeof(plot)) not in scene!") + end + for screen in scene.current_screens + delete!(screen, scene, plot) + end +end + function Base.push!(scene::Scene, child::Scene) push!(scene.children, child) disconnect!(child.camera)