Drag-and-dropWouldn't it be nice if you could just drag wedges between pie charts? Let's implement this! The basic method to be overridden is wantsMorph:Event:. This is sent to a morph to enquire if it wants to accept a morph being dropped onto it, and we should make charts accept wedges. The argument is a ui2Event (which characterizes the mouse position, source hand and so on), which we can ignore. This method is added to the chart traits:
wantsMorph: m Event: evt = ( m morphTypeName = 'pieWedgeMorph').
Now we need to make wedges mouse-sensitive, so we add this method to the wedge traits.
leftMouseDown: evt = ( evt shiftIsDown && [owner morphTypeName = 'pieChartMorph'] ifTrue: [evt sourceHand addMorph: self] False: [resend.leftMouseDown: evt ]. self ).
This lets us extract a wedge by holding the shift key down while using the left mouse button. The wedge is added to the hand that clicked the button. If the wedge is not in a chart, the default left mouse activity is invoked.