add functionality for changing height of canvas

This commit is contained in:
2025-07-11 22:57:20 +01:00
parent a448fcf469
commit 86369db055
7 changed files with 92 additions and 6 deletions

View File

@@ -252,10 +252,10 @@ struct
fun updateBlue model = (AppWith.b model, [])
fun updateAlpha model = (AppWith.a model, [])
fun updateCanvasWidth model =
fun updateCanvas (model, canvasWidth, canvasHeight) =
let
val newCanvasWidth = #modalNum model
val model = AppWith.canvasWidth (model, newCanvasWidth)
val newCanvaidth = #modalNum model
val model = AppWith.canvasWidth (model, canvasWidth)
val
{ arrowX
@@ -263,15 +263,13 @@ struct
, windowWidth
, windowHeight
, squares
, canvasWidth
, canvasHeight
, xClickPoints
, yClickPoints
, showGraph
, ...
} = model
val dotVec = getDotVecFromIndices (model, #arrowX model, #arrowY model)
val dotVec = getDotVecFromIndices (model, arrowX, arrowY)
val graphLines =
if showGraph then GraphLines.generate model else Vector.fromList []
@@ -294,6 +292,23 @@ struct
(model, [DRAW msg])
end
fun updateCanvasWidth model =
let
val newCanvasWidth = #modalNum model
val (model as {canvasWidth, canvasHeight, ...}) =
AppWith.canvasWidth (model, newCanvasWidth)
in
updateCanvas (model, canvasWidth, canvasHeight)
end
fun updateCanvasHeight model =
let
val newCanvasHeight = #modalNum model
val (model as {canvasWidth, canvasHeight, ...}) =
AppWith.canvasHeight (model, newCanvasHeight)
in
updateCanvas (model, canvasWidth, canvasHeight)
end
fun enterBrowseMode model =
let
@@ -324,6 +339,7 @@ struct
| KEY_B => updateBlue model
| KEY_A => updateAlpha model
| KEY_W => updateCanvasWidth model
| KEY_H => updateCanvasHeight model
| RESIZE_WINDOW {width, height} => resizeWindow (model, width, height)
| UNDO_ACTION => undoAction model
| REDO_ACTION => redoAction model