From eb4559081d3c1adafa765cad5cb5f97cd9c2ddbf Mon Sep 17 00:00:00 2001 From: MA Laforge Date: Sun, 4 Jul 2021 17:24:28 -0400 Subject: [PATCH] Fix annotation bug. Would not skip annotation meant for another strip. --- Project.toml | 2 +- src/cairo_annotation.jl | 17 ++++++++--------- src/gtk_base.jl | 5 +++++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Project.toml b/Project.toml index 62540b8..a126944 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "InspectDR" uuid = "d0351b0e-4b05-5898-87b3-e2a8edfddd1d" -version = "0.4.2" +version = "0.4.3" [deps] Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" diff --git a/src/cairo_annotation.jl b/src/cairo_annotation.jl index 0d1dc1f..489da98 100644 --- a/src/cairo_annotation.jl +++ b/src/cairo_annotation.jl @@ -19,6 +19,11 @@ const ALIGN_MAP = Dict{Symbol, CAlignment}( ) +#==Accessors +===============================================================================# +skipannot(a::PlotAnnotation, rstrip::RStrip2D) = (a.strip != rstrip.istrip && a.strip != 0) + + #==Rendering text annotation ===============================================================================# function render(ctx::CairoContext, rstrip::RStrip2D, a::TextAnnotation) @@ -77,17 +82,11 @@ end #==Generic rendering algorithm for annotations ===============================================================================# -#Basic render function for PlotAnnotation types: -function render(ctx::CairoContext, rstrip::RStrip2D, a::PlotAnnotation) - if 0 == a.strip || a.strip == rstrip.istrip - render(ctx, rstrip, a) - end - return -end - function render(ctx::CairoContext, rstrip::RStrip2D, alist::Vector{T}) where T<:PlotAnnotation for a in alist - render(ctx, rstrip, a) + if !skipannot(a, rstrip) + render(ctx, rstrip, a) + end end return end diff --git a/src/gtk_base.jl b/src/gtk_base.jl index 1a80d85..82709ef 100644 --- a/src/gtk_base.jl +++ b/src/gtk_base.jl @@ -187,6 +187,11 @@ mutable struct GtkPlot end +#==Accessors +===============================================================================# +skipannot(::CtrlMarkerGroup, rstrip::RStrip2D) = false + + #==Helper functions ===============================================================================# function refresh_title(gplot::GtkPlot)