@guardian/interactive-component-library 0.7.7 → 0.7.9
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.
|
@@ -172,7 +172,7 @@ class Map {
|
|
|
172
172
|
const matchingFeatures = [];
|
|
173
173
|
for (const layer of this.layers) {
|
|
174
174
|
const layerExtent = layer.getExtent();
|
|
175
|
-
if (layer.hitDetectionEnabled && containsCoordinate(layerExtent, mapCoordinate)) {
|
|
175
|
+
if (layerExtent && layer.hitDetectionEnabled && containsCoordinate(layerExtent, mapCoordinate)) {
|
|
176
176
|
const features = layer.findFeatures(mapCoordinate);
|
|
177
177
|
if (features) {
|
|
178
178
|
matchingFeatures.push(...features);
|
|
@@ -19,7 +19,17 @@ class MapRenderer {
|
|
|
19
19
|
const { zoomLevel, projection, sizeInPixels } = frameState.viewState;
|
|
20
20
|
const layers = this.map.layers;
|
|
21
21
|
const mapElements = [];
|
|
22
|
-
|
|
22
|
+
let canvasElement;
|
|
23
|
+
if (canvas) {
|
|
24
|
+
canvasElement = canvas;
|
|
25
|
+
} else if (this._canvas) {
|
|
26
|
+
canvasElement = this._canvas;
|
|
27
|
+
canvasElement.width = sizeInPixels[0];
|
|
28
|
+
canvasElement.height = sizeInPixels[1];
|
|
29
|
+
} else {
|
|
30
|
+
canvasElement = createCanvas(sizeInPixels);
|
|
31
|
+
this._canvas = canvasElement;
|
|
32
|
+
}
|
|
23
33
|
const visibleLayers = layers.filter((layer) => {
|
|
24
34
|
return zoomLevel > (layer.minZoom || 0);
|
|
25
35
|
});
|