Commit cef151ce authored by Jérémie Garcia's avatar Jérémie Garcia

debug and multiplay OK

New colors using golden number ratio
parent f9c3c98d
......@@ -12,7 +12,6 @@ if (typeof require !== 'undefined') {
fetchingInterface = null;
}
if(typeof global.interface === 'undefined') { // only run if not reloading...
var OSC_ADMIN_PORT = 10000, WEBSOCKET_ADMIN_PORT = 10001, ids = [];
......
<!DOCTYPE html>
<html>
<string name="app_name">Trajectoires</string>
<head>
<meta charset="utf-8" />
<meta name="apple-mobile-web-app-capable" content="yes">
......@@ -67,8 +65,8 @@
<form>
<label for="flip-loop">Loop Mode:</label>
<select name="flip-loop" id="flip-loop" data-role="slider" data-theme="b" onchange="javascript:Traj.Player.updateLoopMode()">
<option value="off" selected="selected">Off</option>
<option value="on">On</option>
<option value="off" selected="selected">Off</option>
</select>
</form>
<form>
......@@ -110,26 +108,6 @@
</div>
</div>
<div id="sourceSelectDiv">
<button class='sourceButton' id='s1' data-role="none">1</button>
<br/>
<button class='sourceButton' id='s2' data-role="none">2</button>
<br/>
<button class='sourceButton' id='s3' data-role="none">3</button>
<br/>
<button class='sourceButton' id='s4' data-role="none">4</button>
<br/>
<button class='sourceButton' id='s5' data-role="none">5</button>
<br/>
<button class='sourceButton' id='s6' data-role="none">6</button>
<br/>
<button class='sourceButton' id='s7' data-role="none">7</button>
<br/>
<button class='sourceButton' id='s8' data-role="none">8</button>
<br/>
</div>
<div class="canvas-container">
<canvas id="bg-canvas" class="drawing-canvas"></canvas>
<canvas id="traj-canvas" class="drawing-canvas"></canvas>
......@@ -137,21 +115,21 @@
<canvas id="current-canvas" class="drawing-canvas"></canvas>
</div>
<div id="sourceSelectDiv">
<button class='sourceButton' id='s1' data-role="none">1</button><br/>
<button class='sourceButton' id='s2' data-role="none">2</button><br/>
<button class='sourceButton' id='s3' data-role="none">3</button><br/>
<button class='sourceButton' id='s4' data-role="none">4</button><br/>
<button class='sourceButton' id='s5' data-role="none">5</button><br/>
<button class='sourceButton' id='s6' data-role="none">6</button><br/>
<button class='sourceButton' id='s7' data-role="none">7</button><br/>
<button class='sourceButton' id='s8' data-role="none">8</button><br/>
</div>
<div id='drawZone' data-role="none">
<div style="margin-top: 40px" unselectable="on" class="unselectable" >Hold to draw a new curve</div>
</div>
<div id="sessionDiv">
<a id="lblCurrentSession" data-role="button" data-mini="true" data-inline="true" data-inline="true">0</a>
<div id="sessionDivOverCanvas">
<a onClick="javascript:Traj.Session.selectPreviousSession();" data-inline="true" data-role="button" data-iconpos="notext" data-icon="arrow-l"> Previous </a>
<a onClick="javascript:Traj.Session.selectNextSession();" data-inline="true" data-role="button" data-iconpos="notext" data-icon="arrow-r"> Next </a>
<a onClick="javascript:Traj.Session.newSession();" data-inline="true" data-role="button" data-icon="plus" data-iconpos="notext"> New </a>
<a onClick="javascript:Traj.Session.deleteSelectedSession();" data-inline="true" data-role="button" data-icon="delete" data-iconpos="notext">Delete</a>
</div>
</div>
<div class="canvas-left-overlay" id="playDiv">
<div data-role="controlgroup" data-type="horizontal" >
<a onClick="javascript:Traj.View.setCanvasZoom(0.8);" data-role="button" data-theme="a" data-inline="true" style="background: rgba(250, 250, 250, 0.7);"> - </a>
......@@ -167,31 +145,36 @@
<input type="hidden" class="ZSlider" value="0" />
</div>
<div id="contextMenu" style="position:absolute,top:100px,left 300px">
<div id="contextMenu">
<button id="circularButton" class="contextualButton" >Circular</button>
<button id="concatButton" class="contextualButton" >Concat</button>
</div>
<div id="longTouchMenu" style="position:absolute, top:100px,left 300px, visibility: hidden">
<a href="#" onClick="javascript:Traj.Manager.deleteCurrentCurve(); Traj.Events.hideLongTouchMenu();" data-mini="true" data-role="button" data-icon="delete">Remove</a>
<a href="#" onClick="javascript:Traj.Manager.SelectandRedrawEdit(); Traj.Events.hideLongTouchMenu();" data-mini="true" data-role="button" data-icon="edit">Select and redraw</a>
<div id="longTouchMenu">
<a href="#" onClick="javascript:Traj.Manager.SelectandRedrawEdit(); Traj.Events.hideLongTouchMenu();" data-mini="true" data-role="button" data-icon="edit">Redraw</a>
<a href="#" onClick="javascript:Traj.Manager.duplicateCurrentCurve(); Traj.Events.hideLongTouchMenu();" data-mini="true" data-role="button">Duplicate</a>
<a href="#" onClick="javascript:Traj.manager.copyCurrentCurve(); Traj.Events.hideLongTouchMenu();" data-mini="true" data-role="button">Copy</a>
<a href="#" onClick="javascript:Traj.Manager.pasteInCurrentCurve(); Traj.Events.hideLongTouchMenu();" data-mini="true" data-role="button">Paste</a>
<a href="#" onClick="javascript:Traj.Manager.simplifyCurrentCurve(0.01); Traj.Events.hideLongTouchMenu();" data-mini="true" data-role="button">Simplify (Soft)</a>
<a href="#" onClick="javascript:Traj.Manager.simplifyCurrentCurve(0.1); Traj.Events.hideLongTouchMenu();" data-mini="true" data-role="button">Simplify (Hard)</a>
</div>
<div class="canvas-bot-overlay" id="slider-div" style: "position: absolute, bottom:40">
<input type="hidden" class="timeSlider" value="0" />
</div>
<div id="sessionDiv">
<a id="lblCurrentSession" data-role="button" data-mini="true" data-inline="true" data-inline="true">0</a>
<div id="sessionDivOverCanvas">
<a onClick="javascript:Traj.Session.selectPreviousSession();" data-inline="true" data-role="button" data-iconpos="notext" data-icon="arrow-l"> Previous </a>
<a onClick="javascript:Traj.Session.selectNextSession();" data-inline="true" data-role="button" data-iconpos="notext" data-icon="arrow-r"> Next </a>
<a onClick="javascript:Traj.Session.newSession();" data-inline="true" data-role="button" data-icon="plus" data-iconpos="notext"> New </a>
<a onClick="javascript:Traj.Session.deleteSelectedSession();" data-inline="true" data-role="button" data-icon="delete" data-iconpos="notext">Delete</a>
</div>
</div>
<div id=footer data-role="footer">
<div class="right" id="options-div">
<a href="#" onClick="javascript:Traj.Session.exportCurrentCurve();" data-mini="true" data-role="button">Export</a>
<!--<a href="#" onClick="javascript:exportCurrentCurveAsAntescofoNIM();" data-mini="true" data-role="button">AntescofoNIM</a> -->
</div>
</div>
<!-- /footer -->
</div>
......@@ -206,5 +189,4 @@
});
</script>
</body>
</html>
\ No newline at end of file
......@@ -226,11 +226,10 @@ a.curveMenuButton {
background-color: rgba(255, 255, 255, 0.8);
}
#touchLongMenu {
#longTouchMenu {
position: absolute;
z-index: 3;
width : 100px;
width : 130px;
top : 20%;
right: 20%
}
......@@ -245,7 +244,6 @@ a.curveMenuButton {
height:40px;
}
#spaceStretchDiv > input {
width: 50px;
......@@ -279,6 +277,12 @@ a.curveMenuButton {
text-align: center;
}
#contextMenu{
position:absolute;
height: 30px;
width:100 px;
}
.contextualButton{
background-color: white;
border-radius: 50%;
......
......@@ -373,10 +373,6 @@ Traj.Player = {
cancelAnimationFrame(this.requestId);
this.requestId = undefined;
}
// if (this.loopID) {
// clearTimeout(this.loopID);
// this.loopID = undefined;
// }
Traj.View.dyn_repaint();
Traj.Player.isPlaying = false;
Traj.OSC.sendPlay("end");
......@@ -388,8 +384,6 @@ Traj.Player = {
}
},
repaintPoint : function(curve,point) {
var dyn_ctx = Traj.View.dyn_ctx;
......@@ -409,7 +403,7 @@ Traj.Player = {
pos,
last_pos;
dyn_ctx.lineWidth = Traj.View.CURVE_ACTIVE_STROKE_SIZE *2.5;
dyn_ctx.lineWidth = Traj.View.CURVE_ACTIVE_STROKE_SIZE *1.3;
dyn_ctx.strokeStyle = curve.color;
//Traj.View.traj_repaint();
if (index>0) {
......
......@@ -7,6 +7,8 @@ Mathematical utilities for curves processing
Traj.Utils = {
golden_ratio_conjugate : 0.618033988749895,
//events utilities
getStartEventName : function(){
return Traj.onmobile ? 'touchstart' : 'mousedown';
......@@ -89,19 +91,38 @@ Traj.Utils = {
var distanceToPoint1 = this.distanceBtwPoints(projectedPoint,pointsLine[1]);
var lengthLine = this.distanceBtwPoints(pointsLine[0],pointsLine[1]);
if (distance < 1 ) {//seuil
if (lengthLine < distanceToPoint0 || lengthLine < distanceToPoint1) {
console.log('false')
return false;
} else {
console.log('true')
return true;
}
} else { return false;}
return (!(lengthLine < distanceToPoint0 || lengthLine < distanceToPoint1));
} else {
return false;
}
},
HSVtoRGB : function (h, s, v) {
var r, g, b, i, f, p, q, t;
i = Math.floor(h * 6);
f = h * 6 - i;
p = v * (1 - s);
q = v * (1 - f * s);
t = v * (1 - (1 - f) * s);
switch (i % 6) {
case 0: r = v, g = t, b = p; break;
case 1: r = q, g = v, b = p; break;
case 2: r = p, g = v, b = t; break;
case 3: r = p, g = q, b = v; break;
case 4: r = t, g = p, b = v; break;
case 5: r = v, g = p, b = q; break;
}
return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
},
rgbToHex : function (rgb) {
return "#" + ((1 << 24) + (rgb[0] << 16) + (rgb[1] << 8) + rgb[2]).toString(16).slice(1);
},
getColorForIndex : function(idx) {
return Traj.View.default_colors[(idx + Traj.View.default_colors.length) % Traj.View.default_colors.length];
},
getColorSource : function(source) {
return Traj.View.default_colors[(source-1)%Traj.View.default_colors.length];
},
......
......@@ -17,7 +17,7 @@ Traj.View = {
current_ctx : {}, //associated context
// Unit converter
scaleFactor : 4,
scaleFactor : 8,
minWH : {}, //Ratios of Width and height to be changed dynamically on init
pixToValue : 1,
......@@ -30,12 +30,20 @@ Traj.View = {
//curve drawing vars
backgroundCurve : true, //boolean to display or not the curves in background
COLOR_SCALE : '#505050', //background color for scale
//defaults colors for the curves, should rather use an algorithm using Golden ratio
//and dynamic affectation depending on the number of sources
default_colors : ['#373737', '#e69a00', '#5a9f29', '#e63d00', '#005788', '#810A69', '#2C827B', '#C6C027'],
default_colors : [],
start_hue : 0.34,
initSourcesColors : function (nbSources){
for(var i = 0; i< Traj.Manager.NB_SOURCES;i++){
var h = (this.start_hue + i*Traj.Utils.golden_ratio_conjugate)%1,
col = Traj.Utils.HSVtoRGB(h, 0.95, 0.68);
this.default_colors[i] = Traj.Utils.rgbToHex(col);
}
},
FIRST_POINT_SIZE : 5, //pix
CURVE_STROKE_SIZE : 2,
CURVE_ACTIVE_STROKE_SIZE : 2,
CURVE_ACTIVE_STROKE_SIZE : 4,
CURVE_ALPHA : 0.4,
CURVE_ACTIVE_ALPHA : 0.9,
......@@ -82,9 +90,12 @@ Traj.View = {
this.minWH = Math.min(this.dyn_canvas.width, this.dyn_canvas.height);
this.pixToValue = this.scaleFactor / this.minWH;
this.initSourcesColors();
this.repaintAll();
},
//used to clear any of the graphics contexts
clearContext : function(ctx) {
ctx.clearRect(0, 0, this.dyn_canvas.width, this.dyn_canvas.height);
......@@ -104,7 +115,6 @@ Traj.View = {
ctx.stroke();
},
drawCurve : function(ctx, curve, index, linewidth, alpha,withPoint) {
ctx.lineWidth = linewidth;
ctx.fillStyle = curve.color;
......@@ -134,21 +144,6 @@ Traj.View = {
ctx.globalAlpha = 1;
},
drawAllCurves : function(ctx) {
var alpha_stroke,
lwidth,
drawPoint,
currentCurveIndex = Traj.Manager.currentCurveIndex,
trajectories = Traj.Manager.trajectories;
for (var i = 0; i < trajectories.length; i++) {
alpha_stroke = (trajectories[i].multiPlay) ? this.CURVE_ACTIVE_ALPHA-0.1 : this.CURVE_ALPHA;
lwidth = (trajectories[i].multiPlay) ? this.CURVE_ACTIVE_STROKE_SIZE-1 : this.CURVE_STROKE_SIZE;
drawPoint = false ;
this.drawCurve(ctx, trajectories[i], i, lwidth, alpha_stroke, drawPoint);
}
},
//////////////////////////////////
//////// BACKGROUND DRAWING///////
//////////////////////////////////
......@@ -257,10 +252,45 @@ Traj.View = {
//////// Trajectories DRAWING///////
//////////////////////////////////
drawAllCurves : function(ctx) {
var alpha_stroke,
lwidth,
drawPoint,
currentCurveIndex = Traj.Manager.currentCurveIndex,
trajectories = Traj.Manager.trajectories;
for (var i = 0; i < trajectories.length; i++) {
alpha_stroke = (trajectories[i].multiPlay) ? this.CURVE_ACTIVE_ALPHA-0.1 : this.CURVE_ALPHA;
lwidth = (trajectories[i].multiPlay) ? this.CURVE_ACTIVE_STROKE_SIZE-1 : this.CURVE_STROKE_SIZE;
drawPoint = false ;
this.drawCurve(ctx, trajectories[i], i, lwidth, alpha_stroke, drawPoint);
}
},
drawAllBackgroundCurves : function(){
var ctx = this.traj_ctx,
alpha_stroke,
lwidth,
drawPoint,
currentCurveIndex = Traj.Manager.currentCurveIndex,
trajectories = Traj.Manager.trajectories,
multiplay_idx = Traj.Manager.getMultiPlayIndexes();
for (var i = 0; i < trajectories.length; i++) {
if(i!= Traj.Manager.currentCurveIndex){
alpha_stroke = (multiplay_idx.indexOf(i)!==-1) ? this.CURVE_ACTIVE_ALPHA : this.CURVE_ALPHA;
lwidth = this.CURVE_STROKE_SIZE;
drawPoint = false ;
this.drawCurve(ctx, trajectories[i], i, lwidth, alpha_stroke, drawPoint);
}
}
},
traj_repaint : function() {
this.clearContext(this.traj_ctx);
if (this.backgroundCurve) {
this.drawAllCurves(this.traj_ctx);
this.drawAllBackgroundCurves();
}
},
......
......@@ -244,7 +244,6 @@ Traj.Events = {
}
},
handleMouseDown : function(evt) {
if (Traj.View.touchState === 'wait') {
Traj.View.touchState = '1touch';
......@@ -565,7 +564,9 @@ Traj.Events = {
Traj.Manager.currentSource = source;
var curve = Traj.Manager.trajectories[Traj.Manager.currentCurveIndex];
if (curve != undefined) {
var prev_source = curve.sourceNumber;
curve.changeSource(source);
Traj.Manager.updateMultiPlayForSourceChange(Traj.Manager.currentCurveIndex,prev_source,source);
}
Traj.View.current_repaint();
Traj.View.traj_repaint();
......@@ -662,10 +663,12 @@ Traj.Events = {
var circularButton = document.getElementById('circularButton'),
concatButton = document.getElementById('concatButton');
handleTouchCircular = function() {
Traj.Manager.processMakeCircular();
Traj.Events.hideContextMenu();
},
handleTouchConcat = function() {
var curve = Traj.Manager.trajectories[Traj.Manager.modifiedCurve];
......@@ -684,6 +687,8 @@ Traj.Events = {
},
hideContextMenu : function() {
var divMenu = document.getElementById("contextMenu");
document.getElementById("circularButton").style.visibility = 'hidden';
document.getElementById("concatButton").style.visibility = 'hidden';
divMenu.style.visibility = "hidden";
},
......@@ -693,24 +698,19 @@ Traj.Events = {
var divMenu = document.getElementById("contextMenu"),
curve = Traj.Manager.trajectories[Traj.Manager.currentCurveIndex],
pos = Traj.Utils.convertUnitsIntoCanvasPos([curve.X[curve.X.length-1],curve.Y[curve.X.length-1]]);
if(circular&&concat){
document.getElementById("circularButton").style.display = "block";
document.getElementById("concatButton").style.display = "block";
} else if (circular){
document.getElementById("circularButton").style.display = "block";
document.getElementById("concatButton").style.display = "none";
}else{
if(!circular && concat){ //display at the first point
pos = Traj.Utils.convertUnitsIntoCanvasPos([curve.X[0],curve.Y[0]]);
document.getElementById("circularButton").style.display = "none";
document.getElementById("concatButton").style.display = "block";
pos[1] = pos[1] - 60;
}
document.getElementById("circularButton").style.visibility = circular ? 'visible' : 'hidden';
document.getElementById("concatButton").style.visibility = concat ? 'visible' : 'hidden';
divMenu.style.left = pos[0] + "px";
divMenu.style.top = pos[1] + "px";
divMenu.style.top = (pos[1] - 40) + "px";
divMenu.style.visibility = "visible";
setTimeout(Traj.Events.hideContextMenu,6000);
setTimeout(Traj.Events.hideContextMenu,7000);
}
},
......
......@@ -9,10 +9,10 @@ Traj.Manager = {
currentSource : 1, //the current selected source (apply to a selected source or set for the next one)
modifiedCurve : null,
NB_SOURCES : 8,
multiplay_indexes : [], //list of curve to play for each source indexes
multiplay_indexes : [], //list of curve index to play for each source indexes i.e. if 4 sources = [0, 'undefined', 23, 'undeifned']
//MULTIPLAY//
//find all possible curves indexes matching the source nb
getPossibleTrajIndexesForSource : function (source_idx){
var traj_indexes = [];
var cpt = 0;
......@@ -25,14 +25,33 @@ Traj.Manager = {
return traj_indexes;
},
//this methods returns an array containeng the indexes of the curves for MultiPlay
getMultiPlayIndexes : function(active_index){
//returns the traj index or undefined for the source asked
findTrajforMissingSource : function (sourceNB){
var idx = Traj.Manager.getPossibleTrajIndexesForSource(sourceNB);
if(idx.length>0){
return idx[idx.length - 1];
}else{
return'undefined';
}
},
//this methods populates the multiplay_indexes array
createMultiPlayIndexes : function(){
var indexes = [];
//for each sources
for (var i = 0 ; i < Traj.Manager.NB_SOURCES; i++) {
indexes[i] = Traj.Manager.findTrajforMissingSource(i+1);
}
this.multiplay_indexes = indexes;
},
//this methods returns an array containeng the curves' indexes for MultiPlay
getMultiPlayIndexes : function(){
var indexes = [],
cpt =0,
multi = Traj.Manager.multiplay_indexes;
for (var i = 0; i < multi.length; i++) {
if(multi[i] !== 'undefined'){
indexes[cpt] = multi[i];
cpt++;
......@@ -41,29 +60,32 @@ Traj.Manager = {
return indexes;
},
//this methods update the multiplay indexes with the current curve
//this methods update the multiplay indexes with the current selected curve
updateMultiPlayIndexes : function(source_nb, curve_index){
Traj.Manager.multiplay_indexes[(source_nb-1)] = curve_index;
},
createMultiPlayIndexes : function(){
var indexes = [];
//for each sources
for (var i = 0 ; i < Traj.Manager.NB_SOURCES; i++) {
var idx = 'undefined';
//for each curves we search for the last traj with the correct source number
for (var j = 0; j < Traj.Manager.trajectories.length; j++) {
var curve = Traj.Manager.trajectories[j];
//if correct, store the index
if((curve.sourceNumber - 1) === i){
idx = j;
//called when a trajectorie gets a new source number
updateMultiPlayForSourceChange: function (index,prev_source,new_source){
var multi = Traj.Manager.multiplay_indexes;
multi[prev_source-1] = Traj.Manager.findTrajforMissingSource(prev_source);
multi[new_source-1] = index;
Traj.Manager.multiplay_indexes = multi;
},
//decrease all indexes by one if they are more or equal than the deleted curve (delted before the call)
updateMultiForDeletedCurve : function(index){
var multi = Traj.Manager.multiplay_indexes;
for (var i = 0; i < multi.length; i++) {
if(multi[i] !== 'undefined'){
if(multi[i]> index){
multi[i] = multi[i]-1;
}else if (multi[i]===index){
multi[i] = Traj.Manager.findTrajforMissingSource(i + 1);
}
}
indexes[i] = idx;
}
this.multiplay_indexes = indexes;
Traj.Manager.multiplay_indexes = multi;
},
setTrajectories : function(traj_array){
......@@ -78,10 +100,8 @@ Traj.Manager = {
if(Traj.Manager.hasSelectedCurve()){
Traj.Manager.modifiedCurve = Traj.Manager.currentCurveIndex; // keep the curve to be modified
Traj.Manager.currentCurveIndex = Traj.Manager.currentCurveIndex + 1;
}else{
Traj.Manager.currentCurveIndex = Traj.Manager.trajectories.length;
}
Traj.Manager.currentCurveIndex = Traj.Manager.trajectories.length;
timeStart = t;
Traj.Manager.currentCurve = new TimedCurve(Traj.Manager.currentSource);
......@@ -96,6 +116,7 @@ Traj.Manager = {
Traj.View.clearContext(Traj.View.current_ctx);
}
Traj.View.traj_repaint();
Traj.OSC.streamNewCurve(Traj.Manager.currentCurveIndex);
Traj.OSC.streamCurveLastPoint(Traj.Manager.currentCurve);
},
......@@ -166,8 +187,6 @@ Traj.Manager = {
currentCurve.addTimedPoint(firstPoint[0],firstPoint[1],currentCurve.Z[0],currentCurve.t[curveLength]+distance/speed);
Traj.Manager.trajectories[curveIndex] = currentCurve;
Traj.Manager.selectCurve(Traj.Manager.trajectories.length-1); // avant ou après
//Traj.Manager.processEndCurveEnd(currentCurve,curveIndex);
// clearInterval(Traj.Manager.idContextMenu);
},
processModifyCurve : function() {
......@@ -178,7 +197,6 @@ Traj.Manager = {
lastPoint = Traj.Utils.findPointIdx(rangeTime[1],curve);
this.clipboardCurve = newCurve;
this.pasteInCurveAndAdapt(curve,firstPoint,lastPoint);
this.selectCurve(this.trajectories.length-1);
},
......@@ -288,14 +306,13 @@ Traj.Manager = {
curve.t.splice(beginIdx+k,0,clipboardCurve.t[k]+rangeTime[0]);
}
curve.t[0] = 0;
Traj.Manager.trajectories.push(curve);
Traj.Events.initSlider(false);
Traj.Events.initSlider(false);
},
deleteCurve : function(index) {
Traj.Manager.trajectories.splice(index, 1);
Traj.Manager.updateMultiForDeletedCurve(index);
Traj.Manager.selectCurve((Traj.Manager.currentCurveIndex - 1 + Traj.Manager.trajectories.length) % Traj.Manager.trajectories.length);
Traj.View.traj_repaint();
Traj.View.dyn_repaint();
......@@ -316,9 +333,7 @@ Traj.Manager = {
var lastCurveIdx = Traj.Manager.currentCurveIndex;
Traj.Manager.currentCurveIndex = index;
Traj.Manager.currentCurveLbl.innerHTML = (index===-1) ? " " : ( "" + Traj.Manager.currentCurveIndex);
Traj.View.traj_repaint();
Traj.View.dyn_repaint();
Traj.View.current_repaint();
//update the source color button
if(Traj.Manager.getCurrentCurve()){
......@@ -332,6 +347,12 @@ Traj.Manager = {
if (Traj.Manager.trajectories[index] && index!=lastCurveIdx) {
Traj.Events.initSlider(false);
}
//redraw
Traj.View.traj_repaint();
Traj.View.dyn_repaint();
Traj.View.current_repaint();
Traj.Session.saveTrajSession();
},
......@@ -449,8 +470,7 @@ Traj.Manager = {
var currentCurve = Traj.Manager.trajectories[Traj.Manager.currentCurveIndex];
if (currentCurve != undefined) {
var newCurve = Traj.Utils.simplifyCurve(currentCurve,tolerance);
Traj.Manager.trajectories.push(newCurve);
Traj.Manager.selectCurve(Traj.Manager.trajectories.length-1);
Traj.Manager.trajectories[Traj.Manager.currentCurveIndex] = newCurve ;
}
},
......@@ -463,7 +483,6 @@ Traj.Manager = {
$("#playDiv").show();
Traj.View.bg_repaint(true);
}
Traj.Events.hideLongTouchMenu();
},
changeScale : function (){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment