From 32fee5a53dac14d6889017db4fc4ad8156324159 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Fri, 29 Mar 2013 21:17:58 +0900 Subject: [PATCH] Fixed the bug that labels with inner_width/height disappears --- packaging/libscl-ui.spec | 2 +- scl/gwes/efl/sclgraphics-efl.cpp | 19 +++++++++++++++++-- scl/include/sclversion.h | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/packaging/libscl-ui.spec b/packaging/libscl-ui.spec index ee03551..0ca8d31 100644 --- a/packaging/libscl-ui.spec +++ b/packaging/libscl-ui.spec @@ -3,7 +3,7 @@ Name: libscl-ui Summary: A library for developing XML-based software keyboards -Version: 0.2.4 +Version: 0.2.5 Release: 1 Group: TO BE / FILLED IN License: TO BE / FILLED IN diff --git a/scl/gwes/efl/sclgraphics-efl.cpp b/scl/gwes/efl/sclgraphics-efl.cpp index 7c9f885..e8fc094 100644 --- a/scl/gwes/efl/sclgraphics-efl.cpp +++ b/scl/gwes/efl/sclgraphics-efl.cpp @@ -579,6 +579,10 @@ CSCLGraphicsImplEfl::draw_text(sclwindow window, const scldrawctx draw_ctx, cons if (text_object) { if (inner_width > 0 || inner_height > 0) { + SclPoint bottom_right; + bottom_right.x = pos_x + width; + bottom_right.y = pos_y + height; + /* The inner width and height value should be bigger than 0 */ if (inner_width <= 0) inner_width = width; if (inner_height <= 0) inner_height = height; @@ -610,8 +614,19 @@ CSCLGraphicsImplEfl::draw_text(sclwindow window, const scldrawctx draw_ctx, cons } else { pos_y += padding_y; } - width = inner_width; - height = inner_height; + + /* Make sure the inner bounding box does not exceed the original bounding box */ + if (pos_x + inner_width > bottom_right.x) { + width = bottom_right.x - pos_x; + } else { + width = inner_width; + } + if (pos_y + inner_height > bottom_right.y) { + height = bottom_right.y - pos_y; + } else { + height = inner_height; + } + align = LABEL_ALIGN_CENTER_MIDDLE; padding_x = 0; padding_y = 0; diff --git a/scl/include/sclversion.h b/scl/include/sclversion.h index 0b99318..a64e042 100644 --- a/scl/include/sclversion.h +++ b/scl/include/sclversion.h @@ -18,7 +18,7 @@ #ifndef __SCL_VERSION_H__ #define __SCL_VERSION_H__ -#define SCL_VERSION "0.2.4-1" +#define SCL_VERSION "0.2.5-1" #endif //__SCL_VERSION_H -- 2.7.4