diff --git a/dotscape b/dotscape index 43a368b..b2b71b4 100755 Binary files a/dotscape and b/dotscape differ diff --git a/functional-core/app/app-init.sml b/functional-core/app/app-init.sml index c4d3ac2..0888eb3 100644 --- a/functional-core/app/app-init.sml +++ b/functional-core/app/app-init.sml @@ -24,6 +24,8 @@ struct , mouseX = 0.0 , mouseY = 0.0 , showGraph = true + , arrowX = 0 + , arrowY = 0 } end diff --git a/functional-core/app/app-type.sml b/functional-core/app/app-type.sml index 38d7045..50150ba 100644 --- a/functional-core/app/app-type.sml +++ b/functional-core/app/app-type.sml @@ -15,6 +15,7 @@ sig , y3: Real32.real } + type app_type = { triangles: triangle list , triangleStage: triangle_stage @@ -24,9 +25,11 @@ sig , yClickPoints: Real32.real vector , undo: (Real32.real * Real32.real) list , redo: (Real32.real * Real32.real) list + , showGraph: bool , mouseX: Real32.real , mouseY: Real32.real - , showGraph: bool + , arrowX: int + , arrowY: int } end @@ -64,8 +67,10 @@ struct , yClickPoints: Real32.real vector , undo: (Real32.real * Real32.real) list , redo: (Real32.real * Real32.real) list + , showGraph: bool , mouseX: Real32.real , mouseY: Real32.real - , showGraph: bool + , arrowX: int + , arrowY: int } end diff --git a/functional-core/app/app-update.sml b/functional-core/app/app-update.sml index a70ce8e..5f04f04 100644 --- a/functional-core/app/app-update.sml +++ b/functional-core/app/app-update.sml @@ -59,9 +59,8 @@ struct val drawMsg = DRAW_DOT drawVec val newTriangleStage = FIRST {x1 = hpos, y1 = vpos} - val model = - AppWith.addTriangleStage - (model, newTriangleStage, newUndoTuple) + val model = AppWith.addTriangleStage + (model, newTriangleStage, newUndoTuple, hIdx, vIdx) in (model, DRAW drawMsg) end @@ -73,16 +72,15 @@ struct val newTriangleStage = SECOND {x1 = x1, y1 = y1, x2 = hpos, y2 = vpos} - val model = - AppWith.addTriangleStage - (model, newTriangleStage, newUndoTuple) + val model = AppWith.addTriangleStage + (model, newTriangleStage, newUndoTuple, hIdx, vIdx) in (model, DRAW drawMsg) end | SECOND {x1, y1, x2, y2} => let val model = AppWith.addTriangle - (model, x1, y1, x2, y2, hpos, vpos, newUndoTuple) + (model, x1, y1, x2, y2, hpos, vpos, newUndoTuple, hIdx, vIdx) val drawVec = Triangles.toVector model val drawMsg = DRAW_TRIANGLES_AND_RESET_DOTS drawVec in diff --git a/functional-core/app/app-with.sml b/functional-core/app/app-with.sml index 169cf51..4f057ae 100644 --- a/functional-core/app/app-with.sml +++ b/functional-core/app/app-with.sml @@ -27,7 +27,11 @@ sig * and also add new click position to undo stack. *) val addTriangleStage: - AppType.app_type * AppType.triangle_stage * (Real32.real * Real32.real) + AppType.app_type + * AppType.triangle_stage + * (Real32.real * Real32.real) + * int + * int -> AppType.app_type val addTriangle: @@ -39,6 +43,8 @@ sig * Real32.real * Real32.real * (Real32.real * Real32.real) + * int + * int -> AppType.app_type val useTriangles: AppType.app_type * AppType.triangle list -> AppType.app_type @@ -50,7 +56,8 @@ struct (* add to undo, clear redo *) fun addTriangleStage - (app: app_type, newTriangleStage: triangle_stage, newUndoHd) : app_type = + (app: app_type, newTriangleStage: triangle_stage, newUndoHd, arrowX, arrowY) : + app_type = let val { triangleStage = _ @@ -61,9 +68,11 @@ struct , windowHeight , undo , redo = _ + , showGraph , mouseX , mouseY - , showGraph + , arrowX = _ + , arrowY = _ } = app val newUndo = newUndoHd :: undo @@ -76,13 +85,17 @@ struct , yClickPoints = yClickPoints , windowWidth = windowWidth , windowHeight = windowHeight + , showGraph = showGraph , mouseX = mouseX , mouseY = mouseY - , showGraph = showGraph + , arrowX = arrowX + , arrowY = arrowY } end - fun addTriangle (app: app_type, x1, y1, x2, y2, x3, y3, newUndoHd) : app_type = + fun addTriangle + (app: app_type, x1, y1, x2, y2, x3, y3, newUndoHd, arrowX, arrowY) : + app_type = let val { triangles @@ -93,9 +106,11 @@ struct , windowHeight , undo , redo = _ + , showGraph , mouseX , mouseY - , showGraph + , arrowX = _ + , arrowY = _ } = app val newTriangle = {x1 = x1, y1 = y1, x2 = x2, y2 = y2, x3 = x3, y3 = y3} @@ -110,9 +125,11 @@ struct , yClickPoints = yClickPoints , windowWidth = windowWidth , windowHeight = windowHeight + , showGraph = showGraph , mouseX = mouseX , mouseY = mouseY - , showGraph = showGraph + , arrowX = arrowX + , arrowY = arrowY } end @@ -129,9 +146,11 @@ struct , triangleStage , undo , redo + , showGraph , mouseX , mouseY - , showGraph + , arrowX + , arrowY } = app val xClickPoints = ClickPoints.generate (wStart, wFinish) @@ -145,9 +164,11 @@ struct , windowHeight = windowHeight , undo = undo , redo = redo + , showGraph = showGraph , mouseX = mouseX , mouseY = mouseY - , showGraph = showGraph + , arrowX = arrowX + , arrowY = arrowY } end @@ -188,6 +209,8 @@ struct , undo , redo , showGraph + , arrowX + , arrowY } = app in { mouseX = mouseX @@ -201,6 +224,8 @@ struct , undo = undo , redo = redo , showGraph = showGraph + , arrowX = arrowX + , arrowY = arrowY } end @@ -216,9 +241,11 @@ struct , windowHeight , undo , redo + , showGraph , mouseX , mouseY - , showGraph + , arrowX + , arrowY } = app val newUndo = @@ -236,9 +263,11 @@ struct , yClickPoints = yClickPoints , windowWidth = windowWidth , windowHeight = windowHeight + , showGraph = showGraph , mouseX = mouseX , mouseY = mouseY - , showGraph = showGraph + , arrowX = arrowX + , arrowY = arrowY } end @@ -254,9 +283,11 @@ struct , windowHeight , undo , redo + , showGraph , mouseX , mouseY - , showGraph + , arrowX + , arrowY } = app val newUndo = newUndoHd :: undo @@ -273,9 +304,11 @@ struct , yClickPoints = yClickPoints , windowWidth = windowWidth , windowHeight = windowHeight + , showGraph = showGraph , mouseX = mouseX , mouseY = mouseY - , showGraph = showGraph + , arrowX = arrowX + , arrowY = arrowY } end @@ -292,6 +325,8 @@ struct , redo , mouseX , mouseY + , arrowX + , arrowY , showGraph = _ } = app in @@ -306,6 +341,8 @@ struct , windowHeight = windowHeight , mouseX = mouseX , mouseY = mouseY + , arrowX = arrowX + , arrowY = arrowY } end @@ -318,9 +355,11 @@ struct , windowHeight , undo , redo + , showGraph , mouseX , mouseY - , showGraph + , arrowX + , arrowY , triangles = _ , triangleStage = _ } = app @@ -338,6 +377,8 @@ struct , windowHeight = windowHeight , mouseX = mouseX , mouseY = mouseY + , arrowX = arrowX + , arrowY = arrowY } end end