@@ -327,13 +327,28 @@ export function trimDefaultStateMapping(
327327 return values ;
328328}
329329
330- /** Returns the hash part of the URL to a Rate-Distortion curve plot. */
330+ /** Returns the hash part of the URL for a two-batch view. */
331+ export function getTwoBatchViewHash ( state : State , currentHash : string ) {
332+ // Get the current hash (the part after the '#' in the URL), if any.
333+ const hash =
334+ new URLSearchParams ( currentHash . length > 3 ? currentHash . slice ( 1 ) : '' ) ;
335+ // Remove any state that depends on indices.
336+ hash . delete ( 'shown' ) ;
337+ hash . delete ( 'panel_batch' ) ;
338+ hash . delete ( 'panel_match' ) ;
339+ // Do not open the batch panel on load.
340+ hash . delete ( 'panel' ) ;
341+ return hash . toString ( ) ;
342+ }
343+
344+ /** Returns the hash part of the URL for a Rate-Distortion curve plot. */
331345export function getRdModeHash (
332346 state : State , batch : Batch , reference : Batch , rowIndex : number | undefined ,
333347 currentHash : string ) {
334348 // No distortion means no Rate-Distortion curve.
335349 if ( state . batchesAreLikelyLossless ) return undefined ;
336350
351+ // Get the current hash (the part after the '#' in the URL), if any.
337352 const hash =
338353 new URLSearchParams ( currentHash . length > 3 ? currentHash . slice ( 1 ) : '' ) ;
339354
@@ -422,6 +437,11 @@ export function getRdModeHash(
422437 }
423438 // Use the default reference because it has no impact in RD mode.
424439 hash . delete ( 'ref' ) ;
440+ // Remove any state that depends on indices.
441+ hash . delete ( 'panel_batch' ) ;
442+ hash . delete ( 'panel_match' ) ;
443+ // Do not open the batch panel on load.
444+ hash . delete ( 'panel' ) ;
425445
426446 if ( rowIndex !== undefined ) {
427447 // Only display the selected image.
0 commit comments