Skip to content

Commit

Permalink
lsp: fix an issue when recursing through non-expanded nodes in the micro
Browse files Browse the repository at this point in the history
layout calculation.
  • Loading branch information
NiklasRentzCAU committed Apr 5, 2024
1 parent cea6949 commit 8ab89d5
Showing 1 changed file with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* http://rtsys.informatik.uni-kiel.de/kieler
*
* Copyright 2018-2023 by
* Copyright 2018-2024 by
* + Kiel University
* + Department of Computer Science
* + Real-Time and Embedded Systems Group
Expand Down Expand Up @@ -46,6 +46,7 @@ import de.cau.cs.kieler.klighd.microlayout.DecoratorPlacementUtil.Decoration
import de.cau.cs.kieler.klighd.microlayout.GridPlacementUtil
import de.cau.cs.kieler.klighd.microlayout.PlacementUtil
import de.cau.cs.kieler.klighd.util.KlighdProperties
import de.cau.cs.kieler.klighd.util.RenderingContextData
import java.awt.geom.Point2D
import java.util.ArrayList
import java.util.HashMap
Expand Down Expand Up @@ -124,8 +125,21 @@ final class RenderingPreparer {
}
}
if (element instanceof KNode) {
for (node : element.children) {
prepareRendering(node, kGraphToSGraph)
// Do not recurse generating IDs if the element is not expanded, as there won't be any SGraph generated for
// it.
var boolean isExpanded
val renderingContextData = RenderingContextData.get(element)
if (renderingContextData.hasProperty(SprottyProperties.EXPANDED)) {
isExpanded = renderingContextData.getProperty(SprottyProperties.EXPANDED)
} else {
// If the expanded property does not exist yet, use the initial expansion.
isExpanded = element.getProperty(KlighdProperties.EXPAND)
}

if (isExpanded) {
for (node : element.children) {
prepareRendering(node, kGraphToSGraph)
}
}
for (edge : element.outgoingEdges) {
prepareRendering(edge, kGraphToSGraph)
Expand Down

0 comments on commit 8ab89d5

Please sign in to comment.