Skip to content

Commit af9f8f9

Browse files
committed
move layer: above shapes and images to toppaper
1 parent 9bfbabf commit af9f8f9

File tree

3 files changed

+33
-11
lines changed

3 files changed

+33
-11
lines changed

src/plot_api/plot_api.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2830,24 +2830,23 @@ function makePlotFramework(gd) {
28302830
// single geo layer for the whole plot
28312831
fullLayout._geolayer = fullLayout._paper.append('g').classed('geolayer', true);
28322832

2833-
// upper shape layer
2834-
// (only for shapes to be drawn above the whole plot, including subplots)
2835-
var layerAbove = fullLayout._paper.append('g')
2836-
.classed('layer-above', true);
2837-
fullLayout._imageUpperLayer = layerAbove.append('g')
2838-
.classed('imagelayer', true);
2839-
fullLayout._shapeUpperLayer = layerAbove.append('g')
2840-
.classed('shapelayer', true);
2841-
28422833
// single pie layer for the whole plot
28432834
fullLayout._pielayer = fullLayout._paper.append('g').classed('pielayer', true);
28442835

28452836
// fill in image server scrape-svg
28462837
fullLayout._glimages = fullLayout._paper.append('g').classed('glimages', true);
28472838

2848-
// lastly info (legend, annotations) and hover layers go on top
2839+
// lastly upper shapes, info (legend, annotations) and hover layers go on top
28492840
// these are in a different svg element normally, but get collapsed into a single
28502841
// svg when exporting (after inserting 3D)
2842+
// upper shapes/images are only those drawn above the whole plot, including subplots
2843+
var layerAbove = fullLayout._toppaper.append('g')
2844+
.classed('layer-above', true);
2845+
fullLayout._imageUpperLayer = layerAbove.append('g')
2846+
.classed('imagelayer', true);
2847+
fullLayout._shapeUpperLayer = layerAbove.append('g')
2848+
.classed('shapelayer', true);
2849+
28512850
fullLayout._infolayer = fullLayout._toppaper.append('g').classed('infolayer', true);
28522851
fullLayout._zoomlayer = fullLayout._toppaper.append('g').classed('zoomlayer', true);
28532852
fullLayout._hoverlayer = fullLayout._toppaper.append('g').classed('hoverlayer', true);

test/image/baselines/pie_style.png

1.24 KB
Loading

test/image/mocks/pie_style.json

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,29 @@
3030
"height": 400,
3131
"width": 500,
3232
"paper_bgcolor": "#ddd",
33-
"showlegend": false
33+
"showlegend": false,
34+
"shapes": [{
35+
"type": "rect",
36+
"xref": "paper",
37+
"yref": "paper",
38+
"x0": 0,
39+
"y0": 0.4,
40+
"x1": 1,
41+
"y1": 0.6,
42+
"fillcolor": "rgba(128, 0, 0, 0.5)",
43+
"line": {"width": 0},
44+
"layer": "below"
45+
}, {
46+
"type": "rect",
47+
"xref": "paper",
48+
"yref": "paper",
49+
"x0": 0.4,
50+
"y0": 0,
51+
"x1": 0.6,
52+
"y1": 1,
53+
"fillcolor": "rgba(0, 0, 128, 0.5)",
54+
"line": {"width": 0},
55+
"layer": "above"
56+
}]
3457
}
3558
}

0 commit comments

Comments
 (0)