Files
sml-projects/temp-squares/fcore/app-update.sml

45 lines
1.2 KiB
Standard ML
Raw Normal View History

2025-07-06 02:49:38 +01:00
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