Comments (3)
Hi, thanks for your awesome editor. I've made some changes to make it supports zoom.
Below are changes I made:
on "GMaps.controller.js"
I added an event:
function addZoomChangedListender() {
google.maps.event.addListener(map, 'zoom_changed', function () {
var newLocation = marker.getPosition();
map.setCenter(newLocation);
lookupPosition(newLocation);
});
}
and this event is registered in initializeMap(), just after line "addPlaceChangedListener();"
addPlaceChangedListener();
addZoomChangedListender();
then in "lookupPosition" method, append the zoom value to model value:
var newLng = marker.getPosition().lng();
var newLat = marker.getPosition().lat();
var zoom = map.getZoom();
$scope.model.value = newLat + "," + newLng + "," + zoom;
and then in showing map: initializeMap() method, set the zoom into options:
var zoom = defaultZoomLvl;
if(location != ''){
var latLngArray = location.split(',');
mapCenter = new google.maps.LatLng(latLngArray[0], latLngArray[1]);
if (latLngArray.length >= 3)
zoom = parseFloat(latLngArray[2]);
}
else {
mapCenter = new google.maps.LatLng(defaultLat, defaultLng);
}
var mapElement = document.getElementById($scope.model.alias + '_map');
var mapOptions = { zoom: zoom, center: mapCenter, mapTypeId: google.maps.MapTypeId.ROADMAP };
on "GMapsLocation.cs", add zoom property:
public struct GMapsLocation
{
public decimal Lat { get; set; }
public decimal Lng { get; set; }
public decimal Zoom { get; set; }
}
and on "GMapsValueConverter.cs", set the zoom value to GMapsLocation:
var loc = new GMapsLocation
{
Lat = decimal.Parse(coordinates[0]),
Lng = decimal.Parse(coordinates[1]),
Zoom = 15m
};
if (coordinates.Length > 2)
{
loc.Zoom = decimal.Parse(coordinates[2]);
}
return loc;
from umbraco-v7-property-editors-gmaps.
Hope that helps.
from umbraco-v7-property-editors-gmaps.
Please submit pull request
from umbraco-v7-property-editors-gmaps.
Related Issues (15)
- Wish: Make it possible to define default initial starting point HOT 4
- Decimal parse localization issue
- Looking up an address confirms with 'undefined:'
- 2 maps one document type - errors HOT 1
- unauthenticated javascript reference when using https
- NuGet package HOT 3
- Location suggest box is not visible when used in a panel HOT 1
- Doesn't work in Nested Content / Archetype
- Reset map position to "default" HOT 1
- Cannot Action Place Lookup HOT 3
- The parsing of the coordinates should use the InvariantCulture HOT 1
- Better localization HOT 2
- Resize bug HOT 1
- Load resources over protocol relative uri's HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from umbraco-v7-property-editors-gmaps.