Add support for 8x8 and 32x32 marker icons (default still 16x16)

This commit is contained in:
Mike Primm 2011-12-01 15:19:40 +08:00 committed by mikeprimm
parent 52a09d41b4
commit 348a37af87
4 changed files with 76 additions and 7 deletions

View file

@ -779,8 +779,6 @@
.dynmap .mapMarker .markerName-show {
display: block;
position: absolute;
top: -8px;
left: 10px;
z-index: 16;
white-space: nowrap;
@ -791,12 +789,42 @@
-moz-border-radius: 3px;
border-radius: 3px;
}
.dynmap .mapMarker .markerName16x16 {
top: -6px;
left: 10px;
}
.dynmap .mapMarker .markerName8x8 {
top: -4px;
left: 6px;
}
.dynmap .mapMarker .markerName32x32 {
top: -8px;
left: 18px;
}
.dynmap .mapMarker .markerIcon16x16 {
margin-top: -8px;
margin-left: -8px;
width: 16px;
height: 16px;
}
.dynmap .mapMarker .markerIcon8x8 {
margin-top: -4px;
margin-left: -4px;
width: 8px;
height: 8px;
}
.dynmap .mapMarker .markerIcon32x32 {
margin-top: -16px;
margin-left: -16px;
width: 32px;
height: 32px;
}
.dynmap .mapMarker .markerName_offline_players {

View file

@ -42,7 +42,7 @@ componentconstructors['markers'] = function(dynmap, configuration) {
dynmapmarkersets[name] = ms;
$.each(markerset.markers, function(mname, marker) {
ms.markers[mname] = { label: marker.label, markup: marker.markup, x: marker.x, y: marker.y, z:marker.z,
icon: marker.icon, desc: marker.desc };
icon: marker.icon, desc: marker.desc, dim: marker.dim };
createMarker(ms, ms.markers[mname], ts);
});
$.each(markerset.areas, function(aname, area) {
@ -70,17 +70,19 @@ componentconstructors['markers'] = function(dynmap, configuration) {
$(div)
.addClass('Marker')
.addClass('mapMarker')
.append($('<img/>').addClass('markerIcon16x16').attr({ src: dynmap.options.tileUrl+'_markers_/'+marker.icon+'.png' }));
.append($('<img/>').addClass('markerIcon'+marker.dim).attr({ src: dynmap.options.tileUrl+'_markers_/'+marker.icon+'.png' }));
if(marker.markup) {
$(div).append($('<span/>')
.addClass(configuration.showlabel?'markerName-show':'markerName')
.addClass('markerName_' + set.id)
.addClass('markerName' + marker.dim)
.append(marker.label));
}
else
$(div).append($('<span/>')
.addClass(configuration.showlabel?'markerName-show':'markerName')
.addClass('markerName_' + set.id)
.addClass('markerName' + marker.dim)
.text(marker.label));
return div;
}});
@ -226,7 +228,7 @@ componentconstructors['markers'] = function(dynmap, configuration) {
dynmapmarkersets[msg.set].layergroup.removeLayer(marker.our_marker);
delete marker.our_marker;
}
marker = { x: msg.x, y: msg.y, z: msg.z, icon: msg.icon, label: msg.label, markup: msg.markup, desc: msg.desc };
marker = { x: msg.x, y: msg.y, z: msg.z, icon: msg.icon, label: msg.label, markup: msg.markup, desc: msg.desc, dim: msg.dim || '16x16' };
dynmapmarkersets[msg.set].markers[msg.id] = marker;
createMarker(dynmapmarkersets[msg.set], marker, msg.timestamp);
}