import getScroll from "./get-scroll";
import { canScrollWindow } from "../can-scroll";

const getWindowScrollChange = ({ viewport, subject, center, dragStartTime, shouldUseTimeDampening }) => {
  const scroll = getScroll({
    dragStartTime,
    container: viewport.frame,
    subject,
    center,
    shouldUseTimeDampening
  });
  return scroll && canScrollWindow(viewport, scroll) ? scroll : null;
};

export default getWindowScrollChange;
