mirror of
https://github.com/grafana/grafana.git
synced 2025-09-26 05:03:51 +08:00
Geomap: Fix data fit (#89247)
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
import { createEmpty, extend, Extent } from 'ol/extent';
|
import { createEmpty, extend, Extent } from 'ol/extent';
|
||||||
import LayerGroup from 'ol/layer/Group';
|
import LayerGroup from 'ol/layer/Group';
|
||||||
import VectorLayer from 'ol/layer/Vector';
|
import VectorLayer from 'ol/layer/Vector';
|
||||||
|
import VectorImage from 'ol/layer/VectorImage';
|
||||||
|
|
||||||
import { MapLayerState } from '../types';
|
import { MapLayerState } from '../types';
|
||||||
|
|
||||||
@ -11,12 +12,12 @@ export function getLayersExtent(
|
|||||||
layer: string | undefined
|
layer: string | undefined
|
||||||
): Extent {
|
): Extent {
|
||||||
return layers
|
return layers
|
||||||
.filter((l) => l.layer instanceof VectorLayer || l.layer instanceof LayerGroup)
|
.filter((l) => l.layer instanceof VectorLayer || l.layer instanceof LayerGroup || l.layer instanceof VectorImage)
|
||||||
.flatMap((ll) => {
|
.flatMap((ll) => {
|
||||||
const l = ll.layer;
|
const l = ll.layer;
|
||||||
if (l instanceof LayerGroup) {
|
if (l instanceof LayerGroup) {
|
||||||
return getLayerGroupExtent(l);
|
return getLayerGroupExtent(l);
|
||||||
} else if (l instanceof VectorLayer) {
|
} else if (l instanceof VectorLayer || l instanceof VectorImage) {
|
||||||
if (allLayers) {
|
if (allLayers) {
|
||||||
// Return everything from all layers
|
// Return everything from all layers
|
||||||
return [l.getSource().getExtent()] ?? [];
|
return [l.getSource().getExtent()] ?? [];
|
||||||
|
Reference in New Issue
Block a user