Flash the disabled message for touch interaction for the save button (re: #7699)

Don't flash undo/redo tooltip text when the map isn't editable
This commit is contained in:
Quincy Morgan
2020-06-12 13:10:15 -04:00
parent a1e6a1acd9
commit b7bb8213ba
2 changed files with 27 additions and 3 deletions

View File

@@ -80,10 +80,32 @@ export function uiToolSave(context) {
.keys([key])
.scrollContainer(context.container().select('.top-toolbar'));
var lastPointerUpType;
button = selection
.append('button')
.attr('class', 'save disabled bar-button')
.on('click', save)
.on('pointerup', function() {
lastPointerUpType = d3_event.pointerType;
})
.on('click', function() {
d3_event.preventDefault();
save();
if (_numChanges === 0 && (
lastPointerUpType === 'touch' ||
lastPointerUpType === 'pen')
) {
// there are no tooltips for touch interactions so flash feedback instead
context.ui().flash
.duration(2000)
.iconName('#iD-icon-save')
.iconClass('disabled')
.text(t('save.no_changes'))();
}
lastPointerUpType = null;
})
.call(tooltipBehavior);
button

View File

@@ -79,8 +79,10 @@ export function uiToolUndoRedo(context) {
d.action();
}
if (lastPointerUpType === 'touch' ||
lastPointerUpType === 'pen') {
if (editable() && (
lastPointerUpType === 'touch' ||
lastPointerUpType === 'pen')
) {
// there are no tooltips for touch interactions so flash feedback instead
var text = annotation ?