reimplements the fade out/in on slide changes for transition between two identical slides.

bzr-revno: 2172
Fixes: https://launchpad.net/bugs/1223841
This commit is contained in:
Oliver Wieland 2013-10-21 09:43:39 +02:00 committed by Andreas Preikschat
commit 35305ae322

View File

@ -129,9 +129,10 @@ sup {
} }
function show_text(newtext){ function show_text(newtext){
var fade_direction = 0;
var match = /-webkit-text-fill-color:[^;\"]+/gi; var match = /-webkit-text-fill-color:[^;\"]+/gi;
if(timer != null) if (timer != null)
clearTimeout(timer); clearInterval(timer);
/* /*
QtWebkit bug with outlines and justify causing outline alignment QtWebkit bug with outlines and justify causing outline alignment
problems. (Bug 859950) Surround each word with a <span> to workaround, problems. (Bug 859950) Surround each word with a <span> to workaround,
@ -150,14 +151,17 @@ sup {
newtext = '<span>' + newtext + '</span>'; newtext = '<span>' + newtext + '</span>';
} }
} }
text_fade('lyricsmain', newtext); text_fade('lyricsmain', newtext);
text_fade('lyricsoutline', newtext); text_fade('lyricsoutline', newtext);
text_fade('lyricsshadow', newtext.replace(match, '')); text_fade('lyricsshadow', newtext.replace(match, ''));
if(text_opacity() == 1) return; if(text_opacity() == 1) return;
timer = setTimeout(function(){ timer = setInterval(function(){
show_text(newtext); text_fade('lyricsmain', newtext);
text_fade('lyricsoutline', newtext);
text_fade('lyricsshadow', newtext.replace(match, ''));
if(text_opacity() == 1) clearInterval(timer);
}, 100); }, 100);
}
function text_fade(id, newtext){ function text_fade(id, newtext){
/* /*
@ -175,14 +179,17 @@ sup {
text.innerHTML = newtext; text.innerHTML = newtext;
return; return;
} }
if(newtext == text.innerHTML){ if(fade_direction != 1){
text.style.opacity = parseFloat(text.style.opacity) + 0.3;
if(text.style.opacity > 0.7)
text.style.opacity = 1;
} else {
text.style.opacity = parseFloat(text.style.opacity) - 0.3; text.style.opacity = parseFloat(text.style.opacity) - 0.3;
if(text.style.opacity <= 0.1){ if(text.style.opacity <= 0.1){
text.innerHTML = newtext; text.innerHTML = newtext;
fade_direction = 1;
}
}else{
text.style.opacity = parseFloat(text.style.opacity) + 0.3;
if(text.style.opacity > 0.7){
text.style.opacity = 1;
}
} }
} }
} }