Skip to content

Commit

Permalink
taken out calculate_abs_camera as an explicit (and optional) step
Browse files Browse the repository at this point in the history
  • Loading branch information
boscoh committed Jul 17, 2015
1 parent 6637579 commit 385c3e6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
14 changes: 14 additions & 0 deletions flask_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,20 @@ def make_embed_page():
'<h3>A local version has been created for you at <br> %s</h3>' % 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"
Expand Down
1 change: 1 addition & 0 deletions js/embedjolecule.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
3 changes: 2 additions & 1 deletion js/fullpagejolecule.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
8 changes: 6 additions & 2 deletions js/protein.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 385c3e6

Please sign in to comment.