How to determine the addition and subtraction of a new triangle

We currently want to calculate the area of a polygon. Left-clicking determines the points of the polygon, and the movement of the mouse will display the current area of the polygon. The area of the polygon is calculated by adding up the areas of multiple triangles. However, we want to know whether the area of the new triangle generated during the mouse movement should be added or subtracted?