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

Method insertChildView

valdi/src/valdi/snap_drawing/SnapDrawingViewTransaction.cpp:63–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61 setValdiViewNodeToLayer(*layer, viewNode);
62}
63
64void SnapDrawingViewTransaction::insertChildView(const Ref<View>& view,
65 const Ref<View>& childView,
66 int index,
67 const Ref<Animator>& animator) {
68 auto parent = toLayer(view);
69 auto child = toLayer(childView);
70 if (parent == nullptr || child == nullptr) {
71 return;
72 }
73
74 auto* childInsertionLayerProvider = dynamic_cast<IChildInsertionLayerProvider*>(parent.get());
75 if (childInsertionLayerProvider != nullptr) {
76 childInsertionLayerProvider->getChildInsertionLayer().insertChild(child, static_cast<size_t>(index));
77 auto scrollView = Valdi::castOrNull<ScrollLayer>(parent);
78 if (scrollView != nullptr) {
79 auto viewNode = snap::drawing::valdiViewNodeFromLayer(*scrollView);
80 if (viewNode != nullptr) {
81 scrollView->setHorizontal(viewNode->isHorizontal());
82 }
83 }
84 } else {
85 parent->insertChild(child, static_cast<size_t>(index));
86 }
87}

Callers

nothing calls this directly

Calls 5

toLayerFunction · 0.85
valdiViewNodeFromLayerFunction · 0.85
isHorizontalMethod · 0.80
insertChildMethod · 0.45
setHorizontalMethod · 0.45

Tested by

no test coverage detected