From 8af84a9b7da3878f59277f09324d207bc2968033 Mon Sep 17 00:00:00 2001 From: lkassianik Date: Fri, 11 Apr 2014 16:09:30 -0700 Subject: [PATCH] Adding getBoundingClientRect math to getPos in Vector.js Summary: Ref T4714, tooltips in fullscreen mode need special math, due to fixed position throwing off position of tooltips. Test Plan: Create work board, create several tasks, create several columns, drag tasks among columns and within columns. Create a paste, check tooltips in comment box show and are positioned correctly. Fullscreen comment box. Verify tooltips still show and position correctly. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin Maniphest Tasks: T4714 Differential Revision: https://secure.phabricator.com/D8762 --- resources/celerity/map.php | 50 ++++++++++---------- webroot/rsrc/externals/javelin/lib/Vector.js | 7 +++ 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index bc494719e8..1acd4b74e5 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -14,7 +14,7 @@ return array( 'differential.pkg.js' => '11a5b750', 'diffusion.pkg.css' => '3783278d', 'diffusion.pkg.js' => '5b4010f4', - 'javelin.pkg.js' => 'a10417f3', + 'javelin.pkg.js' => '74a8353b', 'maniphest.pkg.css' => 'f1887d71', 'maniphest.pkg.js' => '2fe8af22', 'rsrc/css/aphront/aphront-bars.css' => '231ac33c', @@ -206,7 +206,7 @@ return array( 'rsrc/externals/javelin/lib/Request.js' => '23f9bb8d', 'rsrc/externals/javelin/lib/Resource.js' => '356de121', 'rsrc/externals/javelin/lib/URI.js' => 'd9a9b862', - 'rsrc/externals/javelin/lib/Vector.js' => '403a3dce', + 'rsrc/externals/javelin/lib/Vector.js' => '039fb90d', 'rsrc/externals/javelin/lib/Workflow.js' => 'f28bf201', 'rsrc/externals/javelin/lib/__tests__/Cookie.js' => '5ed109e8', 'rsrc/externals/javelin/lib/__tests__/DOM.js' => 'c984504b', @@ -379,7 +379,7 @@ return array( 'rsrc/js/application/files/behavior-icon-composer.js' => '8ef9ab58', 'rsrc/js/application/files/behavior-launch-icon-composer.js' => '48086888', 'rsrc/js/application/harbormaster/behavior-reorder-steps.js' => '957a7fde', - 'rsrc/js/application/herald/HeraldRuleEditor.js' => '6291cf4a', + 'rsrc/js/application/herald/HeraldRuleEditor.js' => '22d2966a', 'rsrc/js/application/herald/PathTypeahead.js' => 'f7fc67ec', 'rsrc/js/application/herald/herald-rule-editor.js' => '7ebaeed3', 'rsrc/js/application/maniphest/behavior-batch-editor.js' => 'fe80fb6d', @@ -522,7 +522,7 @@ return array( 'global-drag-and-drop-css' => '697324ad', 'harbormaster-css' => 'cec833b7', 'herald-css' => '59d48f01', - 'herald-rule-editor' => '6291cf4a', + 'herald-rule-editor' => '22d2966a', 'herald-test-css' => '2b7d0f54', 'inline-comment-summary-css' => '14a91639', 'javelin-aphlict' => '493665ee', @@ -656,7 +656,7 @@ return array( 'javelin-typeahead-static-source' => 'cdde23f1', 'javelin-uri' => 'd9a9b862', 'javelin-util' => '65b0b249', - 'javelin-vector' => '403a3dce', + 'javelin-vector' => '039fb90d', 'javelin-view' => '0f764c35', 'javelin-view-html' => 'e5b406f9', 'javelin-view-interpreter' => '0c33c1a0', @@ -833,6 +833,11 @@ return array( 8 => 'javelin-stratcom', 9 => 'javelin-util', ), + '039fb90d' => + array( + 0 => 'javelin-install', + 1 => 'javelin-event', + ), '03d6ed07' => array( 0 => 'javelin-behavior', @@ -966,6 +971,16 @@ return array( 3 => 'javelin-workflow', 4 => 'javelin-util', ), + '22d2966a' => + array( + 0 => 'multirow-row-manager', + 1 => 'javelin-install', + 2 => 'javelin-util', + 3 => 'javelin-dom', + 4 => 'javelin-stratcom', + 5 => 'javelin-json', + 6 => 'phabricator-prefab', + ), '23f9bb8d' => array( 0 => 'javelin-install', @@ -1049,11 +1064,6 @@ return array( 1 => 'javelin-dom', 2 => 'phortune-credit-card-form', ), - '403a3dce' => - array( - 0 => 'javelin-install', - 1 => 'javelin-event', - ), '441f2137' => array( 0 => 'javelin-behavior', @@ -1189,15 +1199,12 @@ return array( 2 => 'javelin-util', 3 => 'phabricator-shaped-request', ), - '6291cf4a' => + '62e18640' => array( - 0 => 'multirow-row-manager', - 1 => 'javelin-install', - 2 => 'javelin-util', - 3 => 'javelin-dom', - 4 => 'javelin-stratcom', - 5 => 'javelin-json', - 6 => 'phabricator-prefab', + 0 => 'javelin-install', + 1 => 'javelin-util', + 2 => 'javelin-dom', + 3 => 'javelin-typeahead-normalizer', ), '6453c869' => array( @@ -1232,13 +1239,6 @@ return array( 0 => 'javelin-behavior', 1 => 'javelin-dom', ), - '62e18640' => - array( - 0 => 'javelin-install', - 1 => 'javelin-util', - 2 => 'javelin-dom', - 3 => 'javelin-typeahead-normalizer', - ), '75903ee1' => array( 0 => 'javelin-behavior', diff --git a/webroot/rsrc/externals/javelin/lib/Vector.js b/webroot/rsrc/externals/javelin/lib/Vector.js index 20361a15e5..cbd9e41b98 100644 --- a/webroot/rsrc/externals/javelin/lib/Vector.js +++ b/webroot/rsrc/externals/javelin/lib/Vector.js @@ -223,6 +223,13 @@ JX.install('Vector', { getPos : function(node) { JX.Event && (node instanceof JX.Event) && (node = node.getRawEvent()); + if (node.getBoundingClientRect) { + var rect = node.getBoundingClientRect(); + return new JX.Vector( + rect.left + window.pageXOffset, + rect.top + window.pageYOffset); + } + if (('pageX' in node) || ('clientX' in node)) { var c = JX.Vector._viewport; return new JX.Vector(