From 7d54be7d5049447f757e0fa87c2f89b825f8a062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Rahir=20=28rar=29?= Date: Wed, 22 Nov 2023 00:59:56 +0100 Subject: [PATCH] [FIX] Components: rename private method arguments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some component methods were refering to `ctrlKey` or `shiftKey` which are not functionally meaningful. closes odoo/o-spreadsheet#3235 Signed-off-by: Lucas Lefèvre (lul) --- src/components/grid/grid.ts | 8 ++++---- src/components/grid_overlay/grid_overlay.ts | 6 +++--- .../headers_overlay/headers_overlay.ts | 16 +++++++++++----- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/components/grid/grid.ts b/src/components/grid/grid.ts index 7ad015a9b2..8470910a0f 100644 --- a/src/components/grid/grid.ts +++ b/src/components/grid/grid.ts @@ -337,9 +337,9 @@ export class Grid extends Component { onCellClicked( col: HeaderIndex, row: HeaderIndex, - { ctrlKey, shiftKey }: { ctrlKey: boolean; shiftKey: boolean } + { addZone, expandZone }: { addZone: boolean; expandZone: boolean } ) { - if (ctrlKey) { + if (addZone) { this.env.model.dispatch("PREPARE_SELECTION_INPUT_EXPANSION"); } @@ -347,9 +347,9 @@ export class Grid extends Component { if (this.env.model.getters.getEditionMode() === "editing") { this.env.model.dispatch("STOP_EDITION"); } - if (shiftKey) { + if (expandZone) { this.env.model.selection.setAnchorCorner(col, row); - } else if (ctrlKey) { + } else if (addZone) { this.env.model.selection.addCellToSelection(col, row); } else { this.env.model.selection.selectCell(col, row); diff --git a/src/components/grid_overlay/grid_overlay.ts b/src/components/grid_overlay/grid_overlay.ts index 37c0e9cb7b..2521a5d897 100644 --- a/src/components/grid_overlay/grid_overlay.ts +++ b/src/components/grid_overlay/grid_overlay.ts @@ -142,7 +142,7 @@ interface Props { onCellClicked: ( col: HeaderIndex, row: HeaderIndex, - modifiers: { ctrlKey: boolean; shiftKey: boolean } + modifiers: { addZone: boolean; expandZone: boolean } ) => void; onCellRightClicked: (col: HeaderIndex, row: HeaderIndex, coordinates: DOMCoordinates) => void; onGridResized: (dimension: DOMDimension) => void; @@ -197,8 +197,8 @@ export class GridOverlay extends Component { } const [col, row] = this.getCartesianCoordinates(ev); this.props.onCellClicked(col, row, { - shiftKey: ev.shiftKey, - ctrlKey: isCtrlKey(ev), + expandZone: ev.shiftKey, + addZone: isCtrlKey(ev), }); } diff --git a/src/components/headers_overlay/headers_overlay.ts b/src/components/headers_overlay/headers_overlay.ts index 25ec236384..b1bd1ae061 100644 --- a/src/components/headers_overlay/headers_overlay.ts +++ b/src/components/headers_overlay/headers_overlay.ts @@ -92,7 +92,7 @@ abstract class AbstractResizer extends Component