Drag a Famous surface and have it transition back to origin on mouseup?

前端 未结 2 1092
南旧
南旧 2020-12-31 20:32

I want to drag a Famous surface, and have it return to its original position when I let go of it. I\'ve taken the \"Drag\" example and modified it, but while the mouse

2条回答
  •  清酒与你
    2020-12-31 21:21

    instead of binding mouseup event on surface, better way might be using the end event on draggable

    surface.on('mouseup', function() {
      draggable.setPosition([0,0,0], trans);
    });
    

    ->

    draggable.on('end', function(e) {
        draggable.setPosition([0,0,0], trans);
    });
    

    in this way, the touch event will be taken care of as well

提交回复
热议问题