diff options
Diffstat (limited to 'js/tools')
-rw-r--r-- | js/tools/bindingTool.js | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/js/tools/bindingTool.js b/js/tools/bindingTool.js new file mode 100644 index 00000000..1430e090 --- /dev/null +++ b/js/tools/bindingTool.js | |||
@@ -0,0 +1,70 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | var Montage = require("montage/core/core").Montage, | ||
8 | DrawingTool = require("js/tools/drawing-tool").DrawingTool, | ||
9 | ModifierToolBase = require("js/tools/modifier-tool-base").ModifierToolBase; | ||
10 | SelectionTool = require("js/tools/SelectionTool").SelectionTool; | ||
11 | |||
12 | |||
13 | exports.BindingTool = Montage.create(ModifierToolBase, { | ||
14 | drawingFeedback: { value: { mode: "Draw2D", type: "" } }, | ||
15 | |||
16 | Configure: { | ||
17 | value: function (doActivate) | ||
18 | { | ||
19 | if (doActivate) | ||
20 | { | ||
21 | NJevent("enableStageMove"); | ||
22 | this.application.ninja.workspaceMode = "binding"; | ||
23 | |||
24 | } | ||
25 | else | ||
26 | { | ||
27 | NJevent("disableStageMove"); | ||
28 | this.application.ninja.workspaceMode = "default"; | ||
29 | } | ||
30 | } | ||
31 | }, | ||
32 | |||
33 | HandleLeftButtonDown: { | ||
34 | value: function(event) { | ||
35 | NJevent("enableStageMove"); | ||
36 | } | ||
37 | }, | ||
38 | |||
39 | HandleMouseMove: { | ||
40 | value: function(event) { | ||
41 | this.doDraw(event); | ||
42 | } | ||
43 | }, | ||
44 | |||
45 | HandleLeftButtonUp: { | ||
46 | value: function(event) { | ||
47 | |||
48 | if(this._escape) { | ||
49 | this._escape = false; | ||
50 | return; | ||
51 | } | ||
52 | |||
53 | if(this._hasDraw) { | ||
54 | this._hasDraw = false; | ||
55 | this.endDraw(event); | ||
56 | } else { | ||
57 | this.doSelection(event); | ||
58 | if (this.application.ninja.selectedElements.length !== 0 ) { | ||
59 | this.selectedElement = this.application.ninja.selectedElements[0]; | ||
60 | } else { | ||
61 | this.selectedElement = null; | ||
62 | } | ||
63 | this.application.ninja.stage.bindingView.selectedElement = this.selectedElement; | ||
64 | this._isDrawing = false; | ||
65 | } | ||
66 | //this.endDraw(event); | ||
67 | //NJevent("disableStageMove"); | ||
68 | } | ||
69 | } | ||
70 | }); \ No newline at end of file | ||