Improve docs, comments and code readability

This commit is contained in:
Andreas Hocevar
2015-04-19 08:49:17 +02:00
parent 6a2aa833b4
commit 8fd4e2c7c5
3 changed files with 10 additions and 6 deletions

View File

@@ -4949,7 +4949,7 @@ olx.source.VectorOptions.prototype.url;
/** /**
* Wrap the world horizontally. Default is `true`. For vector editing across the * Wrap the world horizontally. Default is `true`. For vector editing across the
* 0° and 180° meridians to work properly, this should be set to `false`. The * -180° and 180° meridians to work properly, this should be set to `false`. The
* resulting geometry coordinates will then exceed the world bounds. * resulting geometry coordinates will then exceed the world bounds.
* @type {boolean|undefined} * @type {boolean|undefined}
* @api * @api

View File

@@ -135,14 +135,16 @@ ol.renderer.canvas.Map.prototype.dispatchComposeEvent_ =
var worldWidth = ol.extent.getWidth(projectionExtent); var worldWidth = ol.extent.getWidth(projectionExtent);
var world = 0; var world = 0;
while (startX < projectionExtent[0]) { while (startX < projectionExtent[0]) {
transform = this.getTransform(frameState, worldWidth * (--world)); --world;
transform = this.getTransform(frameState, worldWidth * world);
replayGroup.replay(context, pixelRatio, transform, rotation, {}); replayGroup.replay(context, pixelRatio, transform, rotation, {});
startX += worldWidth; startX += worldWidth;
} }
world = 0; world = 0;
startX = extent[2]; startX = extent[2];
while (startX > projectionExtent[2]) { while (startX > projectionExtent[2]) {
transform = this.getTransform(frameState, worldWidth * (++world)); ++world;
transform = this.getTransform(frameState, worldWidth * ++world);
replayGroup.replay(context, pixelRatio, transform, rotation, {}); replayGroup.replay(context, pixelRatio, transform, rotation, {});
startX -= worldWidth; startX -= worldWidth;
} }

View File

@@ -116,7 +116,8 @@ ol.renderer.canvas.VectorLayer.prototype.composeFrame =
var worldWidth = ol.extent.getWidth(projectionExtent); var worldWidth = ol.extent.getWidth(projectionExtent);
var world = 0; var world = 0;
while (startX < projectionExtent[0]) { while (startX < projectionExtent[0]) {
transform = this.getTransform(frameState, worldWidth * (--world)); --world;
transform = this.getTransform(frameState, worldWidth * world);
replayGroup.replay( replayGroup.replay(
replayContext, pixelRatio, transform, rotation, skippedFeatureUids); replayContext, pixelRatio, transform, rotation, skippedFeatureUids);
startX += worldWidth; startX += worldWidth;
@@ -124,7 +125,8 @@ ol.renderer.canvas.VectorLayer.prototype.composeFrame =
world = 0; world = 0;
startX = extent[2]; startX = extent[2];
while (startX > projectionExtent[2]) { while (startX > projectionExtent[2]) {
transform = this.getTransform(frameState, worldWidth * (++world)); ++world;
transform = this.getTransform(frameState, worldWidth * world);
replayGroup.replay( replayGroup.replay(
replayContext, pixelRatio, transform, rotation, skippedFeatureUids); replayContext, pixelRatio, transform, rotation, skippedFeatureUids);
startX -= worldWidth; startX -= worldWidth;
@@ -229,7 +231,7 @@ ol.renderer.canvas.VectorLayer.prototype.prepareFrame =
if (vectorSource.getWrapX() && viewState.projection.isGlobal() && if (vectorSource.getWrapX() && viewState.projection.isGlobal() &&
!ol.extent.containsExtent(projectionExtent, frameState.extent)) { !ol.extent.containsExtent(projectionExtent, frameState.extent)) {
// do not clip when the view crosses the 0 or 180 meridians // do not clip when the view crosses the -180° or 180° meridians
extent[0] = projectionExtent[0]; extent[0] = projectionExtent[0];
extent[2] = projectionExtent[2]; extent[2] = projectionExtent[2];
} }