Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void XMTelestration::onTouchMoved(int index, float x, float y)
- {
- KEEP_ALIVE
- PortableLockGuard<std::recursive_mutex> guard(mtx);
- auto tx = x;
- auto ty = y;
- auto aspect = renderer->getAspectRatio();
- if (aspect > 1.0)
- ty /= aspect;
- else
- tx *= aspect;
- auto currentLineDrawing = existingDrawingFor(index);
- if (currentLineDrawing == nullptr)
- {
- currentLineDrawing.reset(new XMTelestrationLine(stroke.withWidth(stroke.width * previewScale)));
- currentDrawings[index] = currentLineDrawing;
- }
- renderer->getAspectRatio();
- currentLineDrawing->addPoint(
- tx * (width*previewScale) / 2.0f + (width*previewScale) / 2.0f,
- ty * (height*previewScale) / 2.0f + (height*previewScale) / 2.0f);
- updateQueue->invoke([this, SELF, currentLineDrawing]() {
- updateLayers(Preview);
- if (hub)
- {
- auto lineDrawing = std::make_shared<XMTelestrationLine>(*currentLineDrawing);
- lineDrawing->scale(1.0f / previewScale);
- hub->broadcastMessage(std::make_shared<AddTelestrationMessage>(lineDrawing));
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement