2 * Copyright (c) 2017 The xterm.js authors. All rights reserved.
6 import { ICharSizeService, IRenderService, IMouseService } from './Services';
7 import { getCoords, getRawByteCoords } from 'browser/input/Mouse';
9 export class MouseService implements IMouseService {
13 @IRenderService private readonly _renderService: IRenderService,
14 @ICharSizeService private readonly _charSizeService: ICharSizeService
18 public getCoords(event: {clientX: number, clientY: number}, element: HTMLElement, colCount: number, rowCount: number, isSelection?: boolean): [number, number] | undefined {
24 this._charSizeService.hasValidSize,
25 this._renderService.dimensions.actualCellWidth,
26 this._renderService.dimensions.actualCellHeight,
31 public getRawByteCoords(event: MouseEvent, element: HTMLElement, colCount: number, rowCount: number): { x: number, y: number } | undefined {
32 const coords = this.getCoords(event, element, colCount, rowCount);
33 return getRawByteCoords(coords);