nx.graphic.DragManager - Next UI Toolkit

#

API Docs for: trial
Show: Inherited Protected Private Deprecated

# nx.graphic.DragManager Class

Extends nx.Observable
Module: nx.ui

Global drag manager

    var Component = nx.define(nx.ui.Component, {
       view: {
           content: {
               name: "stage",
               type: 'nx.graphic.TopologyStage',
               props: {
                   width: 600,
                   height: 600
               },
               content: {
                   name: 'a',
                   type: 'nx.graphic.Rect',
                   props: {
                       x: 100,
                       y: 10,
                       width: 100,
                       height: 100,
                       fill: '#f0f'
                   },
                   events: {
                       'mousedown': '{#_mousedown}',
                       'dragmove': '{#_dragmove}'
                   }
               }
           }
       },
       properties: {
           positionX: {
               value: 150
           }
       },
       methods: {
           _mousedown: function (sender, event) {
               event.captureDrag(sender.owner());
           },
           _dragmove: function (sender, event) {
               sender.set("x", sender.get("x") * 1 + event.drag.delta[0]);
               sender.set("y", sender.get("y") * 1 + event.drag.delta[1]);
           }

       }
    });

    var app = new nx.ui.Application();
    var comp = new Component();
    comp.attach(app);

- Index
- Methods
- Properties

## Item Index

### Methods

- dispose
- end
- move
- start
- clearBinding
- getBinding
- notify
- setBinding
- unwatch

### Properties

- dragging
- node
- referrer
- track

## Methods

### `dispose`

()

Inherited from nx.Observable:

Dispose current object.

### `end`

(

- `evt`

)

Drag end

#### Parameters:

- `evt` Event

  original dom event

### `move`

(

- `evt`

)

Drag move handler

#### Parameters:

- `evt` Event

  original dom event

### `start`

(

- `evt`

)
function(this:nx.graphic.DragManager)

Start drag event capture

#### Parameters:

- `evt` Event

  original dom event

#### Returns:

function(this:nx.graphic.DragManager):

### ``

(

- `names`
- `handler`
- `context`

)

Inherited from nx.Observable:

#### Parameters:

- `names` Object
- `handler` Object
- `context` Object

### `clearBinding`

(

- `prop`

)

Inherited from nx.Observable:

Clear binding for specified property.

#### Parameters:

- `prop` Object

### `getBinding`

(

- `prop`

)

Inherited from nx.Observable:

Get existing binding object for specified property.

#### Parameters:

- `prop` Object

#### Returns:

:

### `notify`

(

- `names`
- `oldValue`

)

Inherited from nx.Observable:

#### Parameters:

- `names` Object
- `oldValue` Object

### `setBinding`

(

- `prop`
- `expr`
- `source`

)

Inherited from nx.Observable:

Set binding for specified property.

#### Parameters:

- `prop` Object
- `expr` Object
- `source` Object

### `unwatch`

(

- `names`
- `handler`
- `context`

)

Inherited from nx.Observable:

#### Parameters:

- `names` Object
- `handler` Object
- `context` Object

## Properties

### `dragging`

Boolean

Dragging indicator

### `node`

nx.graphic.Component

activated component.

### `referrer`

DOMELement

All coordinate will reference to this element.

### `track`

Array

drag track