From c766658cd89232da2238aceeebcd4b3cc1b1a8c8 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Tue, 2 Jun 2015 01:28:58 +0200 Subject: [PATCH] Added style properties icon-offset-{x,y} --- TODO | 3 +++ dict-props.t | 2 ++ sym-point.c | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/TODO b/TODO index 2977c83..54c3c1a 100644 --- a/TODO +++ b/TODO @@ -4,3 +4,6 @@ Does it matter? - Fixing of label positions should include some margin - Clean up shp.c + +- Add icon-anchor-* properties like text-anchor-* + (for now, we have only icon-offset-*) diff --git a/dict-props.t b/dict-props.t index a164805..f2132d4 100644 --- a/dict-props.t +++ b/dict-props.t @@ -15,6 +15,8 @@ font-style font-weight icon-height icon-image +icon-offset-x +icon-offset-y icon-opacity icon-width major-z-index diff --git a/sym-point.c b/sym-point.c index c7c2be0..e8b32d9 100644 --- a/sym-point.c +++ b/sym-point.c @@ -130,6 +130,12 @@ static void sym_icon_gen(struct osm_object *o, struct style_info *si, struct svg if (!osm_obj_center(o, &sir->x, &sir->y)) return; + double dx = 0, dy = 0; + style_get_number(si, PROP_ICON_OFFSET_X, &dx); + style_get_number(si, PROP_ICON_OFFSET_Y, &dy); + sir->x += dx; + sir->y += dy; + sir->width = icon->width; sir->height = icon->height; style_scale(si, &sir->width, &sir->height, PROP_ICON_WIDTH, PROP_ICON_HEIGHT); -- 2.39.2