From 69660e3530b9c04b1b96aa7b86d250ff1f06dc72 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Wed, 22 Feb 2012 17:22:30 +0100 Subject: [PATCH] Minor coding style improvements. --- lib/OpenLayers/Renderer/Canvas.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/OpenLayers/Renderer/Canvas.js b/lib/OpenLayers/Renderer/Canvas.js index eb2b7fcc54..35939afdd2 100644 --- a/lib/OpenLayers/Renderer/Canvas.js +++ b/lib/OpenLayers/Renderer/Canvas.js @@ -336,29 +336,29 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, { // Push symbol scaling, translation and rotation onto the transformation stack in reverse order. // Don't forget to apply all canvas transformations to the hitContext canvas as well(!) this.canvas.save(); - if (this.hitDetection) this.hitContext.save(); + if (this.hitDetection) { this.hitContext.save(); } // Step 3: place symbol at the desired location this.canvas.translate(p0,p1); - if (this.hitDetection) this.hitContext.translate(p0,p1); + if (this.hitDetection) { this.hitContext.translate(p0,p1); } // Step 2a. rotate the symbol if necessary angle = deg2rad * style.rotation; // will be NaN when style.rotation is undefined. if (!isNaN(angle)) { this.canvas.rotate(angle); - if (this.hitDetection) this.hitContext.rotate(angle); + if (this.hitDetection) { this.hitContext.rotate(angle); } } // // Step 2: scale symbol such that pointRadius equals half the maximum symbol dimension. scaling = 2.0 * style.pointRadius / Math.max(symbolBounds.getWidth(), symbolBounds.getHeight()); this.canvas.scale(scaling,scaling); - if (this.hitDetection) this.hitContext.scale(scaling,scaling); + if (this.hitDetection) { this.hitContext.scale(scaling,scaling); } // Step 1: center the symbol at the origin cx = symbolBounds.getCenterLonLat().lon; cy = symbolBounds.getCenterLonLat().lat; this.canvas.translate(-cx,-cy); - if (this.hitDetection) this.hitContext.translate(-cx,-cy); + if (this.hitDetection) { this.hitContext.translate(-cx,-cy); } // Don't forget to scale stroke widths, because they are affected by canvas scale transformations as well(!) // Alternative: scale symbol coordinates manually, so stroke width scaling is not needed anymore. @@ -408,7 +408,7 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, { style.strokeWidth = unscaledStrokeWidth; this.canvas.restore(); - if (this.hitDetection) this.hitContext.restore(); + if (this.hitDetection) { this.hitContext.restore(); } this.setCanvasStyle("reset"); },