File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed
Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 77 StreetViewTool ,
88 } from " lib/common" ;
99 import { CheckboxGroup } from " lib/govuk" ;
10+ import { layerId } from " lib/maplibre" ;
11+ import { FillLayer , GeoJSON } from " svelte-maplibre" ;
1012 import CensusOutputAreaLayerControl from " ./layers/areas/CensusOutputAreas.svelte" ;
1113 import CombinedAuthoritiesLayerControl from " ./layers/areas/CombinedAuthorities.svelte" ;
1214 import ImdLayerControl from " ./layers/areas/IMD.svelte" ;
3537 // Workaround for https://github.com/sveltejs/svelte/issues/7630
3638 $ : streetviewEnabled = ! $interactiveMapLayersEnabled ;
3739 $ : interactiveMapLayersEnabled .set (! streetviewEnabled );
40+
41+ // When StreetView is on, disable interactive layers -- no hovering or
42+ // clicking behavior. Achieve this by enabling an invisible layer on top of
43+ // everything.
44+ let coverEverything = {
45+ type: " Feature" as const ,
46+ properties: {},
47+ geometry: {
48+ type: " Polygon" as const ,
49+ coordinates: [
50+ [
51+ [180.0 , 90.0 ],
52+ [- 180.0 , 90.0 ],
53+ [- 180.0 , - 90.0 ],
54+ [180.0 , - 90.0 ],
55+ [180.0 , 90.0 ],
56+ ],
57+ ],
58+ },
59+ };
3860 </script >
3961
4062<CollapsibleCard label =" Layers" open >
89111 </CollapsibleCard >
90112 <BaselayerSwitcher disabled ={! $interactiveMapLayersEnabled } />
91113</CollapsibleCard >
114+
115+ <GeoJSON data ={coverEverything }>
116+ <FillLayer
117+ {...layerId (" cover-interactive-layers" )}
118+ paint ={{
119+ " fill-color" : " black" ,
120+ " fill-opacity" : 0.0 ,
121+ }}
122+ layout ={{
123+ visibility : $interactiveMapLayersEnabled ? " none" : " visible" ,
124+ }}
125+ />
126+ </GeoJSON >
Original file line number Diff line number Diff line change @@ -137,4 +137,6 @@ const layerZorder = [
137137
138138 // TODO This might look nicer lower
139139 "georeferenced-image" ,
140+
141+ "cover-interactive-layers" ,
140142] ;
You can’t perform that action at this time.
0 commit comments