"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ScaleDisplayContainer = void 0;
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var scale_display_1 = require("../components/scale-display");
var hooks_1 = require("./hooks");
var map_1 = require("../actions/map");
var hooks_mapguide_1 = require("./hooks-mapguide");
var context_1 = require("../components/map-providers/context");
var ScaleDisplayContainer = function (props) {
    var style = props.style;
    var dispatch = (0, context_1.useReduxDispatch)();
    var locale = (0, hooks_1.useViewerLocale)();
    var activeMapName = (0, hooks_1.useActiveMapName)();
    var view = (0, hooks_1.useActiveMapView)();
    var finiteScales = (0, hooks_mapguide_1.useActiveMapFiniteScales)();
    var setScaleAction = function (mapName, scale) { return dispatch((0, map_1.setScale)(mapName, scale)); };
    var onScaleChanged = function (scale) {
        if (activeMapName) {
            setScaleAction(activeMapName, scale);
        }
    };
    if (view) {
        return React.createElement(scale_display_1.ScaleDisplay, { onScaleChanged: onScaleChanged, view: view, style: style, finiteScales: finiteScales, locale: locale });
    }
    else {
        return React.createElement("noscript", null);
    }
};
exports.ScaleDisplayContainer = ScaleDisplayContainer;
//# sourceMappingURL=scale-display.js.map