Jump to content
Search Community

paprika

Premium
  • Posts

    3
  • Joined

  • Last visited

Posts posted by paprika

  1. Hi!

     

    I'm experiencing a problem with draggable. Maybe someone can help me...

     

    I'm using draggable with the throwPropsPlugin to move a DIV and I have my own Javascript to scale and center it on mousewheel and pinch events. Unfortunately draggable doesn't use the new translate3d values, if I drag the div after that, because the internal x and y values were not updated. I found that .update() schould do this, but the .x and .y values of my draggeable object are the same before and after I execute .update() even though the translate3d values of my DOM object have changed. What am I doing wrong?

     

    My code is:

    Draggable.create(

      "#image",

      {type:"x,y",

        edgeResistance:0.8,

        bounds:"#frame",

        throwProps:true,

        onDragStart:function(){

          console.log("dragstart");

          clearTimeout(mousewheelTimer);

        }

      }

    );

     

    and later called after a short timeout, when the mousewheel is no longer scrolling:

     

    function mousewheelEnd(){
        console.log(Draggable.get("#image").x );
        Draggable.get("#image").update();
        setTimeout(function(){console.log(Draggable.get("#image").x );},1000);
    }

     

    I also tried to kill the Draggable object and create a new one and to disable it while the mouse is scrolling. Nothing worked.

     

    Please help! Thanks.

×
×
  • Create New...