Skip to content

Commit 944a29b

Browse files
authored
Update header level in dragAndDropExample.md to avoid merging it with animation chapter
1 parent 9bf82f7 commit 944a29b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Chapters/bloc/dragAndDropExample.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
### Drag and Drop
1+
## Drag and Drop
22

33
Bloc has basic support for drag-and-drop which needs to be further improved. In this chapter we try to explain the basics of drag-and-drop with Bloc events and we display some valuable examples.
44

5-
#### Three basic events
5+
### Three basic events
66

77
To start understanding the Drag-and-drop process, you must acknowledge the following 3 basic events:
88

99
- BlDragStartEvent : Starts the drag process, sent when you move the cursor for the first time after having a MouseDownEvent.
1010
- BlDragEvent : sent whenever you move the cursor during the drag process. **Needs the BlDragStartEvent to be consumed in order to be sent**.
1111
- BlDragEndEvent : Ends the drag process, sent when you lift your cursor (i.e. send a MouseUpEvent)
1212

13-
#### First drag and drop
13+
### First drag and drop
1414

1515
Using the basic events we can write the simplest drag and drop snippet
1616

@@ -30,9 +30,9 @@ element openInSpace
3030

3131
Here we add a small offset variable that is defined when starting to drag the element so that we can redefine the element's position according to the mouse position and have a smooth drag and drop.
3232

33-
#### Custom Drag Handlers
33+
### Custom Drag Handlers
3434

35-
##### DragHandler
35+
#### DragHandler
3636

3737
In Bloc, there is a an implementation of an object called DragHandler. This object is a a CustomEventHandler aiming to deal with basic drag and drop without having to write again the lines above.
3838

@@ -47,7 +47,7 @@ element openInSpace
4747
```
4848
However you can see the default behavior when dropping the Element is to bring the element back to its original position.
4949

50-
##### PullHandler
50+
#### PullHandler
5151

5252
There is also the BlPullHandler which has a more detailed API allowing you more behaviours.
5353

@@ -113,7 +113,7 @@ element addEventHandlerOn: BlClickEvent do: [ :event |
113113
element openInSpace
114114
```
115115

116-
#### Events for the environment
116+
### Events for the environment
117117

118118
Other Events related to Drag and Drop are available in Bloc but they mainly concern the environment in which an Element is dragged.
119119

@@ -296,7 +296,7 @@ One thing important in this snippet is to use the messages `requestFocus` and `l
296296

297297
The example is not exactly perfect nor practical but it serves as a good example on how to dynamically change the drag behaviour with keyboard events.
298298

299-
#### Other Examples
299+
### Other Examples
300300

301301
You can find more examples/experiments on Drag and Drop in the class `BlDragAndDropExamples`.
302302
We suggest looking at the class `BlDragAndDropLetterExampleDemo` that shows an example of a letter sorter with letters reacting if hovering the 'vowel' or 'consonant' areas.

0 commit comments

Comments
 (0)