Skip to content

Commit 8109eda

Browse files
committed
Move BlSpace class >> #extractRoots: into its sole sender; deprecate the originals
1 parent 6a43cc6 commit 8109eda

2 files changed

Lines changed: 25 additions & 28 deletions

File tree

src/Bloc/BlElementBoundsUpdater.class.st

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,25 @@ BlElementBoundsUpdater >> commitChanges [
3838
thenCollect: [ :eachAssociation | eachAssociation key ].
3939
theElements ifEmpty: [ ^ self ].
4040

41-
"<---"
42-
self flag: 'Workarroud: avoiding #extractRoots: use speed-up position updates a lot'.
43-
"theElements do: [ :eachRootElement |
44-
eachRootElement withAllChildrenBreadthFirstDo: [ :eachChild | eachChild onPositionInSpaceChanged ] ]."
45-
"--->"
46-
self flag: 'Original version'.
47-
"<---"
48-
self flag: ' It sounds better with #extractRoots: from feenk '.
49-
theRoots := BlSpace extractRoots: theElements.
41+
theRoots := self extractRoots: theElements.
5042
theRoots do: [ :eachRootElement |
5143
eachRootElement withAllChildrenBreadthFirstDo: [ :eachChild | eachChild onPositionInSpaceChanged ] ]
52-
"--->"
44+
]
5345

46+
{ #category : #'private - changes' }
47+
BlElementBoundsUpdater >> extractRoots: aSetOfElements [
48+
| roots |
49+
roots := IdentitySet withAll: aSetOfElements.
50+
aSetOfElements do: [ :each |
51+
| current |
52+
current := each parent.
53+
[ current isNil ] whileFalse: [
54+
(roots includes: current)
55+
ifTrue: [
56+
roots remove: each ifAbsent: [ ].
57+
current := nil ]
58+
ifFalse: [ current := current parent ] ] ].
59+
^ roots
5460
]
5561

5662
{ #category : #testing }

src/Bloc/BlSpace.class.st

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ Class {
3636
'focusChain',
3737
'pulseRequested',
3838
'currentCursor',
39-
'session',
4039
'focused',
4140
'title',
4241
'fullscreen',
@@ -64,23 +63,11 @@ BlSpace class >> defaultRootLabel [
6463

6564
{ #category : #'private - change' }
6665
BlSpace class >> extractRoots: aSetOfElements [
67-
| roots |
68-
" feenk version 2022-02-01 that eliminate recursion from allParentsDo: "
69-
70-
roots := IdentitySet withAll: aSetOfElements.
71-
aSetOfElements
72-
do:
73-
[ :each |
74-
| current |
75-
current := each parent.
76-
[ current isNil ]
77-
whileFalse:
78-
[ (roots includes: current)
79-
ifTrue:
80-
[ roots remove: each ifAbsent: [ ].
81-
current := nil ]
82-
ifFalse: [ current := current parent ] ] ].
83-
^ roots
66+
self
67+
deprecated: 'Use BlElementBoundsUpdater >> #extractRoots: instead'
68+
transformWith: '`@receiver extractRoots: `@arg' -> 'BlElementBoundsUpdater new extractRoots: `@arg'.
69+
70+
^ BlElementBoundsUpdater new extractRoots: aSetOfElements
8471
]
8572

8673
{ #category : #'debug - simulation' }
@@ -897,6 +884,10 @@ BlSpace >> extent: aNewExtent [
897884

898885
{ #category : #'private - change' }
899886
BlSpace >> extractRoots: aSetOfElements [
887+
self
888+
deprecated: 'Use BlElementBoundsUpdater >> #extractRoots: instead'
889+
transformWith: '`@receiver extractRoots: `@arg' -> 'BlElementBoundsUpdater new extractRoots: `@arg'.
890+
900891
^ self class extractRoots: aSetOfElements
901892
]
902893

0 commit comments

Comments
 (0)