Skip to content

Commit

Permalink
fix: clip id bug for mushroom layer
Browse files Browse the repository at this point in the history
  • Loading branch information
neocarto committed Jul 22, 2022
1 parent d6494da commit 86cac0d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,7 @@ bertin.draw({
- **stroke**: stroke color (default: "white")
- **strokeWidth**: stroke width (default: 0.5)
- **fillOpacity**: fill opacity (default: 1)
- **strokeOpacity**: stroke opacity (default: 1)
- **top_tooltip**: an array of values defining what to display within the tooltip. If you use a $, the value within the geojson is displayed.
- **bottom_tooltip**: an array of values defining what to display within the tooltip. If you use a $, the value within the geojson is displayed.
Expand Down
2 changes: 1 addition & 1 deletion src/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ export function draw({ params = {}, layers = {} } = {}) {
stroke: layer.stroke,
strokeWidth: layer.strokeWidth,
fillOpacity: layer.fillOpacity,
strokeOpacity: layer.strokeOpacity,
top_tooltip: layer.top_tooltip,
bottom_tooltip: layer.bottom_tooltip,
leg_x: layer.leg_x,
Expand All @@ -342,7 +343,6 @@ export function draw({ params = {}, layers = {} } = {}) {
leg_stroke: layer.leg_stroke,
leg_strokeWidth: layer.leg_strokeWidth,
},
clipid,
width,
height
);
Expand Down
7 changes: 5 additions & 2 deletions src/layers/mushroom.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ export function mushroom(
projection,
planar,
options = {},
clipid,
width,
height
) {
let clipid =
Date.now().toString(36) + Math.random().toString(36).substring(2);

let geojson = topo2geo(options.geojson);
let top_values = options.top_values;
let bottom_values = options.bottom_values;
Expand All @@ -28,6 +30,7 @@ export function mushroom(
let stroke = options.stroke ? options.stroke : "white";
let strokeWidth = options.strokeWidth ? options.strokeWidth : 0.5;
let fillOpacity = options.fillOpacity ? options.fillOpacity : 1;
let strokeOpacity = options.strokeOpacity ? options.strokeOpacity : 1;
let top_tooltip = options.top_tooltip ? options.top_tooltip : false;
if (Array.isArray(top_tooltip)) {
top_tooltip = { fields: top_tooltip };
Expand Down Expand Up @@ -229,7 +232,7 @@ export function mushroom(
.attr("stroke-width", strokeWidth);
}

// // Legend
// Legend

if (leg_x != null && leg_y != null) {
const span = 30;
Expand Down

0 comments on commit 86cac0d

Please sign in to comment.