mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-10 21:44:22 +00:00
Fix widget border in drawTextBox()
This commit is contained in:
parent
6abe417328
commit
fec4e27d8e
@ -85,7 +85,7 @@ void drawTextBox(Graphics* g, Widget* widget,
|
|||||||
View* view = View::getView(widget);
|
View* view = View::getView(widget);
|
||||||
char* text = const_cast<char*>(widget->text().c_str());
|
char* text = const_cast<char*>(widget->text().c_str());
|
||||||
char* beg, *end;
|
char* beg, *end;
|
||||||
int x1, y1, x2, y2;
|
int x1, y1;
|
||||||
int x, y, chr, len;
|
int x, y, chr, len;
|
||||||
gfx::Point scroll;
|
gfx::Point scroll;
|
||||||
int textheight = widget->textHeight();
|
int textheight = widget->textHeight();
|
||||||
@ -100,14 +100,10 @@ void drawTextBox(Graphics* g, Widget* widget,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
vp = widget->clientBounds();
|
vp = widget->clientBounds();
|
||||||
vp.w -= widget->border().width();
|
|
||||||
vp.h -= widget->border().height();
|
|
||||||
scroll.x = scroll.y = 0;
|
scroll.x = scroll.y = 0;
|
||||||
}
|
}
|
||||||
x1 = widget->clientBounds().x;
|
x1 = widget->clientBounds().x + widget->border().left();
|
||||||
y1 = widget->clientBounds().y;
|
y1 = widget->clientBounds().y + widget->border().top();
|
||||||
x2 = vp.x + vp.w;
|
|
||||||
y2 = vp.y + vp.h;
|
|
||||||
|
|
||||||
// Fill background
|
// Fill background
|
||||||
if (g)
|
if (g)
|
||||||
@ -117,7 +113,7 @@ void drawTextBox(Graphics* g, Widget* widget,
|
|||||||
|
|
||||||
// Without word-wrap
|
// Without word-wrap
|
||||||
if (!(widget->align() & WORDWRAP)) {
|
if (!(widget->align() & WORDWRAP)) {
|
||||||
width = widget->clientBounds().w;
|
width = widget->clientChildrenBounds().w;
|
||||||
}
|
}
|
||||||
// With word-wrap
|
// With word-wrap
|
||||||
else {
|
else {
|
||||||
@ -139,6 +135,7 @@ void drawTextBox(Graphics* g, Widget* widget,
|
|||||||
else {
|
else {
|
||||||
width = vp.w;
|
width = vp.w;
|
||||||
}
|
}
|
||||||
|
width -= widget->border().width();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -167,7 +164,7 @@ void drawTextBox(Graphics* g, Widget* widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// To here we can print
|
// To here we can print
|
||||||
if ((old_end) && (x+font->textLength(beg) > x1-scroll.x+width)) {
|
if ((old_end) && (x+font->textLength(beg) > x1+width-scroll.x)) {
|
||||||
if (end)
|
if (end)
|
||||||
*end = chr;
|
*end = chr;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user