Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.04 KB | None | 0 0
  1. void XMTelestration::onTouchMoved(int index, float x, float y)
  2. {
  3.     KEEP_ALIVE
  4.  
  5.     PortableLockGuard<std::recursive_mutex> guard(mtx);
  6.  
  7.     auto tx = x;
  8.     auto ty = y;
  9.  
  10.     auto aspect = renderer->getAspectRatio();
  11.     if (aspect > 1.0)
  12.         ty /= aspect;
  13.     else
  14.         tx *= aspect;
  15.  
  16.  
  17.     auto currentLineDrawing = existingDrawingFor(index);
  18.  
  19.     if (currentLineDrawing == nullptr)
  20.     {
  21.         currentLineDrawing.reset(new XMTelestrationLine(stroke.withWidth(stroke.width * previewScale)));
  22.         currentDrawings[index] = currentLineDrawing;
  23.     }
  24.  
  25.     renderer->getAspectRatio();
  26.  
  27.     currentLineDrawing->addPoint(
  28.         tx * (width*previewScale) / 2.0f + (width*previewScale) / 2.0f,
  29.         ty * (height*previewScale) / 2.0f + (height*previewScale) / 2.0f);
  30.  
  31.     updateQueue->invoke([this, SELF, currentLineDrawing]() {
  32.  
  33.         updateLayers(Preview);
  34.  
  35.         if (hub)
  36.         {
  37.             auto lineDrawing = std::make_shared<XMTelestrationLine>(*currentLineDrawing);
  38.             lineDrawing->scale(1.0f / previewScale);
  39.  
  40.             hub->broadcastMessage(std::make_shared<AddTelestrationMessage>(lineDrawing));
  41.         }
  42.     });
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement