[OpenLayers-Dev] Vector feature redrawing on map panning
Andreas Hocevar
ahocevar at opengeo.org
Thu Mar 24 06:55:14 EDT 2011
Hi,
the new OpenLayers.Renderer.SVG2 renderer does what you are requesting. It is available on trunk (and will be in 2.11). To use it, configure the renderers array for your OpenLayers.Layer.Vector like this:
new OpenLayers.Layer.Vector("My Layer", {
renderers: ["SVG2", "VML", "Canvas"]
});
Or set it on the prototype:
OpenLayers.Layer.Vector.renderers = ["SVG2", "VML", "Canvas"];
Note that VML (used in IE6,7,8) and Canvas (used on Android devices) behave like Renderer.SVG and don't draw features while panning.
Regards,
Andreas.
On Mar 16, 2011, at 13:39 , Martin Saturka wrote:
> Hi,
> when you pan a Google map with some points of interest outside the
> current map view, those POIs are drawn immediately when they get into
> the map view, i.e. during the panning. It is not so at the OL based
> maps. We do some event checking (plus putting hooks at some controls,
> as shown below) to force POI rendering (one way to force it is by
> calling the map.setCenter method). Is there a better way to do that,
> please?
>
> Apropos, it looks that this behavior changes somewhat during
> OpenLayers development.
>
> // some hooks put inside to handle POI rendering
> OpenLayers.Control.DragPanMod = OpenLayers.Class(OpenLayers.Control.DragPan, {
> panMapDone: function(pixel) {
> OpenLayers.Hooks.DragPan.panMapDone(this);
> },
> panMap: function(xy) {
> this.panned = true;
>
> this.map.pan(this.handler.last.x - xy.x, this.handler.last.y -
> xy.y, {dragging: this.handler.dragging, animate: false});
>
> OpenLayers.Hooks.DragPan.panMap(this);
> },
>
> CLASS_NAME: "OpenLayers.Control.DragPan"
> });
>
> M.
>
> --
> Martin Saturka
> Software Engineer, Sourcefabric
> www.sourcefabric.org
> _______________________________________________
> Dev mailing list
> Dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-dev
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Dev
mailing list