MovingBlocks / Terasology

Terasology - open source voxel world
http://terasology.org
Apache License 2.0
3.66k stars 1.33k forks source link

New UI Widget: The UI Link Widget #2715

Open VaibhavBajaj opened 7 years ago

VaibhavBajaj commented 7 years ago

I am opening this Issue in hope that someone will create a new UI Widget: A Link.

The UILink will be a widget used when people need to input a hyperlink. The widget may have fields similar to UIText. The only extra field shall be a "URL" or "link" field which can be used to enter hyperlinks (HTTP, HTTPS) to pages (Web pages to begin with, but later probably even in-game descriptive pages). Another optional field could be "image". One could use this field to set an image which, if clicked, would lead to a web page or an in-game page.

When seen, the link could be of a different color (preferably blue since that is usually the color of links) and if clicked, would lead to the hyperlink or in-game screen in the "URL" or "link" field.

The need for such a widget arose when I was creating an InformativeLinksScreen interface for the user. If you wish to share links like Terasology's main page, Github page, facebook page, or twitter page, it is recommended that the link you share can be clicked to lead to the actual page. If that is not the case, the amount of people who actually use that link merely out of curiosity drastically reduces due to the inconvenience.

Other than the example shared above, there are a multitude of places where the UILink widget would come in handy. As I mentioned before, in-game links may be helpful. For example, if people wish to update the "help" command to open a page with "links" to the various in-game descriptive pages, that would improve Terasology's UI interface.

Some APIs that this widget may use are:

  1. createLink()
  2. getLink()
  3. setColor()
  4. setLinkText()
  5. getLinkText()
  6. setLinkImage()
  7. getLinkImage()

Images of uses of similar widgets are boundless. Some examples are:

  1. In text
  2. As an image
smsunarto commented 7 years ago

Probably should ask for user confirmation before opening a link, since link in chat could be used for malicious purposes.

VaibhavBajaj commented 7 years ago

Ah, apologies smsunarto. I gave an in-chat picture but I only meant it to show how a link can be used "in text" (Edited just now). I do not intend this for this widget to be used by the user himself. The user may only access the link which has been written by Terasology programmers themselves. If people were to push code to Terasology with harmful link widgets contained, I am sure their merge will not be approved. That is why I did not mention the need for a user confirmation request.

That is still a very good idea. Thanks!