mdbootstrap / perfect-scrollbar

Minimalistic but perfect custom scrollbar plugin. Get more free components with Material Design for Bootstrap UI Kit (link below)
https://perfectscrollbar.com/
MIT License
353 stars 69 forks source link

[help]ctrl + wheel should do not trigger scroll #12

Open Sara2009 opened 3 years ago

Sara2009 commented 3 years ago

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Today I used patch-package to patch perfect-scrollbar@1.5.2 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/perfect-scrollbar/dist/perfect-scrollbar.esm.js b/node_modules/perfect-scrollbar/dist/perfect-scrollbar.esm.js
index 3b60ef4..3c787b8 100644
--- a/node_modules/perfect-scrollbar/dist/perfect-scrollbar.esm.js
+++ b/node_modules/perfect-scrollbar/dist/perfect-scrollbar.esm.js
@@ -851,7 +851,7 @@ function wheel(i) {
     var deltaX = ref[0];
     var deltaY = ref[1];

-    if (shouldBeConsumedByChild(e.target, deltaX, deltaY)) {
+    if (shouldBeConsumedByChild(e.target, deltaX, deltaY) || e.ctrlKey) {
       return;
     }

This issue body was partially generated by patch-package.

yunsii commented 2 years ago

Same to me. Maybe add option to handle event to control whether event propagation?