styled opacity slider + fixed tooltips.

This commit is contained in:
Saman Bemel-Benrud
2012-12-10 18:36:36 -05:00
parent 1ec08c229f
commit 2bac913537
2 changed files with 49 additions and 26 deletions
+26 -4
View File
@@ -430,13 +430,33 @@ button.Browse .label {
}
.opacity-options li {
position: relative;
height: 100%;
display: block;
float: left;
cursor: pointer;
}
.layerswitcher-control a.opacity {
background:#4672ff;
.opacity-options li .select-box{
position: absolute;
width: 100%;
height: 100%;
z-index: 9999;
}
.layerswitcher-control li:hover .select-box,
.layerswitcher-control li.selected .select-box {
border: 2px solid #4672ff;
background: rgba(70, 114, 255, .5);
opacity: .5;
}
.layerswitcher-control li.selected:hover .select-box,
.layerswitcher-control li.selected .select-box {
opacity: 1;
}
.layerswitcher-control .opacity {
background:#222;
display:inline-block;
width:20px;
height:18px;
@@ -590,7 +610,8 @@ div.typeahead a {
.tooltip {
white-space: normal;
position: absolute;
z-index: 1030;
z-index: -1000;
height: 0;
padding: 5px;
opacity: 0;
display: block;
@@ -601,6 +622,8 @@ div.typeahead a {
.tooltip.in {
opacity: 0.8;
filter: alpha(opacity=80);
z-index: 1030;
height: auto;
}
.tooltip.top {
@@ -619,7 +642,6 @@ div.typeahead a {
margin-left: -5px;
}
.tooltip-inner {
max-width: 200px;
min-width: 100px;
+23 -22
View File
@@ -2,13 +2,16 @@ iD.layerswitcher = function(map) {
var event = d3.dispatch('cancel', 'save'),
sources = [{
name: 'Bing',
source: iD.BackgroundSource.Bing
source: iD.BackgroundSource.Bing,
description: 'High quality satellite imagery'
}, {
name: 'TIGER 2012',
source: iD.BackgroundSource.Tiger2012
source: iD.BackgroundSource.Tiger2012,
description: 'Public domain road data from the US Government'
}, {
name: 'OSM',
source: iD.BackgroundSource.OSM
source: iD.BackgroundSource.OSM,
description: 'The default OpenStreetMap layer'
}],
opacities = [1, 0.5, 0];
@@ -34,30 +37,28 @@ iD.layerswitcher = function(map) {
.attr('data-original-title', 'Adjust the opacity')
.call(bootstrap.tooltip().placement('right'))
.attr('class', 'opacity-options')
.selectAll('a.opacity')
.selectAll('div.opacity')
.data(opacities)
.enter()
.append('li').append('a').attr('class', 'opacity')
.append('li')
.on('click', function(d) {
d3.select('#tile-g')
.transition()
.style('opacity', d)
.attr('data-opacity', d);
d3.selectAll('.opacity-options li')
.classed('selected', false)
d3.select(this)
.classed('selected', true)
})
.html("<div class='select-box'></div>")
.append('div')
.attr('class', 'opacity')
.style('opacity', function(d) {
return d;
})
.on('mouseover', function(d) {
d3.select('#tile-g')
.transition()
.style('opacity', d);
})
.on('mouseout', function(d) {
var o = d3.select('#tile-g').attr('data-opacity');
d3.select('#tile-g')
.transition()
.style('opacity', o);
})
.on('click', function(d) {
d3.select('#tile-g')
.transition()
.style('opacity', d)
.attr('data-opacity', d);
});
// Make sure there is an active selection by default
d3.select('.opacity-options li').classed('selected', true)
function selectLayer(d) {
content.selectAll('a.layer')