From 385c3e631604a89f6901e7577eb1c3c50a00849c Mon Sep 17 00:00:00 2001 From: Bosco Ho Date: Fri, 17 Jul 2015 18:28:14 +1000 Subject: [PATCH] taken out calculate_abs_camera as an explicit (and optional) step --- flask_server.py | 14 ++++++++++++++ js/embedjolecule.js | 1 + js/fullpagejolecule.js | 3 ++- js/protein.js | 8 ++++++-- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/flask_server.py b/flask_server.py index 8ee7e75..c414847 100755 --- a/flask_server.py +++ b/flask_server.py @@ -249,6 +249,20 @@ def make_embed_page(): '

A local version has been created for you at
%s

' % full_index_html) +@app.route('/gl_structure', methods=['GET']) +def get_gl_structure(): + filename = request.args.get('file') + return jinja_it( + os.path.join(root_dir, 'templates', 'local_gl_structure.jinja2.html'), + { + 'pdb_id': filename, + 'escaped_pdb_id': urllib.quote(filename), + 'data_server_url': '/data_server.js?file=%s&name=%s' % (filename, 'data_server'), + + } + ) + + @app.route('/isrunning', methods=['GET']) def isrunning(): return "true" diff --git a/js/embedjolecule.js b/js/embedjolecule.js index e1aa7bf..7dd3c03 100644 --- a/js/embedjolecule.js +++ b/js/embedjolecule.js @@ -54,6 +54,7 @@ function EmbedJolecule(params) { this.save_curr_view = function() { var new_id = random_id(); + this.controller.calculate_current_abs_camera(); this.controller.save_current_view(new_id); this.update_view() this.view_div.css('background-color', 'lightgray'); diff --git a/js/fullpagejolecule.js b/js/fullpagejolecule.js index 97ae98e..7827f8c 100644 --- a/js/fullpagejolecule.js +++ b/js/fullpagejolecule.js @@ -324,7 +324,8 @@ var ViewsDisplay = function(div_tag, controller, protein_display, data_server) { this.make_new_view = function() { new_id = random_id(); - var j = this.controller.save_current_view(new_id); + this.controller.calculate_current_abs_camera(); + this.controller.save_current_view(new_id); this.insert_new_view_div(new_id); this.update_views(); this.view_piece[new_id].div.css('background-color', 'lightgray'); diff --git a/js/protein.js b/js/protein.js index e843340..1b70b1b 100644 --- a/js/protein.js +++ b/js/protein.js @@ -824,7 +824,7 @@ var Scene = function(protein) { this.calculate_abs_camera = function(view) { var m_origin_view = this.origin.clone(); - var m_current_view = this.current_view.clone(); + var m_current_view = view.clone(); var m = get_camera_transform( m_current_view.camera, m_origin_view.camera, 1); m_current_view.camera.transform(m); @@ -904,7 +904,6 @@ var Scene = function(protein) { } this.insert_view = function(j, new_id, new_view) { - this.calculate_abs_camera(new_view); this.saved_views_by_id[new_id] = new_view; if (j >= this.saved_views.length) { this.saved_views.push(new_view); @@ -1274,6 +1273,11 @@ var Controller = function(scene) { this.scene.is_new_view_chosen = true; } + this.calculate_current_abs_camera = function() { + var view = this.scene.current_view; + this.scene.calculate_abs_camera(view); + } + this.save_current_view = function(new_id) { var j = this.scene.i_last_view + 1; var new_view = this.scene.current_view.clone();