begin refactoring AppUpdate structure
This commit is contained in:
44
temp-squares/fcore/app-update.sml
Normal file
44
temp-squares/fcore/app-update.sml
Normal file
@@ -0,0 +1,44 @@
|
||||
structure AppUpdate =
|
||||
struct
|
||||
open AppType
|
||||
|
||||
open DrawMessage
|
||||
open FileMessage
|
||||
open InputMessage
|
||||
open UpdateMessage
|
||||
|
||||
fun getDotVecFromIndices (model: app_type, hIdx, vIdx) =
|
||||
let
|
||||
val {windowWidth, windowHeight, xClickPoints, yClickPoints, ...} = model
|
||||
val xpos = Vector.sub (xClickPoints, hIdx)
|
||||
val ypos = Vector.sub (yClickPoints, vIdx)
|
||||
|
||||
val endXpos =
|
||||
if hIdx + 1 = Vector.length xClickPoints then
|
||||
xpos
|
||||
else
|
||||
Vector.sub (xClickPoints, hIdx + 1)
|
||||
|
||||
val endYpos =
|
||||
if vIdx + 1 = Vector.length yClickPoints then
|
||||
ypos
|
||||
else
|
||||
Vector.sub (yClickPoints, vIdx + 1)
|
||||
|
||||
val tl =
|
||||
ClickPoints.getDrawDotRgb
|
||||
(xpos, ypos, 1.0, 0.0, 0.0, windowWidth, windowHeight)
|
||||
val tr =
|
||||
ClickPoints.getDrawDotRgb
|
||||
(endXpos, ypos, 1.0, 0.0, 0.0, windowWidth, windowHeight)
|
||||
val bl =
|
||||
ClickPoints.getDrawDotRgb
|
||||
(xpos, endYpos, 1.0, 0.0, 0.0, windowWidth, windowHeight)
|
||||
val br =
|
||||
ClickPoints.getDrawDotRgb
|
||||
(endXpos, endYpos, 1.0, 0.0, 0.0, windowWidth, windowHeight)
|
||||
in
|
||||
Vector.concat [tl, tr, bl, br]
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user