@@ -211,6 +211,59 @@ function buildAuthenticatedAssetUrl(
211211 return url . toString ( ) ;
212212}
213213
214+ function chromeStampNumber ( value : number | undefined ) : string {
215+ return Number . isFinite ( value ) ? String ( Math . round ( ( value ?? 0 ) * 1000 ) ) : "0" ;
216+ }
217+
218+ function chromeStampText ( value : string | undefined | null ) : string {
219+ return ( value ?? "" ) . replace ( / [ ^ a - z A - Z 0 - 9 _ . - ] + / g, "_" ) ;
220+ }
221+
222+ function buildChromeProfileAssetStamp ( profile : ChromeProfile | null ) : string {
223+ if ( ! profile ) {
224+ return "" ;
225+ }
226+
227+ const geometryStamp = [
228+ profile . totalWidth ,
229+ profile . totalHeight ,
230+ profile . screenX ,
231+ profile . screenY ,
232+ profile . screenWidth ,
233+ profile . screenHeight ,
234+ profile . cornerRadius ,
235+ ]
236+ . map ( chromeStampNumber )
237+ . join ( "x" ) ;
238+ const maskStamp = profile . hasScreenMask ? "mask" : "nomask" ;
239+ const buttonStamp = [ ...( profile . buttons ?? [ ] ) ]
240+ . sort ( ( left , right ) => left . name . localeCompare ( right . name ) )
241+ . map ( ( button ) =>
242+ [
243+ chromeStampText ( button . name ) ,
244+ chromeStampText ( button . type ) ,
245+ chromeStampText ( button . imageName ) ,
246+ chromeStampText ( button . imageDownName ) ,
247+ chromeStampText ( button . anchor ) ,
248+ chromeStampText ( button . align ) ,
249+ button . onTop ? "top" : "under" ,
250+ chromeStampNumber ( button . x ) ,
251+ chromeStampNumber ( button . y ) ,
252+ chromeStampNumber ( button . width ) ,
253+ chromeStampNumber ( button . height ) ,
254+ chromeStampNumber ( button . normalOffset ?. x ) ,
255+ chromeStampNumber ( button . normalOffset ?. y ) ,
256+ chromeStampNumber ( button . rolloverOffset ?. x ) ,
257+ chromeStampNumber ( button . rolloverOffset ?. y ) ,
258+ String ( button . usagePage ?? "" ) ,
259+ String ( button . usage ?? "" ) ,
260+ ] . join ( "," ) ,
261+ )
262+ . join ( ";" ) ;
263+
264+ return [ geometryStamp , maskStamp , buttonStamp ] . filter ( Boolean ) . join ( ":" ) ;
265+ }
266+
214267function shouldUseRemoteStreamDefault ( apiRoot : string ) : boolean {
215268 if ( apiRoot ) {
216269 return true ;
@@ -918,18 +971,9 @@ export function AppShell({
918971 button . name . toLowerCase ( ) === "digital-crown" ,
919972 ) ,
920973 ) ;
921- const chromeGeometryStamp = viewportChromeProfile
922- ? [
923- viewportChromeProfile . totalWidth ,
924- viewportChromeProfile . totalHeight ,
925- viewportChromeProfile . screenX ,
926- viewportChromeProfile . screenY ,
927- viewportChromeProfile . screenWidth ,
928- viewportChromeProfile . screenHeight ,
929- ]
930- . map ( ( value ) => Math . round ( value ) )
931- . join ( "x" )
932- : "" ;
974+ const chromeGeometryStamp = buildChromeProfileAssetStamp (
975+ viewportChromeProfile ,
976+ ) ;
933977 const chromeAssetStamp = [
934978 selectedSimulator ?. deviceTypeIdentifier ,
935979 selectedSimulator ?. deviceTypeName ,
@@ -1718,18 +1762,10 @@ export function AppShell({
17181762 const chromeScreenStyle =
17191763 viewportChromeProfile && chromeScreenRect
17201764 ? ( {
1721- left : viewportChromeProfile . hasScreenMask
1722- ? `calc(${ ( chromeScreenRect . x / viewportChromeProfile . totalWidth ) * 100 } % - 1px)`
1723- : `${ ( chromeScreenRect . x / viewportChromeProfile . totalWidth ) * 100 } %` ,
1724- top : viewportChromeProfile . hasScreenMask
1725- ? `calc(${ ( chromeScreenRect . y / viewportChromeProfile . totalHeight ) * 100 } % - 1px)`
1726- : `${ ( chromeScreenRect . y / viewportChromeProfile . totalHeight ) * 100 } %` ,
1727- width : viewportChromeProfile . hasScreenMask
1728- ? `calc(${ ( chromeScreenRect . width / viewportChromeProfile . totalWidth ) * 100 } % + 2px)`
1729- : `${ ( chromeScreenRect . width / viewportChromeProfile . totalWidth ) * 100 } %` ,
1730- height : viewportChromeProfile . hasScreenMask
1731- ? `calc(${ ( chromeScreenRect . height / viewportChromeProfile . totalHeight ) * 100 } % + 2px)`
1732- : `${ ( chromeScreenRect . height / viewportChromeProfile . totalHeight ) * 100 } %` ,
1765+ left : `${ ( chromeScreenRect . x / viewportChromeProfile . totalWidth ) * 100 } %` ,
1766+ top : `${ ( chromeScreenRect . y / viewportChromeProfile . totalHeight ) * 100 } %` ,
1767+ width : `${ ( chromeScreenRect . width / viewportChromeProfile . totalWidth ) * 100 } %` ,
1768+ height : `${ ( chromeScreenRect . height / viewportChromeProfile . totalHeight ) * 100 } %` ,
17331769 borderRadius : viewportChromeProfile . hasScreenMask
17341770 ? "0"
17351771 : ( chromeScreenBorderRadius ?? "0" ) ,
0 commit comments