我使用 fa-draggable 有效的指令:
<fa-modifier fa-size="[90, 90]">
<fa-draggable fa-pipe-from="item.handler"
fa-options="draggableOptions"
fa-pipe-to="item.handler">
<fa-surface fa-background-color="'#268bd2'"
fa-pipe-to="item.handler">
A
</fa-surface>
</fa-draggable>
</fa-modifier>
在我的控制器内部我设置:
$scope.draggableOptions = {
xRange: [-4, 4],
yRange: [-4, 4]
};
$scope.item.handler = new EventHandler();
$scope.item.handler.on('end', function (e) {
//return somehow to default position
});
如何确保在拖动事件完成后,可拖动表面返回到默认位置?
我发现了这个问题Drag a Famous surface and have it transition back to origin on mouseup? 但我不知道如何在我的情况下使用“setPosition”功能?