mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-16 13:59:27 +02:00
Allow customizable flash showDuration and fadeDuration
This commit is contained in:
@@ -15,10 +15,10 @@ export function behaviorOperation(context) {
|
||||
d3.event.preventDefault();
|
||||
var disabled = which.disabled();
|
||||
if (disabled) {
|
||||
uiFlash().text(which.tooltip);
|
||||
uiFlash(2000, 500).text(which.tooltip);
|
||||
} else {
|
||||
var annotation = which.annotation || which.title;
|
||||
uiFlash().text(annotation);
|
||||
uiFlash(1500, 250).text(annotation);
|
||||
which();
|
||||
}
|
||||
});
|
||||
|
||||
+6
-3
@@ -3,7 +3,10 @@ import * as d3 from 'd3';
|
||||
var timeout;
|
||||
|
||||
|
||||
export function uiFlash() {
|
||||
export function uiFlash(showDuration, fadeDuration) {
|
||||
showDuration = showDuration || 1500;
|
||||
fadeDuration = fadeDuration || 250;
|
||||
|
||||
var content = d3.select('#flash').selectAll('.content')
|
||||
.data([0]);
|
||||
|
||||
@@ -19,7 +22,7 @@ export function uiFlash() {
|
||||
timeout = window.setTimeout(function() {
|
||||
content
|
||||
.transition()
|
||||
.duration(250)
|
||||
.duration(fadeDuration)
|
||||
.style('opacity', 0)
|
||||
.style('transform', 'scaleY(.1)')
|
||||
.on('end', function() {
|
||||
@@ -28,7 +31,7 @@ export function uiFlash() {
|
||||
});
|
||||
|
||||
return true;
|
||||
}, 1500);
|
||||
}, showDuration);
|
||||
|
||||
|
||||
return content;
|
||||
|
||||
Reference in New Issue
Block a user