mirror of
https://github.com/edubart/otclient.git
synced 2025-10-20 06:23:26 +02:00
still implemeting uitextedit
This commit is contained in:
@@ -81,6 +81,7 @@ public:
|
||||
const Size *getGlyphsSize() const { return m_glyphsSize; }
|
||||
const TexturePtr& getTexture() const { return m_texture; }
|
||||
int getTopMargin() const { return m_topMargin; }
|
||||
const Size& getGlyphSpacing() const { return m_glyphSpacing; }
|
||||
|
||||
private:
|
||||
void calculateGlyphsWidthsAutomatically(const Size& glyphSize);
|
||||
|
@@ -281,4 +281,17 @@ void TextArea::moveCursor(bool right)
|
||||
recalculate();
|
||||
}
|
||||
|
||||
|
||||
int TextArea::getTextPos(Point pos)
|
||||
{
|
||||
int textLength = m_text.length();
|
||||
dump << " get pos: " << pos << m_drawArea;
|
||||
for(int i=0;i<textLength;++i) {
|
||||
Rect clickGlyphRect = m_glyphsCoords[i];
|
||||
clickGlyphRect.addTop(m_font->getTopMargin() + m_font->getGlyphSpacing().height());
|
||||
clickGlyphRect.addLeft(m_font->getGlyphSpacing().width()+1);
|
||||
dump << clickGlyphRect;
|
||||
if(m_glyphsCoords[i].contains(pos))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@@ -54,6 +54,8 @@ public:
|
||||
|
||||
const std::string& getText() const { return m_text; }
|
||||
|
||||
int getTextPos(Point pos);
|
||||
|
||||
private:
|
||||
void recalculate();
|
||||
|
||||
|
Reference in New Issue
Block a user