Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get current position for start waypoint #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ondrakub
Copy link

@ondrakub ondrakub commented Sep 1, 2015

just call addMarker with array position ['auto']

$start = $markers->addMarker(['auto'], Markers::BOUNCE, 'Start');

I dont know why IDE changed some empty line for another, sorry

just call addMarker with array position ['auto']
$start = $markers->addMarker(['auto'], Markers::BOUNCE, 'Start');
@Olicek
Copy link
Owner

Olicek commented Sep 4, 2015

Thanks, but it not works. I try it on linux, Google chrome and Firefox. Everytime i get type error request is not a function on line 142. Could you look at that, or does it works for you?

btw. empty lines are because PHPStorm. I wrote it in Netbeans and it lets white spaces in empty lines. Now it's better 👍

@ondrakub
Copy link
Author

ondrakub commented Sep 4, 2015

I dont know if it's because of linux, but on windows 10 (chrome, firefox, edge) it works.
Request is a function defined a few lines below. I don't have option how to test it on linux right now.

@Olicek
Copy link
Owner

Olicek commented Sep 4, 2015

I know, it's defined. Probably some issue with scope. I will try debug it today and we will see :)

@Olicek Olicek added this to the v2.2 milestone Sep 4, 2015
@Olicek
Copy link
Owner

Olicek commented Jan 20, 2016

Finally i had time to investigate thsi problem. Sorry for that long time waiting. And I found it. Unfortunately i have absolutly no idea how it repair. I spend 3 hours with it without any solution.

Problem is in markers. Markers are delivered at the end by ajax. And this markers contein original data from Markers.php. It means it contains position['auto'].

I tried:

base.markers = data;

base.markers.forEach(function(item, i, thisArray){
    if(navigator.geolocation && item.position[0]) {
        navigator.geolocation.getCurrentPosition(function(position) {
            initialLocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);
            thisArray[i]['position'][0] = position.coords.latitude;
            thisArray[i]['position'][1] = position.coords.longitude;
        }, function() {
            handleNoGeolocation(browserSupportFlag);
        });
    }
});

What i don't understand, why console.log(markers[i]); returns right value but console.log(markers[i].position); wrong value (auto).

It can be seen even at this picture (position has 1 item in array, but when i expand this object i can see 2 items in position array):

wrongjs

Any suggestions?

@Olicek Olicek modified the milestones: v2.3, v2.2 Mar 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants