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