Loading ...
Sorry, an error occurred while loading the content.

1853Re: [ydn-javascript] Dragdrop perfomance

Expand Messages
  • Peter Michaux
    Jun 1, 2006
    • 0 Attachment
      > The boolean isTarget can be set to false, then the DD instance is not a
      > target.

      Thanks for the info. I'll try this. So when I am dragging the libary
      only looks for interactions with possible targets? That would be nice
      and efficient like I was trying for with the groups games I was
      playing.

      > I think that the pattern used by the YAHOO DragDrop library might be
      > slightly flawed.
      >
      > To me, there should be a difference between a draggable object, and a
      > target object.
      >
      > The drag events (onDragEnter, onDrag, onDragDrop and onDragOut) should
      > be delivered to the draggable (as now), *and* the target. The target
      > should get to decide what kind of action needs to be taken. The
      > draggable probably doesn't know enough to actually implement any of
      > these handlers. The *target* would do drop position highlighting, change
      > the cursor type to indicate whether drop is possible, and handle the
      > drop event creating a new object, and HTMLElement of it's own choosing.
      >
      > I have implemented this pattern on top of the current library in my
      > DDTreeView/Draggable implementation, but I think that should be the
      > pattern the library uses.

      I agree it seems a little strange but I don't think it is a disaster.
      In my onDragEnter, onDragOut etc methods I have some "hey you" calls
      to get the target to pay attention. Things like

      Draggable.prototype.onDragEnter = function(e, id) {
      YAHOO.util.getDDById(id).heyYou();
      //..do other stuff
      };

      If the onDragEnter was delivered to the both the draggable and the
      target then which one will fire first? It might be better the way it
      is so that we can know the order things happen. I'm curious how you
      did implement it however.

      For you draggabble tree, did you make it so that items in an
      individual node can be reordered or just that items can be moved from
      node to node. I am looking at sortable lists too and will have to do
      something different than the Yahoo! example. I don't want the
      individual items to be targets. I want the node to be the target since
      the node's HTMLelement might be much bigger than the few elements
      inside.

      Peter
    • Show all 9 messages in this topic