From 1902f366c85f098f91a5d54d8425c97ec695e83e Mon Sep 17 00:00:00 2001 From: Ivan Voskoboynyk Date: Wed, 13 Feb 2013 21:23:13 +0200 Subject: [PATCH] Fixed directions unitSystem option rendering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the `$this->directions->request_options['units']` option is defined this code rendered  ```javascript unitSystem: google.maps.DirectionsUnitSystem.1 ``` javascription code. This is wrong. Also 'imperial' and 'metric' string literals should be uppercase. Because `google.maps.DirectionsUnitSystem` contains `IMPERIAL` and `METRIC` constants but not `imperial` and `metric`. --- Map.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Map.php b/Map.php index 0d2e1d9..c02e3e9 100644 --- a/Map.php +++ b/Map.php @@ -1228,7 +1228,7 @@ public function setHeight( $height ) { * @return void */ public function setUnitsMetric() { - $this->setUnits( 'metric' ); + $this->setUnits( 'METRIC' ); } /** @@ -1237,7 +1237,7 @@ public function setUnitsMetric() { * @return void */ public function setUnitsImperial() { - $this->setUnits( 'imperial' ); + $this->setUnits( 'IMPERIAL' ); } /** @@ -1940,7 +1940,7 @@ function getMapJS() { $request_options .= sprintf( "\t\ttravelMode: google.maps.DirectionsTravelMode.%s,\n", strtoupper( $this->directions->request_options['travelMode'] ) ); break; case 'units': - $request_options .= sprintf( "\t\tunitSystem: google.maps.DirectionsUnitSystem.%s,\n", isset( $this->directions->request_options['units'] ) ?: $this->units ); + $request_options .= sprintf( "\t\tunitSystem: google.maps.DirectionsUnitSystem.%s,\n", isset( $this->directions->request_options['units'] ) ? $this->directions->request_options['units'] : $this->units ); break; default: $request_options .= sprintf( "\t\t%s:%s,\n", $request_option, $this->phpToJs( $request_value ) ); @@ -2392,4 +2392,4 @@ function enableClustering( $clustering_js_file, $options = null ) { $this->clustering_options = $options; } -} \ No newline at end of file +}