]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#257] cleanup of if/else
authorScottDowne <sdowne@learn.senecac.on.ca>
Tue, 11 Jan 2011 23:09:42 +0000 (18:09 -0500)
committerScottDowne <sdowne@learn.senecac.on.ca>
Tue, 11 Jan 2011 23:09:42 +0000 (18:09 -0500)
plugins/googlemap/popcorn.googlemap.js

index b275654d9647262b53102b349ccd395f88831dbd..80581d8e5699226011a92d9d89be1b848b02bf45 100644 (file)
@@ -126,13 +126,13 @@ var googleCallback;
             options._map.getDiv().style.display = 'block';
             // reset the location and zoom just in case the user plaid with the map
             options._map.setCenter(options._location);
-            if ( options.zoom ) {
-              if ( typeof options.zoom !== "number" ) {
-                options.zoom = +options.zoom;
-              } 
-            } else {
-              options.zoom = 0;
+
+            // make sure options.zoom is a number
+            if ( options.zoom && isNaN( options.zoom ) ) {
+              options.zoom = +options.zoom;
             }
+            options.zoom = options.zoom || 0; // default to 0
+
             options._map.setZoom( options.zoom );
           }
         };