Browse Source

fix startX for non-bound components

pull/2/head
Odilitime 5 years ago
parent
commit
6acad9d2d2
  1. 8
      src/graphics/components/TextComponent.cpp

8
src/graphics/components/TextComponent.cpp

@ -110,14 +110,11 @@ void TextComponent::rasterize(const int rawX, const int rawY) { @@ -110,14 +110,11 @@ void TextComponent::rasterize(const int rawX, const int rawY) {
//glyphs = textRasterizer->rasterize(text, rawX, windowWidth, wrapToX, width, height, glyphCount, endingX, endingY, wrapped);
rasterizationRequest request;
request.text = text;
// startX needs to be relative to the parent x. Why?
// I think for non-boundComponents
request.startX = rawX; // - x
/*
if (!boundToPage) {
// startX needs to be relative to the parent x. Why?
request.startX -= x;
}
*/
//std::cout << "TextComponent::rasterize - [" << text << "] request.startX: " << request.startX << " x: " << x << " rawX: " << rawX << std::endl;
request.availableWidth = availableWidth;
request.sourceStartX = rasterStartX;
@ -126,7 +123,8 @@ void TextComponent::rasterize(const int rawX, const int rawY) { @@ -126,7 +123,8 @@ void TextComponent::rasterize(const int rawX, const int rawY) {
//std::cout << "rasterizing [" << text << "] @" << rawX << " availableWidth: " << availableWidth << " sourceStartX: " << rasterStartX << " noWrap: " << noWrap << std::endl;
std::shared_ptr<rasterizationResponse> response = textRasterizer->rasterize(request);
if (response.get() == nullptr) {
std::cout << "TextComponent::rasterize - got nullptr from rasterizer" << std::endl;
// window could be minimized
//std::cout << "TextComponent::rasterize - got nullptr from rasterizer" << std::endl;
return;
}
width = response->width;

Loading…
Cancel
Save