2025-10-15 16:33:24 +03:00
|
|
|
#include "TextParagraph.hpp"
|
|
|
|
|
#include <include/core/SkPath.h>
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
|
|
namespace GUIStuff {
|
|
|
|
|
|
2026-03-27 09:51:53 +03:00
|
|
|
TextParagraph::TextParagraph(GUIManager& gui):
|
|
|
|
|
Element(gui) {}
|
|
|
|
|
|
|
|
|
|
void TextParagraph::layout(std::unique_ptr<skia::textlayout::Paragraph> paragraph, float width) {
|
2025-10-15 16:33:24 +03:00
|
|
|
data = std::move(paragraph);
|
|
|
|
|
data->layout(width);
|
2025-12-02 16:09:30 +03:00
|
|
|
CLAY_AUTO_ID({
|
2025-10-15 16:33:24 +03:00
|
|
|
.layout = {
|
|
|
|
|
.sizing = {.width = CLAY_SIZING_FIXED(width), .height = CLAY_SIZING_FIXED(data->getHeight())}
|
|
|
|
|
},
|
|
|
|
|
.custom = { .customData = this }
|
2026-03-27 09:51:53 +03:00
|
|
|
}) {}
|
2025-10-15 16:33:24 +03:00
|
|
|
}
|
|
|
|
|
|
2026-03-20 20:53:59 +03:00
|
|
|
void TextParagraph::clay_draw(SkCanvas* canvas, UpdateInputData& io, Clay_RenderCommand* command, bool skiaAA) {
|
2026-03-27 09:51:53 +03:00
|
|
|
if(data) {
|
|
|
|
|
auto& bb = boundingBox.value();
|
2025-10-15 16:33:24 +03:00
|
|
|
data->paint(canvas, bb.min.x(), bb.min.y());
|
2026-03-27 09:51:53 +03:00
|
|
|
}
|
2025-10-15 16:33:24 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|