improve creation of click points, so that we can have a pixel be a perfect square, even if the canvas isn't
This commit is contained in:
@@ -160,9 +160,7 @@ struct
|
||||
}
|
||||
end
|
||||
|
||||
fun helpWindowResize
|
||||
(app: app_type, windowWidth, windowHeight, wStart, wFinish, hStart, hFinish) :
|
||||
app_type =
|
||||
fun windowResize (app: app_type, windowWidth, windowHeight) : app_type =
|
||||
let
|
||||
val
|
||||
{ mode
|
||||
@@ -188,9 +186,9 @@ struct
|
||||
, modalNum
|
||||
} = app
|
||||
|
||||
val maxPoints = Int.max (canvasWidth, canvasHeight)
|
||||
val xClickPoints = ClickPoints.generate (wStart, wFinish, maxPoints)
|
||||
val yClickPoints = ClickPoints.generate (hStart, hFinish, maxPoints)
|
||||
val (xClickPoints, yClickPoints) =
|
||||
ClickPoints.generate
|
||||
(windowWidth, windowHeight, canvasWidth, canvasHeight)
|
||||
in
|
||||
{ mode = mode
|
||||
, squares = squares
|
||||
@@ -216,29 +214,6 @@ struct
|
||||
}
|
||||
end
|
||||
|
||||
fun windowResize (app: app_type, windowWidth, windowHeight) =
|
||||
if windowWidth = windowHeight then
|
||||
helpWindowResize
|
||||
(app, windowWidth, windowHeight, 0, windowWidth, 0, windowHeight)
|
||||
else if windowWidth > windowHeight then
|
||||
let
|
||||
val difference = windowWidth - windowHeight
|
||||
val wStart = difference div 2
|
||||
val wFinish = wStart + windowHeight
|
||||
in
|
||||
helpWindowResize
|
||||
(app, windowWidth, windowHeight, wStart, wFinish, 0, windowHeight)
|
||||
end
|
||||
else
|
||||
let
|
||||
val difference = windowHeight - windowWidth
|
||||
val hStart = difference div 2
|
||||
val hFinish = hStart + windowWidth
|
||||
in
|
||||
helpWindowResize
|
||||
(app, windowWidth, windowHeight, 0, windowWidth, hStart, hFinish)
|
||||
end
|
||||
|
||||
fun mousePosition (app: app_type, mouseX, mouseY) =
|
||||
let
|
||||
val
|
||||
|
||||
Reference in New Issue
Block a user