add ability to select cursor colour

This commit is contained in:
2025-08-09 07:04:03 +01:00
parent 7a3fc728f6
commit fa2a5c878c
6 changed files with 72 additions and 1 deletions

View File

@@ -1115,6 +1115,62 @@ struct
, xClickPoints = xClickPoints
, yClickPoints = yClickPoints
, showGraph = showGraph
, openFilePath = openFilePath
, fileBrowser = fileBrowser
, fileBrowserIdx = fileBrowserIdx
, r = r
, g = g
, b = b
, a = a
, modalNum = 0
, undo = undo
, redo = redo
}
end
fun cursorColour (app, r, g, b, a) =
let
val
{ mode
, canvasHeight
, canvasWidth
, squares
, arrowX
, arrowY
, windowWidth
, windowHeight
, xClickPoints
, yClickPoints
, showGraph
, mouseX
, mouseY
, openFilePath
, fileBrowser
, fileBrowserIdx
, r = _
, g = _
, b = _
, a = _
, modalNum
, undo
, redo
} = app
in
{ mode = mode
, canvasHeight = canvasHeight
, canvasWidth = canvasWidth
, arrowX = arrowX
, mouseX = mouseX
, mouseY = mouseY
, squares = squares
, arrowY = arrowY
, windowWidth = windowWidth
, windowHeight = windowHeight
, xClickPoints = xClickPoints
, yClickPoints = yClickPoints
, showGraph = showGraph
, openFilePath = openFilePath
, fileBrowser = fileBrowser

View File

@@ -263,6 +263,16 @@ struct
fun updateBlue model = (AppWith.b model, [])
fun updateAlpha model = (AppWith.a model, [])
fun selectCursorColour (model: app_type) =
let
val {squares, arrowX, arrowY, ...} = model
val yAxis = Vector.sub (squares, arrowX)
val {r, g, b, a} = Vector.sub (yAxis, arrowY)
val model = AppWith.cursorColour (model, r, g, b, a)
in
(model, [])
end
fun updateCanvas (model, canvasWidth, canvasHeight) =
let
val
@@ -359,6 +369,7 @@ struct
| KEY_G => updateGreen model
| KEY_B => updateBlue model
| KEY_A => updateAlpha model
| KEY_C => selectCursorColour model
| KEY_W => updateCanvasWidth model
| KEY_H => updateCanvasHeight model
| KEY_M => enterMoveMode model