diff --git a/src/renderer/src/lib/map/MapContainer.svelte b/src/renderer/src/lib/map/MapContainer.svelte index da0f5f0..4419163 100644 --- a/src/renderer/src/lib/map/MapContainer.svelte +++ b/src/renderer/src/lib/map/MapContainer.svelte @@ -169,7 +169,6 @@ resizeObserver.disconnect(); } - let g: SVGGElement; let svg: SVGElement; let transform: ZoomTransform | null = null; let lastRenderedTransform: ZoomTransform | null = null; @@ -180,17 +179,23 @@ let endZooming = debounce(() => { zooming = false; }, 100); - let zoomHandler = zoom().on('zoom', (e) => { - tooltip = null; - zooming = true; - endZooming(); - zoomedPngDataUrl = ''; - zoomedPngDataUrlRequestId = null; - starScapeDataUrl = ''; - starScapeDataUrlRequestId = null; - transform = e.transform; - if (g) g.setAttribute('transform', e.transform.toString()); - }); + let zoomHandler = zoom() + .on('zoom', (e) => { + tooltip = null; + zooming = true; + endZooming(); + zoomedPngDataUrl = ''; + zoomedPngDataUrlRequestId = null; + starScapeDataUrl = ''; + starScapeDataUrlRequestId = null; + transform = e.transform; + }) + .filter(function filter(event: MouseEvent) { + // click and drag for middle button only + if (event.type === 'mousedown') return event.button === 1; + // this is the default implementation + return (!event.ctrlKey || event.type === 'wheel') && !event.button; + }); $: if (svg) { select(svg).call(zoomHandler as any); } @@ -482,94 +487,94 @@ system={openedSystem} colors={colorsOrNull} /> - {:else} - - { - tooltip = null; - }} - on:click={onMapClick} - class:cursor-pointer={tooltip?.countryId != null} - class="h-full w-full" - > + {/if} + + { + tooltip = null; + }} + on:click={onMapClick} + class:hidden={openedSystem != null} + class:cursor-pointer={tooltip?.countryId != null} + class="h-full w-full" + > + + {#if unzoomedStarScapeDataUrl} + + {/if} + + + {#if pngDataUrl} + + {/if} + + {#if starScapeDataUrl} + + + {:else if lastRenderedTransformStarScapePngDataUrl} - {#if unzoomedStarScapeDataUrl} - - {/if} - - - {#if pngDataUrl} - - {/if} - - {#if starScapeDataUrl} - - {:else if lastRenderedTransformStarScapePngDataUrl} - - - - - {/if} - {#if zoomedPngDataUrl} - - {:else if lastRenderedTransformPngDataUrl} - - - - {/if} - - {/if} + + + {/if} + {#if zoomedPngDataUrl} + + {:else if lastRenderedTransformPngDataUrl} + + + + {/if} + {/if}