MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / highlight

Function highlight

Source/CocosExplorer.cpp:61–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61void highlight(ax::Node* node, bool selected)
62{
63 ax::Point bb_min(node->getBoundingBox().getMinX(), node->getBoundingBox().getMinY());
64 ax::Point bb_max(node->getBoundingBox().getMaxX(), node->getBoundingBox().getMaxY());
65 auto& foreground = *ImGui::GetForegroundDrawList();
66 auto parent = node->getParent();
67
68 auto camera_parent = node;
69 while (camera_parent)
70 {
71 auto camera = Camera::getDefaultCamera();
72
73 if (camera) {
74 const ax::Mat4& viewMatrix = camera->getViewMatrix();
75 const ax::Point offset(viewMatrix.m[3], viewMatrix.m[7]);
76 bb_min -= offset;
77 bb_max -= offset;
78 }
79
80 camera_parent = camera_parent->getParent();
81 }
82
83 auto min = cocos_to_vec2(parent ? parent->convertToWorldSpace(bb_min) : bb_min);
84 auto max = cocos_to_vec2(parent ? parent->convertToWorldSpace(bb_max) : bb_max);
85
86 foreground.AddRectFilled(min, max, selected ? IM_COL32(200, 200, 255, 60) : IM_COL32(255, 255, 255, 70));
87}
88
89void drawProperties()
90{

Callers 1

drawFunction · 0.85

Calls 1

cocos_to_vec2Function · 0.85

Tested by

no test coverage detected