乐趣区

关于javascript:3d-获得最大距离和限制最大最小距离

限度最大间隔, 默认为 2,设为 3 能够拉的更远,设为 1 能够限度的更近
viewer.navigation.setZoomOutLimitFactor(3)
限度最小间隔, 默认为 200,只针对 2d
viewer.navigation.setZoomInLimitFactor(300)

取得最大间隔

function getMaxDis() {var maxFactor = viewer.navigation.getZoomOutLimitFactor();
 if(viewer.toolController.getActiveTool().getName() == "orbit"){var computeOverviewDistance = viewer.navigation.computeOverviewDistance(viewer.toolController.getActiveTool().getFitBounds());
 var maxDis = maxFactor * computeOverviewDistance;
 return maxDis
    }
    return ;
}
退出移动版