目录
当前位置: 首页 > 文档资料 > Snap.svg 英文文档 >

Element.drag(onmove, onstart, onend, [mcontext], [scontext], [econtext])

优质
小牛编辑
131浏览
2023-12-01

Adds event handlers for an element's drag gesture

Parameters

  1. onmovefunctionhandler for moving
  2. onstartfunctionhandler for drag start
  3. onendfunctionhandler for drag end
  4. mcontextobjectcontext for moving handler
  5. scontextobjectcontext for drag start handler
  6. econtextobjectcontext for drag end handler

Additionaly following drag events are triggered: drag.start.<id> on start, drag.end.<id> on end and drag.move.<id> on every move. When element is dragged over another element drag.over.<id> fires as well.

Start event and start handler are called in specified context or in context of the element with following parameters:

  1. xnumberx position of the mouse
  2. ynumbery position of the mouse
  3. eventobjectDOM event object

Move event and move handler are called in specified context or in context of the element with following parameters:

  1. dxnumbershift by x from the start point
  2. dynumbershift by y from the start point
  3. xnumberx position of the mouse
  4. ynumbery position of the mouse
  5. eventobjectDOM event object

End event and end handler are called in specified context or in context of the element with following parameters:

  1. eventobjectDOM event object

Returns: objectElement