Ver Fonte

small changes

Rumei há 5 anos atrás
pai
commit
e64e93eae7

+ 4 - 4
SketchAssistant/SketchAssistantWPF/Armband.cs

@@ -30,7 +30,7 @@ namespace SketchAssistantWPF
         //{
         //    bool valid;
         //    pthread_mutex_t mutex; //TODO fix this
-        //    Thread thread;
+        //    pthread_t thread;
         //    Actuator* actuators; //TODO
         //    uint tactorType;
         //    uint modulation;
@@ -41,19 +41,19 @@ namespace SketchAssistantWPF
         //public class ArduinoHub
         //{
         //    enum ArduinoHub_Type
-        //    { 
+        //    {
         //        ARDUINOHUB_TYPE_PIEZO = 'P',
         //        ARDUINOHUB_TYPE_ERM = 'E',
         //        ARDUINOHUB_TYPE_EMS = 'M'
         //    }
         //    bool valid;
         //    pthread_mutex_t mutex; //TODO fix this
-        //    Thread thread;
+        //    pthread_t thread;
         //    ArduinoHub_Type arduinoType;
         //    Serial* serial;
         //    Actuator* actuators;
         //}
-        
+
         //[DllImport("BodyActuator.dll", EntryPoint = "BodyActuator_actuate")]
         //static extern void pushForward(ref BodyActuator self, byte tactor, double intensity, ulong duration);
 

+ 13 - 18
SketchAssistant/SketchAssistantWPF/MVP_Model.cs

@@ -488,11 +488,15 @@ namespace SketchAssistantWPF
         /// </summary>
         public void Tick()
         {
+            if (cursorPositions.Count > 0) { previousCursorPosition = cursorPositions.Dequeue(); }
+            else { previousCursorPosition = currentCursorPosition; }
             if (optiTrackInUse)
             {
                 if (CheckInsideDrawingZone(optiTrackZ))
                 {
                     SetCurrentFingerPosition(new Point(optiTrackX, optiTrackY));
+                    currentLine.Add(currentCursorPosition);
+                    programPresenter.UpdateCurrentLine(currentLine);
                     if (!optiTrackInsideDrawingZone)
                     {
                         optiTrackInsideDrawingZone = true;
@@ -510,36 +514,27 @@ namespace SketchAssistantWPF
                 }
                 else
                 {
-                    if (optiTrackInsideDrawingZone)
+                    if (optiTrackInsideDrawingZone) //trackable was in drawing zone last tick -> finish line
                     {
                         optiTrackInsideDrawingZone = false;
                         FinishCurrentLine(true);
                         Console.WriteLine("line finished");
                     }
                 }
-                if(optiTrackX != 0 && optiTrackY != 0 && optiTrackZ != 0) {
-                    projectPointOntoScreen(optiTrackX, optiTrackY);
-                }
+                //if (optitrackAvailable) { TODO test and remove
+                projectPointOntoScreen(optiTrackX, optiTrackY);
+                //}
+                cursorPositions.Enqueue(currentCursorPosition);
             }
-            if (cursorPositions.Count > 0) { previousCursorPosition = cursorPositions.Dequeue(); }
-            else { previousCursorPosition = currentCursorPosition; }
-            cursorPositions.Enqueue(currentCursorPosition);
-
-            //Drawing
-            if (optiTrackInUse)
+            else
             {
-                if (CheckInsideDrawingZone(optiTrackZ))
+                cursorPositions.Enqueue(currentCursorPosition);
+                if (inDrawingMode && programPresenter.IsMousePressed())
                 {
-                    Console.WriteLine("point added");
                     currentLine.Add(currentCursorPosition);
-                    programPresenter.UpdateCurrentLine(currentLine);
+                    //programPresenter.UpdateCurrentLine(currentLine);
                 }
             }
-            else if (inDrawingMode && programPresenter.IsMousePressed())
-            {
-                currentLine.Add(currentCursorPosition);
-                //programPresenter.UpdateCurrentLine(currentLine);
-            }
             //Deleting
             if (!inDrawingMode && programPresenter.IsMousePressed())
             {