1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-30 17:30:59 +01:00

Fix flickering hovercards

Summary:
Refs T1048, T2902 - This //should// fix flickering hovercards. Probably does not fix displaced hovercards, though could (because of the flickering doing something bad to rendering).

I'm bad with JS D:

Test Plan: Tried out plenty of reload & hover combos. No flickering anymore. Never again.

Reviewers: epriestley, vrana

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1048

Differential Revision: https://secure.phabricator.com/D5607
This commit is contained in:
Anh Nhan Nguyen 2013-04-06 12:57:44 -07:00 committed by epriestley
parent fa41a3d6c6
commit 3c8365538a
2 changed files with 11 additions and 3 deletions

View file

@ -3043,7 +3043,7 @@ celerity_register_resource_map(array(
), ),
'phabricator-hovercard' => 'phabricator-hovercard' =>
array( array(
'uri' => '/res/345f3fca/rsrc/js/application/core/Hovercard.js', 'uri' => '/res/80f2fdb1/rsrc/js/application/core/Hovercard.js',
'type' => 'js', 'type' => 'js',
'requires' => 'requires' =>
array( array(

View file

@ -48,9 +48,15 @@ JX.install('Hovercard', {
_drawCard : function(phid) { _drawCard : function(phid) {
var self = JX.Hovercard; var self = JX.Hovercard;
// Already displaying
if (self.getCard() && phid == self._visiblePHID) {
return;
}
// Not the current requested card
if (phid != self._visiblePHID) { if (phid != self._visiblePHID) {
return; return;
} }
// Not loaded
if (!(phid in self._cards)) { if (!(phid in self._cards)) {
return; return;
} }
@ -121,8 +127,10 @@ JX.install('Hovercard', {
for (var phid in r.cards) { for (var phid in r.cards) {
self._cards[phid] = r.cards[phid]; self._cards[phid] = r.cards[phid];
if (self.getCard()) { // Don't draw if the user is faster than the browser
self.hide(); // Only draw if the user is still requesting the original card
if (self.getCard() && phid != self._visiblePHID) {
continue;
} }
self._drawCard(phid); self._drawCard(phid);