gmaps.core
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -8,4 +8,3 @@ 'use strict'; | ||
_omit = require('lodash-compat/object/omit'), | ||
isGoogleMapsRegistered = (typeof window.google === 'object' && window.google.maps), | ||
doc = window.document, | ||
isGoogleMapsRegistered = (typeof google === 'object' && google.maps), | ||
nativeMethods = [ | ||
@@ -19,6 +18,2 @@ 'setCenter', 'streetView_changed', 'getDiv', 'panBy', 'panTo', | ||
if (!isGoogleMapsRegistered) { | ||
throw 'Google Maps API is required. Please register the following JavaScript library in your site: http://maps.google.com/maps/api/js?sensor=true'; | ||
} | ||
function querySelector(selector, context) { | ||
@@ -28,3 +23,3 @@ var element; | ||
if (!context) { | ||
context = doc; | ||
context = document; | ||
} | ||
@@ -36,3 +31,3 @@ | ||
else if (selector[0] === '#') { | ||
element = doc.getElementById(selector.replace(/^#/, '')); | ||
element = document.getElementById(selector.replace(/^#/, '')); | ||
} | ||
@@ -152,2 +147,6 @@ else if (selector[0] === '.') { | ||
function GMaps(options) { | ||
if (!isGoogleMapsRegistered) { | ||
throw 'Google Maps API is required. Please register the following JavaScript library in your site: http://maps.google.com/maps/api/js?sensor=true'; | ||
} | ||
if (!this) { | ||
@@ -361,3 +360,3 @@ return new GMaps(options); | ||
GMaps.prototype.setContextMenu = function(options) { | ||
var contextMenuElement = doc.createElement('ul'), | ||
var contextMenuElement = document.createElement('ul'), | ||
contextMenuControlType = options.control, | ||
@@ -387,7 +386,7 @@ contextMenuOptions = options.options, | ||
doc.body.appendChild(contextMenuElement); | ||
document.body.appendChild(contextMenuElement); | ||
google.maps.event.addDomListener(contextMenuElement, 'mouseout', function(mouseOutEvent) { | ||
if (!mouseOutEvent.relatedTarget || !this.contains(mouseOutEvent.relatedTarget)) { | ||
window.setTimeout(function() { | ||
setTimeout(function() { | ||
contextMenuElement.style.display = 'none'; | ||
@@ -394,0 +393,0 @@ }, 400); |
{ | ||
"name": "gmaps.core", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "gmaps.js core that contains the base for create simple maps using Google Maps API", | ||
@@ -5,0 +5,0 @@ "main": "gmaps.core.js", |
@@ -37,3 +37,3 @@ # gmaps.core | ||
var map = new GMaps({ | ||
el : '#basic-map', | ||
el : '#map', | ||
lat: -12.0433, | ||
@@ -54,3 +54,3 @@ lng: -77.0283, | ||
Creates a new instance of `GMaps`, a wrapper for simpler use of the Google Maps JavaScript API. The new instance has the same methods of `google.maps.Map`. | ||
Create a new instance of `GMaps`, a wrapper for simpler use of the Google Maps JavaScript API. The new instance has the same methods of `google.maps.Map`. | ||
@@ -73,3 +73,3 @@ `GMaps` accepts all the [MapOptions](https://developers.google.com/maps/documentation/javascript/reference#MapOptions) and [events](https://developers.google.com/maps/documentation/javascript/reference#Map) listed in the Google Maps API. | ||
Returns the HTML element container of the map. | ||
Return the HTML element container of the map. | ||
@@ -90,7 +90,7 @@ ### `zoomIn()` | ||
Returns an array of `google.maps.LatLng` objects. If `useGeoJSON` is true, inverts the order of `coords` before convert it, since GeoJSON format has the order `longitude, latitude` instead Google Maps' `latitude, longitude`. Supports simple or multi-dimensional arrays. | ||
Return an array of `google.maps.LatLng` objects. If `useGeoJSON` is true, inverts the order of `coords` before convert it, since GeoJSON format has the order `longitude, latitude` instead Google Maps' `latitude, longitude`. Supports simple or multi-dimensional arrays. | ||
### `GMaps.coordsToLatLngs(coords, useGeoJSON)` | ||
Returns a `google.maps.LatLng` object from a two-elements array. If `useGeoJSON` is true, inverts the order of `coords` before convert it, since GeoJSON format has the order `longitude, latitude` instead Google Maps' `latitude, longitude`. | ||
Return a `google.maps.LatLng` object from a two-elements array. If `useGeoJSON` is true, inverts the order of `coords` before convert it, since GeoJSON format has the order `longitude, latitude` instead Google Maps' `latitude, longitude`. | ||
@@ -101,2 +101,6 @@ ## Changelog | ||
### 0.5.1 | ||
* Remove `window` references for using in Isomorphic/Universal JavaScript apps | ||
### 0.5.0 | ||
@@ -103,0 +107,0 @@ |
describe('Creating a map', function() { | ||
var basicMap, advancedMap, mapWithEvents, mapWithCustomControls; | ||
var basicMap, advancedMap, mapWithEvents; | ||
@@ -4,0 +4,0 @@ it('should throw an error if element is not defined', function() { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
131
204010
3336