# Flipping diagonals in a regular polygon

Say, I have a triangulation of an octagon:

edges[n_Integer]:=Join[Table[{i,i+1},{i,n-1}],{{1,n}}]

triangulation[n_Integer,d_List]:=Module[{pts,external=edges[n]},
pts=CirclePoints[n];
Graphics[Map[Line[{pts[[#[]]],pts[[#[]]]}]&,Join[d,external,{{1,n}}]]]]

triangulation[8,{{1,3},{1,4},{1,5},{1,6},{1,7}}] Now, each diagonal in that triangulation is a diagonal of some quadrilateral. What I want to do is, when I click on one of the diagonals, it gets flipped to another diagonal of the quadrilateral in which it was inscribed initially. I have only managed to do this partially. I can flip a diagonal back and forth, using this code:

FlipDiagonal[T_List,D_List]:=Module[{TriangulationAsGraph=Graph[#]& @ T/. List -> UndirectedEdge},
Complement[Flatten@Select[FindKClique[TriangulationAsGraph, 1 ,  Infinity, All],SubsetQ[#,D] &],D]]

Flip[L_Line, T_List,n_Integer]:=Module[{line,vpair, flip,  pts = CirclePoints[n]},
line = First@L /. Line -> List ;
vpair =  Flatten[Position[pts,#]& /@ line] ;
flip = FlipDiagonal[T,vpair];
If[MemberQ[{-1,1,1-n,n-1},First@Differences[vpair]],L,Line[{pts[[flip[]]],pts[[flip[]]]}]]]

T=Join[{{1,3},{1,4},{1,5},{1,6},{1,7}},edges]

triangulation[8,{{1,3},{1,4},{1,5},{1,6},{1,7}}]/.l_Line->FlipView[{{Green,l},{Blue,Thick,Flip[l,T,8]}}]


But what I want to achieve is to be able to flip any diagonal sequentially. So I flip one diagonal, get a new triangulation, then I can flip any diagonal in that new triangulation, which will give me a new triangulation again (as long as I don't flip the same diagonal twice), etc., etc. Could someone help please?