I am facing a challenge with an HTML element that has dual roles:
- Automatically moving to the positive x-level whenever an Obsarbalve emits a new value.
- Moving manually to both positive and negative x-levels by dragging and dropping it.
The manual drag and drop functionality is achieved using Angular's drag and drop CDK. However, an issue arises when the drag action is released (cdkDragReleased)
A specific function is triggered upon releasing the drag:
onDragEnd(e: CdkDragRelease){
let newPosition = e.source.element.nativeElement.getClientRects().item(0).left;
this.facade.setBehaviorSubject(newPosition);
}
setBehaviorSubject updates the Observable's next value, subsequently updating the element based on the first role mentioned earlier.
The end goal is to have a combined position x value (resulting from the dragged value + observable value).
I am seeking a way to retrieve the exact value where the user releases the element. How can I prevent this behavior?