From fa6e860b1101bd843bc2640c88e8f6fb0d458c47 Mon Sep 17 00:00:00 2001 From: Fabian Greimel Date: Thu, 7 Jan 2021 16:25:55 +0100 Subject: [PATCH] scale linestyle patterns by linewidth --- src/drawing_primitives.jl | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/drawing_primitives.jl b/src/drawing_primitives.jl index 6d765c3b..0d8bc618 100644 --- a/src/drawing_primitives.jl +++ b/src/drawing_primitives.jl @@ -215,7 +215,13 @@ function draw_atomic(screen::GLScreen, scene::Scene, @nospecialize(x::Lines)) robj = cached_robj!(screen, scene, x) do gl_attributes linestyle = pop!(gl_attributes, :linestyle) data = Dict{Symbol, Any}(gl_attributes) - data[:pattern] = to_value(linestyle) + ls = to_value(linestyle) + if isnothing(ls) + data[:pattern] = ls + else + linewidth = gl_attributes[:thickness] + data[:pattern] = ls .* (to_value(linewidth) * 0.25) + end positions = handle_view(x[1], data) positions = apply_transform(transform_func_obs(x), positions) handle_intensities!(data) @@ -227,7 +233,13 @@ function draw_atomic(screen::GLScreen, scene::Scene, @nospecialize(x::LineSegmen robj = cached_robj!(screen, scene, x) do gl_attributes linestyle = pop!(gl_attributes, :linestyle) data = Dict{Symbol, Any}(gl_attributes) - data[:pattern] = to_value(linestyle) + ls = to_value(linestyle) + if isnothing(ls) + data[:pattern] = ls + else + linewidth = gl_attributes[:thickness] + data[:pattern] = ls .* (to_value(linewidth) * 0.25) + end positions = handle_view(x.converted[1], data) positions = apply_transform(transform_func_obs(x), positions) if haskey(data, :color) && data[:color][] isa AbstractVector{<: Number}