Skip to content

Commit 03a24aa

Browse files
authored
Fix tooltip not to be displayed by touch (#378)
1 parent 05ff97d commit 03a24aa

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

packages/cheetah-grid/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cheetah-grid",
3-
"version": "1.7.6",
3+
"version": "1.7.8",
44
"description": "Cheetah Grid is a high performance grid engine that works on canvas",
55
"keywords": [
66
"spreadsheet",

packages/cheetah-grid/src/js/core/DrawGrid.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,14 @@ function _bindEvents(this: DrawGrid): void {
13411341
| null
13421342
| undefined = null;
13431343
let longTouchId: NodeJS.Timeout | null = null;
1344+
let touchStartIntervalId: NodeJS.Timeout | null = null;
13441345
handler.on(element, "touchstart", (e) => {
1346+
// Since it is an environment where touch start can be used, it blocks mousemove that occurs after this.
1347+
if (touchStartIntervalId != null) clearTimeout(touchStartIntervalId);
1348+
touchStartIntervalId = setTimeout(() => {
1349+
touchStartIntervalId = null;
1350+
}, 350);
1351+
13451352
if (!doubleTapBefore) {
13461353
doubleTapBefore = getCellEventArgsSet(e).eventArgs;
13471354
setTimeout(() => {
@@ -1462,6 +1469,11 @@ function _bindEvents(this: DrawGrid): void {
14621469
});
14631470

14641471
handler.on(element, "mousemove", (e) => {
1472+
if (touchStartIntervalId != null) {
1473+
// Probably a mousemove event triggered by a touchstart. Therefore, this event is blocked.
1474+
return;
1475+
}
1476+
14651477
const eventArgsSet = getCellEventArgsSet(e);
14661478
const { abstractPos, eventArgs } = eventArgsSet;
14671479
if (eventArgs) {

packages/vue-cheetah-grid/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-cheetah-grid",
3-
"version": "1.7.7",
3+
"version": "1.7.8",
44
"description": "Cheetah Grid for Vue.js",
55
"main": "lib/index.js",
66
"unpkg": "dist/vueCheetahGrid.js",

0 commit comments

Comments
 (0)