progress updating canvas width at runtime
This commit is contained in:
@@ -860,13 +860,14 @@ struct
|
|||||||
} = app
|
} = app
|
||||||
|
|
||||||
val squares = changeSquaresSize (squares, newCanvasWidth, canvasHeight)
|
val squares = changeSquaresSize (squares, newCanvasWidth, canvasHeight)
|
||||||
|
val arrowX = Int.min (arrowX, newCanvasWidth)
|
||||||
in
|
in
|
||||||
{ mode = mode
|
{ mode = mode
|
||||||
, canvasWidth = newCanvasWidth
|
, canvasWidth = newCanvasWidth
|
||||||
|
, arrowX = arrowX
|
||||||
, mouseX = mouseX
|
, mouseX = mouseX
|
||||||
, mouseY = mouseY
|
, mouseY = mouseY
|
||||||
, squares = squares
|
, squares = squares
|
||||||
, arrowX = arrowX
|
|
||||||
, arrowY = arrowY
|
, arrowY = arrowY
|
||||||
, canvasHeight = canvasHeight
|
, canvasHeight = canvasHeight
|
||||||
, windowWidth = windowWidth
|
, windowWidth = windowWidth
|
||||||
|
|||||||
@@ -154,9 +154,6 @@ struct
|
|||||||
|
|
||||||
val dotVec = getDotVecFromIndices (model, hIdx, vIdx)
|
val dotVec = getDotVecFromIndices (model, hIdx, vIdx)
|
||||||
|
|
||||||
val halfWidth = Real32.fromInt (windowWidth div 2)
|
|
||||||
val halfHeight = Real32.fromInt (windowHeight div 2)
|
|
||||||
|
|
||||||
val maxSide = Int.max (canvasWidth, canvasHeight)
|
val maxSide = Int.max (canvasWidth, canvasHeight)
|
||||||
val squares = CollisionTree.toTriangles
|
val squares = CollisionTree.toTriangles
|
||||||
( windowWidth
|
( windowWidth
|
||||||
@@ -248,13 +245,55 @@ struct
|
|||||||
end
|
end
|
||||||
|
|
||||||
fun updateNum (model: app_type, newNum) =
|
fun updateNum (model: app_type, newNum) =
|
||||||
(AppWith.modalNum (model, newNum), [])
|
(AppWith.modalNum (model, newNum), [])
|
||||||
|
|
||||||
fun updateRed model = (AppWith.r model, [])
|
fun updateRed model = (AppWith.r model, [])
|
||||||
fun updateGreen model = (AppWith.g model, [])
|
fun updateGreen model = (AppWith.g model, [])
|
||||||
fun updateBlue model = (AppWith.b model, [])
|
fun updateBlue model = (AppWith.b model, [])
|
||||||
fun updateAlpha model = (AppWith.a model, [])
|
fun updateAlpha model = (AppWith.a model, [])
|
||||||
|
|
||||||
|
fun updateCanvasWidth (model, newCanvasWidth) =
|
||||||
|
let
|
||||||
|
val model = AppWith.canvasWidth (model, newCanvasWidth)
|
||||||
|
|
||||||
|
val
|
||||||
|
{ arrowX
|
||||||
|
, arrowY
|
||||||
|
, windowWidth
|
||||||
|
, windowHeight
|
||||||
|
, squares
|
||||||
|
, canvasWidth
|
||||||
|
, canvasHeight
|
||||||
|
, xClickPoints
|
||||||
|
, yClickPoints
|
||||||
|
, showGraph
|
||||||
|
, ...
|
||||||
|
} = model
|
||||||
|
|
||||||
|
val dotVec = getDotVecFromIndices (model, #arrowX model, #arrowY model)
|
||||||
|
val graphLines =
|
||||||
|
if showGraph then GraphLines.generate model else Vector.fromList []
|
||||||
|
|
||||||
|
val maxSide = Int.max (canvasWidth, canvasHeight)
|
||||||
|
val squares = CollisionTree.toTriangles
|
||||||
|
( windowWidth
|
||||||
|
, windowHeight
|
||||||
|
, squares
|
||||||
|
, maxSide
|
||||||
|
, canvasWidth
|
||||||
|
, canvasHeight
|
||||||
|
, xClickPoints
|
||||||
|
, yClickPoints
|
||||||
|
)
|
||||||
|
|
||||||
|
val msg =
|
||||||
|
RESIZE_SQUARES_DOTS_AND_GRAPH
|
||||||
|
{squares = squares, dots = dotVec, graphLines = graphLines}
|
||||||
|
in
|
||||||
|
(model, [DRAW msg])
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
fun enterBrowseMode model =
|
fun enterBrowseMode model =
|
||||||
let
|
let
|
||||||
val model = AppWith.mode (model, AppType.BROWSE_MODE)
|
val model = AppWith.mode (model, AppType.BROWSE_MODE)
|
||||||
@@ -283,6 +322,7 @@ struct
|
|||||||
| KEY_G => updateGreen model
|
| KEY_G => updateGreen model
|
||||||
| KEY_B => updateBlue model
|
| KEY_B => updateBlue model
|
||||||
| KEY_A => updateAlpha model
|
| KEY_A => updateAlpha model
|
||||||
|
| KEY_W newCanvasWidth => updateCanvasWidth (model, newCanvasWidth)
|
||||||
| RESIZE_WINDOW {width, height} => resizeWindow (model, width, height)
|
| RESIZE_WINDOW {width, height} => resizeWindow (model, width, height)
|
||||||
| UNDO_ACTION => undoAction model
|
| UNDO_ACTION => undoAction model
|
||||||
| REDO_ACTION => redoAction model
|
| REDO_ACTION => redoAction model
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ struct
|
|||||||
| KEY_B
|
| KEY_B
|
||||||
| KEY_T
|
| KEY_T
|
||||||
| KEY_A
|
| KEY_A
|
||||||
|
| KEY_W of int
|
||||||
| KEY_CTRL_S
|
| KEY_CTRL_S
|
||||||
| KEY_CTRL_L
|
| KEY_CTRL_L
|
||||||
| KEY_CTRL_E
|
| KEY_CTRL_E
|
||||||
|
|||||||
Reference in New Issue
Block a user