aboutsummaryrefslogtreecommitdiff
path: root/js/tools/bindingTool.js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-06-26 13:40:44 -0700
committerJose Antonio Marquez2012-06-26 13:40:44 -0700
commit81747f839bf5d176a15511303f7d2a0e4028e5bb (patch)
tree5afab7fb834f9df27d2bf35f6414a906c27ec598 /js/tools/bindingTool.js
parent9ebf80d943b894242d90cf62bc3078c6a83041ad (diff)
parent87a8b62f71bb72274c3dd1fa389e88c12d482ebb (diff)
downloadninja-81747f839bf5d176a15511303f7d2a0e4028e5bb.tar.gz
Merge branch 'refs/heads/Ninja-Internal' into Color
Diffstat (limited to 'js/tools/bindingTool.js')
-rw-r--r--js/tools/bindingTool.js102
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>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No 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
7var Montage = require("montage/core/core").Montage,
8 DrawingTool = require("js/tools/drawing-tool").DrawingTool,
9ModifierToolBase = require("js/tools/modifier-tool-base").ModifierToolBase;
10SelectionTool = require("js/tools/SelectionTool").SelectionTool;
11
12
13exports.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