UNPKG

@carbon/ibm-products

Version:
28 lines (26 loc) 903 B
/** * Copyright IBM Corp. 2020, 2026 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ //#region src/components/DataSpreadsheet/utils/getSelectionAreaPoints.js /** * Copyright IBM Corp. 2022, 2022 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ const getSelectionAreaPoints = (area) => { const greatestRowIndex = Math.max(area.point1.row, area.point2.row); const greatestColumnIndex = Math.max(area.point1.column, area.point2.column); const lowestRowIndex = Math.min(area.point1.row, area.point2.row); return { greatestRowIndex, greatestColumnIndex, lowestColumnIndex: Math.min(area.point1.column, area.point2.column), lowestRowIndex }; }; //#endregion exports.getSelectionAreaPoints = getSelectionAreaPoints;