简体   繁体   English

具有多个矢量图层的OpenLayers地图使整个页面在chrome中闪烁

[英]OpenLayers map with multiple vector layers makes whole page blink in chrome

I have an OpenLayers map, which takes almost all page size. 我有一个OpenLayers地图,几乎占据了所有页面大小。 Also it has 13 vector layers on it. 它上面还有13个矢量图层。 When I drag map with all layers enabled - the whole page starts blinking. 当我拖动地图并启用所有图层时 - 整个页面开始闪烁。 It is reproduced only in chrome, in firefox everything looks fine. 它只在chrome中复制,在firefox中一切看起来都很好。 When I disable two layers - blinking stops. 当我禁用两个图层时 - 闪烁停止。 If I make map smaller - blinking stops. 如果我让地图变小 - 闪烁停止。 It looks like some kind of a chrome bug. 它看起来像某种铬虫。 My chrome version: 31.0.1650.8 beta-m 我的chrome版本:31.0.1650.8 beta-m


I've created a fiddle to demonstrate the problem. 我创造了一个小提琴来演示这个问题。 Try set VECTOR_LAYERS_COUNT to 45 and you'll see the problem, also if you reduce width/height of map the blinking will stop even with 45 layers. 尝试将VECTOR_LAYERS_COUNT设置为45并且您将看到问题,如果您减小地图的宽度/高度,即使有45层,闪烁也会停止。 Here is the code: 这是代码:

var VECTOR_LAYERS_COUNT = 25; // set to 45 to see result
for (var i = 0; i < VECTOR_LAYERS_COUNT; i++) {
    var layer = new OpenLayers.Layer.Vector(i, {
        renderers: OpenLayers.Layer.Vector.prototype.renderers,
        rendererOptions: {
            zIndexing: true
        },
        visibility: true,
    });
    mapa.addLayer(layer);
}

I've had the same problem in Chrome for the last couple of weeks. 在过去的几周里,我在Chrome中遇到了同样的问题。

This seems to be a known problem with OpenLayers and later versions of Chrome. 这似乎是OpenLayers和更高版本Chrome的已知问题。

The workaround is to disable SVG rendering of layers. 解决方法是禁用图层的SVG渲染。

Change the following line from 更改以下行

renderers: OpenLayers.Layer.Vector.prototype.renderers,

to

renderers: ['Canvas', 'VML'],

This fixed the problem for me. 这解决了我的问题。

HTH HTH

UPDATE UPDATE

Turns out this isn't a solution to the problem. 事实证明这不是问题的解决方案。 The problem lies in Chrome's compositing engine. 问题出在Chrome的合成引擎上。 I have have submitted a bug report to the chromium developers, and they have successfully verified and accepted the bug report. 我已经向铬开发者提交了一份错误报告,他们已经成功验证并接受了错误报告。

I'm not sure when the developers will get around to fixing it, but at least there's something in the works. 我不确定开发人员何时会解决这个问题,但至少还有一些工作正在进行中。

For those following along at home, this is the bug report: https://code.google.com/p/chromium/issues/detail?id=346621 对于那些在家中关注的人,这是错误报告: https//code.google.com/p/chromium/issues/detail?id = 346621

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM