[otrs-cvs] otrs/var/httpd/htdocs/js Core.Agent.Admin.ProcessManagement.Canvas.js, 1.50, 1.51

"CVS commits notifications of OTRS.org" <[email protected]>
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/otrs/var/httpd/htdocs/js
In directory lancelot:/tmp/cvs-serv19296/var/httpd/htdocs/js

Modified Files:
	Core.Agent.Admin.ProcessManagement.Canvas.js 
Log Message:
Fixed bug#9173 - ProcessManagement: Very right aligned activities can't display assigned dialogs.

Author: mn

Index: Core.Agent.Admin.ProcessManagement.Canvas.js
===================================================================
RCS file: /home/cvs/otrs/var/httpd/htdocs/js/Core.Agent.Admin.ProcessManagement.Canvas.js,v
retrieving revision 1.50
retrieving revision 1.51
diff -2 -u -d -r1.50 -r1.51
--- Core.Agent.Admin.ProcessManagement.Canvas.js	14 Feb 2013 10:18:08 -0000	1.50
+++ Core.Agent.Admin.ProcessManagement.Canvas.js	18 Feb 2013 10:57:04 -0000	1.51
@@ -259,10 +259,12 @@
 
     TargetNS.ShowActivityTooltip = function ($Element) {
-        var $tooltip = $('#DiagramTooltip'),
+        var $Tooltip = $('#DiagramTooltip'),
             text = '<h4>' + EscapeHTML($Element.find('span').text()) + '</h4>',
-            position = { x: 0, y: 0},
+            position = {x: 0, y: 0},
             Activity = Core.Agent.Admin.ProcessManagement.ProcessData.Activity,
             ActivityDialogs,
-            ElementID = $Element.attr('id');
+            ElementID = $Element.attr('id'),
+            CanvasWidth,
+            TooltipWidth;
 
         if (typeof Activity[$Element.attr('id')] === 'undefined') {
@@ -272,18 +274,11 @@
         ActivityDialogs = Activity[$Element.attr('id')].ActivityDialog;
 
-        if (!$tooltip.length) {
-            $tooltip = $('<div id="DiagramTooltip"></div>').css('display', 'none').appendTo('#Canvas');
+        if (!$Tooltip.length) {
+            $Tooltip = $('<div id="DiagramTooltip"></div>').css('display', 'none').appendTo('#Canvas');
         }
-        else if ($tooltip.is(':visible')) {
-            $tooltip.hide();
+        else if ($Tooltip.is(':visible')) {
+            $Tooltip.hide();
         }
 
-        // calculate tooltip position
-        // x: x-coordinate of canvas + x-coordinate of element within canvas + width of element
-        position.x = parseInt($Element.css('left'), 10) + parseInt($Element.width(), 10) + 10;
-
-        // y: y-coordinate of canvas + y-coordinate of element within canvas + height of element
-        position.y = parseInt($Element.css('top'), 10) + 10;
-
         // Add content to the tooltip
         text += "<ul>";
@@ -308,6 +303,26 @@
         text += "</ul>";
 
-        $tooltip
-            .html(text)
+        $Tooltip.html(text);
+
+        // calculate tooltip position
+        // if activity box is at the right border of the canvas, switch tooltip to the left side of the box
+        CanvasWidth = $('#Canvas').width();
+        TooltipWidth = $Tooltip.width();
+
+        // If activity does not fit in canvas, generate tooltip on the left side
+        if (CanvasWidth < (parseInt($Element.css('left'), 10) + parseInt($Element.width(), 10) + TooltipWidth)) {
+            // x: x-coordinate of element within canvas - width of tooltip
+            position.x = parseInt($Element.css('left'), 10) - TooltipWidth - 10;
+        }
+        // otherwise put tooltip on the right side (default behaviour)
+        else {
+            // x: x-coordinate of canvas + x-coordinate of element within canvas + width of element
+            position.x = parseInt($Element.css('left'), 10) + parseInt($Element.width(), 10) + 10;
+        }
+
+        // y-coordinate
+        position.y = parseInt($Element.css('top'), 10) + 10;
+
+        $Tooltip
             .css('top', position.y)
             .css('left', position.x)
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.