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

Method notifyOnDragEnding

valdi/src/valdi/runtime/Context/ViewNodeScrollState.cpp:374–401  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

372 directionAgnosticContentOffset, directionAgnosticUnclampedContentOffset, directionAgnosticVelocity);
373 _onDragEndCallback->call(ValueFunctionFlagsBoundedMainThreadSync, &scrollEvent, 1);
374}
375
376Result<std::optional<Point>> ViewNodeScrollState::notifyOnDragEnding(
377 const Point& directionAgnosticContentOffset,
378 const Point& directionAgnosticUnclampedContentOffset,
379 const Point& directionAgnosticVelocity) const {
380 if (_onDragEndingCallback == nullptr) {
381 return {std::nullopt};
382 }
383 VALDI_TRACE("Valdi.notifyOnDragEnding")
384
385 auto scrollEvent = makeScrollEvent(
386 directionAgnosticContentOffset, directionAgnosticUnclampedContentOffset, directionAgnosticVelocity);
387
388 auto result = _onDragEndingCallback->callSyncWithDeadline(kInputSyncCallDeadline, &scrollEvent, 1);
389 if (!result) {
390 return result.moveError();
391 }
392
393 if (result.value().isNullOrUndefined()) {
394 return {std::nullopt};
395 }
396
397 if (!result.value().isMap()) {
398 return Error("Expecting Point object for onDragEnding");
399 }
400
401 return {Point(*result.value().getMap())};
402}
403
404void ViewNodeScrollState::notifyContentSizeChanged() const {

Callers 1

onDragEndingMethod · 0.80

Calls 8

makeScrollEventFunction · 0.85
valueMethod · 0.65
getMapMethod · 0.65
ErrorInterface · 0.50
PointClass · 0.50
callSyncWithDeadlineMethod · 0.45
isNullOrUndefinedMethod · 0.45
isMapMethod · 0.45

Tested by

no test coverage detected