Javascript Scriptaculous拖动:如何偏移拖动元素?

Javascript Scriptaculous拖动:如何偏移拖动元素?,javascript,events,drag-and-drop,scriptaculous,Javascript,Events,Drag And Drop,Scriptaculous,这是一个由来已久的问题——但现在我正在使用scriptaculous,它又回来困扰着我。将树节点拖动到其他树节点上时,我希望鼠标悬停在我拖动到的每个节点上。所以我想定位拖动对象,使其左上角略低于鼠标指针的右侧 有人能帮忙吗谢谢也许他们的本地代码中有答案,但我找不到 所以我通过添加一个插件来修复它。在Draggable.prototype.draw中更改了这些行 // if((!this.options.constraint) || (this.options.constraint=='hori

这是一个由来已久的问题——但现在我正在使用scriptaculous,它又回来困扰着我。将树节点拖动到其他树节点上时,我希望鼠标悬停在我拖动到的每个节点上。所以我想定位拖动对象,使其左上角略低于鼠标指针的右侧


有人能帮忙吗谢谢

也许他们的本地代码中有答案,但我找不到

所以我通过添加一个插件来修复它。在Draggable.prototype.draw中更改了这些行

//  if((!this.options.constraint) || (this.options.constraint=='horizontal'))
//      style.left = p[0] + "px";
//  if((!this.options.constraint) || (this.options.constraint=='vertical'))
//      style.top = p[1] + "px";  

if((!this.options.constraint) || (this.options.constraint=='horizontal'))
    style.left = ((this.options.mouseOffset && point[0]) || p[0]) + "px";
if((!this.options.constraint) || (this.options.constraint=='vertical'))
    style.top = ((this.options.mouseOffset && point[1]) || p[1]) + "px"; 
当我创建DragTable时,我设置了自己的自定义选项

mouseOffset: true

也许他们的本地代码中有答案,但我找不到

所以我通过添加一个插件来修复它。在Draggable.prototype.draw中更改了这些行

//  if((!this.options.constraint) || (this.options.constraint=='horizontal'))
//      style.left = p[0] + "px";
//  if((!this.options.constraint) || (this.options.constraint=='vertical'))
//      style.top = p[1] + "px";  

if((!this.options.constraint) || (this.options.constraint=='horizontal'))
    style.left = ((this.options.mouseOffset && point[0]) || p[0]) + "px";
if((!this.options.constraint) || (this.options.constraint=='vertical'))
    style.top = ((this.options.mouseOffset && point[1]) || p[1]) + "px"; 
当我创建DragTable时,我设置了自己的自定义选项

mouseOffset: true