2025-07-06 01:38:02 +01:00
|
|
|
signature APP_INIT =
|
|
|
|
|
sig
|
|
|
|
|
val fromWindowWidthAndHeight: int * int * int * int -> AppType.app_type
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
structure AppInit :> APP_INIT =
|
|
|
|
|
struct
|
|
|
|
|
open AppType
|
|
|
|
|
|
|
|
|
|
fun helpFromWidthAndHeight
|
|
|
|
|
( windowWidth
|
|
|
|
|
, windowHeight
|
|
|
|
|
, wStart
|
|
|
|
|
, wFinish
|
|
|
|
|
, hStart
|
|
|
|
|
, hFinish
|
|
|
|
|
, canvasWidth
|
|
|
|
|
, canvasHeight
|
|
|
|
|
) : app_type =
|
|
|
|
|
let
|
2025-07-11 00:57:29 +01:00
|
|
|
val (xClickPoints, yClickPoints) =
|
|
|
|
|
ClickPoints.generate
|
|
|
|
|
(windowWidth, windowHeight, canvasWidth, canvasHeight)
|
2025-07-06 01:38:02 +01:00
|
|
|
|
2025-07-07 01:48:15 +01:00
|
|
|
val maxPoints = Int.max (canvasWidth, canvasHeight)
|
2025-08-09 09:32:34 +01:00
|
|
|
val layerTree = LayerTree.init maxPoints
|
2025-07-06 01:38:02 +01:00
|
|
|
in
|
|
|
|
|
{ mode = AppType.NORMAL_MODE
|
|
|
|
|
, canvasWidth = canvasWidth
|
|
|
|
|
, canvasHeight = canvasHeight
|
|
|
|
|
, windowWidth = windowWidth
|
|
|
|
|
, windowHeight = windowHeight
|
|
|
|
|
, xClickPoints = xClickPoints
|
|
|
|
|
, yClickPoints = yClickPoints
|
|
|
|
|
|
|
|
|
|
, mouseX = 0.0
|
|
|
|
|
, mouseY = 0.0
|
|
|
|
|
, showGraph = true
|
|
|
|
|
, arrowX = 0
|
|
|
|
|
, arrowY = 0
|
|
|
|
|
, openFilePath = ""
|
|
|
|
|
, fileBrowser = Vector.fromList []
|
|
|
|
|
, fileBrowserIdx = 0
|
2025-07-11 16:39:39 +01:00
|
|
|
, r = 0
|
|
|
|
|
, g = 0
|
|
|
|
|
, b = 0
|
|
|
|
|
, a = 1
|
2025-08-09 08:15:11 +01:00
|
|
|
, layer = 0
|
2025-08-09 09:32:34 +01:00
|
|
|
, layerTree = layerTree
|
2025-07-06 01:38:02 +01:00
|
|
|
, modalNum = 0
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
fun fromWindowWidthAndHeight
|
|
|
|
|
(windowWidth, windowHeight, canvasWidth, canvasHeight) =
|
|
|
|
|
if windowWidth > windowHeight then
|
|
|
|
|
let
|
|
|
|
|
val difference = windowWidth - windowHeight
|
|
|
|
|
val wStart = difference div 2
|
|
|
|
|
val wFinish = wStart + windowHeight
|
|
|
|
|
in
|
|
|
|
|
helpFromWidthAndHeight
|
|
|
|
|
( windowWidth
|
|
|
|
|
, windowHeight
|
|
|
|
|
, wStart
|
|
|
|
|
, wFinish
|
|
|
|
|
, 0
|
|
|
|
|
, windowHeight
|
|
|
|
|
, canvasWidth
|
|
|
|
|
, canvasHeight
|
|
|
|
|
)
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
let
|
|
|
|
|
val difference = windowHeight - windowWidth
|
|
|
|
|
val hStart = difference div 2
|
|
|
|
|
val hFinish = hStart + windowWidth
|
|
|
|
|
in
|
|
|
|
|
helpFromWidthAndHeight
|
|
|
|
|
( windowWidth
|
|
|
|
|
, windowHeight
|
|
|
|
|
, 0
|
|
|
|
|
, windowWidth
|
|
|
|
|
, hStart
|
|
|
|
|
, hFinish
|
|
|
|
|
, canvasWidth
|
|
|
|
|
, canvasHeight
|
|
|
|
|
)
|
|
|
|
|
end
|
|
|
|
|
end
|