summaryrefslogtreecommitdiffstats
path: root/scene
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-06-11 10:41:43 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-06-11 10:41:43 -0300
commit64e83bfd1404ea593f0c79b478d196a3fcde42a8 (patch)
treec18c61da239443532a94fb9fa54df702df12a90b /scene
parent9b8696d3dd92e2ed6f310ad0f0bf3c2182c9c6ae (diff)
parent5f5cd5e6d1508f85ac1bffa44e122b4dc0e2bb1d (diff)
downloadredot-engine-64e83bfd1404ea593f0c79b478d196a3fcde42a8.tar.gz
Merge branch 'master' of https://github.com/okamstudio/godot
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/label.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index a2f837c3c4..b7918994d8 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -398,12 +398,15 @@ void Label::regenerate_word_cache() {
}
if (current=='\n') {
-
insert_newline=true;
} else {
total_char_cache++;
}
+ if (i<text.length() && text[i] == ' ') {
+ total_char_cache--; // do not count spaces
+ }
+
} else {
@@ -442,7 +445,8 @@ void Label::regenerate_word_cache() {
last_width=line_width;
}
-
+
+ total_char_cache -= line_count + 1; // do not count new lines (including the first one)
if (!autowrap) {
@@ -519,6 +523,7 @@ String Label::get_text() const {
return text;
}
+
void Label::set_visible_characters(int p_amount) {
visible_chars=p_amount;
@@ -582,7 +587,7 @@ void Label::_bind_methods() {
ADD_PROPERTY( PropertyInfo( Variant::INT, "valign", PROPERTY_HINT_ENUM,"Top,Center,Bottom,Fill" ),_SCS("set_valign"),_SCS("get_valign") );
ADD_PROPERTY( PropertyInfo( Variant::BOOL, "autowrap"),_SCS("set_autowrap"),_SCS("has_autowrap") );
ADD_PROPERTY( PropertyInfo( Variant::BOOL, "uppercase"),_SCS("set_uppercase"),_SCS("is_uppercase") );
- ADD_PROPERTY( PropertyInfo( Variant::REAL, "percent_visible"),_SCS("set_percent_visible"),_SCS("get_percent_visible") );
+ ADD_PROPERTY( PropertyInfo( Variant::REAL, "percent_visible", PROPERTY_HINT_RANGE,"0,1,0.001"),_SCS("set_percent_visible"),_SCS("get_percent_visible") );
}