From 5f36f5a6a3bd5c7e81d9279db25fee3cf142e15f Mon Sep 17 00:00:00 2001 From: cenfun Date: Sun, 2 Jun 2024 22:03:15 +0800 Subject: [PATCH] disable event if mask --- public/events.html | 2 ++ src/grid/events.js | 11 +++++++---- src/grid/mask.js | 2 ++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/public/events.html b/public/events.html index ab41b34..0373f64 100644 --- a/public/events.html +++ b/public/events.html @@ -50,6 +50,8 @@ + +
diff --git a/src/grid/events.js b/src/grid/events.js index 0ecf0a9..44ab532 100644 --- a/src/grid/events.js +++ b/src/grid/events.js @@ -544,10 +544,10 @@ export default { containerWheelHandler: function(e) { - // disable for tg-mask - // if (e.target && e.target.className === 'tg-mask') { - // return; - // } + // stop wheel if has mask + if (this.hasMask) { + return; + } // init mouse wheel data const lineHeight = this.getRowHeight(); @@ -660,6 +660,9 @@ export default { containerKeyDownHandler: function(e) { // console.log('onKeyDown', this.id, e.keyCode); + if (this.hasMask) { + return; + } this.trigger(E.onKeyDown, { e: e diff --git a/src/grid/mask.js b/src/grid/mask.js index da26607..752098e 100644 --- a/src/grid/mask.js +++ b/src/grid/mask.js @@ -14,12 +14,14 @@ export default { } $mask.show(); + this.hasMask = true; return this; }, hideMask: function() { this.$container.find('.tg-mask').hide(); + this.hasMask = false; return this; } };