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

DragNDrop moves where I don't want it

Expand Messages
  • Gatchaman_98
    I m using the Yahoo DD, and I want to display a confirm box when the user is done dragging. But when I do that, here s what happens: the confirm box pops up
    Message 1 of 3 , Oct 27, 2006
      I'm using the Yahoo DD, and I want to display a confirm box when the
      user is done dragging. But when I do that, here's what happens: the
      confirm box pops up (good), so I move my mouse pointer over the
      confirm box to make a selection. As soon as I move onto the confirm
      box, the DD moves to where my mouse is (bad); I think it's because the
      endDrag function hasn't completely finished. The DD doesn't move any
      more after that, until I answer the confirm box.

      So I'd either like to temporarily stop the DD from following my mouse
      while inside the endDrag function, or come up with a different
      solution. Any ideas? Thanks for any help.

      Here's my overwritten endDrag function:

      YAHOO.util.DDStamp.prototype.endDrag = function(e) {
      YAHOO.log("endDrag");
      if (confirm("Are you ready?")) {
      doSomething();
      } else {
      doSomethingElse();
      }
      }
    • Eric Miraglia
      Gatchaman_98, Have you tried moving your confirm dialog to an onMouseUp function? onMouseUp happens after endDrag and might be late enough to suit your needs.
      Message 2 of 3 , Oct 27, 2006
        Gatchaman_98,

        Have you tried moving your confirm dialog to an onMouseUp function?  onMouseUp happens after endDrag and might be late enough to suit your needs.

        To avoid popping up a confirmation on a click as well as a drag, be sure create a flag that is set to true in endDrag (designating that the original mousedown had resulted in a drag) and is set back to false after you're done with it in onMouseUp.

        Regards,
        Eric

        ______________________________________________
        Eric Miraglia
        Yahoo! Presentation Platform Engineering



        On Oct 27, 2006, at 11:11 AM, Gatchaman_98 wrote:

        I'm using the Yahoo DD, and I want to display a confirm box when the
        user is done dragging. But when I do that, here's what happens: the
        confirm box pops up (good), so I move my mouse pointer over the
        confirm box to make a selection. As soon as I move onto the confirm
        box, the DD moves to where my mouse is (bad); I think it's because the
        endDrag function hasn't completely finished. The DD doesn't move any
        more after that, until I answer the confirm box.

        So I'd either like to temporarily stop the DD from following my mouse
        while inside the endDrag function, or come up with a different
        solution. Any ideas? Thanks for any help.

        Here's my overwritten endDrag function:

        YAHOO.util.DDStamp.prototype.endDrag = function(e) {
        YAHOO.log("endDrag");
        if (confirm("Are you ready?")) {
        doSomething();
        } else {
        doSomethingElse();
        }
        }


      • Gatchaman_98
        Thanks for the response. But I got the same behavior when using the onMouseUp function. But I did find a solution -- I temporarily disable the
        Message 3 of 3 , Nov 1, 2006
          Thanks for the response. But I got the same behavior when using the
          onMouseUp function. But I did find a solution -- I temporarily
          disable the alignElWithMouse function by setting it to null (copying
          it into a temp function so I can use it after the confirm is done):

          YAHOO.util.DD.prototype.onMouseUp = function(e) {
          YAHOO.log("onMouseUp");
          this.temp = this.alignElWithMouse;
          this.alignElWithMouse = function() {};
          if (this.hitTarget) {
          if (confirm("Are you ready?")) {
          doSomething();
          }
          }
          this.alignElWithMouse = this.temp;
          this.temp = null;
          }

          --- In ydn-javascript@yahoogroups.com, Eric Miraglia <miraglia@...> wrote:
          >
          > Gatchaman_98,
          >
          > Have you tried moving your confirm dialog to an onMouseUp function?
          > onMouseUp happens after endDrag and might be late enough to suit your
          > needs.
          >
          > To avoid popping up a confirmation on a click as well as a drag, be
          > sure create a flag that is set to true in endDrag (designating that
          > the original mousedown had resulted in a drag) and is set back to
          > false after you're done with it in onMouseUp.
          >
          > Regards,
          > Eric
          >
          > ______________________________________________
          > Eric Miraglia
          > Yahoo! Presentation Platform Engineering
          >
          >
          >
          > On Oct 27, 2006, at 11:11 AM, Gatchaman_98 wrote:
          >
          > > I'm using the Yahoo DD, and I want to display a confirm box when the
          > > user is done dragging. But when I do that, here's what happens: the
          > > confirm box pops up (good), so I move my mouse pointer over the
          > > confirm box to make a selection. As soon as I move onto the confirm
          > > box, the DD moves to where my mouse is (bad); I think it's because the
          > > endDrag function hasn't completely finished. The DD doesn't move any
          > > more after that, until I answer the confirm box.
          > >
          > > So I'd either like to temporarily stop the DD from following my mouse
          > > while inside the endDrag function, or come up with a different
          > > solution. Any ideas? Thanks for any help.
          > >
          > > Here's my overwritten endDrag function:
          > >
          > > YAHOO.util.DDStamp.prototype.endDrag = function(e) {
          > > YAHOO.log("endDrag");
          > > if (confirm("Are you ready?")) {
          > > doSomething();
          > > } else {
          > > doSomethingElse();
          > > }
          > > }
          > >
          > >
          > >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.