Skip to content

Commit

Permalink
disable event if mask
Browse files Browse the repository at this point in the history
  • Loading branch information
cenfun committed Jun 2, 2024
1 parent 0706480 commit 5f36f5a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions public/events.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
<button>rerender()</button>
<button>addRow({"id":"id1","name":"Row"})</button>
<button>deleteRow("id1")</button>
<button>showMask()</button>
<button>hideMask()</button>
</div>
</div>
<div class="grid-container flex-auto"></div>
Expand Down
11 changes: 7 additions & 4 deletions src/grid/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/grid/mask.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};

0 comments on commit 5f36f5a

Please sign in to comment.