Jump to content

Set fixed postion for tooltip affect image


Recommended Posts

  • Active Member

Hey guys,

I have small question. Someone know how to set fixed position for the text in this function to not overflow the left side of the game screen? Now, if I'll change any value for x postion, it will overflow to the left. The text position is affected by affect image, so it looks like, 1st image has x position and 2nd image has x+20 position, I want to set all the texts at one selected position.

Spoiler
#uiaffectshower.py
def SetToolTipText(self, text, x = 0, y = -19):

		if not self.toolTipText:
			textLine = ui.TextLine()
			textLine.SetParent(self)
			textLine.SetSize(0, 0)
			textLine.SetOutline()
			textLine.Hide()
			self.toolTipText = textLine

		self.toolTipText.SetText(text)
		w, h = self.toolTipText.GetTextSize()
		self.toolTipText.SetPosition(max(0, x + self.GetWidth()/2 - w/2), y)

 

Thanks for answers!

Sincerely,

ReFresh

I'll be always helpful! 👊 

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Premium

Try this:
 

	def SetToolTipText(self, text, x = 0, y = -19):
		if not self.toolTipText:
			textLine = ui.TextLine()
			textLine.SetParent(self)
			textLine.SetHorizontalAlignCenter()
			textLine.SetSize(0, 0)
			textLine.SetOutline()
			textLine.Hide()
			self.toolTipText = textLine

		self.toolTipText.SetText(text)
		w, h = self.toolTipText.GetTextSize()
		self.toolTipText.SetPosition(max(0, x + self.GetWidth()/2 - w/2), y)

 

Link to comment
Share on other sites

  • Active Member

@dumita123 Nope, it still does the same thing. The text is still overflowing the left side of the game screen. For example, if you hover over autopotion the text will overflow. I'm wondering why it's happening. Looks like mentioned function has nothing to do with that, but I can't see anything else what could cause this problem.

I'll be always helpful! 👊 

Link to comment
Share on other sites

  • 2 weeks later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.