From 3d8001f71beac62008f2772dec21afd699a595c9 Mon Sep 17 00:00:00 2001 From: Vladislav Poddubskii Date: Thu, 19 Dec 2024 13:48:28 +0000 Subject: [PATCH] Pull request #5406: [DXCF-5744] [Native mobile] Long tap on some candle - crosshair jumps to the wrong place Merge in DXCHARTS/dxchart5 from bugfix/DXCF-5744-native-mobile-long-tap-on-some-candle-crosshair-jumps-to-the-wrong-place to master * commit '6dd7ff594daa266ca6e54df035c1af3082acf02e': [DXCF-5744] [Native mobile] Long tap on some candle - crosshair jumps to the wrong place // removed unnecessary fix, and console.log [DXCF-5744] [Native mobile] Long tap on some candle - crosshair jumps to the wrong place GitOrigin-RevId: e24ca43b7204af14804b186ff8dd1d5a211a815a --- src/chart/components/cross_tool/cross-tool.model.ts | 1 + src/chart/inputhandlers/hover-producer.component.ts | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/chart/components/cross_tool/cross-tool.model.ts b/src/chart/components/cross_tool/cross-tool.model.ts index c74169f..044e128 100644 --- a/src/chart/components/cross_tool/cross-tool.model.ts +++ b/src/chart/components/cross_tool/cross-tool.model.ts @@ -108,6 +108,7 @@ export class CrossToolModel extends ChartBaseElement { /** * Updates the current hover position with the provided hover object. * @param {Object} hover - The hover object containing the x and y coordinates and time formatted. + * @param magnetTarget {MagnetTarget} * @param {number} hover.x - The x coordinate of the hover. * @param {number} hover.y - The y coordinate of the hover. * @param {string} hover.timeFormatted - The formatted time of the hover. diff --git a/src/chart/inputhandlers/hover-producer.component.ts b/src/chart/inputhandlers/hover-producer.component.ts index 5c1b710..a54a6f6 100644 --- a/src/chart/inputhandlers/hover-producer.component.ts +++ b/src/chart/inputhandlers/hover-producer.component.ts @@ -210,6 +210,11 @@ export class HoverProducerComponent extends ChartBaseElement { if (!this.crossEventProducer.crossToolTouchInfo.isSet) { this.crossEventProducer.crossToolTouchInfo.isSet = true; + // previous fixed goes to temporary to prevent crosstool jumps outside the candle on candle update tick + this.crossEventProducer.crossToolTouchInfo.temp = { + x: this.crossEventProducer.crossToolTouchInfo.fixed.x, + y: this.crossEventProducer.crossToolTouchInfo.fixed.y, + }; this.crossEventProducer.crossToolTouchInfo.fixed = { x, y, @@ -260,6 +265,7 @@ export class HoverProducerComponent extends ChartBaseElement { * Creates a hover object based on the provided x and y coordinates. * @param {number} x - The x coordinate of the hover. * @param {number} y - The y coordinate of the hover. + * @param {string} uuid * @returns {Hover | undefined} - The hover object or undefined if there are no candles in the chart model. * @todo Check if uuid is still useful here. */ @@ -334,7 +340,6 @@ export class HoverProducerComponent extends ChartBaseElement { * If no hover event is provided, it fires the EVENT_CLOSE_HOVER event. * * @param {Hover} [hover] - The hover event to handle. - * @param {boolean} [showCrossTool=true] - A boolean value indicating whether to show the cross tool or not. * @returns {void} */ private fireHover(hover?: Hover) {