[hg] galaxy 1487: A better fix for bring-to-front stacking in wo...

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[hg] galaxy 1487: A better fix for bring-to-front stacking in wo...

greg
details:   http://www.bx.psu.edu/hg/galaxy/rev/a7248362c37b
changeset: 1487:a7248362c37b
user:      James Taylor <[hidden email]>
date:      Thu Aug 28 13:38:54 2008 -0400
description:
A better fix for bring-to-front stacking in workflow editor

2 file(s) affected in this change:

static/scripts/galaxy.workflow_editor.canvas.js
templates/workflow/editor.mako

diffs (71 lines):

diff -r 9e956e7b738f -r a7248362c37b static/scripts/galaxy.workflow_editor.canvas.js
--- a/static/scripts/galaxy.workflow_editor.canvas.js Wed Aug 27 16:36:41 2008 -0400
+++ b/static/scripts/galaxy.workflow_editor.canvas.js Thu Aug 28 13:38:54 2008 -0400
@@ -259,7 +259,12 @@
         $(this.element).addClass( "toolForm-active" );
     },
     make_inactive : function () {
-        $(this.element).removeClass( "toolForm-active" );
+        // Keep inactive nodes stacked from most to least recently active
+        // by moving element to the end of parent's node list
+        var element = this.element.get(0);
+        (function(p) { p.removeChild( element ); p.appendChild( element ) })(element.parentNode);
+        // Remove active class
+        $(element).removeClass( "toolForm-active" );
     },
     init_field_data : function ( data ) {
         var f = this.element;
@@ -480,14 +485,6 @@
         function() { $(this).attr( 'src', "../images/delete_icon_dark.png" ) },
         function() { $(this).attr( 'src', "../images/delete_icon.png" ) }
     ) );
-    // zIndex tracking for bring to front
-    zmax = $("#canvas-container").data( "zmax" )
-    if ( ! zmax ) {
-        // Start above level where connectors are drawn
-        zmax = 20;
-    }
-    f.css( "zIndex", zmax + 1 );
-    $("#canvas-container").data( "zmax", zmax + 1 );
     // Place inside container
     f.appendTo( "#canvas-container" );
     // Position in container
@@ -508,16 +505,11 @@
         // containment: $("#shim"),
         // grow: true,
         click: function( e, ui ) {
-            // Bring to front
-            zmax = $("#canvas-container").data( "zmax" )
-            $(this).css( "zIndex", zmax + 1 );
-            $("#canvas-container").data( "zmax", zmax + 1 );
             // Make active
             workflow.activate_node( node );
         },
         start: function( e, ui ) {
             workflow.activate_node( node );
-            $(this).css( 'z-index', $("#canvas-container").data( "zmax" ) + 1000 );
         },
         drag: function( e, ui ) {
             $(this).find( ".terminal" ).each( function() {
@@ -525,10 +517,6 @@
             })
         },
         stop: function( e, ui  ) {
-            // Bring to front
-            zmax = $("#canvas-container").data( "zmax" )
-            $(this).css( "zIndex", zmax + 1 );
-            $("#canvas-container").data( "zmax", zmax + 1 );
             // Redraw
             $(this).find( ".terminal" ).each( function() {
                 this.terminal.redraw();
diff -r 9e956e7b738f -r a7248362c37b templates/workflow/editor.mako
--- a/templates/workflow/editor.mako Wed Aug 27 16:36:41 2008 -0400
+++ b/templates/workflow/editor.mako Thu Aug 28 13:38:54 2008 -0400
@@ -394,6 +394,7 @@
     }
     
     div.toolForm-active {
+        z-index: 1001;
         border: solid #8080FF 4px;
         margin: 3px;
     }