Skip to content

Commit

Permalink
fixing top left position
Browse files Browse the repository at this point in the history
  • Loading branch information
ppisljar committed Nov 9, 2016
1 parent 9e08139 commit 76f66a8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
11 changes: 10 additions & 1 deletion src/ui/public/vislib/styles/_tilemap.less
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
font-weight: bold;
}


.tilemap-legend i {
width: 10px;
height: 10px;
Expand All @@ -42,6 +41,16 @@
background: @tilemap-legend-i-bg;
}

/* top left needs some more styles */
.leaflet-top.leaflet-left .tilemap-legend-wrapper {
position: absolute;
left: 50px;
white-space: nowrap;
}

.leaflet-top.leaflet-left .tilemap-legend-wrapper span {
padding-right: 20px;
}

/* leaflet Dom Util div for map legend */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ export default function MarkerFactory() {
self._legend.onAdd = function () {
// creates all the neccessary DOM elements for the control, adds listeners
// on relevant map events, and returns the element containing the control
const $wrapper = $('<div>').addClass('tilemap-legend-wrapper');
const $div = $('<div>').addClass('tilemap-legend');
$wrapper.append($div);

const titleText = self.getLabel();
const $title = $('<div>').addClass('tilemap-legend-title').text(titleText);
Expand All @@ -62,18 +64,21 @@ export default function MarkerFactory() {
.map(self._valueFormatter)
.join(' – ');

const label = $('<div>').text(labelText);
const label = $('<div>');

const icon = $('<i>').css({
background: color,
'border-color': self.darkerColor(color)
});

const text = $('<span>').text(labelText);

label.append(icon);
label.append(text);
$div.append(label);
});

return $div.get(0);
return $wrapper.get(0);
};

self._legend.addTo(self.map);
Expand Down

0 comments on commit 76f66a8

Please sign in to comment.