Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixed directions unitSystem option rendering #17

Closed
wants to merge 1 commit into from

2 participants

Ivan Voskoboynyk Galen Grover
Ivan Voskoboynyk

When the $this->directions->request_options['units'] option is defined getMapJS method rendered this javascript code:

{
unitSystem: google.maps.DirectionsUnitSystem.1
}

Obviously 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.

Ivan Voskoboynyk e1himself Fixed directions unitSystem option rendering
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`.
1902f36
Ivan Voskoboynyk

Is there something wrong with this bugfix?

Galen Grover galen closed this in 04d13fd
Galen Grover
Owner

Nothing was wrong I was just busy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 13, 2013
  1. Ivan Voskoboynyk

    Fixed directions unitSystem option rendering

    e1himself authored
    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`.
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 4 deletions.
  1. +4 −4 Map.php
8 Map.php
View
@@ -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;
}
-}
+}
Something went wrong with that request. Please try again.