@devexperts/dxcharts-lite
Version:
26 lines (25 loc) • 1.55 kB
JavaScript
/*
* 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 { defaultDragComponentOptions, DragNDropComponent, } from './drag-n-drop.component';
export class DragNDropXComponent extends DragNDropComponent {
constructor(hitTest, dragCallbacks, canvasInputListener, chartPanComponent, dragComponentOptions = defaultDragComponentOptions) {
super(hitTest, dragCallbacks, canvasInputListener, chartPanComponent, dragComponentOptions);
}
/**
* This method is used to activate the component and add the necessary subscriptions to the canvasInputListener.
* It calls the super method doActivate() and then adds the following subscriptions:
* - observeXDragStart() subscription with hitTest() as parameter and onDragStart() as callback function
* - observeXDrag() subscription with onDragTick() as callback function
* - observeXDragEnd() subscription with onDragEnd() as callback function
* @returns {void}
*/
doActivate() {
super.doActivate();
this.addRxSubscription(this.canvasInputListener.observeXDragStart(this.hitTest).subscribe(this.onDragStart));
this.addRxSubscription(this.canvasInputListener.observeXDrag().subscribe(this.onDragTick));
this.addRxSubscription(this.canvasInputListener.observeXDragEnd().subscribe(this.onDragEnd));
}
}