- better handling of edit mode click
This commit is contained in:
parent
8d6cdfb5db
commit
8dc59d74f7
|
@ -288,6 +288,24 @@ void GraphicLabel::init(int x, int y, int w, int h, bool centered, Vec3f textCol
|
||||||
this->wordWrap = wordWrap;
|
this->wordWrap = wordWrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GraphicLabel::mouseMove(int x, int y) {
|
||||||
|
if(this->getVisible() == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int useWidth = w;
|
||||||
|
if(text.length() > 0 && font3D != NULL) {
|
||||||
|
float lineWidth = (font3D->getTextHandler()->Advance(text.c_str()) * Font::scaleFontValue);
|
||||||
|
useWidth = (int)lineWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
x > this->x &&
|
||||||
|
y > this->y &&
|
||||||
|
x < this->x + useWidth &&
|
||||||
|
y < this->y + h;
|
||||||
|
}
|
||||||
|
|
||||||
bool GraphicLabel::getCenteredW() const {
|
bool GraphicLabel::getCenteredW() const {
|
||||||
bool result = (centered || centeredW == 1);
|
bool result = (centered || centeredW == 1);
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -147,6 +147,8 @@ public:
|
||||||
GraphicLabel();
|
GraphicLabel();
|
||||||
void init(int x, int y, int w=defW, int h=defH, bool centered= false, Vec3f textColor=GraphicComponent::customTextColor, bool wordWrap=false);
|
void init(int x, int y, int w=defW, int h=defH, bool centered= false, Vec3f textColor=GraphicComponent::customTextColor, bool wordWrap=false);
|
||||||
|
|
||||||
|
virtual bool mouseMove(int x, int y);
|
||||||
|
|
||||||
bool getCentered() const {return centered;}
|
bool getCentered() const {return centered;}
|
||||||
void setCentered(bool centered) {this->centered= centered;}
|
void setCentered(bool centered) {this->centered= centered;}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user