bool
ScrollbarActivity::UpdateOpacity(TimeStamp aTime)
{
  double progress = (aTime - mFadeBeginTime) / FadeDuration();
  double opacity = 1.0 - std::max(0.0, std::min(1.0, progress));

  // 'this' may be getting destroyed during SetOpacityOnElement calls.
  nsWeakFrame weakFrame((do_QueryFrame(mScrollableFrame)));
  SetOpacityOnElement(GetHorizontalScrollbar(), opacity);
  if (!weakFrame.IsAlive()) {
    return false;
  }
  SetOpacityOnElement(GetVerticalScrollbar(), opacity);
  if (!weakFrame.IsAlive()) {
    return false;
  }
  return true;
}
Beispiel #2
0
/*
================
idEntityFx::FadeOutFx
================
*/
void idEntityFx::FadeOutFx( void ) {
	if( started < 0 || manualFadeIsOn ){ //if not active or already fading
		return;
	}

	manualFadeIsOn = true;
	SetupFade();

	if( endlessSounds ){
		FadeSound( SND_CHANNEL_ANY, -60, 1 ); //fade out sounds
		//gameLocal.Printf("fading sounds!");
	}

	if( manualRemove ){

		CancelEvents( &EV_Activate ); // make sure it's not going to re-activate itself
		CancelEvents( &EV_Fx_KillFx ); // make sure it's not going to kill or re-activate itself too soon

		PostEventMS( &EV_Fx_KillFx, FadeDuration() );
	}
}
Beispiel #3
0
bool
ScrollbarActivity::UpdateOpacity(TimeStamp aTime)
{
  // Avoid division by zero if mScrollbarFadeDuration is zero, just jump
  // to the end of the fade animation
  double progress = mScrollbarFadeDuration
    ? ((aTime - mFadeBeginTime) / FadeDuration())
    : 1.0;
  double opacity = 1.0 - std::max(0.0, std::min(1.0, progress));

  // 'this' may be getting destroyed during SetOpacityOnElement calls.
  nsWeakFrame weakFrame((do_QueryFrame(mScrollableFrame)));
  SetOpacityOnElement(GetHorizontalScrollbar(), opacity);
  if (!weakFrame.IsAlive()) {
    return false;
  }
  SetOpacityOnElement(GetVerticalScrollbar(), opacity);
  if (!weakFrame.IsAlive()) {
    return false;
  }
  return true;
}
Beispiel #4
0
bool
ScrollbarActivity::IsStillFading(TimeStamp aTime)
{
  return !mFadeBeginTime.IsNull() && (aTime - mFadeBeginTime < FadeDuration());
}