Commit df0e6ba68bad1eb5dd760b297ad02440bc3ccb29
1 parent
176b1cb453
Exists in
master
Centrar ventana de puntos de descarga
Showing
1 changed file
with
6 additions
and
4 deletions
Show diff stats
src/js/osm-directive.js
| ... | ... | @@ -5,7 +5,7 @@ angular.module('focaModalPuntoDescarga').directive('osmPuntoDescarga', function( |
| 5 | 5 | var contenedor = document.createElement('div'); |
| 6 | 6 | contenedor.className = 'w-100 h-50 mt-3'; |
| 7 | 7 | el.append(contenedor); |
| 8 | - scope.map = L.map(contenedor).setView([-32.89214159952345, -68.84572999101856], attrs.zoom); | |
| 8 | + scope.map = L.map(contenedor); | |
| 9 | 9 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(scope.map); |
| 10 | 10 | }, |
| 11 | 11 | controller: ['$scope', '$timeout', function($scope, $timeout) { |
| ... | ... | @@ -19,8 +19,9 @@ angular.module('focaModalPuntoDescarga').directive('osmPuntoDescarga', function( |
| 19 | 19 | for(var i in $scope.markers) { |
| 20 | 20 | $scope.map.removeLayer($scope.markers[i]); |
| 21 | 21 | } |
| 22 | + $scope.map.setView([$scope.latitud, $scope.longitud], 14); | |
| 22 | 23 | $scope.markers.push( |
| 23 | - L.marker([$scope.latitud, $scope.longitud], {draggable: $scope.draggable}) | |
| 24 | + L.marker([$scope.latitud, $scope.longitud], {draggable: true}) | |
| 24 | 25 | .addTo($scope.map) |
| 25 | 26 | .on('dragend', function() { |
| 26 | 27 | $scope.latitud = this.getLatLng().lat; |
| ... | ... | @@ -28,13 +29,14 @@ angular.module('focaModalPuntoDescarga').directive('osmPuntoDescarga', function( |
| 28 | 29 | $scope.$apply(); |
| 29 | 30 | }) |
| 30 | 31 | ); |
| 32 | + | |
| 31 | 33 | }); |
| 32 | 34 | }], |
| 35 | + | |
| 33 | 36 | scope: { |
| 34 | 37 | latitud: '=', |
| 35 | 38 | longitud: '=', |
| 36 | - zoom: '=', | |
| 37 | - draggable: '<' | |
| 39 | + zoom: '=' | |
| 38 | 40 | } |
| 39 | 41 | }; |
| 40 | 42 | }); |