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

Method to get marker #7

Closed
aswinkumar863 opened this issue Aug 17, 2019 · 3 comments
Closed

Method to get marker #7

aswinkumar863 opened this issue Aug 17, 2019 · 3 comments

Comments

@aswinkumar863
Copy link

aswinkumar863 commented Aug 17, 2019

A method like getMarker helps to extend the marker functionality such as bind events to the Leaflet.motion's marker

Current workaround

var motionLine = L.motion.polyline( ... )
var marker = motionLine.__marker

Expected

var motionLine = L.motion.polyline( ... )
var marker = motionLine.getMarker()

Related Stackoverflow questions

@Igor-Vladyka
Copy link
Owner

Hi there,

Thanks for posting it, and answering all questions on stackoverflow :)

Just added getMarker() and getMarkers() logic to all motion components.

  • additonal param showMarker to visualize marker on the map before animation stated.

Please let me know if any,

Regards,
Igor

@aswinkumar863
Copy link
Author

Thank you @Igor-Vladyka for your support. I will let you know if any :)

@andrusha19
Copy link
Contributor

andrusha19 commented Nov 12, 2019

Hi
Now your demo gives an error in getMarker method:
"Uncaught ReferenceError: marker is not defined"

In /dist folder you have this code:

getMarker: function () {
    if (this.markerOptions) {
        if (!this.__marker) {
                this.__marker = L.marker([0, 0], this.markerOptions);
                if (this.markerOptions.showMarker) {
        /* Here it should be this.__marker.addTo(this._map);*/
                     marker.addTo(this._map);   
                 }
        }
    }
    return this.__marker;
}

In source code it looks like:

getMarker: function () {
	return this.__marker;
}

Please correct code in /dist folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants