mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-09 20:55:58 +00:00
Don't show tooltips for touch input (close #6035)
This commit is contained in:
@@ -89,6 +89,7 @@ export function tooltip(klass) {
|
||||
selection.call(tooltip.destroy, '.tooltip');
|
||||
};
|
||||
|
||||
var isTouchEvent = false;
|
||||
|
||||
function setup() {
|
||||
var root = d3_select(this);
|
||||
@@ -118,12 +119,20 @@ export function tooltip(klass) {
|
||||
var place = _placement.apply(this, arguments);
|
||||
tip.classed(place, true);
|
||||
|
||||
root.on('touchstart.tooltip', function() {
|
||||
// hack to avoid showing tooltips upon touch input
|
||||
isTouchEvent = true;
|
||||
});
|
||||
root.on('mouseenter.tooltip', show);
|
||||
root.on('mouseleave.tooltip', hide);
|
||||
}
|
||||
|
||||
|
||||
function show() {
|
||||
if (isTouchEvent) {
|
||||
isTouchEvent = false;
|
||||
return;
|
||||
}
|
||||
var root = d3_select(this);
|
||||
var content = _title.apply(this, arguments);
|
||||
var tip = root.selectAll('.tooltip-' + _id);
|
||||
|
||||
Reference in New Issue
Block a user