From 05affa5ad4320f0b2bc4475f4c483a497ab22f15 Mon Sep 17 00:00:00 2001 From: Mononaut Date: Sun, 23 Jul 2023 16:19:48 +0900 Subject: [PATCH] Fix difficulty tooltip position --- .../app/components/difficulty/difficulty.component.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/components/difficulty/difficulty.component.ts b/frontend/src/app/components/difficulty/difficulty.component.ts index d3983c939..a2c03dc56 100644 --- a/frontend/src/app/components/difficulty/difficulty.component.ts +++ b/frontend/src/app/components/difficulty/difficulty.component.ts @@ -1,4 +1,4 @@ -import { ChangeDetectionStrategy, Component, HostListener, Inject, Input, LOCALE_ID, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ChangeDetectorRef, Component, HostListener, Inject, Input, LOCALE_ID, OnInit } from '@angular/core'; import { combineLatest, Observable, timer } from 'rxjs'; import { map, switchMap } from 'rxjs/operators'; import { StateService } from '../..//services/state.service'; @@ -61,6 +61,7 @@ export class DifficultyComponent implements OnInit { constructor( public stateService: StateService, + private cd: ChangeDetectorRef, @Inject(LOCALE_ID) private locale: string, ) { } @@ -189,9 +190,15 @@ export class DifficultyComponent implements OnInit { return shapes; } + @HostListener('pointerdown', ['$event']) + onPointerDown(event) { + this.onPointerMove(event); + } + @HostListener('pointermove', ['$event']) onPointerMove(event) { this.tooltipPosition = { x: event.clientX, y: event.clientY }; + this.cd.markForCheck(); } onHover(event, rect): void {