add function to help change size of canvas
This commit is contained in:
@@ -10,6 +10,20 @@ struct
|
|||||||
else
|
else
|
||||||
el) squares
|
el) squares
|
||||||
|
|
||||||
|
fun changeSquaresSize (squares, newCanvasWidth, newCanvasHeight) =
|
||||||
|
Vector.tabulate (newCanvasWidth + 1, fn i =>
|
||||||
|
if i < Vector.length squares then
|
||||||
|
Vector.tabulate (newCanvasHeight + 1, fn ii =>
|
||||||
|
let
|
||||||
|
val yAxis = Vector.sub (squares, i)
|
||||||
|
in
|
||||||
|
if ii < Vector.length yAxis then Vector.sub (yAxis, ii)
|
||||||
|
else {r = 0, g = 0, b = 0, a = 0}
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
Vector.tabulate (newCanvasHeight + 1, fn _ =>
|
||||||
|
{r = 0, g = 0, b = 0, a = 0}))
|
||||||
|
|
||||||
fun addSquare (app, newX, newY, arrowX, arrowY) : app_type =
|
fun addSquare (app, newX, newY, arrowX, arrowY) : app_type =
|
||||||
let
|
let
|
||||||
val
|
val
|
||||||
|
|||||||
Reference in New Issue
Block a user