209 |
diff.x = node_chain->node->lpos.x - last->lpos.x; |
diff.x = node_chain->node->lpos.x - last->lpos.x; |
210 |
diff.y = node_chain->node->lpos.y - last->lpos.y; |
diff.y = node_chain->node->lpos.y - last->lpos.y; |
211 |
|
|
212 |
|
/* only draw arrow if there's sufficient space */ |
213 |
|
/* TODO: what if there's not enough space anywhere? */ |
214 |
float len = sqrt(pow(diff.x, 2)+pow(diff.y, 2)); |
float len = sqrt(pow(diff.x, 2)+pow(diff.y, 2)); |
215 |
if(len > map->style->highlight.arrow_limit*arrow_width) { |
if(len > map->style->highlight.arrow_limit*arrow_width) { |
216 |
len /= arrow_width; |
len /= arrow_width; |
773 |
return NULL; |
return NULL; |
774 |
} |
} |
775 |
|
|
776 |
if(map_item->highlight) |
if(map_item->highlight) |
777 |
printf(" item is highlight\n"); |
printf(" item is highlight\n"); |
778 |
|
|
779 |
switch(map_item->type) { |
switch(map_item->type) { |
792 |
} |
} |
793 |
|
|
794 |
/* get the real item (no highlight) at x, y */ |
/* get the real item (no highlight) at x, y */ |
795 |
static map_item_t *map_real_item_at(map_t *map, gint x, gint y) { |
map_item_t *map_real_item_at(map_t *map, gint x, gint y) { |
796 |
map_item_t *map_item = map_item_at(map, x, y); |
map_item_t *map_item = map_item_at(map, x, y); |
797 |
|
|
798 |
/* no item or already a real one */ |
/* no item or already a real one */ |
1628 |
case MAP_ACTION_NODE_ADD: |
case MAP_ACTION_NODE_ADD: |
1629 |
map_hl_cursor_draw(map, x, y, FALSE, map->style->node.radius); |
map_hl_cursor_draw(map, x, y, FALSE, map->style->node.radius); |
1630 |
break; |
break; |
1631 |
|
|
1632 |
case MAP_ACTION_WAY_ADD: |
case MAP_ACTION_WAY_ADD: |
1633 |
map_hl_cursor_draw(map, x, y, FALSE, map->style->node.radius); |
map_hl_cursor_draw(map, x, y, FALSE, map->style->node.radius); |
1634 |
map_touchnode_update(appdata, x, y); |
map_touchnode_update(appdata, x, y); |
1636 |
|
|
1637 |
case MAP_ACTION_WAY_NODE_ADD: |
case MAP_ACTION_WAY_NODE_ADD: |
1638 |
map_hl_cursor_clear(map); |
map_hl_cursor_clear(map); |
1639 |
map_item_t *item = map_item_at(map, x, y); |
map_item_t *item = map_real_item_at(map, x, y); |
1640 |
if(item) map_edit_way_node_add_highlight(map, item, x, y); |
if(item) map_edit_way_node_add_highlight(map, item, x, y); |
1641 |
break; |
break; |
1642 |
|
|
1643 |
case MAP_ACTION_WAY_CUT: |
case MAP_ACTION_WAY_CUT: |
1644 |
map_hl_cursor_clear(map); |
map_hl_cursor_clear(map); |
1645 |
item = map_item_at(map, x, y); |
item = map_real_item_at(map, x, y); |
1646 |
if(item) map_edit_way_cut_highlight(map, item, x, y); |
if(item) map_edit_way_cut_highlight(map, item, x, y); |
1647 |
break; |
break; |
1648 |
|
|