UNPKG

@devexperts/dxcharts-lite

Version:
26 lines (25 loc) 1.31 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 { distinctUntilChanged } from 'rxjs/operators'; import { ChartBaseElement } from '../../model/chart-base-element'; export class HitTestComponent extends ChartBaseElement { constructor(hitTestCanvasModel, canvasAnimation, eventBus) { super(); this.hitTestCanvasModel = hitTestCanvasModel; this.canvasAnimation = canvasAnimation; this.eventBus = eventBus; } doActivate() { super.doActivate(); this.addRxSubscription(this.canvasAnimation.animationInProgressSubject.subscribe(() => { const animationInProgress = this.canvasAnimation.animationInProgressSubject.getValue(); this.hitTestCanvasModel.hitTestDrawersPredicateSubject.next(!animationInProgress); })); this.addRxSubscription(this.hitTestCanvasModel.hitTestDrawersPredicateSubject .pipe(distinctUntilChanged((prev, cur) => prev !== cur && prev === true && cur === false)) .subscribe(() => this.eventBus.fireDraw([this.hitTestCanvasModel.canvasId]))); } }