On 29/09/17 00:51, Igor Stasenko wrote:
Stephan , you said you cannot replace the last one in the video. I think you can have an easy solution: you should treat a pane that you are currently over - the one you are going to replace, so if you drag over something which is not placeholder, then it should automatically be shifted and replaced by placeholder.
Thanks. This works. I forgot that there is always one more dropping place possible than there are elements dragEvent: anEvent | dragOver | anEvent consumed: true. dragOver := inspector children first. inspector childrenDo: [ :c | c boundsInSpace center y < (anEvent position y + dragOffset y) ifTrue: [ dragOver := c ] ]. (dragOver ~= placeHolder ) ifTrue: [ (inspector childIndexOf: placeHolder) > 0 ifTrue: [inspector removeChild: placeHolder]. inspector children last boundsInSpace bottom < (anEvent position y + dragOffset y) ifTrue: [ inspector addChild: placeHolder at: (1+(inspector childIndexOf: dragOver))] ifFalse: [ inspector addChild: placeHolder at: (inspector childIndexOf: dragOver)]]. anEvent currentTarget position: (anEvent position - dragOffset).