Skip to content

Commit

Permalink
Prevent TypeError: Attempted to assign to readonly property.
Browse files Browse the repository at this point in the history
Signed-off-by: Diego Casorran <[email protected]>
  • Loading branch information
diegocr committed Jan 16, 2024
1 parent bd2e703 commit 6946372
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 83 deletions.
18 changes: 8 additions & 10 deletions dist/perfect-scrollbar.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* perfect-scrollbar v1.5.6 - mega.nz build.
* Copyright 2023 Hyunje Jun, MDBootstrap and Contributors
* perfect-scrollbar v1.5.7 - mega.nz build.
* Copyright 2024 Hyunje Jun, MDBootstrap and Contributors
* Licensed under MIT
*/

Expand Down Expand Up @@ -576,11 +576,10 @@
let scrollBy = null;

function mouseMoveHandler(e) {
if (e.touches && e.touches[0]) {
e[pageY] = e.touches[0].pageY;
}
const y = e.touches && e.touches[0] ? e.touches[0].pageY : e[pageY];

element[scrollTop] =
startingScrollTop + scrollBy * (e[pageY] - startingMousePageY);
startingScrollTop + scrollBy * (y - startingMousePageY);
addScrollingClass(i, y);
updateGeometry(i);

Expand All @@ -601,10 +600,9 @@
return;
}
startingScrollTop = element[scrollTop];
if (touchMode && e.touches) {
e[pageY] = e.touches[0].pageY;
}
startingMousePageY = e[pageY];
startingMousePageY =
touchMode && e.touches && e.touches[0] ? e.touches[0].pageY : e[pageY];

scrollBy =
(i[contentHeight] - i[containerHeight]) /
(i[railYHeight] - i[scrollbarYHeight]);
Expand Down
127 changes: 65 additions & 62 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "perfect-scrollbar",
"version": "1.5.6",
"version": "1.5.7",
"description": "Minimalistic but perfect custom scrollbar plugin",
"author": "Hyunje Jun <[email protected]>",
"keywords": [
Expand Down Expand Up @@ -29,8 +29,8 @@
"@rollup/plugin-babel": "6.0.4",
"@rollup/plugin-buble": "1.0.3",
"chokidar-cli": "3.0.0",
"prettier": "3.1.1",
"rollup": "4.9.1"
"prettier": "3.2.2",
"rollup": "4.9.5"
},
"scripts": {
"test": "npm run format:lint && npm run build",
Expand Down
14 changes: 6 additions & 8 deletions src/handlers/drag-thumb.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@ function bindMouseScrollHandler(
let scrollBy = null;

function mouseMoveHandler(e) {
if (e.touches && e.touches[0]) {
e[pageY] = e.touches[0].pageY;
}
const y = e.touches && e.touches[0] ? e.touches[0].pageY : e[pageY];

element[scrollTop] =
startingScrollTop + scrollBy * (e[pageY] - startingMousePageY);
startingScrollTop + scrollBy * (y - startingMousePageY);
addScrollingClass(i, y);
updateGeometry(i);

Expand All @@ -78,10 +77,9 @@ function bindMouseScrollHandler(
return;
}
startingScrollTop = element[scrollTop];
if (touchMode && e.touches) {
e[pageY] = e.touches[0].pageY;
}
startingMousePageY = e[pageY];
startingMousePageY =
touchMode && e.touches && e.touches[0] ? e.touches[0].pageY : e[pageY];

scrollBy =
(i[contentHeight] - i[containerHeight]) /
(i[railYHeight] - i[scrollbarYHeight]);
Expand Down

0 comments on commit 6946372

Please sign in to comment.