forked from MapComplete/MapComplete
		
	UX: use center icon for directionINdicator if no GPS signal is available
This commit is contained in:
		
							parent
							
								
									0733c46fcb
								
							
						
					
					
						commit
						1d089e1e81
					
				
					 3 changed files with 26 additions and 51 deletions
				
			
		|  | @ -5,58 +5,24 @@ | ||||||
|    viewBox="0 0 544.02838 544.02838" |    viewBox="0 0 544.02838 544.02838" | ||||||
|    version="1.1" |    version="1.1" | ||||||
|    id="svg1" |    id="svg1" | ||||||
|    sodipodi:docname="center.svg" |  | ||||||
|    inkscape:version="1.3.2 (1:1.3.2+202311252150+091e20ef0f)" |  | ||||||
|    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" |  | ||||||
|    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" |  | ||||||
|    xmlns="http://www.w3.org/2000/svg" |    xmlns="http://www.w3.org/2000/svg" | ||||||
|    xmlns:svg="http://www.w3.org/2000/svg"> |    xmlns:svg="http://www.w3.org/2000/svg"> | ||||||
|   <defs |   <defs | ||||||
|      id="defs1" /> |      id="defs1" /> | ||||||
|   <sodipodi:namedview |  | ||||||
|      id="namedview1" |  | ||||||
|      pagecolor="#505050" |  | ||||||
|      bordercolor="#eeeeee" |  | ||||||
|      borderopacity="1" |  | ||||||
|      inkscape:showpageshadow="0" |  | ||||||
|      inkscape:pageopacity="0" |  | ||||||
|      inkscape:pagecheckerboard="0" |  | ||||||
|      inkscape:deskcolor="#d1d1d1" |  | ||||||
|      showguides="true" |  | ||||||
|      inkscape:zoom="0.90326851" |  | ||||||
|      inkscape:cx="393.57068" |  | ||||||
|      inkscape:cy="250.756" |  | ||||||
|      inkscape:window-width="1920" |  | ||||||
|      inkscape:window-height="995" |  | ||||||
|      inkscape:window-x="0" |  | ||||||
|      inkscape:window-y="0" |  | ||||||
|      inkscape:window-maximized="1" |  | ||||||
|      inkscape:current-layer="svg1"> |  | ||||||
|     <sodipodi:guide |  | ||||||
|        position="171.95879,103.32864" |  | ||||||
|        orientation="0,-1" |  | ||||||
|        id="guide4" |  | ||||||
|        inkscape:locked="false" /> |  | ||||||
|     <sodipodi:guide |  | ||||||
|        position="271.68286,132.35281" |  | ||||||
|        orientation="1,0" |  | ||||||
|        id="guide5" |  | ||||||
|        inkscape:locked="false" /> |  | ||||||
|   </sodipodi:namedview> |  | ||||||
|   <path |   <path | ||||||
|      d="m 365.63918,111.75001 h -62.375 V 15.9375 c 0,-8.75 -7,-15.9375 -15.625,-15.9375 h -31.1875 c -8.5625,0 -15.625,7.1875 -15.625,15.9375 v 95.81251 h -62.375 l 93.5625,127.75 z" |      d="m 365.63918,111.75001 h -62.375 V 15.9375 c 0,-8.75 -7,-15.9375 -15.625,-15.9375 h -31.1875 c -8.5625,0 -15.625,7.1875 -15.625,15.9375 v 95.81251 h -62.375 l 93.5625,127.75 z" | ||||||
|      id="path1" |      id="path1" | ||||||
|      sodipodi:nodetypes="ccsssscccc" /> |      style="fill:#000000;fill-opacity:1" /> | ||||||
|   <path |   <path | ||||||
|      d="m 432.27837,365.63919 v -62.375 h 95.8125 c 8.75,0 15.9375,-7 15.9375,-15.625 v -31.1875 c 0,-8.5625 -7.1875,-15.625 -15.9375,-15.625 h -95.8125 v -62.375 l -127.75,93.5625 z" |      d="m 432.27837,365.63919 v -62.375 h 95.8125 c 8.75,0 15.9375,-7 15.9375,-15.625 v -31.1875 c 0,-8.5625 -7.1875,-15.625 -15.9375,-15.625 h -95.8125 v -62.375 l -127.75,93.5625 z" | ||||||
|      id="path1-5" |      id="path1-5" | ||||||
|      sodipodi:nodetypes="ccsssscccc" /> |      style="fill:#000000;fill-opacity:1" /> | ||||||
|   <path |   <path | ||||||
|      d="m 178.38918,432.27838 h 62.375 v 95.8125 c 0,8.75 7,15.9375 15.625,15.9375 h 31.1875 c 8.5625,0 15.625,-7.1875 15.625,-15.9375 v -95.8125 h 62.375 l -93.5625,-127.75 z" |      d="m 178.38918,432.27838 h 62.375 v 95.8125 c 0,8.75 7,15.9375 15.625,15.9375 h 31.1875 c 8.5625,0 15.625,-7.1875 15.625,-15.9375 v -95.8125 h 62.375 l -93.5625,-127.75 z" | ||||||
|      id="path2" |      id="path2" | ||||||
|      sodipodi:nodetypes="ccsssscccc" /> |      style="fill:#000000;fill-opacity:1" /> | ||||||
|   <path |   <path | ||||||
|      d="m 111.75,178.38919 v 62.375 H 15.9375 c -8.75,0 -15.9375,7 -15.9375,15.625 v 31.1875 c 0,8.5625 7.1875,15.625 15.9375,15.625 H 111.75 v 62.375 l 127.74999,-93.5625 z" |      d="m 111.75,178.38919 v 62.375 H 15.9375 c -8.75,0 -15.9375,7 -15.9375,15.625 v 31.1875 c 0,8.5625 7.1875,15.625 15.9375,15.625 H 111.75 v 62.375 l 127.74999,-93.5625 z" | ||||||
|      id="path3" |      id="path3" | ||||||
|      sodipodi:nodetypes="ccsssscccc" /> |      style="fill:#000000;fill-opacity:1" /> | ||||||
| </svg> | </svg> | ||||||
|  |  | ||||||
| Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 1.2 KiB | 
|  | @ -16,6 +16,7 @@ | ||||||
|   import Locale from "../i18n/Locale" |   import Locale from "../i18n/Locale" | ||||||
|   import { ariaLabelStore } from "../../Utils/ariaLabel" |   import { ariaLabelStore } from "../../Utils/ariaLabel" | ||||||
|   import type { SpecialVisualizationState } from "../SpecialVisualization" |   import type { SpecialVisualizationState } from "../SpecialVisualization" | ||||||
|  |   import Center from "../../assets/svg/Center.svelte" | ||||||
| 
 | 
 | ||||||
|   export let state: SpecialVisualizationState |   export let state: SpecialVisualizationState | ||||||
|   export let feature: Feature |   export let feature: Feature | ||||||
|  | @ -95,26 +96,34 @@ | ||||||
| 
 | 
 | ||||||
|   let label = labelFromCenter.map(labelFromCenter => { |   let label = labelFromCenter.map(labelFromCenter => { | ||||||
|     if (labelFromGps.data !== undefined) { |     if (labelFromGps.data !== undefined) { | ||||||
|       if(closeToCurrentLocation.data){ |       if (closeToCurrentLocation.data) { | ||||||
|         return labelFromGps.data |         return labelFromGps.data | ||||||
|       } |       } | ||||||
|       return labelFromCenter + ", " + labelFromGps.data |       return labelFromCenter + ", " + labelFromGps.data | ||||||
|     } |     } | ||||||
|     return labelFromCenter |     return labelFromCenter | ||||||
|   }, [labelFromGps]) |   }, [labelFromGps]) | ||||||
|   function focusMap(){ | 
 | ||||||
|  |   function focusMap() { | ||||||
|     state.mapProperties.location.setData({ lon: fcenter[0], lat: fcenter[1] }) |     state.mapProperties.location.setData({ lon: fcenter[0], lat: fcenter[1] }) | ||||||
|   } |   } | ||||||
| </script> | </script> | ||||||
| 
 | 
 | ||||||
| <button class={twMerge("relative rounded-full soft", size)} use:ariaLabelStore={label} on:click={() => focusMap()}> | {#if $bearingAndDistGps === undefined} | ||||||
|   <div class={twMerge("absolute top-0 left-0 flex items-center justify-center text-sm break-words",size)}> |   <button class={twMerge("relative rounded-full soft p-1", size)} on:click={() => focusMap()} | ||||||
|     {GeoOperations.distanceToHuman($bearingAndDistGps?.dist)} |           use:ariaLabelStore={label}> | ||||||
|   </div> |     <Center class="w-7 h-7"/> | ||||||
|   {#if $bearingFromGps !== undefined} |   </button> | ||||||
|     <div class={twMerge("absolute top-0 left-0 rounded-full", size)}> | {:else} | ||||||
|       <Compass_arrow class={size} |   <button class={twMerge("relative rounded-full soft", size)} on:click={() => focusMap()} use:ariaLabelStore={label}> | ||||||
|                      style={`transform: rotate( calc( 45deg + ${$bearingFromGps - ($compass ?? 0)}deg) );`} /> |     <div class={twMerge("absolute top-0 left-0 flex items-center justify-center text-sm break-words",size)}> | ||||||
|  |       {GeoOperations.distanceToHuman($bearingAndDistGps?.dist)} | ||||||
|     </div> |     </div> | ||||||
|   {/if} |     {#if $bearingFromGps !== undefined} | ||||||
| </button> |       <div class={twMerge("absolute top-0 left-0 rounded-full", size)}> | ||||||
|  |         <Compass_arrow class={size} | ||||||
|  |                        style={`transform: rotate( calc( 45deg + ${$bearingFromGps - ($compass ?? 0)}deg) );`} /> | ||||||
|  |       </div> | ||||||
|  |     {/if} | ||||||
|  |   </button> | ||||||
|  | {/if} | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| <script> | <script> | ||||||
| export let color = "#000000" | export let color = "#000000" | ||||||
| </script> | </script> | ||||||
|  <svg {...$$restProps} on:click on:mouseover on:mouseenter on:mouseleave on:keydown    width="544.02838"    height="544.02838"    viewBox="0 0 544.02838 544.02838"    version="1.1"    id="svg1"    sodipodi:docname="center.svg"    inkscape:version="1.3.2 (1:1.3.2+202311252150+091e20ef0f)"    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"    xmlns="http://www.w3.org/2000/svg"    xmlns:svg="http://www.w3.org/2000/svg">   <defs      id="defs1" />   <sodipodi:namedview      id="namedview1"      pagecolor="#505050"      bordercolor="#eeeeee"      borderopacity="1"      inkscape:showpageshadow="0"      inkscape:pageopacity="0"      inkscape:pagecheckerboard="0"      inkscape:deskcolor="#d1d1d1"      showguides="true"      inkscape:zoom="0.90326851"      inkscape:cx="393.57068"      inkscape:cy="250.756"      inkscape:window-width="1920"      inkscape:window-height="995"      inkscape:window-x="0"      inkscape:window-y="0"      inkscape:window-maximized="1"      inkscape:current-layer="svg1">     <sodipodi:guide        position="171.95879,103.32864"        orientation="0,-1"        id="guide4"        inkscape:locked="false" />     <sodipodi:guide        position="271.68286,132.35281"        orientation="1,0"        id="guide5"        inkscape:locked="false" />   </sodipodi:namedview>   <path      d="m 365.63918,111.75001 h -62.375 V 15.9375 c 0,-8.75 -7,-15.9375 -15.625,-15.9375 h -31.1875 c -8.5625,0 -15.625,7.1875 -15.625,15.9375 v 95.81251 h -62.375 l 93.5625,127.75 z"      id="path1"      sodipodi:nodetypes="ccsssscccc" />   <path      d="m 432.27837,365.63919 v -62.375 h 95.8125 c 8.75,0 15.9375,-7 15.9375,-15.625 v -31.1875 c 0,-8.5625 -7.1875,-15.625 -15.9375,-15.625 h -95.8125 v -62.375 l -127.75,93.5625 z"      id="path1-5"      sodipodi:nodetypes="ccsssscccc" />   <path      d="m 178.38918,432.27838 h 62.375 v 95.8125 c 0,8.75 7,15.9375 15.625,15.9375 h 31.1875 c 8.5625,0 15.625,-7.1875 15.625,-15.9375 v -95.8125 h 62.375 l -93.5625,-127.75 z"      id="path2"      sodipodi:nodetypes="ccsssscccc" />   <path      d="m 111.75,178.38919 v 62.375 H 15.9375 c -8.75,0 -15.9375,7 -15.9375,15.625 v 31.1875 c 0,8.5625 7.1875,15.625 15.9375,15.625 H 111.75 v 62.375 l 127.74999,-93.5625 z"      id="path3"      sodipodi:nodetypes="ccsssscccc" /> </svg>  |  <svg {...$$restProps} on:click on:mouseover on:mouseenter on:mouseleave on:keydown    width="544.02838"    height="544.02838"    viewBox="0 0 544.02838 544.02838"    version="1.1"    id="svg1"    xmlns="http://www.w3.org/2000/svg"    xmlns:svg="http://www.w3.org/2000/svg">   <defs      id="defs1" />   <path      d="m 365.63918,111.75001 h -62.375 V 15.9375 c 0,-8.75 -7,-15.9375 -15.625,-15.9375 h -31.1875 c -8.5625,0 -15.625,7.1875 -15.625,15.9375 v 95.81251 h -62.375 l 93.5625,127.75 z"      id="path1"      style="fill:{color};fill-opacity:1" />   <path      d="m 432.27837,365.63919 v -62.375 h 95.8125 c 8.75,0 15.9375,-7 15.9375,-15.625 v -31.1875 c 0,-8.5625 -7.1875,-15.625 -15.9375,-15.625 h -95.8125 v -62.375 l -127.75,93.5625 z"      id="path1-5"      style="fill:{color};fill-opacity:1" />   <path      d="m 178.38918,432.27838 h 62.375 v 95.8125 c 0,8.75 7,15.9375 15.625,15.9375 h 31.1875 c 8.5625,0 15.625,-7.1875 15.625,-15.9375 v -95.8125 h 62.375 l -93.5625,-127.75 z"      id="path2"      style="fill:{color};fill-opacity:1" />   <path      d="m 111.75,178.38919 v 62.375 H 15.9375 c -8.75,0 -15.9375,7 -15.9375,15.625 v 31.1875 c 0,8.5625 7.1875,15.625 15.9375,15.625 H 111.75 v 62.375 l 127.74999,-93.5625 z"      id="path3"      style="fill:{color};fill-opacity:1" /> </svg>  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue