mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 11:30:55 +01:00
Hovercards - don't let them run off the right edge of the viewport anymore
Summary: Fixes T7524. Test Plan: - made a task with a comment including another task. resized window so still desktop size and task reference on edge of window. invoked hovercard by bovering over task reference and noted the hovercard was completely visible. - opened the durable column and made a task reference. invoked hovercard by hovering over task reference and noted the hovercard was completely visible. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T7524 Differential Revision: https://secure.phabricator.com/D12759
This commit is contained in:
parent
7556a70280
commit
f7c14736c1
2 changed files with 16 additions and 11 deletions
|
@ -8,7 +8,7 @@
|
|||
return array(
|
||||
'names' => array(
|
||||
'core.pkg.css' => 'ca3f6a60',
|
||||
'core.pkg.js' => '5a18f0ab',
|
||||
'core.pkg.js' => 'dcd6c8e3',
|
||||
'darkconsole.pkg.js' => 'e7393ebb',
|
||||
'differential.pkg.css' => 'bb338e4b',
|
||||
'differential.pkg.js' => '895b8d62',
|
||||
|
@ -436,7 +436,7 @@ return array(
|
|||
'rsrc/js/core/DragAndDropFileUpload.js' => '07de8873',
|
||||
'rsrc/js/core/DraggableList.js' => 'a16ec1c6',
|
||||
'rsrc/js/core/FileUpload.js' => '477359c8',
|
||||
'rsrc/js/core/Hovercard.js' => '7e8468ae',
|
||||
'rsrc/js/core/Hovercard.js' => '14ac66f5',
|
||||
'rsrc/js/core/KeyboardShortcut.js' => '1ae869f2',
|
||||
'rsrc/js/core/KeyboardShortcutManager.js' => 'c1700f6f',
|
||||
'rsrc/js/core/MultirowRowManager.js' => 'b5d57730',
|
||||
|
@ -724,7 +724,7 @@ return array(
|
|||
'phabricator-file-upload' => '477359c8',
|
||||
'phabricator-filetree-view-css' => 'fccf9f82',
|
||||
'phabricator-flag-css' => '5337623f',
|
||||
'phabricator-hovercard' => '7e8468ae',
|
||||
'phabricator-hovercard' => '14ac66f5',
|
||||
'phabricator-hovercard-view-css' => '44394670',
|
||||
'phabricator-keyboard-shortcut' => '1ae869f2',
|
||||
'phabricator-keyboard-shortcut-manager' => 'c1700f6f',
|
||||
|
@ -913,6 +913,13 @@ return array(
|
|||
'javelin-json',
|
||||
'phabricator-draggable-list',
|
||||
),
|
||||
'14ac66f5' => array(
|
||||
'javelin-install',
|
||||
'javelin-dom',
|
||||
'javelin-vector',
|
||||
'javelin-request',
|
||||
'javelin-uri',
|
||||
),
|
||||
'14d7a8b8' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-behavior-device',
|
||||
|
@ -1410,13 +1417,6 @@ return array(
|
|||
'7e41274a' => array(
|
||||
'javelin-install',
|
||||
),
|
||||
'7e8468ae' => array(
|
||||
'javelin-install',
|
||||
'javelin-dom',
|
||||
'javelin-vector',
|
||||
'javelin-request',
|
||||
'javelin-uri',
|
||||
),
|
||||
'7ebaeed3' => array(
|
||||
'herald-rule-editor',
|
||||
'javelin-behavior',
|
||||
|
|
|
@ -80,6 +80,7 @@ JX.install('Hovercard', {
|
|||
var p = JX.$V(root);
|
||||
var d = JX.Vector.getDim(root);
|
||||
var n = JX.Vector.getDim(child);
|
||||
var v = JX.Vector.getViewport();
|
||||
|
||||
// Move the tip so it's nicely aligned.
|
||||
// I'm just doing north/south alignment for now
|
||||
|
@ -89,8 +90,12 @@ JX.install('Hovercard', {
|
|||
var x = parseInt(p.x, 10) - margin / 2;
|
||||
var y = parseInt(p.y - n.y, 10) - margin;
|
||||
|
||||
// If running off the edge of the viewport, make it margin / 2 away
|
||||
// from the far right edge of the viewport instead
|
||||
if ((x + n.x) > (v.x)) {
|
||||
x = x - parseInt(x + n.x - v.x + margin / 2, 10);
|
||||
// If more in the center, we can safely center
|
||||
if (x > (n.x / 2) + margin) {
|
||||
} else if (x > (n.x / 2) + margin) {
|
||||
x = parseInt(p.x - (n.x / 2) + d.x, 10);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue