Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PanningTool

Hierarchy

PanningTool支持手动平移画布,用户可以通过拖拽鼠标来改变 Diagram.position

该工具是个标准的鼠标-移动工具, ToolManager.panningTool. 尽管ToolManager.dragSelectingTool 触发优先级比该工具高, DragSelectingTool 只会在mouse-down事件有延迟的情况下起作用. 如果DragSelectingTool没有触发,那么panningTool就有机会工作了

该工具不使用任何的装饰层或者其他工具手柄. 该工具不会修改model或者发起任何事务

如果你想通过代码 "移动" 画布, 你可以修改Diagram.position 或者调用像 Diagram.scroll, Diagram.scrollToRect, or Diagram.centerRect等方法.

Index

Constructors

constructor

Properties

bubbles : boolean

  • Gets or sets whether panning actions will allow events to bubble instead of panning in the diagram.

    Set this to true to allow mobile devices to scroll the page with panning gestures on the diagram. Otherwise, the panning events will be captured and used to pan inside of the diagram.

    The default value is false.

Read-only originalPosition : Point

  • This read-only property returns the Point that was the original value of Diagram.position when the panning operation started.

    since

    1.1

Methods

Virtual Override canStart

  • canStart(): boolean
  • This tool can run when the diagram allows scrolling and the mouse has been dragged with the left button far enough away from the mouse-down point to avoid being a click.

    This method may be overridden. Please read the Introduction page on Extensions for how to override methods and how to call this base method.

    Returns boolean

Override doActivate

  • doActivate(): void
  • Capture the mouse, change the diagram cursor to "move", and remember the Diagram.position.

    Returns void

Override doCancel

  • doCancel(): void
  • Restore the Diagram.position to what it was when this tool activated.

    Returns void

Override doDeactivate

  • doDeactivate(): void
  • Release the mouse and restore the default diagram cursor.

    Returns void

Override doMouseMove

  • doMouseMove(): void
  • Modify the Diagram.position according to how much the mouse has moved.

    Returns void

Override doMouseUp

  • doMouseUp(): void
  • Modify the Diagram.position according to how much the mouse has moved.

    Returns void