From c323e0ad4a4bf5b83c27cf3270ab4a65def99b83 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sun, 21 May 2017 11:57:24 -0700 Subject: [PATCH] jsdoc --- src/utils/Mouse.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/utils/Mouse.ts b/src/utils/Mouse.ts index b5faa167..ce852ace 100644 --- a/src/utils/Mouse.ts +++ b/src/utils/Mouse.ts @@ -4,6 +4,14 @@ import { CharMeasure } from './CharMeasure'; +/** + * Gets coordinates within the terminal for a particular mouse event. The result + * is returned as an array in the form [x, y] instead of an object as it's a + * little faster and this function is used in some low level code. + * @param event The mouse event. + * @param rowContainer The terminal's row container. + * @param charMeasure The char measure object used to determine character sizes. + */ export function getCoords(event: MouseEvent, rowContainer: HTMLElement, charMeasure: CharMeasure): [number, number] { // ignore browsers without pageX for now if (event.pageX == null) { @@ -29,6 +37,16 @@ export function getCoords(event: MouseEvent, rowContainer: HTMLElement, charMeas return [x, y]; } +/** + * Gets coordinates within the terminal for a particular mouse event, wrapping + * them to the bounds of the terminal and adding 32 to both the x and y values + * as expected by xterm. + * @param event The mouse event. + * @param rowContainer The terminal's row container. + * @param charMeasure The char measure object used to determine character sizes. + * @param colCount The number of columns in the terminal. + * @param rowCount The number of rows in the terminal. + */ export function getRawByteCoords(event: MouseEvent, rowContainer: HTMLElement, charMeasure: CharMeasure, colCount: number, rowCount: number): { x: number, y: number } { const coords = getCoords(event, rowContainer, charMeasure); let x = coords[0];