0 Replies Latest reply on Jan 9, 2009 2:21 PM by aperitech

    Drag and Drop design choices

    aperitech
      I am implementing a Drag and Drop feature in the application I am working on. Essentially there are images parented to a Canvas where the Images will follow certain rules about how they can be dragged, i.e. maybe they can only be dragged along the y axis and not the x axis. In addition the Image needs to move seamlessly with the cursor from the time it is first clicked. I've experimented with two approaches and neither one seems entirely satisfying.

      The first approach was to work with the DragManager directly. The issue I'm having with this approach is that a) when dragging the drag Image proxy jitters a bit and b) when I drop I am unable to get it to drop without shifting the image ever so slightly. I am maintaining the x and y offset from when the image was originally clicked in order to try and compensate when repositioning in the drop handler but it never seems to be quite right.

      The second approach is to use the Sprite.start/stopDrag methods. This approach seems to provide a much more pleasing visual experience, and when dropping the image stays exactly where you expect (i.e. no annoying shifting). With this approach however I have design issues with fine tuning the drag restrictions in a reasonable way.

      I was curious about how the drag and drop works in the Sprite code but that doesn't seem to be available?

      I am looking for some general guidance on my issues and suggestions on what might be the best approach.

      Thanks in advance.