Donner SVG 0.8.0-pre
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
DisclosureChevron.h File Reference

Shared tree-disclosure chevron used by both the inspector tree and the LayersPanel so the two trees present one consistent disclosure style. More...

#include <optional>
#include <span>
#include "donner/base/Vector2.h"
#include "donner/editor/EmbeddedSvgIcon.h"
#include "donner/editor/ImGuiIncludes.h"
#include "donner/svg/renderer/RendererInterface.h"
Include dependency graph for DisclosureChevron.h:

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.

Functions

const std::optional< svg::RendererBitmap > & donner::editor::CachedDisclosureChevronBitmap (bool expanded)
 Cached white-mask bitmap for the disclosure chevron in the given state (right-pointing when collapsed, down-pointing when expanded), or std::nullopt if rendering failed. Rendered lazily on first use.
int donner::editor::DisclosureChevronTextureVariant (bool expanded)
 Stable texture-cache key suffix (0 collapsed, 1 expanded) so callers upload and reuse the two chevron masks as distinct textures.
std::span< const EmbeddedSvgIconRequestdonner::editor::DisclosureChevronPrewarmRequests ()
 Both chevron rasterizations, for the shell's startup prewarm batch. The two masks are cached together on first use, so a tree row of either state pays for both.
void donner::editor::DrawDisclosureChevron (ImDrawList *drawList, ImTextureID texture, const Vector2d &uvBottomRight, const ImVec2 &center, float sizePx, ImU32 tint)
 Blit an already-uploaded chevron texture centered at center within a sizePx square, tinted tint. The texture's valid payload UV range is [0, uvBottomRight].

Variables

constexpr int donner::editor::kDisclosureChevronRasterSizePx = 32
 Raster size (device px) for the shared chevron masks. Rendered once each and scaled down at draw time.

Detailed Description

Shared tree-disclosure chevron used by both the inspector tree and the LayersPanel so the two trees present one consistent disclosure style.

The chevron art is editor-authored SVG (donner/editor/icons/chevron.svg and chevron-down.svg), Donner-rendered to a tintable white mask via RenderEmbeddedSvgIcon. Two axis-aligned assets (right for collapsed, down for expanded) are used so the mask can be blitted with the sanctioned AddImage path rather than a rotated quad.