gridviz 3.0.39 → 3.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gridviz.js +16 -4
- package/dist/gridviz.min.js +1 -1
- package/package.json +1 -1
- package/src/core/Map.js +5 -1
- package/src/layer/GridLayer.js +10 -2
package/package.json
CHANGED
package/src/core/Map.js
CHANGED
|
@@ -245,7 +245,11 @@ export class Map {
|
|
|
245
245
|
//remove legend elements: the legends themselves only, not what is inside them
|
|
246
246
|
//(a legend keeps its content while one of its swatches is hovered, see Style.updateLegends)
|
|
247
247
|
//except the one being hovered, which would lose its mouseleave (see Legend.highlight)
|
|
248
|
-
if (this.legend)
|
|
248
|
+
if (this.legend) {
|
|
249
|
+
this.legend.selectAll(':scope > *:not([data-gridviz-hovered])').remove()
|
|
250
|
+
// the legends of this draw are placed one after the other (see GridLayer.addLegends)
|
|
251
|
+
this.legend.node()._gridvizLegendCursor = null
|
|
252
|
+
}
|
|
249
253
|
|
|
250
254
|
//clear
|
|
251
255
|
this.geoCanvas.initCanvasTransform()
|
package/src/layer/GridLayer.js
CHANGED
|
@@ -137,8 +137,16 @@ export class GridLayer extends Layer {
|
|
|
137
137
|
// so that hovering a swatch can highlight the cells of the style on the map
|
|
138
138
|
lg.style_ = style
|
|
139
139
|
lg.redraw = () => (geoCanvas.redraw ? geoCanvas.redraw() : undefined)
|
|
140
|
-
//
|
|
141
|
-
|
|
140
|
+
// The legends go in the order they are drawn, after the one placed before them. A hovered legend is
|
|
141
|
+
// still in the container (see Map.redrawNow) and is left where it is: moving it would lose its mouseleave,
|
|
142
|
+
// and appending the others after it would put it above the legends that come before it.
|
|
143
|
+
const container = legendComp.node()
|
|
144
|
+
const el = lg.div.node()
|
|
145
|
+
const previous = container._gridvizLegendCursor
|
|
146
|
+
if (previous) {
|
|
147
|
+
if (el.previousSibling !== previous) previous.after(el)
|
|
148
|
+
} else if (container.firstChild !== el) container.prepend(el)
|
|
149
|
+
container._gridvizLegendCursor = el
|
|
142
150
|
}
|
|
143
151
|
}
|
|
144
152
|
|