From d441c5b0c6ca109a0c1fdd9a0556ad78a592cb36 Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Thu, 25 Jun 2020 11:21:23 -0400 Subject: [PATCH] Flash operation annotation when tapping buttons with touch or stylus (re: #7699) --- modules/behavior/operation.js | 12 ++++-------- modules/ui/edit_menu.js | 9 +++++++++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/modules/behavior/operation.js b/modules/behavior/operation.js index c4aa722a0..cfaf60a22 100644 --- a/modules/behavior/operation.js +++ b/modules/behavior/operation.js @@ -11,25 +11,21 @@ export function behaviorOperation(context) { d3_event.preventDefault(); var disabled = _operation.disabled(); - var flash; if (disabled) { - flash = context.ui().flash + context.ui().flash .duration(4000) .iconName('#iD-operation-' + _operation.id) .iconClass('operation disabled') - .text(_operation.tooltip); - - flash(); + .text(_operation.tooltip)(); } else { - flash = context.ui().flash + context.ui().flash .duration(2000) .iconName('#iD-operation-' + _operation.id) .iconClass('operation') - .text(_operation.annotation() || _operation.title); + .text(_operation.annotation() || _operation.title)(); - flash(); if (_operation.point) _operation.point(null); _operation(); } diff --git a/modules/ui/edit_menu.js b/modules/ui/edit_menu.js index 5bc6aec0b..b55edbbc6 100644 --- a/modules/ui/edit_menu.js +++ b/modules/ui/edit_menu.js @@ -123,6 +123,15 @@ export function uiEditMenu(context) { .text(operation.tooltip)(); } } else { + if (lastPointerUpType === 'touch' || + lastPointerUpType === 'pen') { + context.ui().flash + .duration(2000) + .iconName('#iD-operation-' + operation.id) + .iconClass('operation') + .text(operation.annotation() || operation.title)(); + } + operation(); editMenu.close(); }