"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getLayout = function (legend, width, height) {
    var isHorizontal = width > height;
    var layout = { x: 0, y: 0, w: width, h: height };
    var nest = { x: 0, y: 0, w: 0, h: 0 };
    // 需要显示标签
    if (legend) {
        if (isHorizontal) {
            if (legend == 'left') {
                layout = { x: width - height, y: 0, w: height, h: height };
                nest = { x: 0, y: 0, w: width - height, h: height };
            }
            else {
                layout = { x: 0, y: 0, w: height, h: height };
                nest = { x: height, y: 0, w: width - height, h: height };
            }
        }
        else {
            if (legend == 'top') {
                layout = { x: 0, y: height - width, w: width, h: width };
                nest = { x: 0, y: 0, w: width, h: height - width };
            }
            else {
                layout = { x: 0, y: 0, w: width, h: width };
                nest = { x: 0, y: width, w: width, h: height - width };
            }
        }
    }
    else {
        // 不需要显示标签时，取中间小方块
        var diff = Math.abs(width - height) / 2;
        if (isHorizontal) {
            layout = { x: diff, y: 0, w: height, h: height };
        }
        else {
            layout = { x: 0, y: diff, w: width, h: width };
        }
    }
    return { layout: layout, nest: nest, isHorizontal: isHorizontal };
};
