tileExtent is calculated from the tileCoord argument, so I think we cannot
move numCols out of the closure.


On 11 March 2013 14:35, Tom Payne <notifications@github.com> wrote:

> In src/ol/source/wmtssource.js:
>
> > +        if (tileGrid.getResolutions().length <= tileCoord.z) {
> > +          return null;
> > +        }
> > +        var x = tileCoord.x;
> > +        var y = -tileCoord.y - 1;
> > +        var tileExtent = tileGrid.getTileCoordExtent(tileCoord);
> > +        var projectionExtent = projection.getExtent();
> > +        var extent = goog.isDef(wmtsOptions.extent) ?
> > +            wmtsOptions.extent : projectionExtent;
> > +
> > +        if (!goog.isNull(extent) && projection.isGlobal() &&
> > +            extent.minX === projectionExtent.minX &&
> > +            extent.maxX === projectionExtent.maxX) {
> > +          var numCols = Math.ceil(
> > +              (extent.maxX - extent.minX) /
> > +              (tileExtent.maxX - tileExtent.minX));
>
> I think the calculation of numCols can be moved out of the closure so
> that it is only calculated once rather than every time the tileUrlFunction
> is called.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/openlayers/ol3/pull/342/files#r3316552>
> .
>