Skip to content

Commit

Permalink
Working on #1248
Browse files Browse the repository at this point in the history
  • Loading branch information
ClotildeToullec committed Nov 26, 2024
1 parent 413a6eb commit 36c9c60
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 31 deletions.
30 changes: 14 additions & 16 deletions src/MooseIDE-CoUsageMap/MiCoHighlightManager.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,23 @@ MiCoHighlightManager >> defaultBoxBorder [

{ #category : #selection }
MiCoHighlightManager >> deselectInnerBox: evt [
"called when clicking on a shape ('permanent' highlight)"
"Called when clicking on a shape ('permanent' highlight)"

evt canvas
propertyAt: highlight propertyKey
mapBuilder selectedInnerShape ifNil: [ ^ self ].
evt canvas
propertyAt: highlight propertyKey
put: (highlight highlightShapesFor: mapBuilder selectedInnerShape).
mapBuilder selectedInnerShape: nil.
highlight unhighlightRecordedShapes: evt shape.
evt signalUpdate.
evt signalUpdate
]

{ #category : #highlighting }
MiCoHighlightManager >> highlight: evt [
"called on mouse entering a shape"

mapBuilder selectedInnerEntity
ifNil: [ evt shape border: self selectedBoxBorder ]
ifNotNil: [
].
mapBuilder selectedInnerEntity ifNil: [
evt shape border: self selectedBoxBorder ]
]

{ #category : #initialization }
Expand Down Expand Up @@ -70,12 +69,13 @@ MiCoHighlightManager >> mapBuilder: aCoUsageMapBuilder [

{ #category : #hooks }
MiCoHighlightManager >> onShape: aShape [
(aShape isShape not or: [aShape isComposite]) ifTrue: [

(aShape isShape not or: [ aShape isComposite ]) ifTrue: [
aShape when: RSMouseClick send: #deselectInnerBox: to: self.
^ self ].
aShape
aShape
addInteraction: highlight;
when: RSMouseLeftClick send: #selectInnerBox: to: self.
when: RSMouseLeftClick send: #selectInnerBox: to: self
]

{ #category : #selection }
Expand All @@ -85,7 +85,7 @@ MiCoHighlightManager >> selectInnerBox: evt [
mapBuilder selectedInnerEntity ifNotNil: [
self deselectInnerBox: evt ].
highlight doHighlight: evt shape.
mapBuilder selectedInnerShape: evt shape.
mapBuilder selectedInnerShape: evt shape
]

{ #category : #accessing }
Expand All @@ -101,8 +101,6 @@ MiCoHighlightManager >> selectedBoxBorder [
MiCoHighlightManager >> unhighlight: evt [
"called on mouse leaving a shape"

mapBuilder selectedInnerEntity
ifNil: [ evt shape border: self defaultBoxBorder ]
ifNotNil: [
].
mapBuilder selectedInnerEntity ifNil: [
evt shape border: self defaultBoxBorder ]
]
13 changes: 9 additions & 4 deletions src/MooseIDE-CoUsageMap/MiCoTagLegendBuilder.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -149,22 +149,27 @@ MiCoTagLegendBuilder >> removeOldLegend [

]

{ #category : #hooks }
{ #category : #rendering }
MiCoTagLegendBuilder >> renderIn: aCanvas [

| tagShapes legend |
| legend |
self removeOldLegend.

legend := RSLegend new
container: aCanvas;
yourself.

shapes := RSGroup new.
tagShapes := self tags collect: [ :tag | self legendTagLine: tag ].
shapes addAll: tagShapes.
shapes addAll:
(self tags collect: [ :tag | self legendTagLine: tag ]).
shapes add: self legendBottomLine.
legend shapes ifNotNil: [ :collection | collection addAll: shapes ].

legend layout vertical gapSize: 2.
legend defaultTitle
color: Color black;
fontSize: 12.

legend
legendDo: [ :l | self legendDo: l ];
beFixedWithTitle: self legendTitle;
Expand Down
19 changes: 8 additions & 11 deletions src/MooseIDE-CoUsageMap/MiCoUsageMapBuilder.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -289,28 +289,25 @@ MiCoUsageMapBuilder >> resizeLabelIfNecessary: label [
{ #category : #accessing }
MiCoUsageMapBuilder >> selectedInnerEntity [

^visualization selectedInnerEntity
^ visualization selectedInnerEntity
]

{ #category : #accessing }
MiCoUsageMapBuilder >> selectedInnerShape [
| selectedEntity |
selectedEntity := visualization selectedInnerEntity.
self canvas children do: [:containerShape |

self canvas children do: [ :containerShape |
containerShape innerBoxShapes
detect: [ :innerShape |
innerShape model mooseEntity = selectedEntity ]
ifOne: [ :innerShape | ^innerShape ]
ifNone: [ nil ]
].

Error signal: 'Shape of selected entity not found'
innerShape model mooseEntity = self selectedInnerEntity ]
ifFound: [ :innerShape | ^ innerShape ] ].
^ nil
]

{ #category : #accessing }
MiCoUsageMapBuilder >> selectedInnerShape: anInnerShape [

^visualization selectedInnerEntity: (anInnerShape ifNil: [ nil ] ifNotNil: [anInnerShape model mooseEntity])
^ visualization selectedInnerEntity:
(anInnerShape ifNotNil: [ anInnerShape model mooseEntity ])
]

{ #category : #accessing }
Expand Down

0 comments on commit 36c9c60

Please sign in to comment.