Remove layer control, cleanup map scope and fix updating issue.
This commit is contained in:
parent
cc0fadb7cd
commit
67767f915e
|
@ -18,7 +18,7 @@ angular.module('ffffng')
|
||||||
var monitoringConfirmed = $scope.node.monitoringConfirmed;
|
var monitoringConfirmed = $scope.node.monitoringConfirmed;
|
||||||
|
|
||||||
$scope.config = config;
|
$scope.config = config;
|
||||||
angular.extend($scope, {
|
$scope.map = {
|
||||||
center: {
|
center: {
|
||||||
lat: config.coordsSelector.lat,
|
lat: config.coordsSelector.lat,
|
||||||
lng: config.coordsSelector.lng,
|
lng: config.coordsSelector.lng,
|
||||||
|
@ -41,10 +41,10 @@ angular.module('ffffng')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
if (config.otherCommunityInfo.showBorderForDebugging) {
|
if (config.otherCommunityInfo.showBorderForDebugging) {
|
||||||
$scope.paths = {
|
$scope.map.paths = {
|
||||||
border: {
|
border: {
|
||||||
color: '#ff0000',
|
color: '#ff0000',
|
||||||
weight: 3,
|
weight: 3,
|
||||||
|
@ -67,7 +67,7 @@ angular.module('ffffng')
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateNodePosition = function (lat, lng) {
|
var updateNodePosition = function (lat, lng) {
|
||||||
$scope.markers.node = {
|
$scope.map.markers.node = {
|
||||||
lat: lat,
|
lat: lat,
|
||||||
lng: lng,
|
lng: lng,
|
||||||
focus: true,
|
focus: true,
|
||||||
|
@ -104,7 +104,7 @@ angular.module('ffffng')
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.updateMap = function (optCoords) {
|
$scope.updateMap = function (optCoords) {
|
||||||
var coords = optCoords || $scope.coords;
|
var coords = optCoords || $scope.node.coords;
|
||||||
withValidCoords(coords, function (lat, lng) {
|
withValidCoords(coords, function (lat, lng) {
|
||||||
updateNodePosition(lat, lng);
|
updateNodePosition(lat, lng);
|
||||||
});
|
});
|
||||||
|
@ -112,7 +112,7 @@ angular.module('ffffng')
|
||||||
|
|
||||||
$scope.resetCoords = function () {
|
$scope.resetCoords = function () {
|
||||||
$scope.node.coords = '';
|
$scope.node.coords = '';
|
||||||
$scope.markers = {};
|
$scope.map.markers = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.constraints = Constraints.node;
|
$scope.constraints = Constraints.node;
|
||||||
|
|
|
@ -122,6 +122,10 @@ f-node-form {
|
||||||
padding-bottom: 66%;
|
padding-bottom: 66%;
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
|
|
||||||
|
.leaflet-control-layers.leaflet-control {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.buttons {
|
.buttons {
|
||||||
|
|
|
@ -42,14 +42,28 @@
|
||||||
an die Stelle, wo Dein Knoten erscheinen soll. Durch erneutes Klicken kannst Du die Position jederzeit
|
an die Stelle, wo Dein Knoten erscheinen soll. Durch erneutes Klicken kannst Du die Position jederzeit
|
||||||
anpassen.
|
anpassen.
|
||||||
</p>
|
</p>
|
||||||
<input type="text" id="coords" name="coords" class="{{node.coords ? 'has-coords' : ''}}" placeholder="z. B. {{config.coordsSelector.lat}} {{config.coordsSelector.lng}}" ng-model="node.coords" ng-pattern="constraints.coords.regex" ng-required="!constraints.coords.optional" ng-blur="updateMap" />
|
<input
|
||||||
|
type="text"
|
||||||
|
id="coords"
|
||||||
|
name="coords"
|
||||||
|
class="{{node.coords ? 'has-coords' : ''}}"
|
||||||
|
placeholder="z. B. {{config.coordsSelector.lat}} {{config.coordsSelector.lng}}"
|
||||||
|
ng-model="node.coords"
|
||||||
|
ng-pattern="constraints.coords.regex"
|
||||||
|
ng-required="!constraints.coords.optional"
|
||||||
|
ng-change="updateMap()" />
|
||||||
<i class="reset-coords" ng-if="node.coords" ng-click="resetCoords()"></i>
|
<i class="reset-coords" ng-if="node.coords" ng-click="resetCoords()"></i>
|
||||||
<span class="feedback" ng-if="hasError('coords')">
|
<span class="feedback" ng-if="hasError('coords')">
|
||||||
Bitte gib die Koordinaten wie folgt an, Beispiel: {{config.coordsSelector.lat}} {{config.coordsSelector.lng}}
|
Bitte gib die Koordinaten wie folgt an, Beispiel: {{config.coordsSelector.lat}} {{config.coordsSelector.lng}}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<leaflet class="map" center="center" layers="layers" markers="markers" paths="paths"></leaflet>
|
<leaflet
|
||||||
|
class="map"
|
||||||
|
center="map.center"
|
||||||
|
layers="map.layers"
|
||||||
|
markers="map.markers"
|
||||||
|
paths="map.paths"></leaflet>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue