Skip to content

Commit

Permalink
Adding im and re variable values to draggables.
Browse files Browse the repository at this point in the history
  • Loading branch information
exh12001 committed Nov 20, 2017
1 parent d749b2f commit 1c027e1
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion js/mobius.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ function add_2d_ctrl(parent,variable,label,min_x,max_x,min_y,max_y) {
slider.className = "sliderHandle";
$(slider).draggable({
containment: "parent",

//update value based on location, rounded to thrid decimal
drag: function(event, ui){

variable.setVals(remap(ui.position.left,0,80,min_x,max_x),remap(ui.position.top,0,80,min_y,max_y));
console.log(variable);
//console.log(variable['im']);

imNum.nodeValue = 'im: ' +variable['im'].toFixed(3)
reNum.nodeValue = 're: ' +variable['re'].toFixed(3)
}
});
container.append(slider);
Expand All @@ -19,6 +25,21 @@ function add_2d_ctrl(parent,variable,label,min_x,max_x,min_y,max_y) {
caption.className = "slider-caption";
$(caption).text(label);
container.append(caption);

var value = document.createElement('div');
var br = document.createElement('br');

var imNum = document.createTextNode('im: '+variable['im']);
var newLine = document.createTextNode('\n');
var reNum = document.createTextNode('re: '+variable['re']);
value.append(imNum);
value.append(br)
value.append(reNum);
parent.append(value);
}

function add_vector_field(parent,variable){

}

var Complex = function(_re,_im){
Expand Down

0 comments on commit 1c027e1

Please sign in to comment.