mirror of
https://github.com/minetest/minetest.git
synced 2024-07-07 08:25:28 +02:00
Supertip: Make static position argument mandatory
This commit is contained in:
parent
b3c06bb9e5
commit
14fa03172d
@ -2849,13 +2849,15 @@ Elements
|
|||||||
* `bgcolor` tooltip background color as `ColorString` (optional)
|
* `bgcolor` tooltip background color as `ColorString` (optional)
|
||||||
* `fontcolor` tooltip font color as `ColorString` (optional)
|
* `fontcolor` tooltip font color as `ColorString` (optional)
|
||||||
|
|
||||||
### `supertip[<X>,<Y>;<W>,<H>;<posX>,<posY>;<width>;<name>;<text>]`
|
### `supertip[<X>,<Y>;<W>,<H>;<staticPos>;<width>;<name>;<text>]`
|
||||||
|
|
||||||
* Displays a formatted text using `Markup Language` in a tooltip.
|
* Adds an advanced tooltip for an area. Displays a formatted text using
|
||||||
* `x`, `y`, `w` and `h` set the mouse hover area that allows the tooltip to pop-up.
|
`Markup Language` in a tooltip.
|
||||||
* `posX` and `posY` set the static positioning of the tooltip (optional).
|
* `X`, `Y`, `W` and `H` set the cursor hover area that allows the tooltip to pop-up.
|
||||||
If not set, the tooltip is floating (moving with the pointer).
|
* `staticPos` is an optional position of the form `posX,posY` in formspec coordinates.
|
||||||
* `width` sets the tooltip width.
|
If specified, the tooltip will always appear at these given formspec coordinates.
|
||||||
|
If this field is empty, the tooltip will follow the cursor.
|
||||||
|
* `width` sets the tooltip width (in formspec units).
|
||||||
* `name` is the name of the field.
|
* `name` is the name of the field.
|
||||||
* `text` is the formatted text using `Markup Language` described below.
|
* `text` is the formatted text using `Markup Language` described below.
|
||||||
|
|
||||||
|
@ -483,11 +483,11 @@ mouse control = true]
|
|||||||
supertip[1,3;1,1;2.5,3.5;5;supertip_static;<big>Simple supertip (<i>static</i>)</big>
|
supertip[1,3;1,1;2.5,3.5;5;supertip_static;<big>Simple supertip (<i>static</i>)</big>
|
||||||
This one should always appear at the tiny white square.]
|
This one should always appear at the tiny white square.]
|
||||||
box[1,5;1,1;#ff000080]
|
box[1,5;1,1;#ff000080]
|
||||||
supertip[1,5;1,1;5;supertip_dynamic;<big>Simple supertip (<i>dynamic</i>)</big>
|
supertip[1,5;1,1;;5;supertip_dynamic;<big>Simple supertip (<i>dynamic</i>)</big>
|
||||||
This should appear at the cursor.]
|
This should appear at the cursor.]
|
||||||
|
|
||||||
box[1,7;1,1;#ff000080]
|
box[1,7;1,1;#ff000080]
|
||||||
supertip[1,7;1,1;5;supertip_dynamic_complex;]]..minetest.formspec_escape([[<big>Complex supertip (<i>dynamic</i>)</big>
|
supertip[1,7;1,1;;5;supertip_dynamic_complex;]]..minetest.formspec_escape([[<big>Complex supertip (<i>dynamic</i>)</big>
|
||||||
<img name=testformspec_node.png float=right width=64 height=64>
|
<img name=testformspec_node.png float=right width=64 height=64>
|
||||||
<left>Left align</left>
|
<left>Left align</left>
|
||||||
<center>Right align</center>
|
<center>Right align</center>
|
||||||
@ -497,7 +497,7 @@ Item:
|
|||||||
<item name=testformspec:node>]])..[[]
|
<item name=testformspec:node>]])..[[]
|
||||||
|
|
||||||
box[1,9;1,1;#ff000080]
|
box[1,9;1,1;#ff000080]
|
||||||
supertip[1,9;1,1;5;supertip_stone;]]..minetest.formspec_escape([[<global color=#333 background=#aaa margin=20>
|
supertip[1,9;1,1;;5;supertip_stone;]]..minetest.formspec_escape([[<global color=#333 background=#aaa margin=20>
|
||||||
<item name=testformspec:node float=left width=64 height=64>
|
<item name=testformspec:node float=left width=64 height=64>
|
||||||
<big><b><center>Formspec Test Node</center></b></big>
|
<big><b><center>Formspec Test Node</center></b></big>
|
||||||
The <b>Formspec Test Node</b> is a dummy node to display an item in the <mono>testformspec</mono> mod.
|
The <b>Formspec Test Node</b> is a dummy node to display an item in the <mono>testformspec</mono> mod.
|
||||||
|
@ -1756,24 +1756,23 @@ void GUIFormSpecMenu::parseHyperText(parserData *data, const std::string &elemen
|
|||||||
|
|
||||||
void GUIFormSpecMenu::parseSuperTip(parserData *data, const std::string &element)
|
void GUIFormSpecMenu::parseSuperTip(parserData *data, const std::string &element)
|
||||||
{
|
{
|
||||||
constexpr char max_parts = 6;
|
|
||||||
std::vector<std::string> parts;
|
std::vector<std::string> parts;
|
||||||
|
|
||||||
if (!precheckElement("supertip", element, 5, max_parts, parts))
|
if (!precheckElement("supertip", element, 6, 6, parts))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::vector<std::string> v_stpos;
|
|
||||||
std::vector<std::string> v_pos = split(parts[0], ',');
|
std::vector<std::string> v_pos = split(parts[0], ',');
|
||||||
std::vector<std::string> v_geom = split(parts[1], ',');
|
std::vector<std::string> v_geom = split(parts[1], ',');
|
||||||
bool floating = parts.size() == max_parts - 1;
|
std::vector<std::string> v_stpos;
|
||||||
|
bool floating = true;
|
||||||
if (!floating)
|
if(parts[2] != "") {
|
||||||
v_stpos = split(parts[2], ',');
|
v_stpos = split(parts[2], ',');
|
||||||
|
floating = false;
|
||||||
|
}
|
||||||
|
|
||||||
const char i = max_parts - parts.size();
|
s32 width = stof(parts[3]) * spacing.Y;
|
||||||
s32 width = stof(parts[3-i]) * spacing.Y;
|
std::string name = parts[4];
|
||||||
std::string name = parts[4-i];
|
std::string text = parts[5];
|
||||||
std::string text = parts[5-i];
|
|
||||||
|
|
||||||
MY_CHECKPOS("supertip", 0);
|
MY_CHECKPOS("supertip", 0);
|
||||||
MY_CHECKGEOM("supertip", 1);
|
MY_CHECKGEOM("supertip", 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user