done implementing load-squares functionality

This commit is contained in:
2025-07-12 07:17:52 +01:00
parent dcf6bc074d
commit b58100ca7e
5 changed files with 83 additions and 12 deletions

View File

@@ -265,9 +265,6 @@ struct
fun updateCanvas (model, canvasWidth, canvasHeight) =
let
val newCanvaidth = #modalNum model
val model = AppWith.canvasWidth (model, canvasWidth)
val
{ arrowX
, arrowY
@@ -308,6 +305,7 @@ struct
val newCanvasWidth = #modalNum model
val (model as {canvasWidth, canvasHeight, ...}) =
AppWith.canvasWidth (model, newCanvasWidth)
val {canvasWidth, canvasHeight, ...} = model
in
updateCanvas (model, canvasWidth, canvasHeight)
end
@@ -315,8 +313,15 @@ struct
fun updateCanvasHeight model =
let
val newCanvasHeight = #modalNum model
val (model as {canvasWidth, canvasHeight, ...}) =
AppWith.canvasHeight (model, newCanvasHeight)
val model = AppWith.canvasHeight (model, newCanvasHeight)
val {canvasWidth, canvasHeight, ...} = model
in
updateCanvas (model, canvasWidth, canvasHeight)
end
fun useSquares (model, squares, canvasWidth, canvasHeight) =
let
val model = AppWith.useSquares (model, squares, canvasWidth, canvasHeight)
in
updateCanvas (model, canvasWidth, canvasHeight)
end
@@ -358,8 +363,8 @@ struct
| KEY_CTRL_S => CommonUpdate.getSaveSquaresMsg model
| KEY_CTRL_L => CommonUpdate.getLoadSquaresMsg model
| KEY_CTRL_E => CommonUpdate.getExportSquaresMsg model
| USE_SQUARES squares =>
CommonUpdate.useSquaresInNormalMode (model, squares)
| USE_SQUARES {squares, canvasWidth, canvasHeight} =>
useSquares (model, squares, canvasWidth, canvasHeight)
| SQUARES_LOAD_ERROR => CommonUpdate.squaresLoadError model
| KEY_CTRL_O => enterBrowseMode model
| ARROW_UP => moveArrowUp model