map fixes

This commit is contained in:
Jan Prochazka
2022-06-12 17:58:22 +02:00
parent 3b0ed7df8b
commit 50abead104
3 changed files with 32 additions and 21 deletions

View File

@@ -546,14 +546,14 @@
showModal(ErrorMessageModal, { message: 'There is nothing to be shown on map' });
return;
}
openNewTab({
title: 'Map',
icon: 'img map',
tabComponent: 'MapTab',
props: {
selection,
openNewTab(
{
title: 'Map',
icon: 'img map',
tabComponent: 'MapTab',
},
});
{ editor: selection.map(x => _.omit(x, ['engine'])) }
);
return;
}

View File

@@ -1,6 +1,5 @@
<script lang="ts" context="module">
export function selectionCouldBeShownOnMap(selection) {
console.log('selection', selection);
if (selection.length > 0 && _.find(selection, x => isWktGeometry(x.value))) {
return true;
}
@@ -39,6 +38,7 @@
let geoJson;
function createColumnsTable(cells) {
if (cells.length == 0) return '';
return `<table>${cells.map(cell => `<tr><td>${cell.column}</td><td>${cell.value}</td></tr>`).join('\n')}</table>`;
}
@@ -164,14 +164,14 @@
{
text: 'Open on new tab',
onClick: () => {
openNewTab({
title: 'Map',
icon: 'img map',
tabComponent: 'MapTab',
props: {
selection,
openNewTab(
{
title: 'Map',
icon: 'img map',
tabComponent: 'MapTab',
},
});
{ editor: selection.map(x => _.omit(x, ['engine'])) }
);
},
},
{

View File

@@ -1,8 +1,19 @@
<script lang="ts">
import MapView from '../elements/MapView.svelte';
export let selection;
</script>
import MapView from '../elements/MapView.svelte';
import useEditorData from '../query/useEditorData';
export let tabid;
let selection;
useEditorData({
tabid,
onInitialData: value => {
selection = value;
},
});
</script>
{#if selection}
<MapView {selection} />
<MapView {selection} />
{/if}