Coder Social home page Coder Social logo

Comments (13)

wf9a5m75 avatar wf9a5m75 commented on September 23, 2024 1

Fixed it!

from ionic-googlemaps-demo.

wf9a5m75 avatar wf9a5m75 commented on September 23, 2024

Did you git pull of https://github.com/wf9a5m75/ionic-native/, npm run build google-maps and npm install (path to)/dist/@ionic-native/google-maps?

Because I fixed this yesterday.
The constructor of LatLngBounds is now:

  constructor(southwestOrArrayOfLatLng?: LatLng | LatLng[], northeast?: LatLng) {
    let args = !!northeast ? [southwestOrArrayOfLatLng, northeast] : southwestOrArrayOfLatLng;
    this._objectInstance = new (GoogleMaps.getPlugin()).LatLngBounds(args);
  }

https://github.com/wf9a5m75/ionic-native/blob/master/src/%40ionic-native/plugins/google-maps/index.ts#L1707

from ionic-googlemaps-demo.

ThorvaldAagaard avatar ThorvaldAagaard commented on September 23, 2024

Yes I'm on latest. The fix is fine and allowing an empty signature as constructor. Problem occurs when constructor is called with no parameters

from ionic-googlemaps-demo.

wf9a5m75 avatar wf9a5m75 commented on September 23, 2024

I work this line without no problem.
https://github.com/wf9a5m75/ionic-googlemaps-demo/blob/master/src/pages/geocoder/geocoding/geocoding.ts#L130

from ionic-googlemaps-demo.

ThorvaldAagaard avatar ThorvaldAagaard commented on September 23, 2024

Version af Android? I know it works for you. Just verify if the failing statement is executed in your case

from ionic-googlemaps-demo.

wf9a5m75 avatar wf9a5m75 commented on September 23, 2024

I tested on Android 6.0.1.
But this is JS problem, all code should work as same on any OS.

from ionic-googlemaps-demo.

ThorvaldAagaard avatar ThorvaldAagaard commented on September 23, 2024

I'm not sure the JS-version is the same on all platforms. I am running on 7.something.

But it fails here, so I can show you the call stack later.

Is it possible for you to inspect args[i] prior to the search?

from ionic-googlemaps-demo.

ThorvaldAagaard avatar ThorvaldAagaard commented on September 23, 2024

When calling like this

    }).then((mvcArray: BaseArrayClass<GeocoderResult>) => {

        let latLngBounds = new LatLngBounds();
        let markers = new BaseArrayClass();

        mvcArray.on('error').subscribe((error) => {
          console.log(error);
        });

and setting a breakpoint here
image

you can see that the array arg contains one element "undefined"

If I on the other hand uses this to make the call (Define LatLngBounds with an empty array)

    }).then((mvcArray: BaseArrayClass<GeocoderResult>) => {

        let latLngBounds = new LatLngBounds([]);
        let markers = new BaseArrayClass();

        mvcArray.on('error').subscribe((error) => {
          console.log(error);
        });

the result is
image
where arg now is an empty array, and the code works fine.

I think that

constructor(southwestOrArrayOfLatLng?: LatLng | LatLng[], northeast?: LatLng);

that allows 0, or 1 of 2 parameters, but the code checks to see if the first element is an array, and if not then assumes its LatLng that has been passed, so it should check for no parameters like

    var args = [];
    if (arguments.length === 1 &&
        typeof arguments[0] === "object" &&
        "push" in arguments[0]) {
        args = arguments[0];
    } else {
        if (arguments[0] != undefined) {
            args = Array.prototype.slice.call(arguments, 0);
        }
    }
    for (var i = 0; i < args.length; i++) {
        if ("lat" in args[i] && "lng" in args[i]) {
            this.extend(args[i]);
        }
    }

Then it works fine for me in both situations

from ionic-googlemaps-demo.

wf9a5m75 avatar wf9a5m75 commented on September 23, 2024

Oh, sorry, I haven't caught you up yet..
But thank you for inspecting.

from ionic-googlemaps-demo.

ThorvaldAagaard avatar ThorvaldAagaard commented on September 23, 2024

No need to excuse, I haven't been waiting :-)

It could probably also be fixed here
image

from ionic-googlemaps-demo.

wf9a5m75 avatar wf9a5m75 commented on September 23, 2024

@ThorvaldAagaard

Actually, I fixed this issue long time ago (especially on the marker cluster development).
And I merged the most of all code to the current multiple_maps branch.
I guess I merged after you tested.
Then the code becomes like this:

    for (var i = 0; i < args.length; i++) {
        if (args[i] && args[i] && "lat" in args[i] && "lng" in args[i]) {
            this.extend(args[i]);
        }
    }

https://github.com/mapsplugin/cordova-plugin-googlemaps/blob/93e138a8cefcc7efbb3fea63e67c2f2365453edf/www/LatLngBounds.js#L22

Since the code if (args[i] blocks null and undefined, currently work fine if you execute new LatLng(undefined).

Please reinstall the plugin

from ionic-googlemaps-demo.

ThorvaldAagaard avatar ThorvaldAagaard commented on September 23, 2024

Hmm, interesting my version is still the code without the test.

I can see you committed the change 7th of July, and I can see I installed the plugin at the 28th of July, and in the demo project at 3rd of August

Anyway doing a clean install gave me the fixed version

By the way you might have merged it in twice as it now reads:

args[i] && args[i] &&

from ionic-googlemaps-demo.

wf9a5m75 avatar wf9a5m75 commented on September 23, 2024

Opps!

from ionic-googlemaps-demo.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.