diff options
author | Valerio Virgillito | 2012-06-26 13:15:26 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-06-26 13:15:26 -0700 |
commit | 87a8b62f71bb72274c3dd1fa389e88c12d482ebb (patch) | |
tree | bf9f995e2972c0a61355f24e64231cdf0b2c86b5 /js/tools/bindingTool.js | |
parent | 8821e662484aedb027e26a873883e6ca3fb55a51 (diff) | |
parent | a95bba25c3ba6e31784a452e9b94748cc870ba5d (diff) | |
download | ninja-87a8b62f71bb72274c3dd1fa389e88c12d482ebb.tar.gz |
Merge pull request #323 from dhg637/binding
Binding View - Binding Tool & Binding Panel
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 | ||