fix bug: when loading a parsed layer tree, graph lines should be regenerated

This commit is contained in:
2025-08-09 13:50:31 +01:00
parent c29746dd5b
commit e160e997d3
4 changed files with 19 additions and 6 deletions

BIN
dotscape

Binary file not shown.

View File

@@ -1007,8 +1007,8 @@ struct
{ mode { mode
, mouseX , mouseX
, mouseY , mouseY
, xClickPoints , xClickPoints = _
, yClickPoints , yClickPoints = _
, windowWidth , windowWidth
, windowHeight , windowHeight
, arrowX , arrowX
@@ -1033,6 +1033,9 @@ struct
if canvasWidth = 0 then 0 else Int.min (canvasWidth - 1, arrowX) if canvasWidth = 0 then 0 else Int.min (canvasWidth - 1, arrowX)
val arrowY = val arrowY =
if canvasHeight = 0 then 0 else Int.min (canvasHeight - 1, arrowY) if canvasHeight = 0 then 0 else Int.min (canvasHeight - 1, arrowY)
val (xClickPoints, yClickPoints) =
ClickPoints.generate
(windowWidth, windowHeight, canvasWidth, canvasHeight)
in in
{ mode = mode { mode = mode
, mouseX = mouseX , mouseX = mouseX

View File

@@ -134,7 +134,7 @@ struct
fun realToInt x = Real32.toInt IEEEReal.TO_NEAREST x fun realToInt x = Real32.toInt IEEEReal.TO_NEAREST x
fun getDrawMessage (model: app_type) = fun getDrawMessage (model: app_type, initialMsg) =
let let
val val
{ canvasWidth { canvasWidth
@@ -165,8 +165,9 @@ struct
, yClickPoints , yClickPoints
) )
val drawMsg = DRAW_SQUARES_AND_DOTS {squares = squares, dots = dotVec} val drawMsg = DRAW_SQUARES_AND_DOTS {squares = squares, dots = dotVec}
val drawMsg = DRAW (drawMsg) :: initialMsg
in in
(model, [DRAW drawMsg]) (model, drawMsg)
end end
fun changePixel (model: app_type, hIdx, vIdx, pixel) = fun changePixel (model: app_type, hIdx, vIdx, pixel) =
@@ -179,7 +180,7 @@ struct
(layer, hIdx, vIdx, maxSide, pixel, layerTree) (layer, hIdx, vIdx, maxSide, pixel, layerTree)
val model = AppWith.layerTree (model, layerTree, hIdx, vIdx) val model = AppWith.layerTree (model, layerTree, hIdx, vIdx)
in in
getDrawMessage model getDrawMessage (model, [])
end end
fun addPixel (model: app_type, hIdx, vIdx) = fun addPixel (model: app_type, hIdx, vIdx) =
@@ -338,8 +339,14 @@ struct
let let
val model = val model =
AppWith.parsedLayerTree (model, layerTree, canvasWidth, canvasHeight) AppWith.parsedLayerTree (model, layerTree, canvasWidth, canvasHeight)
val graphLines =
if #showGraph model then GraphLines.generate model
else Vector.fromList []
val initialMsg = DRAW_GRAPH graphLines
val initialMsg = [DRAW initialMsg]
in in
getDrawMessage model getDrawMessage (model, initialMsg)
end end
fun enterBrowseMode model = fun enterBrowseMode model =

3
green.dsc Normal file
View File

@@ -0,0 +1,3 @@
24 3 {
[ {0 1 0 1 0 0 0 1 } {1 0 22 0 0 0 0 1 } {1 1 22 1 239 239 239 1 } {1 2 22 2 0 0 0 1 } {23 1 23 1 0 0 0 1 } ]
}