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