done with loading file into app (loaded triangles are visible, etc.)
This commit is contained in:
@@ -214,6 +214,17 @@ struct
|
||||
fun getLoadTriangleMsg model =
|
||||
(model, FILE LOAD_TRIANGLES)
|
||||
|
||||
fun useTriangles (model, triangles) =
|
||||
let
|
||||
val model = AppWith.useTriangles (model, triangles)
|
||||
val drawVec = Triangles.toVector model
|
||||
val drawMsg = DRAW_TRIANGLES_AND_RESET_DOTS drawVec
|
||||
in
|
||||
(model, DRAW drawMsg)
|
||||
end
|
||||
|
||||
fun trianglesLoadError model = (model, NO_MAILBOX)
|
||||
|
||||
fun update (model: app_type, inputMsg) =
|
||||
case inputMsg of
|
||||
MOUSE_MOVE {x = mouseX, y = mouseY} =>
|
||||
@@ -228,4 +239,6 @@ struct
|
||||
| KEY_G => toggleGraph model
|
||||
| KEY_CTRL_S => getSaveTrianglesMsg model
|
||||
| KEY_CTRL_L => getLoadTriangleMsg model
|
||||
| USE_TRIANGLES triangles => useTriangles (model, triangles)
|
||||
| TRIANGLES_LOAD_ERROR => trianglesLoadError model
|
||||
end
|
||||
|
||||
@@ -40,6 +40,8 @@ sig
|
||||
* Real32.real
|
||||
* (Real32.real * Real32.real)
|
||||
-> AppType.app_type
|
||||
|
||||
val useTriangles: AppType.app_type * AppType.triangle list -> AppType.app_type
|
||||
end
|
||||
|
||||
structure AppWith :> APP_WITH =
|
||||
@@ -306,4 +308,36 @@ struct
|
||||
, mouseY = mouseY
|
||||
}
|
||||
end
|
||||
|
||||
fun useTriangles (app: app_type, triangles) =
|
||||
let
|
||||
val
|
||||
{ xClickPoints
|
||||
, yClickPoints
|
||||
, windowWidth
|
||||
, windowHeight
|
||||
, undo
|
||||
, redo
|
||||
, mouseX
|
||||
, mouseY
|
||||
, showGraph
|
||||
, triangles = _
|
||||
, triangleStage = _
|
||||
} = app
|
||||
|
||||
val triangleStage = NO_TRIANGLE
|
||||
in
|
||||
{ triangleStage = triangleStage
|
||||
, triangles = triangles
|
||||
, undo = []
|
||||
, redo = []
|
||||
, showGraph = showGraph
|
||||
, xClickPoints = xClickPoints
|
||||
, yClickPoints = yClickPoints
|
||||
, windowWidth = windowWidth
|
||||
, windowHeight = windowHeight
|
||||
, mouseX = mouseX
|
||||
, mouseY = mouseY
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user