[sagenb] 98/157: Allow JSmol/Jmol drag resizing fix custom menu

felix salfelder felix-guest at moszumanska.debian.org
Mon Dec 22 16:51:56 UTC 2014


This is an automated email from the git hooks/post-receive script.

felix-guest pushed a commit to branch master
in repository sagenb.

commit 3a548283a939f069f5a0ad5459767e748dd4eaaf
Author: gutow <gutow at uwosh.edu>
Date:   Mon Oct 13 17:21:44 2014 -0500

    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/sagenb/data/sage/js/jmol_lib.js
+++ b/sagenb/data/sage/js/jmol_lib.js
@@ -23,13 +23,13 @@ SageJmolManager.prototype.default_info = function() {
     // add_applet()
     return {
         // actual size is controlled by the parent <div id='#sage_jmol_N'>
-        width: "100%",
-        height: "100%",
+        width: "95%", //This allows the jquery resize to work do not set to 100%
+        height: "95%",
         // debug=true will pop up alert boxes
         debug: false,
         color: "white",
         addSelectionOptions: false,
-        use: "HTML5 WebGL Java",
+        use: "HTML5 WebGL Java", //This should probably only be HTML5
         // Tooltip when the mouse is over the static image
         coverTitle: 
             'Click on 3-D image to make it live. ' + 
@@ -48,8 +48,8 @@ SageJmolManager.prototype.default_info = function() {
         script: "",
         z: 5,
         zIndexBase: 5,
-        menuFile: "/jsmol/appletweb/SageMenu.mnu", //special sagemenu
-        platformSpeed: 6,
+        menuFile: "/java/jmol/appletweb/SageMenu.mnu", //special sagemenu
+        //platformSpeed: 6, does not work have to do it in the ready function
     };
 };
 
@@ -57,6 +57,7 @@ SageJmolManager.prototype.ready_callback = function (name, applet) {
     console.log('Jmol applet has launched ' + name);
     this._applets[name] = applet;
     this._lru_names.push(name);
+    Jmol.script(applet, "set platformSpeed 6;");
     this.enforce_limit();
 };
 
@@ -107,13 +108,13 @@ SageJmolManager.prototype.add_applet =
 
     // append container to dom
     jQuery('#sage_jmol_' + cell_num).append(
-        '<div id="'+applet_name+'" style="height:'+size+'px; width:'+size+'px;" >JSmol here</div>'
-    );
-
+        '<div id="'+applet_name+'" style="height:'+size+'px; width:'+size+'px;" ></div>');
+    //make resizable
+    $('#'+applet_name).resizable({aspectRatio:true});
+    $('#'+applet_name).append('<div id="'+applet_name+'_wrapper" style="height:100%;width:100%;"> JSmol Here</div>');
    // launching JSmol/Jmol applet
     Jmol.setDocument(false); // manually insert Jmol.getAppletHtml
-    var applet_html = Jmol.getAppletHtml(applet_name, info);
-    jQuery('#' + applet_name).html(applet_html);
+    jQuery('#' + applet_name+'_wrapper').html( Jmol.getAppletHtml(applet_name, info));
 
     // Finished
     this._count += 1;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sagenb.git



More information about the debian-science-commits mailing list