I'm trying to drag a path around my canvas by re-plotting the coordinates, stored in an array of point, then re creating it. The path drags but flips horizontally and vertically, like a mirror image, over where the user clicks. I have no idea why.
private void drag(MotionEvent e) {
// TODO correct weird flip
if (clicked(e)) {
for (Point p : points) {
int modX = (int) (e.getX() + (e.getX() - p.x));
int modY = (int) (e.getY() + (e.getY() - p.y));
p.set(modX, modY);
}
updateOutline();
}
}
private void updateOutline() {
// update the outline
outline = new Path();
outline.moveTo(points.get(0).x, points.get(0).y);
for (Point coor : points)
outline.lineTo(coor.x, coor.y);
}
Any help will be appreciated, thanks