Show appropriate tooltips for disabled undo/redo buttons

Implementing this cross-browser requires using a `.disabled`
class rather than the `disabled` property. No browsers except
Opera dispatch mouse events on disabled buttons.

Fixes #620.
This commit is contained in:
John Firebaugh
2013-02-04 11:20:23 -08:00
parent e4a8fbd0f6
commit c2ddf67cc0
3 changed files with 17 additions and 9 deletions
+8 -3
View File
@@ -273,7 +273,12 @@ button.active {
cursor:url(../img/cursor-pointing.png) 6 1, auto;
}
button.active:not([disabled]) {
button.disabled {
background: #6c6c6c;
cursor: auto;
}
button.active:not([disabled]):not(.disabled) {
background: #6bc641;
}
@@ -450,8 +455,8 @@ button[disabled] .icon.browse { background-position: 0px -40px;}
button[disabled] .icon.add-point { background-position: -20px -40px;}
button[disabled] .icon.add-line { background-position: -40px -40px;}
button[disabled] .icon.add-area { background-position: -60px -40px;}
button[disabled] .icon.undo { background-position: -80px -40px;}
button[disabled] .icon.redo { background-position: -100px -40px;}
button.disabled .icon.undo { background-position: -80px -40px;}
button.disabled .icon.redo { background-position: -100px -40px;}
button[disabled] .apply.icon { background-position: -120px -40px;}
button[disabled] .save.icon { background-position: -140px -40px;}
button[disabled] .close.icon { background-position: -160px -40px;}
+6 -6
View File
@@ -91,14 +91,14 @@ iD.ui = function (context) {
undo_buttons.append('button')
.attr({ id: 'undo', 'class': 'col6' })
.property('disabled', true)
.classed('disabled', true)
.html("<span class='undo icon'></span><small></small>")
.on('click.editor', history.undo)
.call(undo_tooltip);
undo_buttons.append('button')
.attr({ id: 'redo', 'class': 'col6' })
.property('disabled', true)
.classed('disabled', true)
.html("<span class='redo icon'><small></small>")
.on('click.editor', history.redo)
.call(undo_tooltip);
@@ -209,13 +209,13 @@ iD.ui = function (context) {
}
limiter.select('#undo')
.property('disabled', !undo)
.attr('data-original-title', hintprefix('⌘ + Z', undo))
.classed('disabled', !undo)
.attr('data-original-title', hintprefix('⌘ + Z', undo || t('nothing_to_undo')))
.call(refreshTooltip);
limiter.select('#redo')
.property('disabled', !redo)
.attr('data-original-title', hintprefix('⌘ + ⇧ + Z', redo))
.classed('disabled', !redo)
.attr('data-original-title', hintprefix('⌘ + ⇧ + Z', redo || t('nothing_to_redo')))
.call(refreshTooltip);
});
+3
View File
@@ -141,6 +141,9 @@ locale.en = {
"zoom-in": "Zoom In",
"zoom-out": "Zoom Out",
nothing_to_undo: "Nothing to undo.",
nothing_to_redo: "Nothing to redo.",
"browser_notice": "This editor is supported in Firefox, Chrome, Safari, Opera, and Internet Explorer 9 and above. Please upgrade your browser or use Potlatch 2 to edit the map.",
"layer_settings": "Layer Settings",