Skip to content

Commit f2022bf

Browse files
gokaysatireszkadev
authored andcommitted
Calc: When user triple clicks on a cell, editing session should start and the cell content should get selected.
Current state: New code assumes that double click is not required for a triple click event. Fix: Send also a double click for a triple click in Calc. Signed-off-by: Gökay Şatır <gokaysatir@collabora.com> Change-Id: I3f0cc7be0937e5c0f1a0f312be6dd04e40c44039
1 parent d2e613f commit f2022bf

File tree

1 file changed

+30
-29
lines changed

1 file changed

+30
-29
lines changed

browser/src/canvas/sections/MouseControl.ts

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,23 @@ class MouseControl extends CanvasSectionObject {
414414
} else return false;
415415
}
416416

417+
private sendClick(clickInfo: any, count: number) {
418+
this.postCoreMouseEvent(
419+
'buttondown',
420+
clickInfo.sendingPosition,
421+
count,
422+
clickInfo.buttons,
423+
clickInfo.modifier,
424+
);
425+
this.postCoreMouseEvent(
426+
'buttonup',
427+
clickInfo.sendingPosition,
428+
count,
429+
clickInfo.buttons,
430+
clickInfo.modifier,
431+
);
432+
}
433+
417434
onClick(point: cool.SimplePoint, e: MouseEvent): void {
418435
app.map.fire('closepopups');
419436
app.map.fire('editorgotfocus');
@@ -437,23 +454,16 @@ class MouseControl extends CanvasSectionObject {
437454
}
438455
}
439456

457+
const clickInfo = {
458+
sendingPosition: sendingPosition,
459+
buttons: buttons,
460+
modifier: modifier,
461+
};
462+
440463
if (this.clickTimer) clearTimeout(this.clickTimer);
441464
else {
442465
// Old code always sends the first click, so do we.
443-
this.postCoreMouseEvent(
444-
'buttondown',
445-
sendingPosition,
446-
1,
447-
buttons,
448-
modifier,
449-
);
450-
this.postCoreMouseEvent(
451-
'buttonup',
452-
sendingPosition,
453-
1,
454-
buttons,
455-
modifier,
456-
);
466+
this.sendClick(clickInfo, 1);
457467

458468
// For future: Here, we are checking the window size to determine the view mode, we can also check the event type (touch/click).
459469
app.map.focus(
@@ -464,21 +474,12 @@ class MouseControl extends CanvasSectionObject {
464474
}
465475

466476
this.clickTimer = setTimeout(() => {
467-
if (this.clickCount > 1) {
468-
this.postCoreMouseEvent(
469-
'buttondown',
470-
sendingPosition,
471-
this.clickCount,
472-
buttons,
473-
modifier,
474-
);
475-
this.postCoreMouseEvent(
476-
'buttonup',
477-
sendingPosition,
478-
this.clickCount,
479-
buttons,
480-
modifier,
481-
);
477+
if (this.clickCount === 3 && app.map._docLayer.isCalc()) {
478+
// Also send a double click for a triple click in Calc.
479+
this.sendClick(clickInfo, 2);
480+
this.sendClick(clickInfo, 3);
481+
} else if (this.clickCount > 1) {
482+
this.sendClick(clickInfo, this.clickCount);
482483
}
483484

484485
this.clickTimer = null;

0 commit comments

Comments
 (0)