You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by mc...@apache.org on 2016/05/17 12:39:22 UTC

nifi git commit: fix for 1864

Repository: nifi
Updated Branches:
  refs/heads/master 3070bd5e1 -> cfd36c553


fix for 1864

Signed-off-by: Matt Gilman <ma...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/cfd36c55
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/cfd36c55
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/cfd36c55

Branch: refs/heads/master
Commit: cfd36c55395fdcd433202f06eac80bf12411e6e9
Parents: 3070bd5
Author: rkarthik29 <rk...@gmail.com>
Authored: Sun May 15 17:24:24 2016 -0400
Committer: Matt Gilman <ma...@gmail.com>
Committed: Tue May 17 08:38:26 2016 -0400

----------------------------------------------------------------------
 .../main/webapp/js/nf/canvas/nf-context-menu.js | 25 +++++++++-----------
 1 file changed, 11 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/cfd36c55/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-context-menu.js
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-context-menu.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-context-menu.js
index ba20b45..a809f52 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-context-menu.js
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-context-menu.js
@@ -495,19 +495,6 @@ nf.ContextMenu = (function () {
         {condition: isDeletable, menuItem: {img: 'images/iconDelete.png', text: 'Delete', action: 'delete'}}
     ];
 
-    /**
-     * Positions and shows the context menu.
-     * 
-     * @param {jQuery} contextMenu  The context menu
-     * @param {object} options      The context menu configuration
-     */
-    var positionAndShow = function (contextMenu, options) {
-        contextMenu.css({
-            'left': options.x + 'px',
-            'top': options.y + 'px'
-        }).show();
-    };
-
     return {
         init: function () {
             $('#context-menu').on('contextmenu', function(evt) {
@@ -521,8 +508,10 @@ nf.ContextMenu = (function () {
          * Shows the context menu. 
          */
         show: function () {
-            var canvasBody = $('#canvas-body').get(0);
             var contextMenu = $('#context-menu').empty();
+            var canvasBody = $('#canvas-body').get(0);
+            var bannerFooter = $('#banner-footer').get(0);
+            var breadCrumb = $('#breadcrumbs').get(0);
 
             // get the current selection
             var selection = nf.CanvasUtils.getSelection();
@@ -547,6 +536,14 @@ nf.ContextMenu = (function () {
             // get the location for the context menu
             var position = d3.mouse(canvasBody);
 
+            // nifi 1864 make sure the context menu is not hidden by the browser boundaries
+            if (position[0] + contextMenu.width() > canvasBody.clientWidth) {
+                position[0] = canvasBody.clientWidth - contextMenu.width() - 2;
+            }
+            if (position[1] + contextMenu.height() > (canvasBody.clientHeight - breadCrumb.clientHeight - bannerFooter.clientHeight)) {
+                position[1] = canvasBody.clientHeight - breadCrumb.clientHeight - bannerFooter.clientHeight - contextMenu.height() - 3;
+            }
+
             // show the context menu
             positionAndShow(contextMenu, {
                 'x': position[0],