aboutsummaryrefslogtreecommitdiff
path: root/src/objects.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2011-11-07 22:07:59 +0100
committerThomas White <taw@bitwiz.org.uk>2011-11-07 22:07:59 +0100
commit38d030f301cc781a56cab5724175a127f2eb1230 (patch)
tree0877238a53a230455d1074d35bed9f37b30670a8 /src/objects.c
parent90a46fb55899b37d4dc91ee0da5c45eb90b8bf76 (diff)
Resize handles on all corners of text objects, as well
Diffstat (limited to 'src/objects.c')
-rw-r--r--src/objects.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/objects.c b/src/objects.c
index f1e9259..01e347e 100644
--- a/src/objects.c
+++ b/src/objects.c
@@ -170,3 +170,29 @@ void delete_object(struct object *o)
o->delete_object(o);
free(o);
}
+
+
+enum corner which_corner(double xp, double yp, struct object *o)
+{
+ double x, y; /* Relative to object position */
+
+ x = xp - o->x;
+ y = yp - o->y;
+
+ if ( x < 0.0 ) return CORNER_NONE;
+ if ( y < 0.0 ) return CORNER_NONE;
+ if ( x > o->bb_width ) return CORNER_NONE;
+ if ( y > o->bb_height ) return CORNER_NONE;
+
+ /* Top left? */
+ if ( (x<20.0) && (y<20.0) ) return CORNER_TL;
+ if ( (x>o->bb_width-20.0) && (y<20.0) ) return CORNER_TR;
+ if ( (x<20.0) && (y>o->bb_height-20.0) ) {
+ return CORNER_BL;
+ }
+ if ( (x>o->bb_width-20.0) && (y>o->bb_height-20.0) ) {
+ return CORNER_BR;
+ }
+
+ return CORNER_NONE;
+}