645 |
|
|
646 |
/* check if it was dropped onto another node */ |
/* check if it was dropped onto another node */ |
647 |
node_t *touchnode = map_hl_touchnode_get_node(map); |
node_t *touchnode = map_hl_touchnode_get_node(map); |
648 |
|
gboolean joined_with_touchnode = FALSE; |
649 |
|
|
650 |
if(touchnode) { |
if(touchnode) { |
651 |
map_hl_touchnode_clear(map); |
map_hl_touchnode_clear(map); |
652 |
|
|
660 |
|
|
661 |
/* the touchnode vanishes and is replaced by the node the */ |
/* the touchnode vanishes and is replaced by the node the */ |
662 |
/* user dropped onto it */ |
/* user dropped onto it */ |
663 |
|
joined_with_touchnode = TRUE; |
664 |
|
|
665 |
/* use touchnodes position */ |
/* use touchnodes position */ |
666 |
node->lpos = touchnode->lpos; |
node->lpos = touchnode->lpos; |
860 |
} |
} |
861 |
} |
} |
862 |
} |
} |
863 |
} else { |
} |
864 |
|
|
865 |
|
/* the node either wasn't dropped into another one (touchnode) or */ |
866 |
|
/* the user didn't want to join the nodes */ |
867 |
|
if(!joined_with_touchnode) { |
868 |
|
|
869 |
/* finally update dragged nodes position */ |
/* finally update dragged nodes position */ |
870 |
|
|
879 |
node->lpos.x = x; |
node->lpos.x = x; |
880 |
node->lpos.y = y; |
node->lpos.y = y; |
881 |
|
|
882 |
/* convert screen position back to ll */ |
/* convert screen position to lat/lon */ |
883 |
lpos2pos(osm->bounds, &node->lpos, &node->pos); |
lpos2pos(osm->bounds, &node->lpos, &node->pos); |
884 |
|
|
885 |
|
/* convert pos back to lpos to see rounding errors */ |
886 |
|
pos2lpos(osm->bounds, &node->pos, &node->lpos); |
887 |
|
|
888 |
printf(" now at %d %d (%f %f)\n", |
printf(" now at %d %d (%f %f)\n", |
889 |
node->lpos.x, node->lpos.y, node->pos.lat, node->pos.lon); |
node->lpos.x, node->lpos.y, node->pos.lat, node->pos.lon); |
890 |
} |
} |