forked from 0x2620/oxjs
migrate to maplibre-gl for maps
This commit is contained in:
parent
f3b8025e8e
commit
8cebad9fb4
7 changed files with 605 additions and 234 deletions
|
|
@ -23,6 +23,7 @@ Ox.MapRectangleMarker = function(options) {
|
|||
that[key] = val;
|
||||
});
|
||||
|
||||
/*
|
||||
that.markerImage = new google.maps.MarkerImage
|
||||
that.marker = new google.maps.Marker({
|
||||
cursor: that.position + '-resize',
|
||||
|
|
@ -35,20 +36,30 @@ Ox.MapRectangleMarker = function(options) {
|
|||
position: that.place.points[that.position],
|
||||
raiseOnDrag: false
|
||||
});
|
||||
*/
|
||||
that.marker = new maplibregl.Marker({
|
||||
cursor: that.position + '-resize',
|
||||
draggable: true,
|
||||
element: Ox.MapMarkerImage({
|
||||
mode: 'editing',
|
||||
rectangle: true,
|
||||
type: that.place.id[0] == '_' ? 'result' : 'place'
|
||||
}),
|
||||
});
|
||||
|
||||
function dragstart(e) {
|
||||
Ox.$body.addClass('OxDragging');
|
||||
that.drag = {
|
||||
lat: e.latLng.lat(),
|
||||
lng: e.latLng.lng()
|
||||
lat: e.lngLat.lat,
|
||||
lng: e.lngLat.lng
|
||||
};
|
||||
}
|
||||
|
||||
function drag(e) {
|
||||
// fixme: implement shift+drag (center stays the same)
|
||||
Ox.Log('Map', e.pixel.x, e.pixel.y)
|
||||
var lat = Ox.limit(e.latLng.lat(), Ox.MIN_LATITUDE, Ox.MAX_LATITUDE),
|
||||
lng = e.latLng.lng();
|
||||
var lat = Ox.limit(e.lngLat.lat, Ox.MIN_LATITUDE, Ox.MAX_LATITUDE),
|
||||
lng = e.lngLat.lng;
|
||||
that.drag = {
|
||||
lat: lat,
|
||||
lng: lng
|
||||
|
|
@ -100,7 +111,7 @@ Ox.MapRectangleMarker = function(options) {
|
|||
remove <f> remove
|
||||
@*/
|
||||
that.remove = function() {
|
||||
that.marker.setMap(null);
|
||||
that.marker.remove();
|
||||
google.maps.event.clearListeners(that.marker);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue