aboutsummaryrefslogtreecommitdiff
path: root/js/tools/bindingTool.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/tools/bindingTool.js')
-rw-r--r--js/tools/bindingTool.js95
1 files changed, 95 insertions, 0 deletions
diff --git a/js/tools/bindingTool.js b/js/tools/bindingTool.js
new file mode 100644
index 00000000..b284fc47
--- /dev/null
+++ b/js/tools/bindingTool.js
@@ -0,0 +1,95 @@
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 this.selectedComponent = this.application.ninja.selectedElements[0].controller;
38 }
39 }
40 else
41 {
42 NJevent("disableStageMove");
43 this.application.ninja.workspaceMode = "default";
44 this.selectedComponent = null;
45 }
46
47 }
48 },
49
50 HandleLeftButtonDown: {
51 value: function(event) {
52 NJevent("enableStageMove");
53 }
54 },
55
56 HandleMouseMove: {
57 value: function(event) {
58 /*
59 In the mouse over event we need to validate if the mouse over is over a hud.
60 If it on top of a hud bring that single hud to the top to associate with.
61 */
62
63 this.application.ninja.stage.bindingView.handleMousemove(event);
64 //this.doDraw(event);
65 }
66 },
67
68 HandleLeftButtonUp: {
69 value: function(event) {
70 if(!this.application.ninja.stage.bindingView._isDrawingConnection) {
71 if(this._escape) {
72 this._escape = false;
73 return;
74 }
75
76 if(this._hasDraw) {
77 this._hasDraw = false;
78 //this.endDraw(event);
79 } else {
80 this.doSelection(event);
81 if (this.application.ninja.selectedElements.length !== 0 ) {
82 if(this.application.ninja.selectedElements[0].controller) {
83 this.selectedComponent = this.application.ninja.selectedElements[0].controller;
84 }
85 } else {
86 this.selectedComponent = null;
87 }
88 this._isDrawing = false;
89 }
90 }
91 //this.endDraw(event);
92 //NJevent("disableStageMove");
93 }
94 }
95}); \ No newline at end of file