I’m drawing a line using this code:
this.graphics.moveTo(posx, posy);
this.graphics.lineTo(2*posx,2*posy);
But now I want to remove it, but I can’t clear the whole this.graphics object because it contains more information that is useful for me.
How can I remove this line without clearing this.graphics object? Is there any method to draw a similar line over it to hide or replace the line?
EDIT:
The purple lines are what I want to hide after I draw them:

You can try drawing the line on a different surface (another
SpriteorMoveClipon top of the original image) – in this case you can hide/clear the top surface which removes the line without actually changing the underlying image.You start by setting the top surface to be transparent and then you get the
graphicsobject that belongs to it and you draw the line on it.If you then want to ‘finalize’ the line, you can just merge the two surfaces. After this, removing the line can be much harder, depending on the surrounding pixels.