Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ang-google-maps

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ang-google-maps - npm Package Compare versions

Comparing version 1.0.8 to 1.0.9

2

bower.json
{
"name": "ang-google-maps",
"version": "1.0.8",
"version": "1.0.9",
"homepage": "https://github.com/khalednobani/ang-google-maps",

@@ -5,0 +5,0 @@ "description": "Initialise Google Maps, Set Location, Drop Pins, Get Connected Routes between the current location and the destination.",

@@ -35,7 +35,2 @@ (function(ang) {

$scope.location = {};
// Methods
$scope.manageDropOffs = function() {
manageDropOffs.call($scope, $filter);
};

@@ -57,3 +52,2 @@ $scope.handleMarkerDrop = function($Event, $Model, $AutoCompScope) {

$scope.location['pickUp'] = $Position;
$scope.manageDropOffs();
$scope.setLocation();

@@ -63,2 +57,62 @@

$scope.setDropoff = function($Position, $Model, $CoreModel, name) {
$scope.location[name] = $Position;
var index = $filter('getByName')($scope.dropOffs, name),
$WayPoint = {
name: name,
location: $Position
},
$PointInfo = ang.copy($WayPoint),
$InsertedEle = 0;
if(index == -1) {
$InsertedEle = $scope.dropOffs.push($PointInfo);
} else {
$scope.dropOffs[index] = $PointInfo;
}
$scope.waypoints = $scope.getWaypoints();
$scope.setLocation();
};
$scope.getWaypoints = function() {
var $List = [];
ang.forEach($scope.dropOffs, function(value, key) {
var isNameMatched = ( $scope.dropOffs[key]['name'] == $scope.currentDestination );
if (!isNameMatched) {
var $Data = ang.copy($scope.dropOffs[key]);
delete $Data['name'];
$List.push($Data);
} else {
// Update on existed one
$scope.dropOffs[key]['location'] = $scope.location[$scope.currentDestination];
}
});
return $List;
};
$scope.setCurrentDestination = function(name) {
if (!name) return;
$scope.currentDestination = name;
$scope.waypoints = $scope.getWaypoints();
console.log($scope);
console.log($scope.waypoints);
$scope.setLocation();
};
$scope.setLocation = function($Position, $Model, $CoreModel) {

@@ -99,2 +153,5 @@

console.log($scope);
console.log(reversedWaypoints);
ang.forEach($scope.dropOffs, function(value, key) {

@@ -110,3 +167,3 @@

if (isNameEqual) {
console.log("Yes, Gotcha");
//console.log("Yes, Gotcha");
$scope.dropOffs[key+1]['location'] = reversedWaypoints[key]['end_location'];

@@ -116,4 +173,4 @@ name = $scope.dropOffs[key+1]['name'];

} else {
console.log("Not Yet");
console.log($scope.dropOffs[key]);
//console.log("Not Yet");
//console.log($scope.dropOffs[key]);
$scope.dropOffs[key]['location'] = reversedWaypoints[key]['end_location'];

@@ -133,5 +190,2 @@ name = $scope.dropOffs[key]['name'];

console.log($scope.dropOffs);
console.log($WayPoints);
};

@@ -157,41 +211,3 @@

function manageDropOffs($filter) {
var $scope = this;
$scope.setDropoff = function($Position, $Model, $CoreModel, name) {
$scope.location[name] = $Position;
var index = $filter('getByName')($scope.dropOffs, name),
$WayPoint = {
name: name,
location: $Position
},
$PointInfo = ang.copy($WayPoint),
$InsertedEle = 0;
if(index == -1) {
$InsertedEle = $scope.dropOffs.push($PointInfo);
} else {
$scope.dropOffs[index] = $PointInfo;
}
$scope.waypoints = reShapeWaypoints($scope.dropOffs);
var currentIndex = (index != -1) ? index : ($InsertedEle == 0) ? 0 : ($InsertedEle - 1);
console.log("currentIndex = " + currentIndex);
console.log($scope);
if ($scope.dropOffs[currentIndex]['name'] == $scope.currentDestination) {
$scope.waypoints.splice(currentIndex, 1);
}
$scope.setLocation();
};
}
}(angular));
{
"name": "ang-google-maps",
"version": "1.0.8",
"version": "1.0.9",
"description": "Module to initialize Google Maps API",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -7,4 +7,6 @@ # ang-google-maps

2. Trigger custom callback on changing directions event.
3. Support for multiple waypoints on the map.
4. Auto center on the map by detecting the Geolocation.
### Screenshots
![alt tag](https://raw.githubusercontent.com/khalednobani/ang-google-maps/master/assets/img/1.%20Demo.png)

@@ -210,2 +210,6 @@ (function(ang, g) {

element[0].appendChild($scope.mapContainer);
// Define Methods
$scope.renderWithGeolocation = renderWithGeolocation;
$scope.renderWithDefault = renderWithDefault;

@@ -234,13 +238,9 @@ initMap.call($scope, element);

}
/**
* Initializes Google map into map's content.
*
*/
function initMap(element) {
function initMapModel() {
this.$parent.map = this.map = new g.maps.Map(this.mapContainer, this.mapOptions);
this.mapOptions['disableDefaultUI'] = true;
this.$parent.map = this.map = new g.maps.Map(this.mapContainer, this.mapOptions);
this.map.markers = [];

@@ -265,3 +265,39 @@ this.map.id = this.configs.id;

attachMapEvents.call(this);
}
function renderWithGeolocation($Position) {
this.map.setCenter({
lat: $Position.coords.latitude,
lng: $Position.coords.longitude
});
}
function renderWithDefault($Error) {
this.map.setCenter({
lat: 13.736717 ,
lng: 100.523186
});
}
/**
* Initializes Google map into map's content.
*
*/
function initMap(element) {
var $Obj = this;
if ('geolocation' in navigator) {
navigator.geolocation.getCurrentPosition(function($Position) {
$Obj.renderWithGeolocation($Position);
}, function($Error) {
$Obj.renderWithDefault($Error);
});
}
initMapModel.call($Obj);
}

@@ -375,5 +411,3 @@

$Position = { lat: parseFloat(lat), lng: parseFloat(lng) };
console.log($Self.model);
$Self.map.setCenter($Position);

@@ -380,0 +414,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc