Skip to content

Commit a19a01a

Browse files
committed
Minor map code cleanup.
Signed-off-by: Katharine Berry <[email protected]>
1 parent d4f651b commit a19a01a

File tree

1 file changed

+4
-2
lines changed
  • service/assistant/widgets

1 file changed

+4
-2
lines changed

service/assistant/widgets/map.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ type MapWidget struct {
5656
}
5757

5858
func mapWidget(ctx context.Context, markerString, includeLocationString string) (*MapWidget, error) {
59-
log.Println("MAP WIDGET!")
6059
includeLocation := strings.EqualFold(includeLocationString, "true")
6160
markers := make(map[string]util.Coords)
6261
threadContext := query.ThreadContextFromContext(ctx)
@@ -135,6 +134,7 @@ func generateMap(ctx context.Context, markers map[string]util.Coords, userLocati
135134
Lng: userLocation.Longitude,
136135
}},
137136
CustomIcon: gmaps.CustomIcon{
137+
// This is a single blue pixel with the magic 16-bit colour rgb(2827, 5911, 56540)
138138
IconURL: "https://storage.googleapis.com/bobby-assets/user-location-pixel.png",
139139
Anchor: "center",
140140
},
@@ -224,7 +224,7 @@ func lowColour(img image.Image) image.Image {
224224
func stampLogo(img *image.Paletted, logo image.Image) {
225225
// slap the black and white version of the Google logo over the existing one
226226
topCorner := image.Pt(7, img.Bounds().Max.Y-17)
227-
targetImageRect := image.Rect(topCorner.X, topCorner.Y, topCorner.X+googleLogo2Bit.Bounds().Dx(), topCorner.Y+googleLogo2Bit.Bounds().Dy())
227+
targetImageRect := image.Rect(topCorner.X, topCorner.Y, topCorner.X+logo.Bounds().Dx(), topCorner.Y+logo.Bounds().Dy())
228228
draw.Draw(img, targetImageRect, logo, image.Point{0, 0}, draw.Over)
229229
}
230230

@@ -249,5 +249,7 @@ func closeToBlack(c color.Color) bool {
249249

250250
func shouldDither(c color.Color) bool {
251251
r, g, b, _ := c.RGBA()
252+
// This is the magic colour we use to indicate a region that should be dithered. It's just off a mid-grey, so the
253+
// antialiasing against it looks about right, but it's not a colour that can ever naturally occur.
252254
return r == 42148 && g == 43176 && b == 43690
253255
}

0 commit comments

Comments
 (0)