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

Inheriting from OverlayView no longer works. #95

Closed JonHodgson closed 3 years ago

JonHodgson commented 3 years ago

I found this using my own code for popup menus using OverlayView which worked with the previous version of dart-google-maps, but I get exactly the same error running the overlay-hideshow example (that's where this particular error report is taken from).

Uncaught TypeError: Cannot read property 'call' of undefined 
page.USGSOverlay.new        page.dart:35
main                        page.dart:25
(anonymous function)        page.dart.bootstrap.js:271
window.$dartRunMain         page.dart.bootstrap.js:270
(anonymous function)        106:1
runMain                     client.js:8656
(anonymous function)        client.js:22068
(anonymous function)        client.js:3830
call$2                      client.js:10905

I'm guessing it's down to the fact that OverlayView now uses a factory constructor?

a14n commented 3 years ago

Inheriting from OverlayView no longer works

That's correct. You have to declare an OverlayView instance and set its draw, onAdd and onRemove.

I get exactly the same error running the overlay-hideshow example

Sorry, I haven't had time to migrate all the examples and some might be broken. I just push the migration of overlay-simple and you can take a look at the change I made (https://github.com/a14n/dart-google-maps/commit/7037fc3e2ed0bda6cf0d811b65d241a20d803e57#diff-b264bc12434cee004ff67414bd69ca662088874bcf73aa23370990c9141d2280R33-R45) to migrate your code.

Let me know if it works for you.