MCPcopy Create free account
hub / github.com/Snapchat/Valdi / fillPointerData

Function fillPointerData

valdi_core/src/valdi_core/cpp/Events/TouchEvents.cpp:59–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59void fillPointerData(ValueMap& map, int pointerCount, Valdi::TouchEvents::PointerLocations& pointerLocations) {
60 static auto pointerCountKey = STRING_LITERAL("pointerCount");
61 static auto pointerLocationsKey = STRING_LITERAL("pointerLocations");
62 static auto xKey = STRING_LITERAL("x");
63 static auto yKey = STRING_LITERAL("y");
64 static auto pointerIdKey = STRING_LITERAL("pointerId");
65
66 auto array = ValueArray::make(pointerLocations.size());
67 for (size_t i = 0; i < pointerLocations.size(); i++) {
68 const Valdi::TouchEvents::PointerData& pointer = pointerLocations[i];
69 auto pointerMap = makeShared<ValueMap>();
70 pointerMap->reserve(3);
71 (*pointerMap)[xKey] = Value(pointer.x);
72 (*pointerMap)[yKey] = Value(pointer.y);
73 (*pointerMap)[pointerIdKey] = Value(pointer.pointerId);
74 array->emplace(i, Value(pointerMap));
75 }
76
77 map[pointerCountKey] = Value(pointerCount);
78 map[pointerLocationsKey] = Value(array);
79}
80
81Value TouchEvents::makeDragEvent(Valdi::TouchEventState state,
82 double x,

Callers 4

makeDragEventMethod · 0.85
makePinchEventMethod · 0.85
makeRotationEventMethod · 0.85
makeTapEventMethod · 0.85

Calls 4

ValueClass · 0.50
sizeMethod · 0.45
reserveMethod · 0.45
emplaceMethod · 0.45

Tested by

no test coverage detected