Skip to content

Commit

Permalink
update layout algo
Browse files Browse the repository at this point in the history
  • Loading branch information
akevalion committed Oct 11, 2023
1 parent 6a82fd5 commit d14059d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
21 changes: 20 additions & 1 deletion src/Roassal-Layouts-Util/RSLayoutNode.class.st
Expand Up @@ -12,7 +12,8 @@ Class {
'children',
'model',
'connectedLines',
'parent'
'parent',
'properties'
],
#category : #'Roassal-Layouts-Util'
}
Expand Down Expand Up @@ -199,6 +200,24 @@ RSLayoutNode >> position: aPoint [
position := aPoint
]

{ #category : #accessing }
RSLayoutNode >> propertyAt: key [
properties ifNil: [ ^ nil ].
^ properties at: key
]

{ #category : #accessing }
RSLayoutNode >> propertyAt: key ifAbsent: aBlock [
properties ifNil: [ ^ aBlock value ].
^ properties at: key ifAbsent: aBlock
]

{ #category : #accessing }
RSLayoutNode >> propertyAt: key put: anObject [
properties ifNil: [ properties := Dictionary new ].
^ properties at: key put: anObject
]

{ #category : #actions }
RSLayoutNode >> remove [
parent ifNil: [ ^ self ].
Expand Down
2 changes: 1 addition & 1 deletion src/Roassal-Layouts/RSConditionalLayout.class.st
Expand Up @@ -45,7 +45,7 @@ RSConditionalLayout >> doExecute: shapes [
thenLayout on: thenShapes.
elseLayout on: elseShapes.

clusterLayout on: { thenShapes. elseShapes }.
clusterLayout on: { thenShapes. elseShapes } asGroup.
]

{ #category : #accessing }
Expand Down
7 changes: 4 additions & 3 deletions src/Roassal-Layouts/RSTWalkBasedRegularTreeLayout.trait.st
Expand Up @@ -220,10 +220,11 @@ RSTWalkBasedRegularTreeLayout >> initialize: elements associationEdges: associat

multipleParents ifFalse: [ children add: child ] ].

rootNode := roots size > 1 ifTrue: [ | rootShape |
rootNode := roots size > 1 ifTrue: [
roots do: [ :each | self assert: (fathers includesKey: each) not ].
rootShape := elements anyOne class new.
self childrenOf: rootShape put: roots asArray
RSLayoutNode new
in: [ :aRootNode | self childrenOf: aRootNode put: roots asArray ];
yourself
] ifFalse: [ roots anyOne ].

leaves do: [ :each |
Expand Down

0 comments on commit d14059d

Please sign in to comment.