mirror of https://github.com/apache/nifi.git
fix for 1864
Signed-off-by: Matt Gilman <matt.c.gilman@gmail.com>
This commit is contained in:
parent
3070bd5e13
commit
cfd36c5539
|
@ -495,19 +495,6 @@ nf.ContextMenu = (function () {
|
||||||
{condition: isDeletable, menuItem: {img: 'images/iconDelete.png', text: 'Delete', action: 'delete'}}
|
{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 {
|
return {
|
||||||
init: function () {
|
init: function () {
|
||||||
$('#context-menu').on('contextmenu', function(evt) {
|
$('#context-menu').on('contextmenu', function(evt) {
|
||||||
|
@ -521,8 +508,10 @@ nf.ContextMenu = (function () {
|
||||||
* Shows the context menu.
|
* Shows the context menu.
|
||||||
*/
|
*/
|
||||||
show: function () {
|
show: function () {
|
||||||
var canvasBody = $('#canvas-body').get(0);
|
|
||||||
var contextMenu = $('#context-menu').empty();
|
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
|
// get the current selection
|
||||||
var selection = nf.CanvasUtils.getSelection();
|
var selection = nf.CanvasUtils.getSelection();
|
||||||
|
@ -547,6 +536,14 @@ nf.ContextMenu = (function () {
|
||||||
// get the location for the context menu
|
// get the location for the context menu
|
||||||
var position = d3.mouse(canvasBody);
|
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
|
// show the context menu
|
||||||
positionAndShow(contextMenu, {
|
positionAndShow(contextMenu, {
|
||||||
'x': position[0],
|
'x': position[0],
|
||||||
|
|
Loading…
Reference in New Issue