remove 'squares' field from app type, and refactor most functions in common-update.sml to use layer tree instead of squares vector
This commit is contained in:
@@ -23,12 +23,9 @@ struct
|
|||||||
(windowWidth, windowHeight, canvasWidth, canvasHeight)
|
(windowWidth, windowHeight, canvasWidth, canvasHeight)
|
||||||
|
|
||||||
val maxPoints = Int.max (canvasWidth, canvasHeight)
|
val maxPoints = Int.max (canvasWidth, canvasHeight)
|
||||||
val squares = Vector.tabulate (maxPoints, fn _ =>
|
|
||||||
Vector.tabulate (maxPoints, fn _ => {r = 0, g = 0, b = 0, a = 0}))
|
|
||||||
val layerTree = LayerTree.init maxPoints
|
val layerTree = LayerTree.init maxPoints
|
||||||
in
|
in
|
||||||
{ mode = AppType.NORMAL_MODE
|
{ mode = AppType.NORMAL_MODE
|
||||||
, squares = squares
|
|
||||||
, canvasWidth = canvasWidth
|
, canvasWidth = canvasWidth
|
||||||
, canvasHeight = canvasHeight
|
, canvasHeight = canvasHeight
|
||||||
, windowWidth = windowWidth
|
, windowWidth = windowWidth
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ struct
|
|||||||
|
|
||||||
type app_type =
|
type app_type =
|
||||||
{ mode: app_mode
|
{ mode: app_mode
|
||||||
, squares: square vector vector
|
|
||||||
, canvasWidth: int
|
, canvasWidth: int
|
||||||
, canvasHeight: int
|
, canvasHeight: int
|
||||||
, windowWidth: int
|
, windowWidth: int
|
||||||
|
|||||||
@@ -2,28 +2,10 @@ structure AppWith =
|
|||||||
struct
|
struct
|
||||||
open AppType
|
open AppType
|
||||||
|
|
||||||
fun changeSquaresSize (squares, newCanvasWidth, newCanvasHeight) =
|
|
||||||
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
|
|
||||||
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 arrowX (app, arrowX) =
|
fun arrowX (app, arrowX) =
|
||||||
let
|
let
|
||||||
val
|
val
|
||||||
{ mode
|
{ mode
|
||||||
, squares
|
|
||||||
, arrowX = _
|
, arrowX = _
|
||||||
, arrowY
|
, arrowY
|
||||||
, canvasWidth
|
, canvasWidth
|
||||||
@@ -49,7 +31,6 @@ struct
|
|||||||
} = app
|
} = app
|
||||||
in
|
in
|
||||||
{ mode = mode
|
{ mode = mode
|
||||||
, squares = squares
|
|
||||||
, arrowX = arrowX
|
, arrowX = arrowX
|
||||||
, arrowY = arrowY
|
, arrowY = arrowY
|
||||||
, canvasWidth = canvasWidth
|
, canvasWidth = canvasWidth
|
||||||
@@ -79,7 +60,6 @@ struct
|
|||||||
let
|
let
|
||||||
val
|
val
|
||||||
{ mode
|
{ mode
|
||||||
, squares
|
|
||||||
, arrowX
|
, arrowX
|
||||||
, arrowY = _
|
, arrowY = _
|
||||||
, canvasWidth
|
, canvasWidth
|
||||||
@@ -105,7 +85,6 @@ struct
|
|||||||
} = app
|
} = app
|
||||||
in
|
in
|
||||||
{ mode = mode
|
{ mode = mode
|
||||||
, squares = squares
|
|
||||||
, arrowX = arrowX
|
, arrowX = arrowX
|
||||||
, arrowY = arrowY
|
, arrowY = arrowY
|
||||||
, canvasWidth = canvasWidth
|
, canvasWidth = canvasWidth
|
||||||
@@ -139,7 +118,6 @@ struct
|
|||||||
, yClickPoints = _
|
, yClickPoints = _
|
||||||
, windowWidth = _
|
, windowWidth = _
|
||||||
, windowHeight = _
|
, windowHeight = _
|
||||||
, squares
|
|
||||||
, arrowX
|
, arrowX
|
||||||
, arrowY
|
, arrowY
|
||||||
, canvasWidth
|
, canvasWidth
|
||||||
@@ -165,7 +143,6 @@ struct
|
|||||||
(windowWidth, windowHeight, canvasWidth, canvasHeight)
|
(windowWidth, windowHeight, canvasWidth, canvasHeight)
|
||||||
in
|
in
|
||||||
{ mode = mode
|
{ mode = mode
|
||||||
, squares = squares
|
|
||||||
, arrowX = arrowX
|
, arrowX = arrowX
|
||||||
, arrowY = arrowY
|
, arrowY = arrowY
|
||||||
, canvasWidth = canvasWidth
|
, canvasWidth = canvasWidth
|
||||||
@@ -201,7 +178,6 @@ struct
|
|||||||
, yClickPoints
|
, yClickPoints
|
||||||
, windowWidth
|
, windowWidth
|
||||||
, windowHeight
|
, windowHeight
|
||||||
, squares
|
|
||||||
, arrowX
|
, arrowX
|
||||||
, arrowY
|
, arrowY
|
||||||
, canvasWidth
|
, canvasWidth
|
||||||
@@ -223,7 +199,6 @@ struct
|
|||||||
{ mode = mode
|
{ mode = mode
|
||||||
, mouseX = mouseX
|
, mouseX = mouseX
|
||||||
, mouseY = mouseY
|
, mouseY = mouseY
|
||||||
, squares = squares
|
|
||||||
, arrowX = arrowX
|
, arrowX = arrowX
|
||||||
, arrowY = arrowY
|
, arrowY = arrowY
|
||||||
, canvasWidth = canvasWidth
|
, canvasWidth = canvasWidth
|
||||||
@@ -257,7 +232,6 @@ struct
|
|||||||
, yClickPoints
|
, yClickPoints
|
||||||
, windowWidth
|
, windowWidth
|
||||||
, windowHeight
|
, windowHeight
|
||||||
, squares
|
|
||||||
, arrowX
|
, arrowX
|
||||||
, arrowY
|
, arrowY
|
||||||
, canvasWidth
|
, canvasWidth
|
||||||
@@ -279,7 +253,6 @@ struct
|
|||||||
{ mode = mode
|
{ mode = mode
|
||||||
, mouseX = mouseX
|
, mouseX = mouseX
|
||||||
, mouseY = mouseY
|
, mouseY = mouseY
|
||||||
, squares = squares
|
|
||||||
, arrowX = arrowX
|
, arrowX = arrowX
|
||||||
, arrowY = arrowY
|
, arrowY = arrowY
|
||||||
, canvasWidth = canvasWidth
|
, canvasWidth = canvasWidth
|
||||||
@@ -313,7 +286,6 @@ struct
|
|||||||
, yClickPoints
|
, yClickPoints
|
||||||
, windowWidth
|
, windowWidth
|
||||||
, windowHeight
|
, windowHeight
|
||||||
, squares
|
|
||||||
, arrowX
|
, arrowX
|
||||||
, arrowY
|
, arrowY
|
||||||
, canvasWidth
|
, canvasWidth
|
||||||
@@ -335,7 +307,6 @@ struct
|
|||||||
{ mode = newMode
|
{ mode = newMode
|
||||||
, mouseX = mouseX
|
, mouseX = mouseX
|
||||||
, mouseY = mouseY
|
, mouseY = mouseY
|
||||||
, squares = squares
|
|
||||||
, arrowX = arrowX
|
, arrowX = arrowX
|
||||||
, arrowY = arrowY
|
, arrowY = arrowY
|
||||||
, canvasWidth = canvasWidth
|
, canvasWidth = canvasWidth
|
||||||
@@ -369,7 +340,6 @@ struct
|
|||||||
, yClickPoints
|
, yClickPoints
|
||||||
, windowWidth
|
, windowWidth
|
||||||
, windowHeight
|
, windowHeight
|
||||||
, squares
|
|
||||||
, arrowX
|
, arrowX
|
||||||
, arrowY
|
, arrowY
|
||||||
, canvasWidth
|
, canvasWidth
|
||||||
@@ -391,7 +361,6 @@ struct
|
|||||||
{ mode = mode
|
{ mode = mode
|
||||||
, mouseX = mouseX
|
, mouseX = mouseX
|
||||||
, mouseY = mouseY
|
, mouseY = mouseY
|
||||||
, squares = squares
|
|
||||||
, arrowX = arrowX
|
, arrowX = arrowX
|
||||||
, arrowY = arrowY
|
, arrowY = arrowY
|
||||||
, canvasWidth = canvasWidth
|
, canvasWidth = canvasWidth
|
||||||
@@ -425,7 +394,6 @@ struct
|
|||||||
, yClickPoints
|
, yClickPoints
|
||||||
, windowWidth
|
, windowWidth
|
||||||
, windowHeight
|
, windowHeight
|
||||||
, squares
|
|
||||||
, arrowX
|
, arrowX
|
||||||
, arrowY
|
, arrowY
|
||||||
, canvasWidth
|
, canvasWidth
|
||||||
@@ -447,7 +415,6 @@ struct
|
|||||||
{ mode = mode
|
{ mode = mode
|
||||||
, mouseX = mouseX
|
, mouseX = mouseX
|
||||||
, mouseY = mouseY
|
, mouseY = mouseY
|
||||||
, squares = squares
|
|
||||||
, arrowX = arrowX
|
, arrowX = arrowX
|
||||||
, arrowY = arrowY
|
, arrowY = arrowY
|
||||||
, canvasWidth = canvasWidth
|
, canvasWidth = canvasWidth
|
||||||
@@ -481,7 +448,6 @@ struct
|
|||||||
, yClickPoints
|
, yClickPoints
|
||||||
, windowWidth
|
, windowWidth
|
||||||
, windowHeight
|
, windowHeight
|
||||||
, squares
|
|
||||||
, arrowX
|
, arrowX
|
||||||
, arrowY
|
, arrowY
|
||||||
, canvasWidth
|
, canvasWidth
|
||||||
@@ -505,7 +471,6 @@ struct
|
|||||||
{ mode = mode
|
{ mode = mode
|
||||||
, mouseX = mouseX
|
, mouseX = mouseX
|
||||||
, mouseY = mouseY
|
, mouseY = mouseY
|
||||||
, squares = squares
|
|
||||||
, arrowX = arrowX
|
, arrowX = arrowX
|
||||||
, arrowY = arrowY
|
, arrowY = arrowY
|
||||||
, canvasWidth = canvasWidth
|
, canvasWidth = canvasWidth
|
||||||
@@ -539,7 +504,6 @@ struct
|
|||||||
, yClickPoints
|
, yClickPoints
|
||||||
, windowWidth
|
, windowWidth
|
||||||
, windowHeight
|
, windowHeight
|
||||||
, squares
|
|
||||||
, arrowX
|
, arrowX
|
||||||
, arrowY
|
, arrowY
|
||||||
, canvasWidth
|
, canvasWidth
|
||||||
@@ -563,7 +527,6 @@ struct
|
|||||||
{ mode = mode
|
{ mode = mode
|
||||||
, mouseX = mouseX
|
, mouseX = mouseX
|
||||||
, mouseY = mouseY
|
, mouseY = mouseY
|
||||||
, squares = squares
|
|
||||||
, arrowX = arrowX
|
, arrowX = arrowX
|
||||||
, arrowY = arrowY
|
, arrowY = arrowY
|
||||||
, canvasWidth = canvasWidth
|
, canvasWidth = canvasWidth
|
||||||
@@ -597,7 +560,6 @@ struct
|
|||||||
, yClickPoints
|
, yClickPoints
|
||||||
, windowWidth
|
, windowWidth
|
||||||
, windowHeight
|
, windowHeight
|
||||||
, squares
|
|
||||||
, arrowX
|
, arrowX
|
||||||
, arrowY
|
, arrowY
|
||||||
, canvasWidth
|
, canvasWidth
|
||||||
@@ -621,7 +583,6 @@ struct
|
|||||||
{ mode = mode
|
{ mode = mode
|
||||||
, mouseX = mouseX
|
, mouseX = mouseX
|
||||||
, mouseY = mouseY
|
, mouseY = mouseY
|
||||||
, squares = squares
|
|
||||||
, arrowX = arrowX
|
, arrowX = arrowX
|
||||||
, arrowY = arrowY
|
, arrowY = arrowY
|
||||||
, canvasWidth = canvasWidth
|
, canvasWidth = canvasWidth
|
||||||
@@ -655,7 +616,6 @@ struct
|
|||||||
, yClickPoints
|
, yClickPoints
|
||||||
, windowWidth
|
, windowWidth
|
||||||
, windowHeight
|
, windowHeight
|
||||||
, squares
|
|
||||||
, arrowX
|
, arrowX
|
||||||
, arrowY
|
, arrowY
|
||||||
, canvasWidth
|
, canvasWidth
|
||||||
@@ -679,7 +639,6 @@ struct
|
|||||||
{ mode = mode
|
{ mode = mode
|
||||||
, mouseX = mouseX
|
, mouseX = mouseX
|
||||||
, mouseY = mouseY
|
, mouseY = mouseY
|
||||||
, squares = squares
|
|
||||||
, arrowX = arrowX
|
, arrowX = arrowX
|
||||||
, arrowY = arrowY
|
, arrowY = arrowY
|
||||||
, canvasWidth = canvasWidth
|
, canvasWidth = canvasWidth
|
||||||
@@ -713,7 +672,6 @@ struct
|
|||||||
, yClickPoints
|
, yClickPoints
|
||||||
, windowWidth
|
, windowWidth
|
||||||
, windowHeight
|
, windowHeight
|
||||||
, squares
|
|
||||||
, arrowX
|
, arrowX
|
||||||
, arrowY
|
, arrowY
|
||||||
, canvasWidth
|
, canvasWidth
|
||||||
@@ -737,7 +695,6 @@ struct
|
|||||||
{ mode = mode
|
{ mode = mode
|
||||||
, mouseX = mouseX
|
, mouseX = mouseX
|
||||||
, mouseY = mouseY
|
, mouseY = mouseY
|
||||||
, squares = squares
|
|
||||||
, arrowX = arrowX
|
, arrowX = arrowX
|
||||||
, arrowY = arrowY
|
, arrowY = arrowY
|
||||||
, canvasWidth = canvasWidth
|
, canvasWidth = canvasWidth
|
||||||
@@ -771,7 +728,6 @@ struct
|
|||||||
, yClickPoints
|
, yClickPoints
|
||||||
, windowWidth
|
, windowWidth
|
||||||
, windowHeight
|
, windowHeight
|
||||||
, squares
|
|
||||||
, arrowX
|
, arrowX
|
||||||
, arrowY
|
, arrowY
|
||||||
, canvasWidth
|
, canvasWidth
|
||||||
@@ -795,7 +751,6 @@ struct
|
|||||||
{ mode = mode
|
{ mode = mode
|
||||||
, mouseX = mouseX
|
, mouseX = mouseX
|
||||||
, mouseY = mouseY
|
, mouseY = mouseY
|
||||||
, squares = squares
|
|
||||||
, arrowX = arrowX
|
, arrowX = arrowX
|
||||||
, arrowY = arrowY
|
, arrowY = arrowY
|
||||||
, canvasWidth = canvasWidth
|
, canvasWidth = canvasWidth
|
||||||
@@ -829,7 +784,6 @@ struct
|
|||||||
, yClickPoints
|
, yClickPoints
|
||||||
, windowWidth
|
, windowWidth
|
||||||
, windowHeight
|
, windowHeight
|
||||||
, squares
|
|
||||||
, arrowX = _
|
, arrowX = _
|
||||||
, arrowY = _
|
, arrowY = _
|
||||||
, canvasWidth
|
, canvasWidth
|
||||||
@@ -851,7 +805,6 @@ struct
|
|||||||
{ mode = mode
|
{ mode = mode
|
||||||
, mouseX = mouseX
|
, mouseX = mouseX
|
||||||
, mouseY = mouseY
|
, mouseY = mouseY
|
||||||
, squares = squares
|
|
||||||
, arrowX = arrowX
|
, arrowX = arrowX
|
||||||
, arrowY = arrowY
|
, arrowY = arrowY
|
||||||
, canvasWidth = canvasWidth
|
, canvasWidth = canvasWidth
|
||||||
@@ -880,7 +833,6 @@ struct
|
|||||||
val
|
val
|
||||||
{ mode
|
{ mode
|
||||||
, canvasWidth = _
|
, canvasWidth = _
|
||||||
, squares
|
|
||||||
, arrowX
|
, arrowX
|
||||||
, arrowY
|
, arrowY
|
||||||
, canvasHeight
|
, canvasHeight
|
||||||
@@ -914,7 +866,6 @@ struct
|
|||||||
, arrowX = arrowX
|
, arrowX = arrowX
|
||||||
, mouseX = mouseX
|
, mouseX = mouseX
|
||||||
, mouseY = mouseY
|
, mouseY = mouseY
|
||||||
, squares = squares
|
|
||||||
, arrowY = arrowY
|
, arrowY = arrowY
|
||||||
, canvasHeight = canvasHeight
|
, canvasHeight = canvasHeight
|
||||||
, windowWidth = windowWidth
|
, windowWidth = windowWidth
|
||||||
@@ -942,7 +893,6 @@ struct
|
|||||||
{ mode
|
{ mode
|
||||||
, canvasHeight = _
|
, canvasHeight = _
|
||||||
, canvasWidth
|
, canvasWidth
|
||||||
, squares
|
|
||||||
, arrowX
|
, arrowX
|
||||||
, arrowY
|
, arrowY
|
||||||
, windowWidth
|
, windowWidth
|
||||||
@@ -976,7 +926,6 @@ struct
|
|||||||
, arrowX = arrowX
|
, arrowX = arrowX
|
||||||
, mouseX = mouseX
|
, mouseX = mouseX
|
||||||
, mouseY = mouseY
|
, mouseY = mouseY
|
||||||
, squares = squares
|
|
||||||
, arrowY = arrowY
|
, arrowY = arrowY
|
||||||
, windowWidth = windowWidth
|
, windowWidth = windowWidth
|
||||||
, windowHeight = windowHeight
|
, windowHeight = windowHeight
|
||||||
@@ -997,75 +946,12 @@ struct
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
fun useSquares (app: app_type, squares, canvasWidth, canvasHeight) =
|
|
||||||
let
|
|
||||||
val
|
|
||||||
{ mode
|
|
||||||
, canvasHeight = _
|
|
||||||
, canvasWidth = _
|
|
||||||
, squares = _
|
|
||||||
, arrowX
|
|
||||||
, arrowY
|
|
||||||
, windowWidth
|
|
||||||
, windowHeight
|
|
||||||
, xClickPoints
|
|
||||||
, yClickPoints
|
|
||||||
|
|
||||||
, showGraph
|
|
||||||
, mouseX
|
|
||||||
, mouseY
|
|
||||||
, openFilePath
|
|
||||||
, fileBrowser
|
|
||||||
, fileBrowserIdx
|
|
||||||
, r
|
|
||||||
, g
|
|
||||||
, b
|
|
||||||
, a
|
|
||||||
, layer
|
|
||||||
, layerTree
|
|
||||||
, modalNum
|
|
||||||
} = app
|
|
||||||
|
|
||||||
val arrowX = Int.min (arrowX, canvasWidth)
|
|
||||||
val arrowY = Int.min (arrowY, canvasHeight)
|
|
||||||
val (xClickPoints, yClickPoints) =
|
|
||||||
ClickPoints.generate
|
|
||||||
(windowWidth, windowHeight, canvasWidth, canvasHeight)
|
|
||||||
in
|
|
||||||
{ mode = mode
|
|
||||||
, canvasHeight = canvasHeight
|
|
||||||
, canvasWidth = canvasWidth
|
|
||||||
, arrowX = arrowX
|
|
||||||
, mouseX = mouseX
|
|
||||||
, mouseY = mouseY
|
|
||||||
, squares = squares
|
|
||||||
, arrowY = arrowY
|
|
||||||
, windowWidth = windowWidth
|
|
||||||
, windowHeight = windowHeight
|
|
||||||
, xClickPoints = xClickPoints
|
|
||||||
, yClickPoints = yClickPoints
|
|
||||||
|
|
||||||
, showGraph = showGraph
|
|
||||||
, openFilePath = openFilePath
|
|
||||||
, fileBrowser = fileBrowser
|
|
||||||
, fileBrowserIdx = fileBrowserIdx
|
|
||||||
, r = r
|
|
||||||
, g = g
|
|
||||||
, b = b
|
|
||||||
, a = a
|
|
||||||
, layer = layer
|
|
||||||
, layerTree = layerTree
|
|
||||||
, modalNum = 0
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
fun cursorColour (app, r, g, b, a) =
|
fun cursorColour (app, r, g, b, a) =
|
||||||
let
|
let
|
||||||
val
|
val
|
||||||
{ mode
|
{ mode
|
||||||
, canvasHeight
|
, canvasHeight
|
||||||
, canvasWidth
|
, canvasWidth
|
||||||
, squares
|
|
||||||
, arrowX
|
, arrowX
|
||||||
, arrowY
|
, arrowY
|
||||||
, windowWidth
|
, windowWidth
|
||||||
@@ -1094,7 +980,6 @@ struct
|
|||||||
, arrowX = arrowX
|
, arrowX = arrowX
|
||||||
, mouseX = mouseX
|
, mouseX = mouseX
|
||||||
, mouseY = mouseY
|
, mouseY = mouseY
|
||||||
, squares = squares
|
|
||||||
, arrowY = arrowY
|
, arrowY = arrowY
|
||||||
, windowWidth = windowWidth
|
, windowWidth = windowWidth
|
||||||
, windowHeight = windowHeight
|
, windowHeight = windowHeight
|
||||||
|
|||||||
@@ -10,17 +10,19 @@ struct
|
|||||||
fun resizeWindow (model, width, height, dots) =
|
fun resizeWindow (model, width, height, dots) =
|
||||||
let
|
let
|
||||||
val
|
val
|
||||||
{ squares
|
{ canvasWidth
|
||||||
, canvasWidth
|
|
||||||
, canvasHeight
|
, canvasHeight
|
||||||
, showGraph
|
, showGraph
|
||||||
, arrowX
|
, arrowX
|
||||||
, arrowY
|
, arrowY
|
||||||
, xClickPoints
|
, xClickPoints
|
||||||
, yClickPoints
|
, yClickPoints
|
||||||
|
, layerTree
|
||||||
, ...
|
, ...
|
||||||
} = model
|
} = model
|
||||||
|
|
||||||
val maxSide = Int.max (canvasWidth, canvasHeight)
|
val maxSide = Int.max (canvasWidth, canvasHeight)
|
||||||
|
val squares = LayerTree.flatten (maxSide, layerTree)
|
||||||
|
|
||||||
val squares = CollisionTree.toTriangles
|
val squares = CollisionTree.toTriangles
|
||||||
( width
|
( width
|
||||||
@@ -46,11 +48,12 @@ struct
|
|||||||
|
|
||||||
fun getSaveSquaresMsg (model: app_type) =
|
fun getSaveSquaresMsg (model: app_type) =
|
||||||
let
|
let
|
||||||
|
(* todo: reimplement, saving each layer to a different line
|
||||||
val {canvasWidth, canvasHeight, squares, ...} = model
|
val {canvasWidth, canvasHeight, squares, ...} = model
|
||||||
val str = CollisionTree.toSaveString (squares, canvasWidth, canvasHeight)
|
val str = CollisionTree.toSaveString (squares, canvasWidth, canvasHeight)
|
||||||
val msg = SAVE_SQUARES str
|
val msg = SAVE_SQUARES str
|
||||||
in
|
*)
|
||||||
(model, [FILE msg])
|
in raise Fail "todo common-update.sml: reimplement saving"
|
||||||
end
|
end
|
||||||
|
|
||||||
fun getLoadSquaresMsg model =
|
fun getLoadSquaresMsg model =
|
||||||
@@ -58,7 +61,11 @@ struct
|
|||||||
|
|
||||||
fun getExportSquaresMsg (model: app_type) =
|
fun getExportSquaresMsg (model: app_type) =
|
||||||
let
|
let
|
||||||
val {squares, canvasWidth, canvasHeight, ...} = model
|
val {layerTree, canvasWidth, canvasHeight, ...} = model
|
||||||
|
|
||||||
|
val maxSide = Int.max (canvasWidth, canvasHeight)
|
||||||
|
val squares = LayerTree.flatten (maxSide, layerTree)
|
||||||
|
|
||||||
val exportString =
|
val exportString =
|
||||||
CollisionTree.toExportString (squares, canvasWidth, canvasHeight)
|
CollisionTree.toExportString (squares, canvasWidth, canvasHeight)
|
||||||
val msg = EXPORT_SQUARES exportString
|
val msg = EXPORT_SQUARES exportString
|
||||||
@@ -68,7 +75,11 @@ struct
|
|||||||
|
|
||||||
fun getCollisionMsg (model: app_type) =
|
fun getCollisionMsg (model: app_type) =
|
||||||
let
|
let
|
||||||
val {squares, canvasWidth, canvasHeight, modalNum, ...} = model
|
val {layerTree, canvasWidth, canvasHeight, modalNum, ...} = model
|
||||||
|
|
||||||
|
val maxSide = Int.max (canvasWidth, canvasHeight)
|
||||||
|
val squares = LayerTree.flatten (maxSide, layerTree)
|
||||||
|
|
||||||
val exportString =
|
val exportString =
|
||||||
CollisionTree.toCollisionString
|
CollisionTree.toCollisionString
|
||||||
(squares, canvasWidth, canvasHeight, modalNum)
|
(squares, canvasWidth, canvasHeight, modalNum)
|
||||||
|
|||||||
@@ -333,11 +333,7 @@ struct
|
|||||||
end
|
end
|
||||||
|
|
||||||
fun useSquares (model, squares, canvasWidth, canvasHeight) =
|
fun useSquares (model, squares, canvasWidth, canvasHeight) =
|
||||||
let
|
raise Fail "todo: reimplement"
|
||||||
val model = AppWith.useSquares (model, squares, canvasWidth, canvasHeight)
|
|
||||||
in
|
|
||||||
updateCanvas (model, canvasWidth, canvasHeight)
|
|
||||||
end
|
|
||||||
|
|
||||||
fun enterBrowseMode model =
|
fun enterBrowseMode model =
|
||||||
let
|
let
|
||||||
|
|||||||
Reference in New Issue
Block a user