Skip to content

Commit

Permalink
#fixing deleted unsafty "stopImmediatePropagation()", and checking wh…
Browse files Browse the repository at this point in the history
…ich element is clicked track or thumb. (#56)
  • Loading branch information
artemderzkiy authored and noeldelgado committed Oct 19, 2017
1 parent 88c5d04 commit fa78ddc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,13 +344,19 @@
};

GeminiScrollbar.prototype._clickVerticalTrackHandler = function _clickVerticalTrackHandler(e) {
if(e.target !== e.currentTarget) {
return;
}
var offset = e.offsetY - this._naturalThumbSizeY * .5
, thumbPositionPercentage = offset * 100 / this._scrollbarVerticalElement.clientHeight;

this._viewElement.scrollTop = thumbPositionPercentage * this._viewElement.scrollHeight / 100;
};

GeminiScrollbar.prototype._clickHorizontalTrackHandler = function _clickHorizontalTrackHandler(e) {
if(e.target !== e.currentTarget) {
return;
}
var offset = e.offsetX - this._naturalThumbSizeX * .5
, thumbPositionPercentage = offset * 100 / this._scrollbarHorizontalElement.clientWidth;

Expand All @@ -368,7 +374,6 @@
};

GeminiScrollbar.prototype._startDrag = function _startDrag(e) {
e.stopImmediatePropagation();
this._cursorDown = true;
addClass(document.body, [CLASSNAMES.disable]);
this._document.addEventListener('mousemove', this._cache.events.mouseMoveDocumentHandler);
Expand Down

0 comments on commit fa78ddc

Please sign in to comment.