Compare commits

..

No commits in common. "529277eb12fa2d6eb5e9a0e32d717f379490bd56" and "e274d88c2b36dbd89829fa34b21b58687a2f4f57" have entirely different histories.

2 changed files with 18 additions and 20 deletions

View file

@ -1800,7 +1800,6 @@ Maps
.OxMap .OxLabel.OxMapControl.OxMapScale { .OxMap .OxLabel.OxMapControl.OxMapScale {
right: 4px; right: 4px;
bottom: 19px; bottom: 19px;
line-height: 1;
} }
.OxMap .OxPlaceControl.OxPlaceFlag { .OxMap .OxPlaceControl.OxPlaceFlag {

View file

@ -719,6 +719,10 @@ Ox.Map = function(options, self) {
- self.options.showZoombar * 16; - self.options.showZoombar * 16;
} }
function getMapType() {
return self.options.showLabels ? 'HYBRID' : 'SATELLITE'
}
function getMaxZoom(point, callback) { function getMaxZoom(point, callback) {
if (arguments.length == 1) { if (arguments.length == 1) {
callback = point; callback = point;
@ -941,8 +945,11 @@ Ox.Map = function(options, self) {
self.center = mapBounds ? mapBounds.getCenter() : new maplibregl.LngLat(0, 0); self.center = mapBounds ? mapBounds.getCenter() : new maplibregl.LngLat(0, 0);
self.zoom = self.minZoom; self.zoom = self.minZoom;
window.map = that.map = self.map = new maplibregl.Map({
self.sateliteStyle = { container: self.$map[0],
center: self.center,
style2: self.options.style,
style: {
'version': 8, 'version': 8,
'sources': { 'sources': {
'raster-tiles': { 'raster-tiles': {
@ -956,7 +963,7 @@ Ox.Map = function(options, self) {
'tileSize': 256, 'tileSize': 256,
'attribution': 'attribution':
'FIXME', 'FIXME',
}, }
}, },
'layers': [ 'layers': [
{ {
@ -966,13 +973,10 @@ Ox.Map = function(options, self) {
'roundZoom': true, 'roundZoom': true,
'minzoom': 0, 'minzoom': 0,
'maxzoom': 22 'maxzoom': 22
}, }
] ]
}; },
window.map = that.map = self.map = new maplibregl.Map({ //mapTypeId: google.maps.MapTypeId[getMapType()],
container: self.$map[0],
center: self.center,
style: self.options.showLabels ? self.options.style : self.sateliteStyle,
//noClear: true, //noClear: true,
//scrollwheel: !self.options.zoomOnlyWhenFocused, //scrollwheel: !self.options.zoomOnlyWhenFocused,
zoom: self.zoom zoom: self.zoom
@ -1149,8 +1153,7 @@ Ox.Map = function(options, self) {
} }
function pan(x, y) { function pan(x, y) {
console.log(x, y, self.$map.width()) self.map.panBy(x * self.$map.width() / 2, y * self.$map.height() / 2);
self.map.panBy([x * self.$map.width() / 2, y * self.$map.height() / 2]);
}; };
function panToPlace() { function panToPlace() {
@ -1217,19 +1220,15 @@ Ox.Map = function(options, self) {
} }
function getType(types, data) { function getType(types, data) {
// see https://developers.google.com/maps/documentation/javascript/geocoding#GeocodingAddressTypes // see https://developers.google.com/maps/documentation/javascript/geocoding#GeocodingAddressTypes
types.unshift(data.properties.addresstype) types.push(data.properties.addresstype)
console.log(types)
var strings = { var strings = {
'country': ['country'], 'country': ['country'],
'region': [ 'region': [
'administrative_area', 'colloquial_area', 'administrative_area', 'colloquial_area',
'state', 'county', 'region' 'state', 'county'
],
'city': [
'locality', 'city', 'town'
], ],
'city': ['locality', 'city'],
'borough': ['neighborhood', 'postal_code', 'sublocality', 'suburb', 'borough'], 'borough': ['neighborhood', 'postal_code', 'sublocality', 'suburb', 'borough'],
'street': [ 'street': [
'intersection', 'route', 'intersection', 'route',
@ -1490,7 +1489,7 @@ Ox.Map = function(options, self) {
function toggleLabels() { function toggleLabels() {
self.options.showLabels = !self.options.showLabels; self.options.showLabels = !self.options.showLabels;
self.map.setStyle(self.options.showLabels ? self.options.style : self.sateliteStyle) self.map.setMapTypeId(google.maps.MapTypeId[getMapType()]);
that.triggerEvent('togglelabels', { that.triggerEvent('togglelabels', {
visible: self.options.showLabels visible: self.options.showLabels
}); });