Get links working on proper coords

This commit is contained in:
Daniel Imms
2017-09-03 11:39:17 -07:00
parent 5619abe12d
commit 923ea7247c
4 changed files with 25 additions and 16 deletions
+3 -3
View File
@@ -2,7 +2,7 @@
* @license MIT
*/
import { CharMeasure } from './CharMeasure';
import { ICharMeasure } from '../Interfaces';
export function getCoordsRelativeToElement(event: MouseEvent, element: HTMLElement): [number, number] {
// Ignore browsers that don't support MouseEvent.pageX
@@ -36,7 +36,7 @@ export function getCoordsRelativeToElement(event: MouseEvent, element: HTMLEleme
* apply an offset to the x value such that the left half of the cell will
* select that cell and the right half will select the next cell.
*/
export function getCoords(event: MouseEvent, element: HTMLElement, charMeasure: CharMeasure, lineHeight: number, colCount: number, rowCount: number, isSelection?: boolean): [number, number] {
export function getCoords(event: MouseEvent, element: HTMLElement, charMeasure: ICharMeasure, lineHeight: number, colCount: number, rowCount: number, isSelection?: boolean): [number, number] {
// Coordinates cannot be measured if charMeasure has not been initialized
if (!charMeasure.width || !charMeasure.height) {
return null;
@@ -68,7 +68,7 @@ export function getCoords(event: MouseEvent, element: HTMLElement, charMeasure:
* @param colCount The number of columns in the terminal.
* @param rowCount The number of rows in the terminal.
*/
export function getRawByteCoords(event: MouseEvent, element: HTMLElement, charMeasure: CharMeasure, lineHeight: number, colCount: number, rowCount: number): { x: number, y: number } {
export function getRawByteCoords(event: MouseEvent, element: HTMLElement, charMeasure: ICharMeasure, lineHeight: number, colCount: number, rowCount: number): { x: number, y: number } {
const coords = getCoords(event, element, charMeasure, lineHeight, colCount, rowCount);
let x = coords[0];
let y = coords[1];