Skip to content

Commit

Permalink
Merge branch 'master' into onClick_for_address_marker
Browse files Browse the repository at this point in the history
  • Loading branch information
steveszc committed Apr 13, 2017
2 parents 464b290 + 0599c0e commit 55fc454
Show file tree
Hide file tree
Showing 44 changed files with 293 additions and 340 deletions.
21 changes: 21 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
root: true,
parserOptions: {
ecmaVersion: 6,
sourceType: 'module'
},
extends: [
'eslint:recommended',
'plugin:ember-suave/recommended'
],
env: {
browser: true
},
rules: {
'ember-suave/no-const-outside-module-scope': 'off',
'ember-suave/no-direct-property-access': 'off'
},
globals: {
'google': true
}
};
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
/connect.lock
/coverage/*
/libpeerconnection.log
npm-debug.log
npm-debug.log*
testem.log
lcov.dat

# IDE misc
/.idea
7 changes: 0 additions & 7 deletions .jscsrc

This file was deleted.

33 changes: 0 additions & 33 deletions .jshintrc

This file was deleted.

2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
.editorconfig
.ember-cli
.gitignore
.jshintrc
.eslintrc.js
.watchmanconfig
.travis.yml
bower.json
Expand Down
20 changes: 12 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
---
language: node_js
node_js:
- "4"
- "6"

sudo: false

cache:
directories:
- node_modules
- $HOME/.npm
- $HOME/.cache # includes bowers cache

env:
- EMBER_TRY_SCENARIO=default
- EMBER_TRY_SCENARIO=ember-1.13
# we recommend testing LTS's and latest stable release (bonus points to beta/canary)
- EMBER_TRY_SCENARIO=ember-lts-2.4
- EMBER_TRY_SCENARIO=ember-lts-2.8
- EMBER_TRY_SCENARIO=ember-release
- EMBER_TRY_SCENARIO=ember-beta
- EMBER_TRY_SCENARIO=ember-canary
- EMBER_TRY_SCENARIO=ember-default

matrix:
fast_finish: true
Expand All @@ -24,18 +27,19 @@ matrix:

before_install:
- npm config set spin false
- npm install -g bower
- npm install phantomjs-prebuilt
- npm install -g bower phantomjs-prebuilt
- bower --version
- phantomjs --version

install:
- npm install
- bower install

script:
- ember try $EMBER_TRY_SCENARIO test
- COVERAGE=true node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO test --skip-cleanup

after_script:
- cat lcov.dat | node_modules/coveralls/bin/coveralls.js
- cat coverage/lcov.info | node_modules/coveralls/bin/coveralls.js

-notifications:
email:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ In `config/environment.js` you can specify:
- additional Google Maps libraries to be loaded along with this add-on
(check the full list [here](https://developers.google.com/maps/documentation/javascript/libraries)),
- optional API key or client ID for your application (additional info could be found [here](https://developers.google.com/maps/web/)),
- optional [channel](https://developers.google.com/maps/premium/reports/usage-reports#channels),
- optional version number,
- optional exclude parameter, which prevents inclusion of the google maps api script tag into the index.html (in case one wants to handle loading of google maps lib by himself),
- optional language for map localization,
Expand Down
26 changes: 14 additions & 12 deletions addon/components/g-map-address-marker.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import layout from '../templates/components/g-map-address-marker';
const { computed, observer, run, isPresent, isEmpty, typeOf } = Ember;

const GMapAddressMarkerComponent = Ember.Component.extend({
layout: layout,
layout,
classNames: ['g-map-address-marker'],

map: computed.alias('mapContext.map'),
Expand All @@ -23,9 +23,9 @@ const GMapAddressMarkerComponent = Ember.Component.extend({
const map = this.get('map');
let service = this.get('placesService');

if (isPresent(map) &&
isEmpty(service) &&
(typeof FastBoot === 'undefined')) {
if (isPresent(map)
&& isEmpty(service)
&& (typeof FastBoot === 'undefined')) {
service = new google.maps.places.PlacesService(map);
this.set('placesService', service);
this.searchLocation();
Expand All @@ -40,9 +40,9 @@ const GMapAddressMarkerComponent = Ember.Component.extend({
const service = this.get('placesService');
const address = this.get('address');

if (isPresent(service) &&
isPresent(address) &&
(typeof FastBoot === 'undefined')) {
if (isPresent(service)
&& isPresent(address)
&& (typeof FastBoot === 'undefined')) {
const request = { query: address };

service.textSearch(request, (results, status) => {
Expand All @@ -54,12 +54,14 @@ const GMapAddressMarkerComponent = Ember.Component.extend({
},

updateLocation(results) {
const lat = results[0].geometry.location.lat();
const lng = results[0].geometry.location.lng();
if (!this.destroyed) {
const lat = results[0].geometry.location.lat();
const lng = results[0].geometry.location.lng();

this.set('lat', lat);
this.set('lng', lng);
this.sendOnLocationChange(lat, lng, results);
this.set('lat', lat);
this.set('lng', lng);
this.sendOnLocationChange(lat, lng, results);
}
},

sendOnLocationChange() {
Expand Down
44 changes: 24 additions & 20 deletions addon/components/g-map-address-route.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import layout from '../templates/components/g-map-address-route';
const { computed, observer, run, isPresent, isEmpty, typeOf } = Ember;

const GMapAddressRouteComponent = Ember.Component.extend({
layout: layout,
layout,
classNames: ['g-map-address-route'],

map: computed.alias('mapContext.map'),
Expand All @@ -23,9 +23,9 @@ const GMapAddressRouteComponent = Ember.Component.extend({
const map = this.get('map');
let service = this.get('placesService');

if (isPresent(map) &&
isEmpty(service) &&
(typeof FastBoot === 'undefined')) {
if (isPresent(map)
&& isEmpty(service)
&& (typeof FastBoot === 'undefined')) {
service = new google.maps.places.PlacesService(map);
this.set('placesService', service);
this.searchLocations();
Expand All @@ -41,9 +41,9 @@ const GMapAddressRouteComponent = Ember.Component.extend({
const originAddress = this.get('originAddress');
const destinationAddress = this.get('destinationAddress');

if (isPresent(service) &&
isPresent(originAddress) &&
(typeof FastBoot === 'undefined')) {
if (isPresent(service)
&& isPresent(originAddress)
&& (typeof FastBoot === 'undefined')) {
const originRequest = { query: originAddress };

service.textSearch(originRequest, (results, status) => {
Expand All @@ -53,9 +53,9 @@ const GMapAddressRouteComponent = Ember.Component.extend({
});
}

if (isPresent(service) &&
isPresent(destinationAddress) &&
(typeof FastBoot === 'undefined')) {
if (isPresent(service)
&& isPresent(destinationAddress)
&& (typeof FastBoot === 'undefined')) {
const destinationRequest = { query: destinationAddress };

service.textSearch(destinationRequest, (results, status) => {
Expand All @@ -67,21 +67,25 @@ const GMapAddressRouteComponent = Ember.Component.extend({
},

updateOriginLocation(results) {
const lat = results[0].geometry.location.lat();
const lng = results[0].geometry.location.lng();
if (!this.isDestroyed) {
const lat = results[0].geometry.location.lat();
const lng = results[0].geometry.location.lng();

this.set('originLat', lat);
this.set('originLng', lng);
this.sendOnLocationsChange(lat, lng, results);
this.set('originLat', lat);
this.set('originLng', lng);
this.sendOnLocationsChange(lat, lng, results);
}
},

updateDestinationLocation(results) {
const lat = results[0].geometry.location.lat();
const lng = results[0].geometry.location.lng();
if (!this.isDestroyed) {
const lat = results[0].geometry.location.lat();
const lng = results[0].geometry.location.lng();

this.set('destinationLat', lat);
this.set('destinationLng', lng);
this.sendOnLocationsChange(lat, lng, results);
this.set('destinationLat', lat);
this.set('destinationLng', lng);
this.sendOnLocationsChange(lat, lng, results);
}
},

sendOnLocationsChange() {
Expand Down
12 changes: 6 additions & 6 deletions addon/components/g-map-infowindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ const { isEmpty, isPresent, observer, computed, run, assert, typeOf } = Ember;
const allowedOptions = Ember.A(['disableAutoPan', 'maxWidth', 'pixelOffset']);

const OPEN_CLOSE_EVENTS = Ember.A(
[ 'click', 'dblclick', 'rightclick', 'mouseover', 'mouseout' ]
['click', 'dblclick', 'rightclick', 'mouseover', 'mouseout']
);

const GMapInfowindowComponent = Ember.Component.extend({
layout: layout,
layout,
classNames: ['g-map-marker'],

map: computed.alias('mapContext.map'),
Expand Down Expand Up @@ -143,10 +143,10 @@ const GMapInfowindowComponent = Ember.Component.extend({
const lat = this.get('lat');
const lng = this.get('lng');

if (isPresent(infowindow) &&
isPresent(lat) &&
isPresent(lng) &&
(typeof FastBoot === 'undefined')) {
if (isPresent(infowindow)
&& isPresent(lat)
&& isPresent(lng)
&& (typeof FastBoot === 'undefined')) {
const position = new google.maps.LatLng(lat, lng);
infowindow.setPosition(position);
}
Expand Down
14 changes: 7 additions & 7 deletions addon/components/g-map-marker.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import GMapComponent from './g-map';
const { isEmpty, isPresent, observer, computed, run, assert, typeOf } = Ember;

const GMapMarkerComponent = Ember.Component.extend({
layout: layout,
layout,
classNames: ['g-map-marker'],

map: computed.alias('mapContext.map'),
Expand All @@ -25,8 +25,8 @@ const GMapMarkerComponent = Ember.Component.extend({

didInsertElement() {
this._super();
if (isEmpty(this.get('marker')) &&
(typeof FastBoot === 'undefined')) {
if (isEmpty(this.get('marker'))
&& (typeof FastBoot === 'undefined')) {
const marker = new google.maps.Marker();
this.set('marker', marker);
}
Expand Down Expand Up @@ -118,10 +118,10 @@ const GMapMarkerComponent = Ember.Component.extend({
const lat = this.get('lat');
const lng = this.get('lng');

if (isPresent(marker) &&
isPresent(lat) &&
isPresent(lng) &&
(typeof FastBoot === 'undefined')) {
if (isPresent(marker)
&& isPresent(lat)
&& isPresent(lng)
&& (typeof FastBoot === 'undefined')) {
const position = new google.maps.LatLng(lat, lng);
if (isPresent(position)) {
marker.setPosition(position);
Expand Down
2 changes: 1 addition & 1 deletion addon/components/g-map-polyline-coordinate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import GMapPolylineComponent from './g-map-polyline';
const { isEmpty, isPresent, observer, computed, run, assert } = Ember;

const GMapPolylineCoordinateComponent = Ember.Component.extend({
layout: layout,
layout,
classNames: ['g-map-polyline-coordinate'],

polyline: computed.alias('polylineContext.polyline'),
Expand Down
2 changes: 1 addition & 1 deletion addon/components/g-map-polyline.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const { isEmpty, isPresent, observer, computed, run, assert, typeOf } = Ember;
const allowedPolylineOptions = Ember.A(['strokeColor', 'strokeWeight', 'strokeOpacity', 'zIndex', 'geodesic', 'icons', 'clickable', 'draggable', 'visible', 'path']);

const GMapPolylineComponent = Ember.Component.extend({
layout: layout,
layout,
classNames: ['g-map-polyline'],

map: computed.alias('mapContext.map'),
Expand Down

0 comments on commit 55fc454

Please sign in to comment.