24 for (uint32_t cid :
ids) {
25 if (
auto* el =
get(cid); el && el->
buffer)
31 for (uint32_t cid :
ids)
35 for (uint32_t cid :
ids)
36 std::erase(related, cid);
38 std::erase_if(
m_relations, [](
const auto& kv) {
return kv.second.empty(); });
57 if (
auto* el =
get(
id)) {
58 el->bounds_hint = bounds;
66 if (
auto* el =
get(
id)) {
75 if (
auto* el =
get(
id)) {
84 if (
auto* el =
get(
id)) {
85 el->interactive = interactive;
96 for (uint32_t member :
closure(
id)) {
97 auto* el =
get(member);
101 el->visible = visible;
102 el->buffer.set_visible(visible);
119 const std::vector<uint32_t>
ids =
closure(
id);
121 auto raise = [
this](uint32_t target) {
123 [target](
const Element& e) {
return e.
id == target; });
133 for (
size_t i = 1; i <
ids.size(); ++i)
145 const std::vector<uint32_t>
ids =
closure(
id);
147 auto lower = [
this](uint32_t target) {
149 [target](
const Element& e) {
return e.
id == target; });
159 for (
size_t i = 1; i <
ids.size(); ++i)
172 for (
const auto& m_element : std::views::reverse(
m_elements)) {
181 std::vector<uint32_t> result;
182 for (
const auto& m_element : std::views::reverse(
m_elements)) {
184 result.push_back(m_element.id);
190 double px,
double py, uint32_t win_w, uint32_t win_h)
const
196 double px,
double py, uint32_t win_w, uint32_t win_h)
const
207 auto* p =
get(primary_id);
208 auto* r =
get(related_id);
209 if (!p || !r || primary_id == related_id)
213 if (std::ranges::find(rel, related_id) == rel.end())
214 rel.push_back(related_id);
216 r->visible = p->visible;
217 r->buffer.set_visible(p->visible);
227 auto& rel = it->second;
228 auto rit = std::ranges::find(rel, related_id);
229 if (rit == rel.end())
240 return it !=
m_relations.end() ? it->second : std::vector<uint32_t> {};
245 std::vector<uint32_t> result {
id };
247 for (
size_t i = 0; i < result.size(); ++i) {
251 for (uint32_t rel_id : it->second) {
252 if (std::ranges::find(result, rel_id) == result.end())
253 result.push_back(rel_id);
267 for (
size_t i = 0; i <
m_elements.size(); ++i)
276 const auto it =
m_index.find(
id);
282 return const_cast<Element*
>(std::as_const(*this).get(
id));
292 return { ndc3.x, ndc3.y };
297 if (!el.interactive || !el.visible)
299 if (el.clip && !el.clip->contains(ndc))
301 if (el.bounds_hint && !el.bounds_hint->contains(ndc))
304 return el.contains(ndc);
305 return el.bounds_hint.has_value();
std::vector< uint64_t > ids
glm::vec3 to_ndc(double window_x, double window_y, uint32_t width, uint32_t height)
Convert window pixel coordinates to NDC.
bool contains(glm::vec2 p) const noexcept
Axis-aligned bounding rectangle in a 2D coordinate space.