Launching off our foundation from the previous recipe, we now get ready to have window widgets magically switch places. This will act like a game of musical chairs where when one widget moves into the place of a second, the second takes the place of the first. And unlike musical chairs, no widget loses and has to sit down until the next round.
The structure of the
Drag.Move() object is the same. Added in this recipe is the functionality of the
onLeave events. Note how the hitters now have a class added upon entering and that class removed upon leaving to create a highlight effect. This tells the user they have dragged an item to a hittable zone.