marker size

This commit is contained in:
j 2025-08-06 19:29:16 +02:00
commit 6a59ff5193

View file

@ -43,12 +43,12 @@ Ox.MapMarker = function(options) {
that[key] = val;
});
setColor()
setSize()
const element = document.createElement('div')
element.style.border = '2px solid black'
element.style.borderRadius = '50px'
element.style.backgroundColor = '#' + Ox.toHex(that.color)
element.style.width = '16px'
element.style.height = '16px'
element.style.width = element.style.height = that.size + 'px'
that.marker = new maplibregl.Marker({
raiseOnDrag: false,
shape: {coords: [8, 8, 8], type: 'circle'},
@ -229,13 +229,8 @@ Ox.MapMarker = function(options) {
}
}
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()
function setSize() {
var size = that.map.options('markerSize');
if (size == 'auto') {
that.size = 8;
Ox.forEach(areaSize, function(size, area) {
@ -250,6 +245,16 @@ Ox.MapMarker = function(options) {
} else {
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
that.marker.setOptions({
// fixme: cursor remains pointer
@ -266,6 +271,7 @@ Ox.MapMarker = function(options) {
*/
//that.marker._color = that.color;
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.setLngLat(that.place.center);
if (fix) {