From 86cac0d7f1eda05914af516f3694f73d4220ec0f Mon Sep 17 00:00:00 2001 From: neocarto Date: Fri, 22 Jul 2022 09:33:02 +0200 Subject: [PATCH] fix: clip id bug for mushroom layer --- README.md | 1 + src/draw.js | 2 +- src/layers/mushroom.js | 7 +++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 300a7ed..10c4a6e 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/src/draw.js b/src/draw.js index a314228..8b8c2cb 100644 --- a/src/draw.js +++ b/src/draw.js @@ -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, @@ -342,7 +343,6 @@ export function draw({ params = {}, layers = {} } = {}) { leg_stroke: layer.leg_stroke, leg_strokeWidth: layer.leg_strokeWidth, }, - clipid, width, height ); diff --git a/src/layers/mushroom.js b/src/layers/mushroom.js index 78a191a..1094a13 100644 --- a/src/layers/mushroom.js +++ b/src/layers/mushroom.js @@ -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; @@ -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 }; @@ -229,7 +232,7 @@ export function mushroom( .attr("stroke-width", strokeWidth); } - // // Legend + // Legend if (leg_x != null && leg_y != null) { const span = 30;