@@ -30,7 +30,7 @@ export interface PermalinkStateInference extends PermalinkState {
3030
3131export interface PermalinkStateGlobal extends PermalinkState {
3232 threshold : number
33- showFieldBoundaries : boolean
33+ fieldBoundariesOpacity : number
3434}
3535
3636export default function usePermalink ( ) {
@@ -59,7 +59,7 @@ export default function usePermalink() {
5959 center : [ 0 , 0 ] ,
6060 year : 2025 ,
6161 threshold : 0.4 ,
62- showFieldBoundaries : true ,
62+ fieldBoundariesOpacity : 90 ,
6363 }
6464
6565 const getDefaultState = ( mode : string ) : PermalinkStateInference | PermalinkStateGlobal => {
@@ -175,7 +175,7 @@ export default function usePermalink() {
175175 zoom,
176176 center,
177177 threshold : defaultGlobalState . threshold ,
178- showFieldBoundaries : defaultGlobalState . showFieldBoundaries ,
178+ fieldBoundariesOpacity : defaultGlobalState . fieldBoundariesOpacity ,
179179 }
180180
181181 for ( const part of keyValueParts ) {
@@ -185,8 +185,9 @@ export default function usePermalink() {
185185 } else if ( part . startsWith ( 'year:' ) ) {
186186 const year = parseInt ( part . substring ( 5 ) , 10 )
187187 if ( ! isNaN ( year ) ) result . year = year
188- } else if ( part . startsWith ( 'field_boundaries:' ) ) {
189- result . showFieldBoundaries = part . substring ( 17 ) === '1'
188+ } else if ( part . startsWith ( 'opacity:' ) ) {
189+ const opacity = parseInt ( part . substring ( 8 ) , 10 )
190+ result . fieldBoundariesOpacity = isNaN ( opacity ) ? 90 : opacity
190191 }
191192 }
192193
@@ -289,15 +290,15 @@ export default function usePermalink() {
289290 if ( settings . value . year ) {
290291 hashParts . push ( `year:${ settings . value . year } ` )
291292 }
292- hashParts . push ( `field_boundaries :${ settings . value . showFieldBoundaries ? 1 : 0 } ` )
293+ hashParts . push ( `opacity :${ settings . value . fieldBoundariesOpacity } ` )
293294
294295 state = {
295296 mode,
296297 zoom,
297298 center,
298299 threshold : settings . value . threshold ,
299300 year : settings . value . year ,
300- showFieldBoundaries : settings . value . showFieldBoundaries ,
301+ fieldBoundariesOpacity : settings . value . fieldBoundariesOpacity ,
301302 }
302303 }
303304
@@ -334,7 +335,7 @@ export default function usePermalink() {
334335
335336 function restoreGlobalState ( state : PermalinkStateGlobal ) {
336337 settings . value . threshold = state . threshold
337- settings . value . showFieldBoundaries = state . showFieldBoundaries
338+ settings . value . fieldBoundariesOpacity = state . fieldBoundariesOpacity
338339 if ( state . year ) {
339340 settings . value . year = state . year
340341 }
@@ -366,7 +367,7 @@ export default function usePermalink() {
366367 settings . value . areaCoverage ,
367368 settings . value . buffer ,
368369 settings . value . threshold ,
369- settings . value . showFieldBoundaries ,
370+ settings . value . fieldBoundariesOpacity ,
370371 ] ,
371372 ( ) => {
372373 if ( ! map . value ) {
0 commit comments