https://codesandbox.io/s/pedantic-roentgen-s514z?file=/src/index.js
import "./styles.css";
import { fromEvent } from "rxjs";
import { switchMap, takeUntil } from "rxjs/operators";
let el = document.getElementById("box0");
const mousedown$ = fromEvent(el, "mousedown");
const mousemove$ = fromEvent(document, "mousemove");
const mouseup$ = fromEvent(document, "mouseup");
const drag$ = mousedown$.pipe(
switchMap(() => mousemove$.pipe(takeUntil(mouseup$)))
);
drag$.subscribe((e) => {
console.log(e);
el.style.left = `${e.clientX}px`;
el.style.top = `${e.clientY}px`;
});
Noticing some delay visually in the drag and drop effect in the UI. Is there any feedback on the way i'm using reactive extensions that might be causing this?
