Compare commits

...

2 commits

Author SHA1 Message Date
j
8dbfcc0ece fix raster subdomains 2025-08-06 19:30:08 +02:00
j
6a59ff5193 marker size 2025-08-06 19:29:16 +02:00
2 changed files with 20 additions and 14 deletions

View file

@ -935,12 +935,11 @@ Ox.Map = function(options, self) {
'raster-tiles': { 'raster-tiles': {
'type': 'raster', 'type': 'raster',
'tiles': [ 'tiles': [
// FIXME: use protocol and make use of all subdomains 'https://mt0.google.com/vt/lyrs=s&x={x}&y={y}&z={z}',
//'https://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}' 'https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}',
'https://mt0.google.com/vt/lyrs=s&x={x}&y={y}&z={z}' 'https://mt2.google.com/vt/lyrs=s&x={x}&y={y}&z={z}',
'https://mt3.google.com/vt/lyrs=s&x={x}&y={y}&z={z}',
], ],
'subdomains':['mt0','mt1','mt2','mt3'],
'tileSize': 256, 'tileSize': 256,
'attribution': 'attribution':
'FIXME', 'FIXME',
@ -951,6 +950,7 @@ Ox.Map = function(options, self) {
'id': 'simple-tiles', 'id': 'simple-tiles',
'type': 'raster', 'type': 'raster',
'source': 'raster-tiles', 'source': 'raster-tiles',
'roundZoom': true,
'minzoom': 0, 'minzoom': 0,
'maxzoom': 22 'maxzoom': 22
} }

View file

@ -43,12 +43,12 @@ Ox.MapMarker = function(options) {
that[key] = val; that[key] = val;
}); });
setColor() setColor()
setSize()
const element = document.createElement('div') const element = document.createElement('div')
element.style.border = '2px solid black' element.style.border = '2px solid black'
element.style.borderRadius = '50px' element.style.borderRadius = '50px'
element.style.backgroundColor = '#' + Ox.toHex(that.color) element.style.backgroundColor = '#' + Ox.toHex(that.color)
element.style.width = '16px' element.style.width = element.style.height = that.size + 'px'
element.style.height = '16px'
that.marker = new maplibregl.Marker({ that.marker = new maplibregl.Marker({
raiseOnDrag: false, raiseOnDrag: false,
shape: {coords: [8, 8, 8], type: 'circle'}, shape: {coords: [8, 8, 8], type: 'circle'},
@ -229,13 +229,8 @@ Ox.MapMarker = function(options) {
} }
} }
function setOptions() { function setSize() {
// workaround to prevent marker from appearing twice var size = that.map.options('markerSize');
// after setting draggable from true to false (google maps bug)
var fix = false, // that.marker.getDraggable() && !that.place.editing,
size = that.map.options('markerSize');
//Ox.Log('Map', 'setOptions, that.map: ', that.map)
setColor()
if (size == 'auto') { if (size == 'auto') {
that.size = 8; that.size = 8;
Ox.forEach(areaSize, function(size, area) { Ox.forEach(areaSize, function(size, area) {
@ -250,6 +245,16 @@ Ox.MapMarker = function(options) {
} else { } else {
that.size = size(that.place); that.size = size(that.place);
} }
}
function setOptions() {
// workaround to prevent marker from appearing twice
// after setting draggable from true to false (google maps bug)
var fix = false, // that.marker.getDraggable() && !that.place.editing,
size = that.map.options('markerSize');
//Ox.Log('Map', 'setOptions, that.map: ', that.map)
setColor()
setSize()
/* fixme, some of those can be set some not /* fixme, some of those can be set some not
that.marker.setOptions({ that.marker.setOptions({
// fixme: cursor remains pointer // fixme: cursor remains pointer
@ -266,6 +271,7 @@ Ox.MapMarker = function(options) {
*/ */
//that.marker._color = that.color; //that.marker._color = that.color;
that.marker._element.style.cursor = that.place.editing ? 'move' : 'pointer'; that.marker._element.style.cursor = that.place.editing ? 'move' : 'pointer';
that.marker._element.height = that.marker._element.width = that.size + 'px'
that.marker.setDraggable(that.place.editing); that.marker.setDraggable(that.place.editing);
that.marker.setLngLat(that.place.center); that.marker.setLngLat(that.place.center);
if (fix) { if (fix) {