From 146d1d5eb09e1d192a4a59b717bab82b2b204398 Mon Sep 17 00:00:00 2001 From: Jovansonlee Cesar Date: Wed, 4 Nov 2020 13:11:55 +0800 Subject: Fix the order of backdrop and fragment nodes --- svgbob/src/buffer/cell_buffer.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/svgbob/src/buffer/cell_buffer.rs b/svgbob/src/buffer/cell_buffer.rs index f50c1e9..4383cfc 100644 --- a/svgbob/src/buffer/cell_buffer.rs +++ b/svgbob/src/buffer/cell_buffer.rs @@ -311,8 +311,10 @@ impl CellBuffer { if settings.include_defs { children.push(Self::get_defs()); } - children.extend(fragment_nodes); + // backdrop needs to appear first before the fragment nodes + // otherwise it will cover the other elements + // in accordance to how z-index works if settings.include_backdrop { children.push(rect( vec![class("backdrop"), x(0), y(0), width(w), height(h)], @@ -320,6 +322,8 @@ impl CellBuffer { )); } + children.extend(fragment_nodes); + svg( vec![xmlns("http://www.w3.org/2000/svg"), width(w), height(h)], children, -- cgit v1.2.3