progress towards saving export string in correct format (but note there is currently an exception somewhere because of changes; need to fix)
This commit is contained in:
@@ -460,7 +460,7 @@ struct
|
||||
fun toSaveStringFolder ({x, ex, y, ey, data = {r, g, b, a}}, acc) =
|
||||
let
|
||||
val item = String.concat
|
||||
[ "{"
|
||||
[ "["
|
||||
, Int.toString x
|
||||
, " "
|
||||
, Int.toString y
|
||||
@@ -476,20 +476,28 @@ struct
|
||||
, Int.toString b
|
||||
, " "
|
||||
, Int.toString a
|
||||
, " } "
|
||||
, " ] "
|
||||
]
|
||||
in
|
||||
item :: acc
|
||||
end
|
||||
|
||||
fun toSaveString (squares, canvasWidth, canvasHeight) =
|
||||
fun toSaveStringTreeFolder size (grid, acc) =
|
||||
let
|
||||
val qtree = buildTree (0, 0, size, grid)
|
||||
val bintree = merge (qtree, grid)
|
||||
val str = BinTree.foldr (toSaveStringFolder, bintree, [])
|
||||
in
|
||||
String.concat str :: acc
|
||||
end
|
||||
|
||||
fun toSaveString (layerTree, canvasWidth, canvasHeight) =
|
||||
let
|
||||
val size = Int.max (canvasWidth, canvasHeight)
|
||||
val qtree = buildTree (0, 0, size, squares)
|
||||
val bintree = merge (qtree, squares)
|
||||
val f = toSaveStringTreeFolder size
|
||||
|
||||
val initial = ["}"]
|
||||
val acc = BinTree.foldr (toSaveStringFolder, bintree, initial)
|
||||
val acc = LayerTree.foldr (f, layerTree, initial)
|
||||
val acc =
|
||||
String.concat
|
||||
[Int.toString canvasWidth, " ", Int.toString canvasHeight, " { "]
|
||||
|
||||
Reference in New Issue
Block a user