add functionality to delete pixel

This commit is contained in:
2025-07-11 23:47:28 +01:00
parent 86369db055
commit 973a1610ce
7 changed files with 110 additions and 5 deletions

View File

@@ -56,11 +56,6 @@ struct
, redo
} = app
val yAxis = Vector.sub (squares, newX)
val undoData = Vector.sub (yAxis, newY)
val undo = undoData :: undo
val redo = []
val item = {r = r, g = g, b = b, a = a}
val squares = updateSquares (squares, newX, newY, item)
in
@@ -91,6 +86,65 @@ struct
}
end
fun deleteSquare (app, deleteX, deleteY, arrowX, arrowY) =
let
val
{ mode
, squares
, arrowX = _
, arrowY = _
, canvasWidth
, canvasHeight
, windowWidth
, windowHeight
, xClickPoints
, yClickPoints
, showGraph
, mouseX
, mouseY
, openFilePath
, fileBrowser
, fileBrowserIdx
, r
, g
, b
, a
, modalNum
, undo
, redo
} = app
val item = {r = 0, g = 0, b = 0, a = 0}
val squares = updateSquares (squares, deleteX, deleteY, item)
in
{ mode = mode
, squares = squares
, arrowX = arrowX
, arrowY = arrowY
, canvasWidth = canvasWidth
, canvasHeight = canvasHeight
, windowWidth = windowWidth
, windowHeight = windowHeight
, xClickPoints = xClickPoints
, yClickPoints = yClickPoints
, showGraph = showGraph
, mouseX = mouseX
, mouseY = mouseY
, openFilePath = openFilePath
, fileBrowser = fileBrowser
, fileBrowserIdx = fileBrowserIdx
, r = r
, g = g
, b = b
, a = a
, modalNum = modalNum
, undo = undo
, redo = redo
}
end
fun arrowX (app, arrowX) =
let
val