src/coord/geo/geoCreator.js
function resizeGeo(geoModel, api) {

    var boundingCoords = geoModel.get('boundingCoords');
    if (boundingCoords != null) {
        var leftTop = boundingCoords[0];
        var rightBottom = boundingCoords[1];
        if (isNaN(leftTop[0]) || isNaN(leftTop[1]) || isNaN(rightBottom[0]) || isNaN(rightBottom[1])) {
            if (__DEV__) {
                console.error('Invalid boundingCoords');
            }
        }
        else {
            this.setBoundingRect(leftTop[0], leftTop[1], rightBottom[0] - leftTop[0], rightBottom[1] - leftTop[1]);
        }
    }

    var rect = this.getBoundingRect();

    var boxLayoutOption;

    var center = geoModel.get('layoutCenter');
    var size = geoModel.get('layoutSize');

    var viewWidth = api.getWidth();
    var viewHeight = api.getHeight();

    var aspect = rect.width / rect.height * this.aspectScale;

    var useCenterAndSize = false;

    if (center && size) {
        center = [
            numberUtil.parsePercent(center[0], viewWidth),
            numberUtil.parsePercent(center[1], viewHeight)
        ];
        size = numberUtil.parsePercent(size, Math.min(viewWidth, viewHeight));

        if (!isNaN(center[0]) && !isNaN(center[1]) && !isNaN(size)) {
            useCenterAndSize = true;
        }
        else {
            if (__DEV__) {
                console.warn('Given layoutCenter or layoutSize data are invalid. Use left/top/width/height instead.');
            }
        }
    }

    var viewRect;
    if (useCenterAndSize) {
        var viewRect = {};
        if (aspect > 1) {
            // Width is same with size
            viewRect.width = size;
            viewRect.height = size / aspect;
        }
        else {
            viewRect.height = size;
            viewRect.width = size * aspect;
        }
        viewRect.y = center[1] - viewRect.height / 2;
        viewRect.x = center[0] - viewRect.width / 2;
    }
    else {
        // Use left/top/width/height
        boxLayoutOption = geoModel.getBoxLayoutParams();

        // 0.75 rate
        boxLayoutOption.aspect = aspect;

        viewRect = layout.getLayoutRect(boxLayoutOption, {
            width: viewWidth,
            height: viewHeight
        });
    }

    this.setViewRect(viewRect.x, viewRect.y, viewRect.width, viewRect.height);

    this.setCenter(geoModel.get('center'));
    this.setZoom(geoModel.get('zoom'));
}
function resizeGeo(geoModel, api) {

    var boundingCoords = geoModel.get('boundingCoords');
    if (boundingCoords != null) {
        var leftTop = boundingCoords[0];
        var rightBottom = boundingCoords[1];
        if (isNaN(leftTop[0]) || isNaN(leftTop[1]) || isNaN(rightBottom[0]) || isNaN(rightBottom[1])) {
            if (__DEV__) {
                console.error('Invalid boundingCoords');
            }
        }
        else {
            this.setBoundingRect(leftTop[0], leftTop[1], rightBottom[0] - leftTop[0], rightBottom[1] - leftTop[1]);
        }
    }

    var rect = this.getBoundingRect();

    var boxLayoutOption;

    var center = geoModel.get('layoutCenter');
    var size = geoModel.get('layoutSize');

    var viewWidth = api.getWidth();
    var viewHeight = api.getHeight();

    var aspect = rect.width / rect.height * this.aspectScale;

    var useCenterAndSize = false;

    if (center && size) {
        center = [
            numberUtil.parsePercent(center[0], viewWidth),
            numberUtil.parsePercent(center[1], viewHeight)
        ];
        size = numberUtil.parsePercent(size, Math.min(viewWidth, viewHeight));

        if (!isNaN(center[0]) && !isNaN(center[1]) && !isNaN(size)) {
            useCenterAndSize = true;
        }
        else {
            if (__DEV__) {
                console.warn('Given layoutCenter or layoutSize data are invalid. Use left/top/width/height instead.');
            }
        }
    }

    var viewRect;
    if (useCenterAndSize) {
        var viewRect = {};
        if (aspect > 1) {
            // Width is same with size
            viewRect.width = size;
            viewRect.height = size / aspect;
        }
        else {
            viewRect.height = size;
            viewRect.width = size * aspect;
        }
        viewRect.y = center[1] - viewRect.height / 2;
        viewRect.x = center[0] - viewRect.width / 2;
    }
    else {
        // Use left/top/width/height
        boxLayoutOption = geoModel.getBoxLayoutParams();

        // 0.75 rate
        boxLayoutOption.aspect = aspect;

        viewRect = layout.getLayoutRect(boxLayoutOption, {
            width: viewWidth,
            height: viewHeight
        });
    }

    this.setViewRect(viewRect.x, viewRect.y, viewRect.width, viewRect.height);

    this.setCenter(geoModel.get('center'));
    this.setZoom(geoModel.get('zoom'));
}
function resizeGeo ( geoModel , api ) { var boundingCoords = geoModel . get ( 'boundingCoords' ) ; if ( boundingCoords != null ) { var leftTop = boundingCoords [ 0 ] ; var rightBottom = boundingCoords [ 1 ] ; if ( isNaN ( leftTop [ 0 ] ) || isNaN ( leftTop [ 1 ] ) || isNaN ( rightBottom [ 0 ] ) || isNaN ( rightBottom [ 1 ] ) ) { if ( __DEV__ ) { console . error ( 'Invalid boundingCoords' ) ; } } else { this . setBoundingRect ( leftTop [ 0 ] , leftTop [ 1 ] , rightBottom [ 0 ] - leftTop [ 0 ] , rightBottom [ 1 ] - leftTop [ 1 ] ) ; } } var rect = this . getBoundingRect ( ) ; var boxLayoutOption ; var center = geoModel . get ( 'layoutCenter' ) ; var size = geoModel . get ( 'layoutSize' ) ; var viewWidth = api . getWidth ( ) ; var viewHeight = api . getHeight ( ) ; var aspect = rect . width / rect . height * this . aspectScale ; var useCenterAndSize = false ; if ( center && size ) { center = [ numberUtil . parsePercent ( center [ 0 ] , viewWidth ) , numberUtil . parsePercent ( center [ 1 ] , viewHeight ) ] ; size = numberUtil . parsePercent ( size , Math . min ( viewWidth , viewHeight ) ) ; if ( ! isNaN ( center [ 0 ] ) && ! isNaN ( center [ 1 ] ) && ! isNaN ( size ) ) { useCenterAndSize = true ; } else { if ( __DEV__ ) { console . warn ( 'Given layoutCenter or layoutSize data are invalid. Use left/top/width/height instead.' ) ; } } } var viewRect ; if ( useCenterAndSize ) { var viewRect = { } ; if ( aspect > 1 ) { // Width is same with size viewRect . width = size ; viewRect . height = size / aspect ; } else { viewRect . height = size ; viewRect . width = size * aspect ; } viewRect . y = center [ 1 ] - viewRect . height / 2 ; viewRect . x = center [ 0 ] - viewRect . width / 2 ; } else { // Use left/top/width/height boxLayoutOption = geoModel . getBoxLayoutParams ( ) ; // 0.75 rate boxLayoutOption . aspect = aspect ; viewRect = layout . getLayoutRect ( boxLayoutOption , { width : viewWidth , height : viewHeight } ) ; } this . setViewRect ( viewRect . x , viewRect . y , viewRect . width , viewRect . height ) ; this . setCenter ( geoModel . get ( 'center' ) ) ; this . setZoom ( geoModel . get ( 'zoom' ) ) ; }
Resize method bound to the geo
@param {module:echarts/coord/geo/GeoModel|module:echarts/chart/map/MapModel} geoModel
@param {module:echarts/ExtensionAPI} api
Resize method bound to the geo