diff --git a/dotscape b/dotscape index 6e9b61f..fa3d28a 100755 Binary files a/dotscape and b/dotscape differ diff --git a/fcore/app-with.sml b/fcore/app-with.sml index 48037df..b21ef16 100644 --- a/fcore/app-with.sml +++ b/fcore/app-with.sml @@ -11,18 +11,21 @@ struct 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 maxPoints = Int.max (newCanvasWidth, newCanvasHeight) + in + Vector.tabulate (maxPoints, fn i => + if i < Vector.length squares then 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})) + Vector.tabulate (maxPoints, fn ii => + if ii < Vector.length yAxis then Vector.sub (yAxis, ii) + else {r = 0, g = 0, b = 0, a = 0}) + end + else + Vector.tabulate (maxPoints, fn _ => {r = 0, g = 0, b = 0, a = 0})) + end fun addSquare (app, newX, newY, arrowX, arrowY) : app_type = let @@ -861,6 +864,9 @@ struct val squares = changeSquaresSize (squares, newCanvasWidth, canvasHeight) val arrowX = Int.min (arrowX, newCanvasWidth) + val (xClickPoints, yClickPoints) = + ClickPoints.generate + (windowWidth, windowHeight, newCanvasWidth, canvasHeight) in { mode = mode , canvasWidth = newCanvasWidth