{i18n._('menu.new')} {i18n._('menu.open')} {#if desktop} {i18n._('menu.open_folder')} {/if} engine.duplicate()} disabled={selectionCount == 0}> {i18n._('menu.duplicate')} {#if desktop} saveSelected(selectedIds)} disabled={selectionCount == 0 && !anyUnsaved} > {i18n._('menu.save')} {i18n._('menu.save_all')} saveAs(selectedIds)} disabled={selectedIds.length !== 1} > {i18n._('menu.save_as')} closeFiles(selectedIds)} disabled={selectedIds.length === 0} > {i18n._('menu.close')} {i18n._('menu.close_all')} {i18n._('menu.close_folder')} {:else} engine.delete(true)} disabled={selectionCount == 0} > {i18n._('menu.delete')} engine.deleteAll()} disabled={noFiles}> {i18n._('menu.delete_all')} {/if} (exportState.current = ExportState.SELECTION)} disabled={selectionCount == 0} > {i18n._('menu.export')} {#if !desktop}{/if} (exportState.current = ExportState.ALL)} disabled={noFiles} > {i18n._('menu.export_all')} {#if !desktop}{/if} engine.undo()} disabled={!$canUndo}> {i18n._('menu.undo')} engine.redo()} disabled={!$canRedo}> {i18n._('menu.redo')} (editMetadata.current = true)} > {i18n._('menu.metadata.button')} (editStyle.current = true)} > {i18n._('menu.style.button')} engine.setSelectionHidden(!$allHidden)} disabled={selectionCount == 0} > {#if $allHidden} {i18n._('menu.unhide')} {:else} {i18n._('menu.hide')} {/if} {#if $treeFileView} {#if $selection.type === 'file'} engine.newTrack()} disabled={selectionCount !== 1} > {i18n._('menu.new_track')} {:else if $selection.type === 'track'} engine.newTrackSegment()} disabled={selectionCount !== 1} > {i18n._('menu.new_segment')} {/if} {/if} engine.selectAll()} disabled={noFiles}> {i18n._('menu.select_all')} { if (selectionCount > 0) { boundsManager.centerMapOnSelection(); } }} disabled={selectionCount == 0} > {i18n._('menu.center')} {#if $treeFileView} engine.copy()} disabled={selectionCount === 0}> {i18n._('menu.copy')} engine.cut()} disabled={selectionCount === 0}> {i18n._('menu.cut')} engine.paste()}> {i18n._('menu.paste')} {/if} engine.delete()} disabled={selectionCount == 0}> {i18n._('menu.delete')} {i18n._('menu.elevation_profile')} {i18n._('menu.tree_file_view')} {i18n._('menu.switch_basemap')} {i18n._('menu.toggle_overlays')} {i18n._('menu.distance_markers')} {i18n._('menu.direction_markers')} map.toggle3D()}> {i18n._('menu.toggle_3d')} {#if fullscreen} {:else} {/if} {i18n._('menu.fullscreen')} {i18n._('menu.distance_units')} {i18n._('menu.metric')} {i18n._('menu.imperial')} {i18n._('menu.nautical')} {i18n._('menu.velocity_units')} {i18n._('quantities.speed')} {i18n._('quantities.pace')} {i18n._('menu.temperature_units')} {i18n._('menu.celsius')} {i18n._('menu.fahrenheit')} {i18n._('menu.language')} {#each Object.entries(languages) as [lang, label]} {label} {/each} {#if mode.current === 'light' || !mode.current} {:else} {/if} {i18n._('menu.mode')} { setMode(value as 'light' | 'dark'); }} > {i18n._('menu.light')} {i18n._('menu.dark')} {i18n._('menu.street_view_source')} {i18n._('menu.mapillary')} {i18n._('menu.google')} (layerSettingsOpen = true)}> {i18n._('menu.layers')}
{ let targetInput = e && e.target && e.target instanceof HTMLElement && (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA' || e.target.tagName === 'SELECT' || e.target.role === 'combobox' || e.target.role === 'radio' || e.target.role === 'menu' || e.target.role === 'menuitem' || e.target.role === 'menuitemradio' || e.target.role === 'menuitemcheckbox'); if (e.key === '+' && (e.metaKey || e.ctrlKey)) { createFile(); e.preventDefault(); } else if ((e.key === 'o' || e.key === 'O') && (e.metaKey || e.ctrlKey)) { if (desktop && e.shiftKey) { openFolder(); } else { openFiles(); } e.preventDefault(); } else if (desktop && (e.key === 'w' || e.key === 'W') && (e.metaKey || e.ctrlKey)) { if (e.shiftKey) { closeAll(); } else { closeFiles(selectedIds); } e.preventDefault(); } else if (desktop && (e.key === 's' || e.key === 'S') && (e.metaKey || e.ctrlKey)) { if (e.shiftKey) { saveAll(); } else { saveSelected(selectedIds); } e.preventDefault(); } else if (e.key === 'd' && (e.metaKey || e.ctrlKey)) { engine.duplicate(); e.preventDefault(); } else if (e.key === 'c' && (e.metaKey || e.ctrlKey)) { if (!targetInput) { engine.copy(); e.preventDefault(); } } else if (e.key === 'x' && (e.metaKey || e.ctrlKey)) { if (!targetInput) { engine.cut(); e.preventDefault(); } } else if (e.key === 'v' && (e.metaKey || e.ctrlKey)) { if (!targetInput) { engine.paste(); e.preventDefault(); } } else if ((e.key === 's' || e.key == 'S') && (e.metaKey || e.ctrlKey)) { if (e.shiftKey) { if (!noFiles) { exportState.current = ExportState.ALL; } } else if (selectionCount > 0) { exportState.current = ExportState.SELECTION; } e.preventDefault(); } else if ((e.key === 'z' || e.key == 'Z') && (e.metaKey || e.ctrlKey)) { if (e.shiftKey) { engine.redo(); } else { engine.undo(); } e.preventDefault(); } else if ((e.key === 'Backspace' || e.key === 'Delete') && (e.metaKey || e.ctrlKey)) { // the desktop app closes files instead if (!targetInput && !desktop) { if (e.shiftKey) { engine.deleteAll(); } else { engine.delete(); } e.preventDefault(); } } else if (e.key === 'a' && (e.metaKey || e.ctrlKey)) { if (!targetInput) { engine.selectAll(); e.preventDefault(); } } else if (e.key === 'i' && (e.metaKey || e.ctrlKey)) { if (selectionCount === 1 && filesOrTracksSelected) { editMetadata.current = true; } e.preventDefault(); } else if (e.key === 'p' && (e.metaKey || e.ctrlKey)) { $elevationProfile = !$elevationProfile; e.preventDefault(); } else if (e.key === 'l' && (e.metaKey || e.ctrlKey)) { $treeFileView = !$treeFileView; e.preventDefault(); } else if (e.key === 'h' && (e.metaKey || e.ctrlKey)) { engine.setSelectionHidden(!$allHidden); e.preventDefault(); } else if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) { if (selectionCount > 0) { boundsManager.centerMapOnSelection(); } } else if (e.key === 'F1') { switchBasemaps(); e.preventDefault(); } else if (e.key === 'F2') { toggleOverlays(); e.preventDefault(); } else if (e.key === 'F3') { $distanceMarkers = !$distanceMarkers; e.preventDefault(); } else if (e.key === 'F4') { $directionMarkers = !$directionMarkers; e.preventDefault(); } else if (e.key === 'F5') { $routing = !$routing; e.preventDefault(); } else if ( e.key === 'ArrowRight' || e.key === 'ArrowDown' || e.key === 'ArrowLeft' || e.key === 'ArrowUp' ) { if (!targetInput) { engine.arrowSelect(e.key === 'ArrowRight' || e.key === 'ArrowDown', e.shiftKey); e.preventDefault(); } } }} on:dragover={(e) => e.preventDefault()} on:drop={(e) => { e.preventDefault(); if (e.dataTransfer && e.dataTransfer.files.length > 0) { loadFiles(e.dataTransfer.files); } }} />