Changeset 791 in main


Ignore:
Timestamp:
02/22/12 10:10:15 (10 years ago)
Author:
pcosquer
Message:

navigate: fix centering if a new filter is chosen

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/openPLM/media/js/navigate.js

    r786 r791  
    7070 
    7171function update_nav(focus_node_id, data){ 
    72     if (focus_node_id != null) 
    73         var offset = $(focus_node_id).offset(); 
     72    if (focus_node_id === null){ 
     73        focus_node_id = "#" + $("#DivNav div.main_node").attr("id"); 
     74    } 
     75    var offset = $(focus_node_id).offset(); 
    7476    var date = new Date(); 
    7577    var divNav = $("#DivNav"); 
     
    8587    $("#FilterNavUl select").css("width", "12em"); 
    8688    $("#FilterNavUl select").chosen({disable_search_threshold: 7}); 
    87     $("#FilterNavUl div.chzn-container").addClass("ui-widget ui-button ui-state-default ui-corner-all") 
    88     if (focus_node_id != null){ 
    89         var new_offset = $(focus_node_id).offset(); 
    90         var delta_top = new_offset.top - offset.top; 
    91         var delta_left = new_offset.left - offset.left; 
    92         divNav.css({ 
    93             left: '-=' + delta_left + "px", 
    94             top: '-=' + delta_top + "px"}); 
    95         } 
    96     else { 
    97         var nw = $("#Navigate").innerWidth(); 
    98         var nh = $("#Navigate").innerHeight(); 
    99         divNav.css({left: (nw / 2 - data.center_x) + "px", 
    100                     top: (nh / 2 - data.center_y) + "px"}); 
    101     } 
     89    $("#FilterNavUl div.chzn-container").addClass("ui-widget ui-button ui-state-default ui-corner-all"); 
     90     
     91    var new_offset = $(focus_node_id).offset(); 
     92    var delta_top = new_offset.top - offset.top; 
     93    var delta_left = new_offset.left - offset.left; 
     94    divNav.css({ 
     95        left: '-=' + delta_left + "px", 
     96        top: '-=' + delta_top + "px"}); 
    10297    init(); 
    10398    draw_edges(data.edges, data.width, data.height); 
Note: See TracChangeset for help on using the changeset viewer.