制作分屏的时出现的报错

0 投票

function onload(Cesium) {
        var viewer = new Cesium.Viewer('cesiumContainer');

        var scene = viewer.scene;
         var promise = scene.open("http://8.134.55.91:8092/iserver/services/3D-YC_Scene/rest/realspace");
        Cesium.when.all(promise, function (layers) {
            $('#viewportType').change(function () {
                var value = $(this).val();
                switch (value) {
                    case "NONE":
                        $("#split_up").css("display", "none");
                        $("#split_bottom").css("display", "none");
                        break;
                    case "HORIZONTAL":
                        $("#split_up").css("display", "block");
                        $("#split_bottom").css("display", "block");
                        break;
                    
                }
                scene.multiViewportMode = Cesium.MultiViewportMode[value];
            });

           
        }, function (e) {
            
        });
    }

代码截图

6月 1 分类:  47次浏览 | 用户: Yana_0705 初出茅庐 (57 分)

1个回答

0 投票

您好,我这边拿到您的服务在官网示例上面测试是没有问题的

6月 1 用户: 卷饼先生 名扬四海 (4,031 分)
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <title>分屏显示</title>
    <link href="../../Build/Cesium/Widgets/widgets.css" rel="stylesheet">
    <link href="./css/bootstrap.min.css" rel="stylesheet">
    <link href="./css/pretty.css" rel="stylesheet">
    <script src="./js/jquery.min.js"></script>
    <script src="./js/bootstrap.min.js"></script>
    <script src="./js/bootstrap-select.min.js"></script>
    <script src="./js/config.js"></script>
    <script type="text/javascript" src="http://www.supermapol.com/earth/Build/Cesium/Cesium.js"></script>
    
</head>

<body>
<div id="cesiumContainer"></div>

<div id="split_up" style="display: none;"></div>
<div id="split_bottom" style="display: none;"></div>

<script type="text/javascript">
    function onload(Cesium) {
        var viewer = new Cesium.Viewer('cesiumContainer');

        var scene = viewer.scene;

        var treePromise = scene.open("http://8.134.55.91:8092/iserver/services/3D-YC_Scene/rest/realspace");
        Cesium.when.all(treePromise, function (layers) {
              $("#split_up").css("display", "block");
              $("#split_bottom").css("display", "block");
           scene.multiViewportMode = Cesium.MultiViewportMode["HORIZONTAL"]

        });
    }

    if (typeof Cesium !== 'undefined') {
        onload(Cesium);
    }
</script>
</body>

</html>

我全部复制过来了   您再试试  就是双屏的时候 放大再缩小  就会出现这个问题
...