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

24151Re: [ydn-javascript] Re: drag and drop

Expand Messages
  • Sergio Gaitan
    Jan 18, 2008
    • 0 Attachment
      Eric, Thanks for all help, but very I am confused and it does not show the final position to me, you shipment the code so that please you help me since in serious profit not to do it

      code:
      <script type="text/javascript">

      (function() {
          var Dom = YAHOO.util.Dom,
              Event = YAHOO.util.Event,
              dd1;


          YAHOO.example.DDRegion = function(id, sGroup, config) {
              this.cont = config.cont;
              YAHOO.example.DDRegion.superclass.constructor.apply(this, arguments);
          };

          YAHOO.extend(YAHOO.example.DDRegion, YAHOO.util.DD, {
              cont: null,
              init: function() {
                  //Call the parent's init method
                  YAHOO.example.DDRegion.superclass.init.apply(this, arguments);
                  this.initConstraints();
                  this.enDrag = function(e){
                      var position = YAHOO.util.Dom.getXY(this.getEl());
                      document.Show.MouseX.value = position;
                  }
             },
             
              initConstraints: function() {
                  //Get the top, right, bottom and left positions
                  var region = Dom.getRegion(this.cont);

                  //Get the element we are working on
                  var el = this.getEl();
                 
                  //Get the xy position of it
                  var xy = Dom.getXY(el);
                 
                 
                  //Get the width and height
                  var width = parseInt(Dom.getStyle(el, 'width'), 10);
                  var height = parseInt(Dom.getStyle(el, 'height'), 10);

                  //Set left to x minus left
                  var left = xy[0] - region.left;

                  //Set right to right minus x minus width
                  var right = region.right - xy[0] - width;
                 
                  //Set top to y minus top
                  var top = xy[1] - region.top;

                  //Set bottom to bottom minus y minus height
                  var bottom = region.bottom - xy[1] - height;

                  //Set the constraints based on the above calculations
                  this.setXConstraint(left, right);
                  this.setYConstraint(top, bottom);
                 

                  Event.on(window, 'resize', function() {
                      this.initConstraints();       
                  }, this, true);
              }

          });
             
          Event.onDOMReady(function() {
              dd1 = new YAHOO.example.DDRegion('dd-demo-1', '', { cont: 'dd-demo-canvas3' });
                  //var position = YAHOO.util.Dom.getXY(dd1.getEl());
                  //document.Show.diseno.value = position;
           });
      })();

      </script>

      Thanks for everything

      Sergio

      ----- Mensaje original ----
      De: Eric Miraglia <miraglia@...>
      Para: ydn-javascript@yahoogroups.com
      Enviado: jueves 17 de enero de 2008, 17:19:16
      Asunto: Re: [ydn-javascript] Re: drag and drop

      Sergio,


      The position of the element prior to drag is provided as part of the argument for the startDrag function.

      The position of the element after the drag is completed should be available to you in the endDrag function if you are using YAHOO.util.DD.

      Regards,
      Eric


      ____________ _________ _________ _________ _______
      Eric Miraglia
      Yahoo! User Interface Library



      On Jan 17, 2008, at 5:39 AM, Sergio Gaitan wrote:


      Eric, 

      In my case, the example of drag and drop Staying in a Region I must add the method to him of endDrag to the function? since at no moment this startDrag and endDrag? because if it shows the starting point to me within the region but not after it has been dragged.

      thanks


      ----- Mensaje original ----
      De: Eric Miraglia <miraglia@yahoo- inc.com>
      Para: ydn-javascript@ yahoogroups. com
      Enviado: miércoles 16 de enero de 2008, 14:48:42
      Asunto: Re: [ydn-javascript] Re: drag and drop

      Sergio,


      If your Drag and Drop instance is "myDD", the following should work (after the drag operation has completed -- say, in yourendDrag method):

      var position = YAHOO.util.Dom. getXY(myDD. getEl());

      For more on getXY:


      Regards,
      Eric


      ____________ _________ _________ _________ _______
      Eric Miraglia
      Yahoo! User Interface Library



      On Jan 14, 2008, at 9:22 AM, xponkflash2 wrote:

      Eric,

      Yes, would like to know I and to see the new position of the element
      after it has been dragged.

      Regards,

      Sergio

      --- In ydn-javascript@ yahoogroups. com, Eric Miraglia <miraglia@.. .> wrote:
      >
      > Sergio,
      > 
      > I'm not sure I understand the question you are asking -- are you 
      > looking for the position of an element after it has been dragged to a 
      > new position?
      > 
      > Regards,
      > Eric
      > 
      > 
      > ____________ _________ _________ _________ _______
      > Eric Miraglia
      > Yahoo! User Interface Library
      > 
      > 
      > 
      > On Jan 10, 2008, at 8:32 AM, xponkflash2 wrote:
      > 
      > > hello it would want please would help me that is to say since I let to
      > > know point "X" and the point "Y" where they are each object after them
      > > to have moved of its starting point
      > >
      > > I am thankful for any aid since I have not managed to show but the
      > > starting point by means of getPosXY
      > >
      > > thanks
      > >
      > > Sergio
      > >
      > >
      > >
      >






      Yahoo! Encuentros
      Ahora encontrar pareja es mucho más fácil, probá el nuevo Yahoo! Encuentros.
      Visitá http://yahoo. cupidovirtual. com/servlet/ NewRegistration






      Tarjeta de crédito Yahoo! de Banco Supervielle. Solicitá tu nueva Tarjeta de crédito. De tu PC directo a tu casa.
      Visitá www.tuprimeratarjeta.com.ar
    • Show all 23 messages in this topic