8000 Added <return:...> pragma to examples. · feenkcom/bloc-pac@f824506 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit f824506

Browse files
committed
Added <return:...> pragma to examples.
1 parent 63ba40d commit f824506

File tree

35 files changed

+3813
-2030
lines changed

35 files changed

+3813
-2030
lines changed

src/BlocPac-CommonParent-Examples/BlCommonParentDetectorExamples.class.st

Lines changed: 179 additions & 98 deletions
Large diffs are not rendered by default.

src/BlocPac-DragAndDrop/BlDragAndDropExamples.class.st

Lines changed: 71 additions & 68 deletions
207
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ BlDragAndDropExamples >> letterFor: aCharacter [
3333
{ #category : #examples }
3434
BlDragAndDropExamples >> lettersSorter [
3535
<gtExample>
36+
<return: #BlElement>
3637
| letters vowels consonants |
3738
letters := self lettersSorterContainer.
3839
vowels := self lettersSorterRoundedContainerWithBorder.
@@ -170,95 +171,97 @@ BlDragAndDropExamples >> tagOrdererSlidingTagFor: aString [
170171
{ #category : #accessing }
171172
BlDragAndDropExamples >> tagsOrderer [
172173
<gtExample>
174+
<return: #BlElement>
173175
| aContainer |
174-
175176
aContainer := BlElement new.
176177
aContainer layout: (BlLinearLayout horizontal cellSpacing: 5).
177-
aContainer constraintsDo: [ :c |
178-
c horizontal matchParent.
179-
c vertical fitContent ].
180-
181-
aContainer addEventHandler: (BlDropHandler new
182-
acceptOnlyFromThisElement;
183-
whenDragOverDo: [ :anItemsDraggedOverEvent |
184-
| container locationElement position childPosition |
185-
186-
container := anItemsDraggedOverEvent currentTarget.
187-
locationElement := container
188-
childWithId: #'drop-area--drop-location'
189-
ifFound: [ :anElement | anElement ]
190-
ifNone: [
191-
| anElement |
192-
193-
anElement := BlElement new
194-
background: Color orange;
195-
width: 2;
196-
constraintsDo: [ :c |
197-
c ignoreByLayout.
198-
c vertical matchParent ].
178+
aContainer
179+
constraintsDo: [ :c |
180+
c horizontal matchParent.
181+
c vertical fitContent ].
199182

200-
container addChild: anElement as: #'drop-area--drop-location'.
201-
anElement ].
183+
aContainer
184+
addEventHandler: (BlDropHandler new
185+
acceptOnlyFromThisElement;
186+
whenDragOverDo: [ :anItemsDraggedOverEvent |
187+
| container locationElement position childPosition |
188+
container := anItemsDraggedOverEvent currentTarget.
189+
locationElement := container
190+
childWithId: #'drop-area--drop-location'
191+
ifFound: [ :anElement | anElement ]
192+
ifNone: [ | anElement |
193+
anElement := BlElement new
194+
background: Color orange;
195+
width: 2;
196+
constraintsDo: [ :c |
197+
c ignoreByLayout.
198+
c vertical matchParent ].
202199

203-
position := anItemsDraggedOverEvent position x.
204-
childPosition := container children accountedByLayout
205-
detect: [ :eachChild | position < eachChild bounds inParent center x ]
206-
ifFound: [ :eachChild | eachChild bounds inParent left - 10 ]
207-
ifNone: [ container children accountedByLayout last bounds inParent right + 10 ].
200+
container addChild: anElement as: #'drop-area--drop-location'.
201+
anElement ].
208202

209-
locationElement relocate: childPosition @ 0 ];
203+
position := anItemsDraggedOverEvent position x.
204+
childPosition := container children accountedByLayout
205+
detect: [ :eachChild | position < eachChild bounds inParent center x ]
206+
ifFound: [ :eachChild | eachChild bounds inParent left - 10 ]
+
ifNone: [ container children accountedByLayout last bounds inParent right
208+
+ 10 ].
210209

211-
whenDragLeftDo: [ :anItemsLeftEvent | anItemsLeftEvent currentTarget removeChildNamed: #'drop-area--drop-location' ];
212-
whenHorizontalDroppedDo: [ :anItemsDroppedEvent :anIndex |
213-
(anItemsDroppedEvent items reverseDo: [ :eachDragItem |
214-
anItemsDroppedEvent currentTarget addChild: eachDragItem sourceElement at: anIndex + 1 ]) ]).
210+
locationElement relocate: childPosition @ 0 ];
211+
whenDragLeftDo: [ :anItemsLeftEvent | anItemsLeftEvent currentTarget removeChildNamed: #'drop-area--drop-location' ];
212+
whenHorizontalDroppedDo: [ :anItemsDroppedEvent :anIndex |
213+
anItemsDroppedEvent items
214+
reverseDo: [ :eachDragItem |
215+
anItemsDroppedEvent currentTarget
216+
addChild: eachDragItem sourceElement
217+
at: anIndex + 1 ] ]).
215218

216-
aContainer addChildren: ({
217-
'One'.
218-
'Two'.
219-
'Three'.
220-
'Four'.
221-
} collect: [ :eachName | self tagOrdererDraggableTagFor: eachName ]).
219+
aContainer
220+
addChildren: ({'One'.
221+
'Two'.
222+
'Three'.
223+
'Four'} collect: [ :eachName | self tagOrdererDraggableTagFor: eachName ]).
222224

223225
^ aContainer
224226
]
225227

226228
{ #category : #accessing }
227229
BlDragAndDropExamples >> tagsSlidingOrderer [
228230
<gtExample>
231+
<return: #BlElement>
229232
| aContainer |
230-
231233
aContainer := BlElement new.
232234
aContainer layout: (BlLinearLayout horizontal cellSpacing: 5).
233-
aContainer constraintsDo: [ :c |
234-
c horizontal matchParent.
235-
c vertical fitContent ].
236-
237-
aContainer addEventHandler: (BlDropHandler new
238-
acceptOnlyFromThisElement;
239-
whenHorizontalSlideOverDo: [];
240-
whenDroppedDo: [ :anItemsDroppedEvent |
241-
| container position childBefore |
235+
aContainer
236+
constraintsDo: [ :c |
237+
c horizontal matchParent.
238+
c vertical fitContent ].
242239

243-
container := anItemsDroppedEvent currentTarget.
244-
position := anItemsDroppedEvent position x.
245-
childBefore := container children accountedByLayout
246-
detect: [ :eachChild | position < (eachChild bounds inParent center x - 5) ]
247-
ifFound: [ :eachChild | eachChild ]
248-
ifNone: [ nil ].
240+
aContainer
241+
addEventHandler: (BlDropHandler new
242+
acceptOnlyFromThisElement;
243+
whenHorizontalSlideOverDo: [ ];
244+
whenDroppedDo: [ :anItemsDroppedEvent |
245+
| container position childBefore |
246+
container := anItemsDroppedEvent currentTarget.
247+
position := anItemsDroppedEvent position x.
248+
childBefore := container children accountedByLayout
249+
detect: [ :eachChild | position < (eachChild bounds inParent center x - 5) ]
250+
ifFound: [ :eachChild | eachChild ]
251+
ifNone: [ nil ].
249252

250-
(anItemsDroppedEvent items collect: [ :eachDragItem | eachDragItem sourceElement ])
251-
do: [ :each |
252-
childBefore
253-
ifNil: [ container addChild: each ]
254-
ifNotNil: [ container addChild: each before: childBefore ] ] ]).
253+
(anItemsDroppedEvent items
254+
collect: [ :eachDragItem | eachDragItem sourceElement ])
255+
do: [ :each |
256+
childBefore
257+
ifNil: [ container addChild: each ]
258+
ifNotNil: [ container addChild: each before: childBefore ] ] ]).
255259

256-
aContainer addChildren: ({
257-
'One'.
258-
'Two'.
259-
'Three'.
260-
'Four'.
261-
} collect: [ :eachName | self tagOrdererSlidingTagFor: eachName ]).
260+
aContainer
261+
addChildren: ({'One'.
262+
'Two'.
263+
'Three'.
264+
'Four'} collect: [ :eachName | self tagOrdererSlidingTagFor: eachName ]).
262265

263266
^ aContainer
264267
]

0 commit comments

Comments
 (0)
0