Skip to content

Commit

Permalink
Merge branch 'master' into labels-update-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillBobkov authored Sep 28, 2023
2 parents 70e5047 + efa4d97 commit f71e4ed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/chart/components/cross_tool/cross-tool.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export class CrossToolModel extends ChartBaseElement {
} else {
this.currentHover.y = hover.y;
}
this.currentHover.paneId = CHART_UUID;
this.currentHoverSubject.next(this.currentHover);
}
}
14 changes: 7 additions & 7 deletions src/chart/inputhandlers/hover-producer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class HoverProducerComponent extends ChartBaseElement {
get hover(): Hover | null {
return this.hoverSubject.getValue();
}
private longTouchActivated: boolean = false;
private longTouchActivatedSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
private hoverProducerParts: HoverProducerParts;
xFormatter: DateTimeFormatter = () => '';
constructor(
Expand Down Expand Up @@ -123,7 +123,7 @@ export class HoverProducerComponent extends ChartBaseElement {
this.addRxSubscription(this.scale.xChanged.subscribe(() => this.fireLastCross()));
this.addRxSubscription(
this.canvasInputListener.observeTouchStart().subscribe(event => {
const x = event.touches[0].clientX;
const x = event.touches[0].clientX - this.canvasBoundsContainer.canvasOnPageLocation.x;
const y = event.touches[0].clientY - this.canvasBoundsContainer.canvasOnPageLocation.y;
const candle = this.chartModel.candleFromX(x, true);
if (candle) {
Expand All @@ -138,17 +138,18 @@ export class HoverProducerComponent extends ChartBaseElement {
this.addRxSubscription(
this.canvasInputListener.observeLongTouch(hitTest).subscribe(event => {
this.paneManager.chartPanComponent.deactivatePanHandlers();
this.longTouchActivated = true;
const x = event.touches[0].clientX;
this.longTouchActivatedSubject.next(true);
const x = event.touches[0].clientX - this.canvasBoundsContainer.canvasOnPageLocation.x;
const y = event.touches[0].clientY - this.canvasBoundsContainer.canvasOnPageLocation.y;
this.createAndFireHover([x, y, '']);
this.crossEventProducer.crossSubject.next([x, y, '']);
}),
);
this.addRxSubscription(
this.canvasInputListener.observeTouchEndDocument().subscribe(() => {
this.paneManager.chartPanComponent.activateChartPanHandlers();
if (this.longTouchActivated) {
this.longTouchActivated = false;
if (this.longTouchActivatedSubject.getValue()) {
this.longTouchActivatedSubject.next(false);
this.crossEventProducer.fireCrossClose();
}
}),
Expand Down Expand Up @@ -271,7 +272,6 @@ export class HoverProducerComponent extends ChartBaseElement {
const candle = hover.candleHover?.visualCandle.candle;
candle && this.chartModel.mainCandleSeries.setActiveCandle(candle);
}
// const showCrossToolOverride = isMobile() ? this.longTouchActivated : showCrossTool;
this.hoverSubject.next(hover);
} else {
this.crossEventProducer.fireCrossClose();
Expand Down

0 comments on commit f71e4ed

Please sign in to comment.