Skip to content

Commit

Permalink
fixed some import errors
Browse files Browse the repository at this point in the history
  • Loading branch information
AntixK committed May 5, 2019
1 parent 14f102b commit 39f782e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 39 deletions.
34 changes: 10 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
<p>
<div class="tab",id="tabs">
<button title="Design Catmull-Rom curve" class="tablinks active" onclick="opentab(event, 'Catmull Rom Spline')" id="defaultOpen">Catmull</button>
<button title="Design Bezier curve" class="tablinks" onclick="opentab(event, 'Bezier')">Bezier</button>
<button title="Design Bezier curve" class="tablinks" onclick="opentab(event, 'Bezier')">B&#xE9zier</button>
<button title="Design NURBS curve" class="tablinks" onclick="opentab(event, 'NURBS')">NURBS</button>
</div>

Expand All @@ -131,7 +131,7 @@
<button title="Exports all the curve data as a JSON file." class = "mybutton" id='exportjson'>Export JSON</button>
<button title="Resets the canvas." class = "mybutton" id='reset'>Reset</button>
<input type="range" min="70" max="200" value="100" step='1' class="myslider" id="zoomslider">

<input type="number" min="1" max="5" value="2" id="degreeslider">
<label class="container"id="clampedbox">
<input type="checkbox">
<span class="checkmark"></span>
Expand Down
27 changes: 14 additions & 13 deletions public/sketch.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
var INITIAL_NUM_PTS = 5;
var N = INITIAL_NUM_PTS;
var MAX_NUM_PTS = 10;
var MAX_NUM_PTS = 15;
var curr_marker;
var control_points = [];
var curve_points;
var curve_choice = 'Catmull Rom Spline';
var degree = 2;
var degree_slider;
let clamped_box;
var clamped_curve = false;
var clamped_curve = true;

var curve_dict = {
'Catmull Rom Spline': 0,
Expand Down Expand Up @@ -147,7 +147,8 @@ function setup() {
degree_text.style('font-family', button_font.font.names.postScriptName["en"]);
degree_text.style('color', 'white');

degree_slider = createInput('2','Number');
degree_slider =select("#degreeslider");
//degree_slider.parent("container");
degree_slider.style('width','70px');
degree_slider.style('text-align','center');
degree_slider.attribute('min', '1');
Expand All @@ -167,6 +168,7 @@ function setup() {
clamped_box.style('color', 'white');
clamped_box.position(NUM_X + 180, NUM_Y - 68);
clamped_box.changed(set_clamped);
update_clamped_box();

reset_canvas(false);

Expand Down Expand Up @@ -301,10 +303,11 @@ function import_json()
x_mark.position(240 + text_offset_x,(- 12)+(N-1)*40 + text_offset_y);
x_mark.html('\u2718');

clamped_curve = in_json_file.clamped;
//clamped_curve = in_json_file.clamped;
degree = in_json_file.degree;
update_degree_slider();
update_clamped_box();
if(in_json_file.clamped && !clamped_curve)
update_clamped_box();
}
reader.readAsText(file_handle.files[0]);
}, false);
Expand All @@ -318,7 +321,7 @@ function reset_canvas(flag = true)
panx = 0;
pany = 0;

clamped_curve = false;
clamped_curve = true;
if(flag)
{
while(N > 0)
Expand Down Expand Up @@ -347,11 +350,10 @@ function reset_canvas(flag = true)

noStroke();

degree_slider.attribute('min', '1');
degree_slider.attribute('max',(INITIAL_NUM_PTS -1).toString());
degree =2;
update_degree_slider();
update_clamped_box();

update_clamped_box();

}

Expand Down Expand Up @@ -425,14 +427,14 @@ function opentab(evt, curve_name) {

function update_degree()
{

console.log("am here!");
degree = Number(degree_slider.value());
}

function set_clamped()
{

clamped_box.value(!clamped_curve);
//document.getElementById('clampedbox').click();
clamped_curve = !clamped_curve;
}

Expand All @@ -443,7 +445,6 @@ function update_degree_slider()

function update_clamped_box()
{
clamped_box.value(clamped_curve);
document.getElementById("clampedbox").checked = clamped_curve;
document.getElementById('clampedbox').click();

}

0 comments on commit 39f782e

Please sign in to comment.