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

update++

Cleaning events and manager files
Many things to clean and update multiplay
parent 17396aef
WOB/qr_code.png

620 Bytes | W: | H:

WOB/qr_code.png

624 Bytes | W: | H:

WOB/qr_code.png
WOB/qr_code.png
WOB/qr_code.png
WOB/qr_code.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -322,6 +322,7 @@
<script type="text/javascript">
$(document).ready(function() {
//Traj.Session.clearTrajSessions();
Traj.initialize();
$.mobile.loading().hide();
});
......
This diff is collapsed.
......@@ -2,13 +2,11 @@
Traj.Manager = {
//Curves
trajectories : [], //Array of TimedCurves
currentCurveIndex : 0,
currentCurve : null,
currentCurveLbl : "",
clipboardCurve : null,
currentSource : 1,
circular : false,
idContextMenu : null,
currentCurveIndex : 0, //Index Of the sekected curve
currentCurve : null,
currentCurveLbl : "", //label for html display
clipboardCurve : null, //temporary curve to paste
currentSource : 1, //the current selected source (apply to a selected source or set for the next one)
modifiedCurve : null,
......@@ -54,64 +52,61 @@ Traj.Manager = {
processEndCurve : function(x, y, z, t) {
Traj.State.newAction();
//TODO use actual length instead of number of points...
if (Traj.Manager.currentCurve !== null && Traj.Manager.currentCurve.X.length > 4) {
var curveIndex = Traj.Manager.currentCurveIndex;
var currentCurve = Traj.Manager.currentCurve;
Traj.Manager.trajectories.push(currentCurve.clone());
Traj.Events.initSlider(false); // update TimeSlider
Traj.Manager.currentCurve = null;
Traj.View.dyn_repaint();
Traj.View.traj_repaint();
Traj.Session.saveTrajSession(); // save session
//TODO use actual length instead of number of points...
if (Traj.Manager.currentCurve !== null && Traj.Manager.currentCurve.X.length > 4) {
var curveIndex = Traj.Manager.currentCurveIndex;
var currentCurve = Traj.Manager.currentCurve;
Traj.Manager.trajectories.push(currentCurve.clone());
var curveSendIdx = Traj.Manager.trajectories.length-1;
if(Traj.Manager.trajectories[curveIndex].X.length <1000){
Traj.OSC.sendCurveSingleMessageOSC(Traj.Manager.trajectories[curveSendIdx], curveSendIdx);
}else{
Traj.OSC.sendCurveOSC(Traj.Manager.trajectories[curveSendIdx], curveSendIdx);
}
Traj.OSC.sendDraw('end');
Traj.Manager.selectCurve(Traj.Manager.trajectories.length-1); // avant ou après
Traj.Events.drawing = false;
// Variables for circular or concat
var currentCurve = Traj.Manager.trajectories[Traj.Manager.currentCurveIndex],
lastCurve = Traj.Manager.trajectories[Traj.Manager.modifiedCurve],
curveLength = currentCurve.X.length-1,
firstPoint = [currentCurve.X[0],currentCurve.Y[0]],
lastPoint = [currentCurve.X[curveLength],currentCurve.Y[curveLength]],
distance = Traj.Utils.distanceBtwPoints(firstPoint,lastPoint);
Traj.Events.initSlider(false); // update TimeSlider
if (typeof(lastCurve)!=='undefined') {
var lastPointLastCurve = [lastCurve.X[lastCurve.X.length-1],lastCurve.Y[lastCurve.X.length-1]]; // TODO : use pixel distance
var distance2 = Traj.Utils.distanceBtwPoints(firstPoint,lastPointLastCurve);
} else { var distance2 = Infinity;}
Traj.Manager.currentCurve = null;
Traj.View.dyn_repaint();
Traj.View.traj_repaint();
// TODO : separate distance for circular and for concat
if (distance < 0.6 || distance2 < 0.6) {
Traj.Events.showContextMenu();
}
Traj.Session.saveTrajSession(); // save session
var curveSendIdx = Traj.Manager.trajectories.length-1;
if(Traj.Manager.trajectories[curveIndex].X.length <1000){
Traj.OSC.sendCurveSingleMessageOSC(Traj.Manager.trajectories[curveSendIdx], curveSendIdx);
}else{
Traj.OSC.sendCurveOSC(Traj.Manager.trajectories[curveSendIdx], curveSendIdx);
}
Traj.OSC.sendDraw('end');
Traj.Manager.selectCurve(Traj.Manager.trajectories.length-1); // avant ou après
Traj.Events.drawing = false;
// Variables for circular or concat
var currentCurve = Traj.Manager.trajectories[Traj.Manager.currentCurveIndex],
lastCurve = Traj.Manager.trajectories[Traj.Manager.modifiedCurve],
curveLength = currentCurve.X.length-1,
firstPoint = [currentCurve.X[0],currentCurve.Y[0]],
lastPoint = [currentCurve.X[curveLength],currentCurve.Y[curveLength]],
distance = Traj.Utils.distanceBtwPoints(firstPoint,lastPoint);
if (typeof(lastCurve)!=='undefined') {
var lastPointLastCurve = [lastCurve.X[lastCurve.X.length-1],lastCurve.Y[lastCurve.X.length-1]]; // TODO : use pixel distance
var distance2 = Traj.Utils.distanceBtwPoints(firstPoint,lastPointLastCurve);
} else {
var distance2 = Infinity;
}
}else{
Traj.Manager.currentCurve = null;
Traj.Manager.selectPreviousCurve();
Traj.View.dyn_repaint();
Traj.OSC.sendDraw('end');
Traj.Manager.selectCurve(Traj.Manager.trajectories.length-1); // avant ou après
}
// TODO : separate distance for circular and for concat
if (distance < 0.6 || distance2 < 0.6) {
Traj.Events.showContextMenu();
}
}else{
Traj.Manager.currentCurve = null;
Traj.Manager.selectPreviousCurve();
Traj.View.dyn_repaint();
Traj.OSC.sendDraw('end');
Traj.Manager.selectCurve(Traj.Manager.trajectories.length-1); // avant ou après
}
},
processMakeCircular : function(currentCurve,curveIndex) {
var curveIndex = Traj.Manager.currentCurveIndex,
currentCurve = Traj.Manager.trajectories[curveIndex],
......
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