a14n / dart-google-maps

A library to use Google Maps JavaScript API v3 from Dart scripts.
Other
125 stars 63 forks source link

Map is correctly displayed but I cannot pan, zoom or anything by default. Is this expected? #126

Closed andynewman10 closed 4 months ago

andynewman10 commented 4 months ago

I did the following:

<html>
[...]
<script src="flutter.js" defer></script>
<!-- added the following line -->
<script src="https://maps......&API_KEY=validAPIkey"></script>
[...]
<body>
<script>
  window.addEventListener('window', ...
  ...
</script>
<!-- added the following line -->
<div style="width: 100%; height: 100%" id="map"></dvi>
</body>
</html>

My Dart code file is the following:

import 'package:google_maps/google_maps.dart'
import 'package:web/web.dart'

void main() {
  GMap(document.getElementById('map') as HTMLElement,
    MapOptions()
      ..center = LatLng(...)
      ..zoom = 8),;
}

When I run this code using the VS code debugger, using Edge or Chrome, I can't pan within the map, or zoom in or out. Is this expected? Am I supposed to add some code to do this? Sorry if this question sounds stupid.

andynewman10 commented 4 months ago

Closing this issue. I was actually running the code from a Flutter project, not a Dart one. I guess there was some competition between the map widget and Flutter as to which component received the mouse events.