File tree Expand file tree Collapse file tree
Providers/Maps/Google/Marker Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2+ namespace OSFramework . Maps . Helper {
3+ /**
4+ * Validates if value is a valid number.
5+ *
6+ * @export
7+ * @param {unknown } value
8+ * @return {* } {boolean}
9+ */
10+ export function IsValidNumber ( value : unknown ) : boolean {
11+ return ! isNaN ( value as number ) ;
12+ }
13+ }
Original file line number Diff line number Diff line change @@ -34,21 +34,23 @@ namespace Provider.Maps.Google.Marker {
3434 } else {
3535 try {
3636 let scaledSize : google . maps . Size ;
37+ //Explicit conversion to number - related with ROU-4592 - as google will behave differently depending on the type
38+ //of the input. Before, in runtime, the input was of type string.
39+ const height = Number ( this . config . iconHeight ) ;
40+ const width = Number ( this . config . iconWidth ) ;
3741 // If the size of the icon is defined by a valid width and height, use those values
3842 // Else If nothing is passed or the icon size has the width or the height equal to 0, use the full image size
3943 if (
40- this . config . iconWidth > 0 &&
41- this . config . iconHeight > 0
44+ OSFramework . Maps . Helper . IsValidNumber ( height ) &&
45+ OSFramework . Maps . Helper . IsValidNumber ( width ) &&
46+ height > 0 && width > 0
4247 ) {
43- scaledSize = new google . maps . Size (
44- this . config . iconWidth ,
45- this . config . iconHeight
46- ) ;
48+ scaledSize = new google . maps . Size ( width , height ) ;
4749 }
4850 // Update the icon using the previous configurations
4951 const icon = {
50- url,
51- scaledSize
52+ url : url ,
53+ size : scaledSize
5254 } ;
5355 // Set the icon to the Marker provider
5456 this . provider . setIcon ( icon ) ;
You can’t perform that action at this time.
0 commit comments