@@ -233,11 +233,22 @@ func generateMap(ctx context.Context, markers map[string]util.Coords, userLocati
233233 }
234234
235235 screenWidth := query .ScreenWidthFromContext (ctx )
236+ screenHeight := query .ScreenHeightFromContext (ctx )
236237 if screenWidth == 0 {
237238 screenWidth = 144
238239 }
240+
241+ widgetHeight := 100
242+ if screenWidth >= 168 {
243+ widgetHeight = 140
244+ }
245+ // Assuming that screen with equal width and height is round
246+ if screenWidth == screenHeight {
247+ widgetHeight = screenHeight
248+ }
249+
239250 request := gmaps.StaticMapRequest {
240- Size : fmt .Sprintf ("%dx100 " , screenWidth ),
251+ Size : fmt .Sprintf ("%dx%d " , screenWidth , widgetHeight ),
241252 Format : "png8" ,
242253 MapType : "roadmap" ,
243254 MapId : config .GetConfig ().GoogleMapsStaticMapId ,
@@ -291,7 +302,9 @@ func monochrome(img image.Image) image.Image {
291302 }
292303 }
293304 }
294- stampLogo (newImg , googleLogo1Bit )
305+ if img .Bounds ().Max .X <= 168 {
306+ stampLogo (newImg , googleLogo1Bit )
307+ }
295308 return newImg
296309}
297310
@@ -308,7 +321,9 @@ func lowColour(img image.Image) image.Image {
308321 }
309322 }
310323 }
311- stampLogo (newImg , googleLogo2Bit )
324+ if img .Bounds ().Max .X <= 168 {
325+ stampLogo (newImg , googleLogo2Bit )
326+ }
312327 return newImg
313328}
314329
0 commit comments