从"打开图层Bing地图"中删除默认控件

Hel*_*rns 4 javascript bing-maps ios openlayers-3

我正在构建一个使用Geolocation的应用程序,使用Open Layers加载Bing Map Layer.我想仅通过触摸来控制缩放,因此想要删除默认的缩放按钮.理想情况下,我想至少移动"i"按钮,这样它就不会与圆形白色按钮发生冲突.

这是当前呈现方式的屏幕截图:

应用截图 所以我在谈论白色圆形下面的蓝色按钮.

除了Geolocation代码之外,这就是我添加Bing Maps图层的方式,我假设我会添加代码来删除这些,但我尝试的所有内容都没有区别:

var styles = [
    'Road',
    'Aerial',
    'AerialWithLabels',
    'ordnanceSurvey'
];
var layers = [];
var i, ii;
for (i = 0, ii = styles.length; i < ii; ++i) {
    layers.push(new ol.layer.Tile({
        visible: false,
        preload: Infinity,
        source: new ol.source.BingMaps({
            key: 'my key is here in the real version',
            imagerySet: styles[i],
            disableZooming: true,
            // use maxZoom 19 to see stretched tiles instead of the BingMaps
            // "no photos at this zoom level" tiles
            maxZoom: 19
        })
    }));
}
Run Code Online (Sandbox Code Playgroud)

有没有人有什么建议?

xna*_*kos 11

zoom和(在左上角的加号和减号按钮)attribution(在i对照上的右下按钮)是一部分ol.Map配置.要禁用它们,您可以ol.Map按如下方式初始化:

var map = new ol.Map({
    ...
    controls : ol.control.defaults({
        attribution : false,
        zoom : false,
    }),
    ...
});
Run Code Online (Sandbox Code Playgroud)