1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Simplify comment highlight behavior in Pholio

Summary:
  - Currently, we register this behavior every time we load comments. Instead, register it once.
  - We have two very similar behaviors for over/out. Just use one that does the right thing based on the event type.

Test Plan: Waved my mouse over areas of the image with reticles, saw the correct comments highlight.

Reviewers: chad, ljalonen

Reviewed By: chad

CC: aran

Differential Revision: https://secure.phabricator.com/D5082
This commit is contained in:
epriestley 2013-02-23 06:27:35 -08:00
parent 11f6e73328
commit a2abbd560a
2 changed files with 16 additions and 24 deletions

View file

@ -1873,7 +1873,7 @@ celerity_register_resource_map(array(
),
'javelin-behavior-pholio-mock-view' =>
array(
'uri' => '/res/893b9f91/rsrc/js/application/pholio/behavior-pholio-mock-view.js',
'uri' => '/res/e30e42ce/rsrc/js/application/pholio/behavior-pholio-mock-view.js',
'type' => 'js',
'requires' =>
array(
@ -2551,7 +2551,7 @@ celerity_register_resource_map(array(
),
'phabricator-application-launch-view-css' =>
array(
'uri' => '/res/13c3d7f3/rsrc/css/application/base/phabricator-application-launch-view.css',
'uri' => '/res/8aee0702/rsrc/css/application/base/phabricator-application-launch-view.css',
'type' => 'css',
'requires' =>
array(

View file

@ -126,6 +126,20 @@ JX.behavior('pholio-mock-view', function(config) {
JX.$V(e)), startPos);
});
JX.Stratcom.listen(
['mouseover', 'mouseout'],
'image_selection',
function(e) {
var data = e.getNodeData('image_selection');
var comment = JX.$(data.phid + "_comment");
var highlight = (e.getType() == 'mouseover');
JX.DOM.alterClass(
comment,
'pholio-mock-inline-comment-highlight',
highlight);
});
JX.Stratcom.listen(
'mouseup',
null,
@ -208,28 +222,6 @@ JX.behavior('pholio-mock-view', function(config) {
}
}
JX.Stratcom.listen(
'mouseover',
'image_selection',
function(e) {
var data = e.getNodeData('image_selection');
var inline_comment = JX.$(data.phid + "_comment");
JX.DOM.alterClass(inline_comment,
'pholio-mock-inline-comment-highlight', true);
});
JX.Stratcom.listen(
'mouseout',
'image_selection',
function(e) {
var data = e.getNodeData('image_selection');
var inline_comment = JX.$(data.phid + "_comment");
JX.DOM.alterClass(inline_comment,
'pholio-mock-inline-comment-highlight', false);
});
});
inline_comments.send();