@@ -38,14 +38,14 @@ function getDefaultSvgBoundsIfUndefined(text: string, src: string) {
3838 return null ;
3939}
4040
41- function createContext ( imageAfter : HTMLImageElement , imageBefore : HTMLImageElement , boundPair : any ) {
41+ function createContext ( imageAfter : HTMLImageElement , imageBefore : HTMLImageElement , svgBoundsInfo : any ) {
4242 const sizeAfter = {
43- width : boundPair . after ?. width || imageAfter ?. width || 0 ,
44- height : boundPair . after ?. height || imageAfter ?. height || 0 ,
43+ width : svgBoundsInfo . after ?. width || imageAfter ?. width || 0 ,
44+ height : svgBoundsInfo . after ?. height || imageAfter ?. height || 0 ,
4545 } ;
4646 const sizeBefore = {
47- width : boundPair . before ?. width || imageBefore ?. width || 0 ,
48- height : boundPair . before ?. height || imageBefore ?. height || 0 ,
47+ width : svgBoundsInfo . before ?. width || imageBefore ?. width || 0 ,
48+ height : svgBoundsInfo . before ?. height || imageBefore ?. height || 0 ,
4949 } ;
5050 const maxSize = {
5151 width : Math . max ( sizeBefore . width , sizeAfter . width ) ,
@@ -92,7 +92,7 @@ class ImageDiff {
9292 boundsInfo : containerEl . querySelector ( '.bounds-info-before' ) ,
9393 } ] ;
9494
95- const boundPair : any = { before : null , after : null } ;
95+ const svgBoundsInfo : any = { before : null , after : null } ;
9696 await Promise . all ( imageInfos . map ( async ( info , index ) => {
9797 const [ success ] = await Promise . all ( Array . from ( info . images , ( img ) => {
9898 return loadElem ( img , info . path ) ;
@@ -103,7 +103,7 @@ class ImageDiff {
103103 const resp = await GET ( info . path ) ;
104104 const text = await resp . text ( ) ;
105105 const bounds = getDefaultSvgBoundsIfUndefined ( text , info . path ) ;
106- boundPair [ index === 0 ? 'after' : 'before' ] = bounds ;
106+ svgBoundsInfo [ index === 0 ? 'after' : 'before' ] = bounds ;
107107 if ( bounds ) {
108108 hideElem ( info . boundsInfo ) ;
109109 }
@@ -113,10 +113,10 @@ class ImageDiff {
113113 const imagesAfter = imageInfos [ 0 ] . images ;
114114 const imagesBefore = imageInfos [ 1 ] . images ;
115115
116- this . initSideBySide ( createContext ( imagesAfter [ 0 ] , imagesBefore [ 0 ] , boundPair ) ) ;
116+ this . initSideBySide ( createContext ( imagesAfter [ 0 ] , imagesBefore [ 0 ] , svgBoundsInfo ) ) ;
117117 if ( imagesAfter . length > 0 && imagesBefore . length > 0 ) {
118- this . initSwipe ( createContext ( imagesAfter [ 1 ] , imagesBefore [ 1 ] , boundPair ) ) ;
119- this . initOverlay ( createContext ( imagesAfter [ 2 ] , imagesBefore [ 2 ] , boundPair ) ) ;
118+ this . initSwipe ( createContext ( imagesAfter [ 1 ] , imagesBefore [ 1 ] , svgBoundsInfo ) ) ;
119+ this . initOverlay ( createContext ( imagesAfter [ 2 ] , imagesBefore [ 2 ] , svgBoundsInfo ) ) ;
120120 }
121121 queryElemChildren ( containerEl , '.image-diff-tabs' , ( el ) => el . classList . remove ( 'is-loading' ) ) ;
122122 }
0 commit comments