Skip to content

Commit

Permalink
Pull request #5389: Feature/DXCF-5029 dxcharts web touchpad chart scr…
Browse files Browse the repository at this point in the history
…olling improvement

Merge in DXCHARTS/dxchart5 from feature/DXCF-5029-dxcharts-web-touchpad-chart-scrolling-improvement to master

* commit '12f492412bfe0cb1b9b5bf5deb08cae8d5aa5c4d':
  [DXCF-5029] [dxCharts][Web] Touchpad chart scrolling improvement // code simplify
  [DXCF-5029] [dxCharts][Web] Touchpad chart scrolling improvement // scroll X change for apple and mobile

GitOrigin-RevId: 26239d25c2fb8541684b00dbfaac838664383c10
  • Loading branch information
artskar authored and dxcity committed Jan 13, 2025
1 parent 9a26a03 commit 485b70a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/chart/components/chart/chart-area-pan.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ interface ChartPanningOptions {
* @param {CanvasBoundsContainer} canvasBoundsContainer - An instance of the CanvasBoundsContainer class.
* @param {CanvasAnimation} canvasAnimation - An instance of the CanvasAnimation class.
* @param {ChartPanComponent} chartPanComponent - An instance of the ChartPanComponent class.
*/
export class ChartAreaPanHandler extends ChartBaseElement {
private currentPoint: Point = { x: 0, y: 0 };
Expand Down Expand Up @@ -98,6 +98,7 @@ export class ChartAreaPanHandler extends ChartBaseElement {
* If the zoomToCursor configuration is set to false, it calls the zoomXToEnd method of the scaleModel to zoom in or out based on the zoomIn parameter.
* Finally, it fires the draw event of the bus to redraw the canvas.
* @param {WheelEvent} e - Wheel event
* @param {number} zoomSensitivity - zoom sensitivity
* @returns {void}
*/
private zoomXHandler = (e: WheelEvent, zoomSensitivity: number) => {
Expand Down Expand Up @@ -137,9 +138,9 @@ export class ChartAreaPanHandler extends ChartBaseElement {
)
.subscribe(e => {
const device = deviceDetector();
const direction = device === 'apple' || device === 'mobile' ? 1 : -1;
const direction = device === 'apple' || device === 'mobile' ? -1 : 1;
const deltaX = 0 + e.deltaX * direction;
const deltaY = 0 + e.deltaY * -direction;
const deltaY = 0 + e.deltaY * direction;

if (e.ctrlKey) {
const zoomSensitivity = this.calculateDynamicSesitivity(
Expand Down Expand Up @@ -192,7 +193,7 @@ export class ChartAreaPanHandler extends ChartBaseElement {

/**
* Registers a handler for panning the chart along the Y-axis.
* @param {ScaleModel} scaleModel - The scale model of the extent.
* @param {ScaleModel} scale - The scale model of the extent.
* @param {HitBoundsTest} hitTest - The hit test of the pane.
* @returns {DragNDropYComponent} - The drag and drop component for panning the chart along the Y-axis.
*/
Expand Down

0 comments on commit 485b70a

Please sign in to comment.