Skip to content

Commit

Permalink
FIX #51: bouncing N times when exclisive=true
Browse files Browse the repository at this point in the history
  • Loading branch information
hosuaby committed Jun 25, 2023
1 parent 9e1b21c commit 4e38ec8
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 1 deletion.
8 changes: 8 additions & 0 deletions dist/BouncingMotionCss3.js
Expand Up @@ -115,6 +115,8 @@ var BouncingMotionCss3 = /*#__PURE__*/function () {

_defineProperty(this, "bouncingAnimationPlaying", false);

_defineProperty(this, "onMotionEnd", void 0);

_classPrivateFieldInitSpec(this, _lastAnimationName, {
writable: true,
value: contractAnimationName
Expand Down Expand Up @@ -205,6 +207,12 @@ var BouncingMotionCss3 = /*#__PURE__*/function () {
});

this.bouncingAnimationPlaying = false;

if (this.onMotionEnd) {
this.onMotionEnd();
this.onMotionEnd = null;
}

this.marker.fire('bounceend');
}
}
Expand Down
8 changes: 8 additions & 0 deletions dist/MarkerPrototypeExt.js
Expand Up @@ -49,8 +49,16 @@ var _default = {
* @return {Marker} this marker
*/
bounce: function bounce() {
var _this = this;

var times = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;

if (times) {
this._bouncingMotion.onMotionEnd = function () {
_leaflet.Marker.prototype._orchestration.removeBouncingMarker(_this);
};
}

this._bouncingMotion.bounce(times);

var exclusive = this._bouncingMotion.bouncingOptions.exclusive;
Expand Down
16 changes: 16 additions & 0 deletions dist/bundle.js
Expand Up @@ -343,8 +343,16 @@
* @return {Marker} this marker
*/
bounce: function bounce() {
var _this = this;

var times = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;

if (times) {
this._bouncingMotion.onMotionEnd = function () {
L.Marker.prototype._orchestration.removeBouncingMarker(_this);
};
}

this._bouncingMotion.bounce(times);

var exclusive = this._bouncingMotion.bouncingOptions.exclusive;
Expand Down Expand Up @@ -627,6 +635,8 @@

_defineProperty(this, "bouncingAnimationPlaying", false);

_defineProperty(this, "onMotionEnd", void 0);

_classPrivateFieldInitSpec(this, _lastAnimationName, {
writable: true,
value: contractAnimationName
Expand Down Expand Up @@ -717,6 +727,12 @@
});

this.bouncingAnimationPlaying = false;

if (this.onMotionEnd) {
this.onMotionEnd();
this.onMotionEnd = null;
}

this.marker.fire('bounceend');
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/bundle.min.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions src/BouncingMotionCss3.js
Expand Up @@ -35,6 +35,7 @@ export default class BouncingMotionCss3 {
iconStyles;
shadowStyles;
bouncingAnimationPlaying = false;
onMotionEnd;
#lastAnimationName = contractAnimationName;
#classes = ['bouncing'];
#eventCounter;
Expand Down Expand Up @@ -98,6 +99,12 @@ export default class BouncingMotionCss3 {
}
});
this.bouncingAnimationPlaying = false;

if (this.onMotionEnd) {
this.onMotionEnd();
this.onMotionEnd = null;
}

this.marker.fire('bounceend');
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/MarkerPrototypeExt.js
Expand Up @@ -40,6 +40,12 @@ export default {
* @return {Marker} this marker
*/
bounce: function(times = null) {
if (times) {
this._bouncingMotion.onMotionEnd = () => {
Marker.prototype._orchestration.removeBouncingMarker(this);
};
}

this._bouncingMotion.bounce(times);
const exclusive = this._bouncingMotion.bouncingOptions.exclusive;
Marker.prototype._orchestration.addBouncingMarker(this, exclusive);
Expand Down

0 comments on commit 4e38ec8

Please sign in to comment.