remove graph lines vector from app type, so the vector can be garbage collected (it is not really needed)
This commit is contained in:
@@ -12,9 +12,6 @@ struct
|
||||
let
|
||||
val xClickPoints = ClickPoints.generate (wStart, wFinish)
|
||||
val yClickPoints = ClickPoints.generate (hStart, hFinish)
|
||||
val graphLines =
|
||||
GraphLines.generate
|
||||
(windowWidth, windowHeight, xClickPoints, yClickPoints)
|
||||
in
|
||||
{ triangles = []
|
||||
, triangleStage = NO_TRIANGLE
|
||||
@@ -22,7 +19,6 @@ struct
|
||||
, windowHeight = windowHeight
|
||||
, xClickPoints = xClickPoints
|
||||
, yClickPoints = yClickPoints
|
||||
, graphLines = graphLines
|
||||
, undo = []
|
||||
, redo = []
|
||||
, mouseX = 0.0
|
||||
|
||||
@@ -22,7 +22,6 @@ sig
|
||||
, windowHeight: int
|
||||
, xClickPoints: Real32.real vector
|
||||
, yClickPoints: Real32.real vector
|
||||
, graphLines: Real32.real vector
|
||||
, undo: (Real32.real * Real32.real) list
|
||||
, redo: (Real32.real * Real32.real) list
|
||||
, mouseX: Real32.real
|
||||
@@ -62,7 +61,6 @@ struct
|
||||
, windowHeight: int
|
||||
, xClickPoints: Real32.real vector
|
||||
, yClickPoints: Real32.real vector
|
||||
, graphLines: Real32.real vector
|
||||
, undo: (Real32.real * Real32.real) list
|
||||
, redo: (Real32.real * Real32.real) list
|
||||
, mouseX: Real32.real
|
||||
|
||||
@@ -69,7 +69,7 @@ struct
|
||||
let
|
||||
val model = AppWith.windowResize (model, width, height)
|
||||
val triangles = Triangles.toVector model
|
||||
val graphLines = #graphLines model
|
||||
val graphLines = GraphLines.generate model
|
||||
val drawMsg =
|
||||
RESIZE_TRIANGLES_BUTTONS_AND_GRAPH
|
||||
{triangles = triangles, graphLines = graphLines}
|
||||
|
||||
@@ -55,7 +55,6 @@ struct
|
||||
, yClickPoints
|
||||
, windowWidth
|
||||
, windowHeight
|
||||
, graphLines
|
||||
, undo
|
||||
, redo = _
|
||||
, mouseX
|
||||
@@ -72,7 +71,6 @@ struct
|
||||
, yClickPoints = yClickPoints
|
||||
, windowWidth = windowWidth
|
||||
, windowHeight = windowHeight
|
||||
, graphLines = graphLines
|
||||
, mouseX = mouseX
|
||||
, mouseY = mouseY
|
||||
}
|
||||
@@ -87,7 +85,6 @@ struct
|
||||
, yClickPoints
|
||||
, windowWidth
|
||||
, windowHeight
|
||||
, graphLines
|
||||
, undo
|
||||
, redo = _
|
||||
, mouseX
|
||||
@@ -106,7 +103,6 @@ struct
|
||||
, yClickPoints = yClickPoints
|
||||
, windowWidth = windowWidth
|
||||
, windowHeight = windowHeight
|
||||
, graphLines = graphLines
|
||||
, mouseX = mouseX
|
||||
, mouseY = mouseY
|
||||
}
|
||||
@@ -121,7 +117,6 @@ struct
|
||||
, yClickPoints = _
|
||||
, windowWidth = _
|
||||
, windowHeight = _
|
||||
, graphLines = _
|
||||
, triangles
|
||||
, triangleStage
|
||||
, undo
|
||||
@@ -132,13 +127,9 @@ struct
|
||||
|
||||
val xClickPoints = ClickPoints.generate (wStart, wFinish)
|
||||
val yClickPoints = ClickPoints.generate (hStart, hFinish)
|
||||
val graphLines =
|
||||
GraphLines.generate
|
||||
(windowWidth, windowHeight, xClickPoints, yClickPoints)
|
||||
in
|
||||
{ xClickPoints = xClickPoints
|
||||
, yClickPoints = yClickPoints
|
||||
, graphLines = graphLines
|
||||
, triangles = triangles
|
||||
, triangleStage = triangleStage
|
||||
, windowWidth = windowWidth
|
||||
@@ -184,7 +175,6 @@ struct
|
||||
, yClickPoints
|
||||
, windowWidth
|
||||
, windowHeight
|
||||
, graphLines
|
||||
, undo
|
||||
, redo
|
||||
} = app
|
||||
@@ -197,7 +187,6 @@ struct
|
||||
, yClickPoints = yClickPoints
|
||||
, windowWidth = windowWidth
|
||||
, windowHeight = windowHeight
|
||||
, graphLines = graphLines
|
||||
, undo = undo
|
||||
, redo = redo
|
||||
}
|
||||
@@ -213,7 +202,6 @@ struct
|
||||
, yClickPoints
|
||||
, windowWidth
|
||||
, windowHeight
|
||||
, graphLines
|
||||
, undo
|
||||
, redo
|
||||
, mouseX
|
||||
@@ -235,7 +223,6 @@ struct
|
||||
, yClickPoints = yClickPoints
|
||||
, windowWidth = windowWidth
|
||||
, windowHeight = windowHeight
|
||||
, graphLines = graphLines
|
||||
, mouseX = mouseX
|
||||
, mouseY = mouseY
|
||||
}
|
||||
@@ -251,7 +238,6 @@ struct
|
||||
, yClickPoints
|
||||
, windowWidth
|
||||
, windowHeight
|
||||
, graphLines
|
||||
, undo
|
||||
, redo
|
||||
, mouseX
|
||||
@@ -272,7 +258,6 @@ struct
|
||||
, yClickPoints = yClickPoints
|
||||
, windowWidth = windowWidth
|
||||
, windowHeight = windowHeight
|
||||
, graphLines = graphLines
|
||||
, mouseX = mouseX
|
||||
, mouseY = mouseY
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
signature GRAPH_LINES =
|
||||
sig
|
||||
val generate: int * int * Real32.real vector * Real32.real vector
|
||||
-> Real32.real vector
|
||||
val generate: AppType.app_type -> Real32.real vector
|
||||
end
|
||||
|
||||
structure GraphLines :> GRAPH_LINES =
|
||||
@@ -134,7 +133,7 @@ struct
|
||||
(pos + 1, yClickPoints, acc, halfHeight, xMin, xMax)
|
||||
end
|
||||
|
||||
fun generate (windowWidth, windowHeight, xClickPoints, yClickPoints) =
|
||||
fun helpGenerate (windowWidth, windowHeight, xClickPoints, yClickPoints) =
|
||||
if windowWidth = windowHeight then
|
||||
helpGenGraphLinesSquare (~1.0, 1.0, [])
|
||||
else if windowWidth > windowHeight then
|
||||
@@ -180,4 +179,11 @@ struct
|
||||
in
|
||||
Vector.concat lines
|
||||
end
|
||||
|
||||
fun generate (app: AppType.app_type) =
|
||||
let
|
||||
val {windowWidth, windowHeight, xClickPoints, yClickPoints, ...} = app
|
||||
in
|
||||
helpGenerate (windowWidth, windowHeight, xClickPoints, yClickPoints)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19,12 +19,7 @@ struct
|
||||
AppInit.fromWindowWidthAndHeight
|
||||
(Constants.windowWidth, Constants.windowHeight)
|
||||
|
||||
val graphLines =
|
||||
let
|
||||
open AppType
|
||||
in
|
||||
#graphLines initialModel
|
||||
end
|
||||
val graphLines = GraphLines.generate initialModel
|
||||
val graphDrawObject = AppDraw.initGraphLines ()
|
||||
val _ = AppDraw.uploadGraphLines (graphDrawObject, graphLines)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user