diff options
author | Ananya Sen | 2012-06-26 16:07:00 -0700 |
---|---|---|
committer | Ananya Sen | 2012-06-26 16:07:00 -0700 |
commit | 1d5372534d11c9c1b818ba5e7d67498c731e9ac6 (patch) | |
tree | bc09c9f08ac2faa955995a91a78337276a81eb77 /js/tools/bindingTool.js | |
parent | 3391a8e6fd5df0d464edaffd98c2b3fde23acf5a (diff) | |
parent | 46174eb0ce93d660c8d2e9276fbdc4f9a03f056a (diff) | |
download | ninja-1d5372534d11c9c1b818ba5e7d67498c731e9ac6.tar.gz |
Merge branch 'refs/heads/ninja-internal-master' into bugfix-master
Conflicts:
js/ninja.reel/ninja.html
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/tools/bindingTool.js')
-rw-r--r-- | js/tools/bindingTool.js | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/js/tools/bindingTool.js b/js/tools/bindingTool.js new file mode 100644 index 00000000..1e1c9e5b --- /dev/null +++ b/js/tools/bindingTool.js | |||
@@ -0,0 +1,102 @@ | |||
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 | _selectedComponent: { | ||
16 | value: null | ||
17 | }, | ||
18 | |||
19 | selectedComponent: { | ||
20 | get:function() { | ||
21 | return this._selectedComponent; | ||
22 | }, | ||
23 | set: function(val) { | ||
24 | this._selectedComponent = val; | ||
25 | this.application.ninja.stage.bindingView.selectedComponent = val; | ||
26 | } | ||
27 | }, | ||
28 | |||
29 | Configure: { | ||
30 | value: function (doActivate) | ||
31 | { | ||
32 | if (doActivate) | ||
33 | { | ||
34 | NJevent("enableStageMove"); | ||
35 | this.application.ninja.workspaceMode = "binding"; | ||
36 | if (this.application.ninja.selectedElements.length !== 0 ) { | ||
37 | if(typeof(this.application.ninja.selectedElements[0].controller) !== "undefined") { | ||
38 | this.selectedComponent = this.application.ninja.selectedElements[0].controller; | ||
39 | } else { | ||
40 | this.selectedComponent = null; | ||
41 | } | ||
42 | |||
43 | } | ||
44 | } | ||
45 | else | ||
46 | { | ||
47 | NJevent("disableStageMove"); | ||
48 | this.application.ninja.workspaceMode = "default"; | ||
49 | this.selectedComponent = null; | ||
50 | } | ||
51 | |||
52 | } | ||
53 | }, | ||
54 | |||
55 | HandleLeftButtonDown: { | ||
56 | value: function(event) { | ||
57 | NJevent("enableStageMove"); | ||
58 | } | ||
59 | }, | ||
60 | |||
61 | HandleMouseMove: { | ||
62 | value: function(event) { | ||
63 | /* | ||
64 | In the mouse over event we need to validate if the mouse over is over a hud. | ||
65 | If it on top of a hud bring that single hud to the top to associate with. | ||
66 | */ | ||
67 | |||
68 | this.application.ninja.stage.bindingView.handleMousemove(event); | ||
69 | //this.doDraw(event); | ||
70 | } | ||
71 | }, | ||
72 | |||
73 | HandleLeftButtonUp: { | ||
74 | value: function(event) { | ||
75 | if(!this.application.ninja.stage.bindingView._isDrawingConnection) { | ||
76 | if(this._escape) { | ||
77 | this._escape = false; | ||
78 | return; | ||
79 | } | ||
80 | |||
81 | if(this._hasDraw) { | ||
82 | this._hasDraw = false; | ||
83 | //this.endDraw(event); | ||
84 | } else { | ||
85 | this.doSelection(event); | ||
86 | if (this.application.ninja.selectedElements.length !== 0 ) { | ||
87 | if(this.application.ninja.selectedElements[0].controller) { | ||
88 | this.selectedComponent = this.application.ninja.selectedElements[0].controller; | ||
89 | } else { | ||
90 | this.selectedComponent = null; | ||
91 | } | ||
92 | } else { | ||
93 | this.selectedComponent = null; | ||
94 | } | ||
95 | this._isDrawing = false; | ||
96 | } | ||
97 | } | ||
98 | //this.endDraw(event); | ||
99 | //NJevent("disableStageMove"); | ||
100 | } | ||
101 | } | ||
102 | }); \ No newline at end of file | ||