2025-10-15 16:33:24 +03:00
|
|
|
#include "TextParagraph.hpp"
|
|
|
|
|
#include <include/core/SkPath.h>
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
|
|
namespace GUIStuff {
|
|
|
|
|
|
|
|
|
|
void TextParagraph::update(UpdateInputData& io, std::unique_ptr<skia::textlayout::Paragraph> paragraph, float width, const std::function<void()>& elemUpdate) {
|
|
|
|
|
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 }
|
|
|
|
|
}) {
|
|
|
|
|
if(elemUpdate)
|
|
|
|
|
elemUpdate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-20 20:53:59 +03:00
|
|
|
void TextParagraph::clay_draw(SkCanvas* canvas, UpdateInputData& io, Clay_RenderCommand* command, bool skiaAA) {
|
2025-10-15 16:33:24 +03:00
|
|
|
bb = get_bb(command);
|
|
|
|
|
|
|
|
|
|
if(data)
|
|
|
|
|
data->paint(canvas, bb.min.x(), bb.min.y());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|