Ticket #16004: 0001-Allow-JSmol-Jmol-drag-resizing-fix-custom-menu.patch

File 0001-Allow-JSmol-Jmol-drag-resizing-fix-custom-menu.patch, 2.9 KB (added by gutow, 7 years ago)

patch to fix custom menu and resizing of 3-D display

  • sagenb/data/sage/js/jmol_lib.js

    From 3a548283a939f069f5a0ad5459767e748dd4eaaf Mon Sep 17 00:00:00 2001
    Message-Id: <3a548283a939f069f5a0ad5459767e748dd4eaaf.1413422351.git.gutow@uwosh.edu>
    From: gutow <gutow@uwosh.edu>
    Date: Mon, 13 Oct 2014 17:21:44 -0500
    Subject: [PATCH] Allow JSmol/Jmol drag resizing fix custom menu
    
    fix custom menu and allow drag resizing of the JSmol/Jmol applet.
    ---
     sagenb/data/sage/js/jmol_lib.js | 21 +++++++++++----------
     1 file changed, 11 insertions(+), 10 deletions(-)
    
    diff --git a/sagenb/data/sage/js/jmol_lib.js b/sagenb/data/sage/js/jmol_lib.js
    index 79cae82..e5f62e2 100644
    a b SageJmolManager.prototype.default_info = function() { 
    2323    // add_applet()
    2424    return {
    2525        // actual size is controlled by the parent <div id='#sage_jmol_N'>
    26         width: "100%",
    27         height: "100%",
     26        width: "95%", //This allows the jquery resize to work do not set to 100%
     27        height: "95%",
    2828        // debug=true will pop up alert boxes
    2929        debug: false,
    3030        color: "white",
    3131        addSelectionOptions: false,
    32         use: "HTML5 WebGL Java",
     32        use: "HTML5 WebGL Java", //This should probably only be HTML5
    3333        // Tooltip when the mouse is over the static image
    3434        coverTitle:
    3535            'Click on 3-D image to make it live. ' +
    SageJmolManager.prototype.default_info = function() { 
    4848        script: "",
    4949        z: 5,
    5050        zIndexBase: 5,
    51         menuFile: "/jsmol/appletweb/SageMenu.mnu", //special sagemenu
    52         platformSpeed: 6,
     51        menuFile: "/java/jmol/appletweb/SageMenu.mnu", //special sagemenu
     52        //platformSpeed: 6, does not work have to do it in the ready function
    5353    };
    5454};
    5555
    SageJmolManager.prototype.ready_callback = function (name, applet) { 
    5757    console.log('Jmol applet has launched ' + name);
    5858    this._applets[name] = applet;
    5959    this._lru_names.push(name);
     60    Jmol.script(applet, "set platformSpeed 6;");
    6061    this.enforce_limit();
    6162};
    6263
    SageJmolManager.prototype.add_applet = 
    107108
    108109    // append container to dom
    109110    jQuery('#sage_jmol_' + cell_num).append(
    110         '<div id="'+applet_name+'" style="height:'+size+'px; width:'+size+'px;" >JSmol here</div>'
    111     );
    112 
     111        '<div id="'+applet_name+'" style="height:'+size+'px; width:'+size+'px;" ></div>');
     112    //make resizable
     113    $('#'+applet_name).resizable({aspectRatio:true});
     114    $('#'+applet_name).append('<div id="'+applet_name+'_wrapper" style="height:100%;width:100%;"> JSmol Here</div>');
    113115   // launching JSmol/Jmol applet
    114116    Jmol.setDocument(false); // manually insert Jmol.getAppletHtml
    115     var applet_html = Jmol.getAppletHtml(applet_name, info);
    116     jQuery('#' + applet_name).html(applet_html);
     117    jQuery('#' + applet_name+'_wrapper').html( Jmol.getAppletHtml(applet_name, info));
    117118
    118119    // Finished
    119120    this._count += 1;