You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ma...@apache.org on 2014/12/11 19:41:07 UTC

[05/25] incubator-nifi git commit: NIFI-147: - Clean up change for SVG resizing to remove unnecessary window resize listener.

NIFI-147:
- Clean up change for SVG resizing to remove unnecessary window resize listener.

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

Branch: refs/heads/bootstrap
Commit: 63e80d3fdc62034d445c1d5725af8c83e221a74a
Parents: 61c5cb3
Author: Matt Gilman <ma...@gmail.com>
Authored: Tue Dec 9 15:33:21 2014 -0500
Committer: Matt Gilman <ma...@gmail.com>
Committed: Tue Dec 9 15:33:21 2014 -0500

----------------------------------------------------------------------
 .../src/main/webapp/js/nf/canvas/nf-canvas.js   | 29 ++++++++++----------
 1 file changed, 14 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/63e80d3f/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js
----------------------------------------------------------------------
diff --git a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js
index 3b71088..e72b5c8 100644
--- a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js
+++ b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js
@@ -198,8 +198,6 @@ nf.Canvas = (function () {
 
         // create the canvas
         svg = d3.select('#canvas-container').append('svg')
-                .attr('width', canvasContainer.width())
-                .attr('height', canvasContainer.height())
                 .on('contextmenu', function () {
                     // reset the canvas click flag
                     canvasClicked = false;
@@ -214,14 +212,6 @@ nf.Canvas = (function () {
                     d3.event.preventDefault();
                 });
 
-        // listen for browser resize events to update the svg
-        $(window).resize(function () {
-            svg.attr({
-                'width': canvasContainer.width(),
-                'height': canvasContainer.height()
-            });
-        });
-
         // create the definitions element
         var defs = svg.append('defs');
 
@@ -470,13 +460,22 @@ nf.Canvas = (function () {
                 bottom = footer.height();
             }
 
-            var graph = $('#canvas-container');
-            var top = parseInt(graph.css('top'), 10);
+            // calculate size
+            var top = parseInt(canvasContainer.css('top'), 10);
             var windowHeight = $(window).height();
-            var graphHeight = (windowHeight - (bottom + top));
-            graph.css('height', graphHeight + 'px');
-            graph.css('bottom', bottom + 'px');
+            var canvasHeight = (windowHeight - (bottom + top));
+            
+            // canvas/svg
+            canvasContainer.css({
+                'height': canvasHeight + 'px',
+                'bottom': bottom + 'px'
+            });
+            svg.attr({
+                'height': canvasContainer.height(),
+                'width': canvasContainer.width()
+            });
 
+            // body
             $('#canvas-body').css({
                 'height': windowHeight + 'px',
                 'width': $(window).width() + 'px'