UNPKG

@devexperts/dxcharts-lite

Version:
69 lines (68 loc) 2.69 kB
/* * Copyright (C) 2019 - 2025 Devexperts Solutions IE Limited * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import { ChartBaseElement } from '../model/chart-base-element'; import { CanvasInputListenerComponent } from '../inputlisteners/canvas-input-listener.component'; import { ScaleModel } from '../model/scale.model'; import { ChartAreaPanHandler } from '../components/chart/chart-area-pan.handler'; import { HitBoundsTest } from '../canvas/canvas-bounds-container'; import { Pixel } from '../model/scaling/viewport.model'; export declare const PIXELS_FOR_MOVE = 2; /** * Handles chart touch events. */ export declare class MainCanvasTouchHandler extends ChartBaseElement { private chartAreaPanHandler; private scale; private canvasInputListeners; private mainCanvasParent; private hitTest; private touchedCandleIndexes; canvasTouchInfo: { touchStart: { x: Pixel; y: Pixel; }; isMoving?: boolean; }; constructor(chartAreaPanHandler: ChartAreaPanHandler, scale: ScaleModel, canvasInputListeners: CanvasInputListenerComponent, mainCanvasParent: Element, hitTest: HitBoundsTest); /** * Activates canvas input listeners for touch start and touch move events. * @protected * @returns {void} */ protected doActivate(): void; /** * Handles the touch start event. * @param {TouchEvent} e - The touch event. * @returns {void} */ private handleTouchStartEvent; /** * Handles touch move event * @param {TouchEvent} e - The touch event object * @returns {void} */ private handleTouchMoveEvent; /** * Handles touch end event * @returns {void} */ private handleTouchEndEvent; /** * Gets candle positions touched by user in pixels. * @param e - touch event with "touches" array * @return Array<number> - X coordinates of touches on the canvas */ private getXPositions; /** * Handles the pinch gesture on the chart. * @param {Array<number>} candleIndexes - An array of two numbers representing the indexes of the first and last visible candles on the chart. * @param {number[]} touchPositions - An array of two numbers representing the touch positions on the screen. * @returns {void} */ pinchHandler(candleIndexes: Array<number>, touchPositions: number[]): void; } export declare const checkChartIsMoving: (x1: Pixel, x2: Pixel, y1: Pixel, y2: Pixel, pixelsToMove?: Pixel) => boolean;