openui5-googlemaps icon indicating copy to clipboard operation
openui5-googlemaps copied to clipboard

Marker.js: - TypeError: Cannot read property 'DROP' of undefined

Open michaelhna opened this issue 6 years ago • 1 comments

Hello,

First of all I would like to thank you for writing and sharing this library!

I am working in WebIDE, using XML views and JS controllers. I have added a map in my 'Detail.view.xml' view similar to your blog post, and included the library in my 'Component.js' file (sap.ui.getCore().loadLibrary("openui5.googlemaps", "../openui5/googlemaps/")), and the map loads fine (I'm able to interact with it, move the draggable marker, etc).

I now wish to use the marker and polygon libraries to do some geofencing. In my 'Detail.controller.js' controller, I am unable to reference 'openui5.googlemaps', as it says "openui5 is not defined".

Instead, I have included the libraries using relative paths in 'sap.ui.define' at the top of the controller. Polygon.js loads without error, however, Marker.js gives the following error, so my controller won't even load: "Error: failed to load 'projectproperties/openui5/googlemaps/Marker.js' from ../openui5/googlemaps/Marker.js: TypeError: Cannot read property 'DROP' of undefined"

A similar error also happens when trying to include Map.js, except it complains about property 'ROADMAP'.

Do you know what would be causing these errors? Or do you have any suggestions for how to better utilize these libraries in my controller (for example, actually referencing the 'openui5.googlemaps' that was loaded in my component)? I cannot simply define 'projectproperties/openui5/googlemaps' like I did with Polygon.js, as it looks for an actual JS file with the name "googlemaps.js".

I have included a picture of my folder structure for reference, as well as the 'sap.ui.define' in my controller - please let me know if any other pictures/information would be helpful. 9-20-2017 1-48-19 pm

9-20-2017 1-59-05 pm

Thanks,

Michael

michaelhna avatar Sep 20 '17 20:09 michaelhna

Try to use this way..

sap.ui.define([
..
"openui5.googlemaps.Polygon",
"openui5.googlemaps.Marker"], function(..., Polygon, Marker) {

connecttobn avatar Oct 23 '17 11:10 connecttobn