refactor(browser): remove unreachable coords guard in getCoords
getCoordsRelativeToElement always returns a two-element tuple, so the array is always truthy and if (!coords) could never run. hasValidCharSize already handles the only early-exit path before coordinates are computed. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -37,10 +37,6 @@ export function getCoords(window: Pick<Window, 'getComputedStyle'>, event: Pick<
|
|||||||
}
|
}
|
||||||
|
|
||||||
const coords = getCoordsRelativeToElement(window, event, element);
|
const coords = getCoordsRelativeToElement(window, event, element);
|
||||||
if (!coords) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
coords[0] = Math.ceil((coords[0] + (isSelection ? cssCellWidth / 2 : 0)) / cssCellWidth);
|
coords[0] = Math.ceil((coords[0] + (isSelection ? cssCellWidth / 2 : 0)) / cssCellWidth);
|
||||||
coords[1] = Math.ceil(coords[1] / cssCellHeight);
|
coords[1] = Math.ceil(coords[1] / cssCellHeight);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user