Skip to content

Commit

Permalink
Merge pull request #42 from ulken/fix-bounce_moved_marker_position
Browse files Browse the repository at this point in the history
bouncemarker.js: save original marker position in `bounce()`
  • Loading branch information
maximeh authored Sep 19, 2021
2 parents a1662ce + a5bd781 commit c7678ee
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions bouncemarker.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@
options.height = arguments[1];
}

// Keep original map center
// Keep original latitude, longitude and map center
this._origLatlng = this.getLatLng();
this._origMapCenter = this._map.project(this._map.getCenter());
this._dropPoint = this._getDropPoint(options.height);
this._bounceMotion(options, endCallback);
Expand Down Expand Up @@ -169,9 +170,6 @@
// Call leaflet original method to add the Marker to the map.
originalOnAdd.call(this, map);

// Keep original latitude and longitude
this._origLatlng = this.getLatLng();

if (this.options.bounceOnAdd === true) {
this.bounce(this.options.bounceOnAddOptions, this.options.bounceOnAddCallback);
}
Expand Down

0 comments on commit c7678ee

Please sign in to comment.