twaver.network.interaction
Class MoveInteraction

java.lang.Object
  extended by twaver.network.interaction.Interaction
      extended by twaver.network.interaction.SingleTouchDragInteraction
          extended by twaver.network.interaction.MoveInteraction
All Implemented Interfaces:
IInteraction

public class MoveInteraction
extends SingleTouchDragInteraction

拖动网元交互


Field Summary
protected  Element currentDraggingElement
          触摸点当前位置拖拽的网元
protected  java.util.List<Element> draggingElements
          当前拖拽的网元集合
 
Fields inherited from class twaver.network.interaction.SingleTouchDragInteraction
stopWhenMultiTouch
 
Fields inherited from class twaver.network.interaction.Interaction
network
 
Constructor Summary
MoveInteraction(Network network)
          构造函数,拖动网元交互
 
Method Summary
protected  boolean doDragging(TouchEvent e1, TouchEvent event, float distanceX, float distanceY)
          拖拽操作中
protected  void endDrag(TouchEvent event)
          结束拖拽
 void reset()
          重置拖拽状态
protected  boolean startDrag(TouchEvent e1, TouchEvent event, float distanceX, float distanceY)
          开始拖拽
 
Methods inherited from class twaver.network.interaction.SingleTouchDragInteraction
destroy, onDown, onScroll, onUp, stop
 
Methods inherited from class twaver.network.interaction.Interaction
onDoubleTap, onFling, onLongPress, onMove, onScale, onScaleBegin, onScaleEnd, onSingleTapConfirmed, onSingleTapUp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

draggingElements

protected java.util.List<Element> draggingElements
当前拖拽的网元集合


currentDraggingElement

protected Element currentDraggingElement
触摸点当前位置拖拽的网元

Constructor Detail

MoveInteraction

public MoveInteraction(Network network)
构造函数,拖动网元交互

Parameters:
network - 拓扑图
Method Detail

reset

public void reset()
Description copied from class: SingleTouchDragInteraction
重置拖拽状态

Overrides:
reset in class SingleTouchDragInteraction

startDrag

protected boolean startDrag(TouchEvent e1,
                            TouchEvent event,
                            float distanceX,
                            float distanceY)
Description copied from class: SingleTouchDragInteraction
开始拖拽

Specified by:
startDrag in class SingleTouchDragInteraction
Parameters:
e1 - 开始拖拽事件
event - 当前触摸事件
distanceX - 拖拽距离
distanceY - 拖拽距离
Returns:
是否允许拖拽操作

doDragging

protected boolean doDragging(TouchEvent e1,
                             TouchEvent event,
                             float distanceX,
                             float distanceY)
Description copied from class: SingleTouchDragInteraction
拖拽操作中

Specified by:
doDragging in class SingleTouchDragInteraction
Parameters:
e1 - 开始拖拽事件
event - 当前触摸事件
distanceX - 拖拽距离
distanceY - 拖拽距离
Returns:
是否执行操作

endDrag

protected void endDrag(TouchEvent event)
Description copied from class: SingleTouchDragInteraction
结束拖拽

Specified by:
endDrag in class SingleTouchDragInteraction
Parameters:
event - 当前触摸事件