diff --git a/dotscape b/dotscape index 87b289c..6f5be3c 100755 Binary files a/dotscape and b/dotscape differ diff --git a/fcore/app-with.sml b/fcore/app-with.sml index 4aa5810..febc96c 100644 --- a/fcore/app-with.sml +++ b/fcore/app-with.sml @@ -2,6 +2,14 @@ structure AppWith = struct open AppType + fun updateSquares (squares, newX, newY, item) = + Vector.mapi + (fn (idx, el) => + if idx = newX then + Vector.mapi (fn (iidx, iel) => if iidx = newY then item else iel) el + else + el) squares + fun addSquare (app, newX, newY, arrowX, arrowY) : app_type = let val @@ -31,16 +39,13 @@ struct , redo } = app - val squares = - Vector.mapi - (fn (idx, el) => - if idx = newX then - Vector.mapi - (fn (iidx, iel) => - if iidx = newY then {r = r, g = g, b = b, a = a} else iel) - el - else - el) squares + 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 { mode = mode , squares = squares