a14n / dart-google-maps

A library to use Google Maps JavaScript API v3 from Dart scripts.
Apache License 2.0
130 stars 66 forks source link

Key code on mouse click event #52

Closed vasner closed 6 years ago

vasner commented 6 years ago

MouseEvent class do not contain key codes. Is it possible to get key code on mouse click event?

   final mapOptions = new gmap.MapOptions()
      ..zoom = 8
      ..disableDoubleClickZoom = true
      ..center = new gmap.LatLng(41.850033, -87.6500523);

    map = new gmap.GMap(mapRoot, mapOptions);

    map.onClick.listen((gmap.MouseEvent me) {
      // TODO How to get key code there?
      //if (me.ctrlKey || me.metaKey)
      addMarker(me.latLng, ctrlClick);
    });
a14n commented 6 years ago

The underlying js object (MouseEvent) doesn't have ctrlKey or metaKey. So the dart API cannot expose them.

I guess you have to listen to keydow/keyup events on the map div to be able to do what you want.