/**
 * DevExtreme (cjs/renovation/ui/common/utils/scroll/getMemoizeScrollTo.js)
 * Version: 22.2.7 (build 23185-0311)
 * Build date: Tue Jul 04 2023
 *
 * Copyright (c) 2012 - 2023 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
"use strict";
exports.getMemoizeScrollTo = getMemoizeScrollTo;

function getMemoizeScrollTo(getScrollableInstance) {
    var instance = getScrollableInstance();
    var lastParams = {};
    return function(params) {
        var force = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : false;
        var normalizedParams = {
            top: void 0 !== params.top ? Math.ceil(params.top) : void 0,
            left: void 0 !== params.left ? Math.ceil(params.left) : void 0
        };
        var isSameParams = normalizedParams.top === lastParams.top && normalizedParams.left === lastParams.left;
        if (!force && isSameParams) {
            return
        }
        lastParams = normalizedParams;
        instance.scrollTo(params)
    }
}
