[OpenLayers-Dev] zoomToExtent/zoomToScale Issue with Android Chrome Browser

Brian Krebs brian.krebs at korterra.com
Thu Nov 7 14:36:10 PST 2013


Have taken over a project from a previous programmer and am having issues using Chrome on an Android phone where it will actually lock up the browser and I have to force stop it.  I debugged by commenting out the code and uncommenting a line at a time and was able to figure out that calling zoomToExtent or zoomToScale(last 2 lines of code) causes the issue.  I downloaded the Opera browser on the same phone and it did not have an issue, so this is something related to Chrome.  Has anyone dealt with this before and figured out a fix?

function markCurrentPosition(position)
{
       var currentFeatures = geolocateLayer.getFeaturesByAttribute('current', true);
       geolocateLayer.removeFeatures(currentFeatures);

       var pointg = new OpenLayers.Geometry.Point(position.coords.longitude, position.coords.latitude);
       pointg = OpenLayers.Projection.transform(
              pointg,
              new OpenLayers.Projection("EPSG:4326"),
              new OpenLayers.Projection("EPSG:4326")

       );

       latestGeolocatePoint = pointg;

       var errorStyle = {
                     fillColor: '#2980b9',
                     fillOpacity: 0.1,
                     strokeWidth: 0
              };
       var errorCircle = OpenLayers.Geometry.Polygon.createRegularPolygon(
                           pointg, position.coords.accuracy/(Math.PI * 40075020/180), 40, 0);
       var errorCircleFeature = new OpenLayers.Feature.Vector(errorCircle, {current: true}, errorStyle);

       var pointStyle = {
               graphicName: 'circle',
               strokeColor: '#3498db',
               strokeWidth: 1,
               fillColor: '#2980b9',
               fillOpacity: 1,
               pointRadius: 4
           };
       var centerPointFeature = new OpenLayers.Feature.Vector(pointg, {current: true}, pointStyle);

       geolocateLayer.addFeatures([centerPointFeature, errorCircleFeature]);

       var entryMap = document.getElementById('eTicketMap_mapdiv').mapComponent;
       entryMap.map.zoomToExtent(geolocateLayer.getDataExtent());
       entryMap.map.zoomToScale(1913);
}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20131107/3d40aea5/attachment.html>


More information about the Dev mailing list