diff --git a/Our.Umbraco.GMaps.Core/Our.Umbraco.GMaps.Core.csproj b/Our.Umbraco.GMaps.Core/Our.Umbraco.GMaps.Core.csproj index 42611c0..5782a29 100644 --- a/Our.Umbraco.GMaps.Core/Our.Umbraco.GMaps.Core.csproj +++ b/Our.Umbraco.GMaps.Core/Our.Umbraco.GMaps.Core.csproj @@ -3,7 +3,7 @@ net5.0;net472 True - 2.0.3-pre003 + 2.0.3 Arnold Visser Arnold Visser Basic Google Maps with autocomplete property editor for Umbraco 8+. This package contains the Core DLL only. diff --git a/Our.Umbraco.GMaps/App_Plugins/Our.Umbraco.GMaps/css/maps.css b/Our.Umbraco.GMaps/App_Plugins/Our.Umbraco.GMaps/css/maps.css index 709a522..0a3f852 100644 --- a/Our.Umbraco.GMaps/App_Plugins/Our.Umbraco.GMaps/css/maps.css +++ b/Our.Umbraco.GMaps/App_Plugins/Our.Umbraco.GMaps/css/maps.css @@ -1,12 +1,24 @@ -.our-coremaps { +.our-coremaps { position: relative; max-width: 800px; } .our-coremaps__area { - margin-bottom: 20px; + margin-bottom: 1em; +} + +.our-coremaps__coordinates { + padding: 0.5em; + /* background-color: #f6f4f4; */ + font-size: .8em; } + .our-coremaps__coordinates span { + min-width: 5em; + font-weight: 600; + display: inline-block; + } + .our-coremaps--loading .our-coremaps__canvas::after { content: ''; top: 0; @@ -19,7 +31,7 @@ .our-coremaps__canvas { position: relative; - height: 500px; + height: 400px; width: 100%; margin-bottom: 20px; } diff --git a/Our.Umbraco.GMaps/App_Plugins/Our.Umbraco.GMaps/js/maps.controller.js b/Our.Umbraco.GMaps/App_Plugins/Our.Umbraco.GMaps/js/maps.controller.js index d8b2f83..c9d042d 100644 --- a/Our.Umbraco.GMaps/App_Plugins/Our.Umbraco.GMaps/js/maps.controller.js +++ b/Our.Umbraco.GMaps/App_Plugins/Our.Umbraco.GMaps/js/maps.controller.js @@ -10,8 +10,8 @@ angular.module('umbraco').controller('GMapsMapsController', ['$scope', '$element vm.map = null vm.mapType = 'roadmap' vm.mapStyle = {} - vm.mapCenter = '' - vm.address = {} + $scope.mapCenter = '' + $scope.address = {} vm.mapconfig = {} vm.marker = null @@ -158,17 +158,17 @@ angular.module('umbraco').controller('GMapsMapsController', ['$scope', '$element function updateMarkerAddress (address, coordinates) { actClearLocation.isDisabled = false - vm.address = {} + $scope.address = {} if (address !== null && (!address.types || address.types.indexOf('plus_code') < 0)) { const composedAddress = getAddressObject(address.address_components) - vm.address = { ...composedAddress, ...{ full_address: address.formatted_address } } + $scope.address = { ...composedAddress, ...{ full_address: address.formatted_address } } } - vm.address.coordinates = { lat: coordinates.lat(), lng: coordinates.lng() } + $scope.address.coordinates = { lat: coordinates.lat(), lng: coordinates.lng() } - if (vm.address.full_address) { - $scope.searchedValue = vm.address.full_address + if ($scope.address.full_address) { + $scope.searchedValue = $scope.address.full_address } else { - $scope.searchedValue = formatCoordinates(vm.address.coordinates) + $scope.searchedValue = formatCoordinates($scope.address.coordinates) } saveData() @@ -177,7 +177,7 @@ angular.module('umbraco').controller('GMapsMapsController', ['$scope', '$element function clearData() { $scope.model.value = {} $scope.searchedValue = '' - vm.address = {} + $scope.address = {} } function saveData() { @@ -188,19 +188,19 @@ angular.module('umbraco').controller('GMapsMapsController', ['$scope', '$element vm.mapconfig.zoom = vm.zoomLevel vm.mapconfig.maptype = vm.mapType - if (vm.mapCenter) { - vm.mapconfig.centerCoordinates = vm.mapCenter + if ($scope.mapCenter) { + vm.mapconfig.centerCoordinates = $scope.mapCenter } $scope.model.value = { - address: vm.address, + address: $scope.address, mapconfig: vm.mapconfig } } function initMapMarker(coordinates) { if (!coordinates) { - coordinates = vm.address.coordinates + coordinates = $scope.address.coordinates } var latLng = new google.maps.LatLng(parseFloat(coordinates.lat), parseFloat(coordinates.lng)) @@ -279,7 +279,7 @@ angular.module('umbraco').controller('GMapsMapsController', ['$scope', '$element google.maps.event.addListener(vm.map, 'center_changed', function () { var mapCenter = vm.map.getCenter() - vm.mapCenter = { lat: mapCenter.lat(), lng: mapCenter.lng() } + $scope.mapCenter = { lat: mapCenter.lat(), lng: mapCenter.lng() } saveData() }) @@ -296,9 +296,9 @@ angular.module('umbraco').controller('GMapsMapsController', ['$scope', '$element // User entered the name of a Place that was not suggested and pressed the Enter key, or the Place Details request failed. var coordTest = parseCoordinates(vm.searchedValue, false) if (coordTest) { - vm.address.coordinates = coordTest + $scope.address.coordinates = coordTest } - initMapMarker(vm.address.coordinates) + initMapMarker($scope.address.coordinates) return } @@ -337,7 +337,7 @@ angular.module('umbraco').controller('GMapsMapsController', ['$scope', '$element } } - vm.address.coordinates = vm.defaultLocation + $scope.address.coordinates = vm.defaultLocation // if there is a value on the model set this to the editor if ($scope.model.value) { @@ -345,28 +345,28 @@ angular.module('umbraco').controller('GMapsMapsController', ['$scope', '$element if ($scope.model.value.address) { actClearLocation.isDisabled = false - vm.address.full_address = $scope.model.value.address.full_address - vm.address.streetNumber = $scope.model.value.address.streetNumber - vm.address.street = $scope.model.value.address.street - vm.address.city = $scope.model.value.address.city - vm.address.state = $scope.model.value.address.state - vm.address.postalcode = $scope.model.value.address.postalcode - vm.address.country = $scope.model.value.address.country + $scope.address.full_address = $scope.model.value.address.full_address + $scope.address.streetNumber = $scope.model.value.address.streetNumber + $scope.address.street = $scope.model.value.address.street + $scope.address.city = $scope.model.value.address.city + $scope.address.state = $scope.model.value.address.state + $scope.address.postalcode = $scope.model.value.address.postalcode + $scope.address.country = $scope.model.value.address.country var enableSearchedCoordinates = false if ($scope.model.value.address.coordinates) { - vm.address.coordinates = $scope.model.value.address.coordinates + $scope.address.coordinates = $scope.model.value.address.coordinates enableSearchedCoordinates = true } else if (vm.model.value.address.latlng) { // Fall back to legacy field. - vm.address.coordinates = parseCoordinates($scope.model.value.address.latlng) + $scope.address.coordinates = parseCoordinates($scope.model.value.address.latlng) enableSearchedCoordinates = true } - if (vm.address.full_address) { - $scope.searchedValue = vm.address.full_address + if ($scope.address.full_address) { + $scope.searchedValue = $scope.address.full_address } else if (enableSearchedCoordinates) { - $scope.searchedValue = formatCoordinates(vm.address.coordinates) + $scope.searchedValue = formatCoordinates($scope.address.coordinates) } } @@ -381,10 +381,10 @@ angular.module('umbraco').controller('GMapsMapsController', ['$scope', '$element } if ($scope.model.value.mapconfig.centerCoordinates) { - vm.mapCenter = $scope.model.value.mapconfig.centerCoordinates + $scope.mapCenter = $scope.model.value.mapconfig.centerCoordinates } else if ($scope.model.value.mapconfig.mapcenter) { // Fallback to legacy property - vm.mapCenter = parseCoordinates($scope.model.value.mapconfig.mapcenter) + $scope.mapCenter = parseCoordinates($scope.model.value.mapconfig.mapcenter) } } } @@ -393,7 +393,7 @@ angular.module('umbraco').controller('GMapsMapsController', ['$scope', '$element if (vm.apiKey !== '') { mapsFactory.initialize(vm.apiKey).then(function () { // Resolved - initMapMarker(vm.address.coordinates) + initMapMarker($scope.address.coordinates) $scope.showLoader = false }) } diff --git a/Our.Umbraco.GMaps/App_Plugins/Our.Umbraco.GMaps/views/maps.editor.html b/Our.Umbraco.GMaps/App_Plugins/Our.Umbraco.GMaps/views/maps.editor.html index 26e7a62..ac40950 100644 --- a/Our.Umbraco.GMaps/App_Plugins/Our.Umbraco.GMaps/views/maps.editor.html +++ b/Our.Umbraco.GMaps/App_Plugins/Our.Umbraco.GMaps/views/maps.editor.html @@ -2,6 +2,11 @@
+ +
+ Pin: {{address.coordinates.lat}},{{address.coordinates.lng}}
+ Center: {{mapCenter.lat}},{{mapCenter.lng}} +
diff --git a/Our.Umbraco.GMaps/Our.Umbraco.GMaps.csproj b/Our.Umbraco.GMaps/Our.Umbraco.GMaps.csproj index d616fae..8bb4029 100644 --- a/Our.Umbraco.GMaps/Our.Umbraco.GMaps.csproj +++ b/Our.Umbraco.GMaps/Our.Umbraco.GMaps.csproj @@ -6,7 +6,7 @@ false true - 2.0.3-pre003 + 2.0.3 Arnold Visser Arnold Visser Basic Google Maps with autocomplete property editor for Umbraco 8+