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

Trouble with proxies

Expand Messages
  • John Vieth
    I created an example using dragdrop objects that works great, but I can t get it to work when I change the objects from DD objects to DDProxy objects. Here s
    Message 1 of 4 , Apr 2, 2007
    • 0 Attachment
      I created an example using dragdrop objects that works great, but I
      can't get it to work when I change the objects from DD objects to
      DDProxy objects. Here's a link to the working example using DD objects:

      http://www.masterwebsmith.com/testajax.html

      ...and here's a link to the same example except using DDProxy objects:

      http://www.masterwebsmith.com/testajaxproxy.html

      In the first example (that works), I am able to make the divs snap
      back to their original position if they don't drop onto a valid
      target, and if they *DO* drop on a valid target they swap position
      with the target.

      But in the second example (that doesn't work), the divs don't snap
      back totheir original position onInvalidDrop, and when they swap
      places with their target, they don't quite end up exactly where the
      target was, but rather based on where the mouse cursor was--despite
      the fact that I'm using the exact same code in both examples. The
      only difference in the code is that the second example uses DDProxy
      instead of DD. What gives? Please help me figure this out. Any
      assistance would be greatly appreciated.

      Thanks,
      John
    • Adam Moore
      ... John, to get the same behavior with DDProxy, you need to override endDrag. This will make it so the source element is not moved to the location you
      Message 2 of 4 , Apr 2, 2007
      • 0 Attachment
        On Mon, Apr 02, 2007 at 08:53:11PM -0000, John Vieth wrote:
        > I created an example using dragdrop objects that works great, but I
        > can't get it to work when I change the objects from DD objects to
        > DDProxy objects. Here's a link to the working example using DD objects:
        >
        > http://www.masterwebsmith.com/testajax.html
        >
        > ...and here's a link to the same example except using DDProxy objects:
        >
        > http://www.masterwebsmith.com/testajaxproxy.html
        >
        > In the first example (that works), I am able to make the divs snap
        > back to their original position if they don't drop onto a valid
        > target, and if they *DO* drop on a valid target they swap position
        > with the target.
        >
        > But in the second example (that doesn't work), the divs don't snap
        > back totheir original position onInvalidDrop, and when they swap
        > places with their target, they don't quite end up exactly where the
        > target was, but rather based on where the mouse cursor was--despite
        > the fact that I'm using the exact same code in both examples. The
        > only difference in the code is that the second example uses DDProxy
        > instead of DD. What gives? Please help me figure this out. Any
        > assistance would be greatly appreciated.

        John, to get the same behavior with DDProxy, you need to override
        endDrag. This will make it so the source element is not moved to the
        location you dragged the proxy, fixing your problem and also making the
        code you have in onInvalidDrop unnecessary.

        -Adam
      • John A. Vieth
        Could you please give me an example of precisely how I need to override endDrag? Also, I was under the impression that DD and DDProxy were virtually identical,
        Message 3 of 4 , Apr 2, 2007
        • 0 Attachment
          Could you please give me an example of precisely how I need to override endDrag?

          Also, I was under the impression that DD and DDProxy were virtually identical, except that DDProxy just drags a substitute element (proxy) instead of the real thing, but all other properties and methods pertain to the real element, not the proxy/displayed substitute.  Am I correct?  If not, please clarify.

          Thanks so much for your help!!!

          - John

          ----- Original Message ----
          From: Adam Moore <adamoore@...>
          To: ydn-javascript@yahoogroups.com
          Sent: Monday, April 2, 2007 4:32:03 PM
          Subject: Re: [ydn-javascript] Trouble with proxies

          On Mon, Apr 02, 2007 at 08:53:11PM -0000, John Vieth wrote:
          > I created an example using dragdrop objects that works great, but I
          > can't get it to work when I change the objects from DD objects to
          > DDProxy objects. Here's a link to the working example using DD objects:
          >
          > http://www.masterwe bsmith.com/ testajax. html
          >
          > ...and here's a link to the same example except using DDProxy objects:
          >
          > http://www.masterwe bsmith.com/ testajaxproxy. html
          >
          > In the first example (that works), I am able to make the divs snap
          > back to their original position if they don't drop onto a valid
          > target, and if they *DO* drop on a valid target they swap position
          > with the target.
          >
          > But in the second example (that doesn't work), the divs don't snap
          > back totheir original position onInvalidDrop, and when they swap
          > places with their target, they don't quite end up exactly where the
          > target was, but rather based on where the mouse cursor was--despite
          > the fact that I'm using the exact same code in both examples. The
          > only difference in the code is that the second example uses DDProxy
          > instead of DD. What gives? Please help me figure this out. Any
          > assistance would be greatly appreciated.

          John, to get the same behavior with DDProxy, you need to override
          endDrag. This will make it so the source element is not moved to the
          location you dragged the proxy, fixing your problem and also making the
          code you have in onInvalidDrop unnecessary.

          -Adam


        • Adam Moore
          ... ddinstance.endDrag = function(){}; // this can be empty ... This is correct, and fact that different elements are moving is the reason why your particular
          Message 4 of 4 , Apr 2, 2007
          • 0 Attachment
            On Mon, Apr 02, 2007 at 03:01:16PM -0700, John A. Vieth wrote:
            > Could you please give me an example of precisely how I need to override endDrag?

            ddinstance.endDrag = function(){}; // this can be empty

            > Also, I was under the impression that DD and DDProxy were virtually identical, except that DDProxy just drags a substitute element (proxy) instead of the real thing, but all other properties and methods pertain to the real element, not the proxy/displayed substitute. Am I correct? If not, please clarify.

            This is correct, and fact that different elements are moving is the reason
            why your particular implementation need change a bit when switching between
            the two.

            DD instances: the source element is repositioned continuously during the drag.

            DDProxy instances: the source element is hidden while you drag, and not
            moved at all until endDrag.

            -Adam
          Your message has been successfully submitted and would be delivered to recipients shortly.