Skip to content

Commit

Permalink
GtInspectorElementLiveViewContainer handles case when its child is …
Browse files Browse the repository at this point in the history
…replaced by another element.
  • Loading branch information
JurajKubelka committed Nov 5, 2024
1 parent 322eeba commit 7d02f42
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ GtInspectorElementLiveViewContainer >> isReadyForLiveView [
Do not display it as live."
^ false ].

"The element am not displayed (used) anywhere, display it live."
"The element is not displayed (used) anywhere, display it live."
^ true
]

Expand Down Expand Up @@ -161,6 +161,16 @@ GtInspectorElementLiveViewContainer >> onAddedToSceneGraph [
self updateElementLiveView
]

{ #category : #'hooks - children' }
GtInspectorElementLiveViewContainer >> onChildAdded: anElement [
super onChildAdded: anElement.

"In case someone uses code like `anElement parent replaceChild: anElement with: aNewElement`,
we establish the new provided child as a new inspected element."
(self childrenCount = 1 and: [ (anElement == self element) not ]) ifTrue: [
element := anElement ]
]

{ #category : #'private - event handling' }
GtInspectorElementLiveViewContainer >> onElementRemovedFromSceneGraphEvent: anEvent [
self updateElementLiveView
Expand Down

0 comments on commit 7d02f42

Please sign in to comment.