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.js93
1 files changed, 93 insertions, 0 deletions
diff --git a/js/tools/bindingTool.js b/js/tools/bindingTool.js
new file mode 100644
index 00000000..93af11c2
--- /dev/null
+++ b/js/tools/bindingTool.js
@@ -0,0 +1,93 @@
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 this.application.ninja.stage.bindingView.handleMousemove(event);
63 //this.doDraw(event);
64 }
65 },
66
67 HandleLeftButtonUp: {
68 value: function(event) {
69
70 if(this._escape) {
71 this._escape = false;
72 return;
73 }
74
75 if(this._hasDraw) {
76 this._hasDraw = false;
77 //this.endDraw(event);
78 } else {
79 this.doSelection(event);
80 if (this.application.ninja.selectedElements.length !== 0 ) {
81 if(this.application.ninja.selectedElements[0].controller) {
82 this.selectedComponent = this.application.ninja.selectedElements[0].controller;
83 }
84 } else {
85 this.selectedComponent = null;
86 }
87 this._isDrawing = false;
88 }
89 //this.endDraw(event);
90 //NJevent("disableStageMove");
91 }
92 }
93}); \ No newline at end of file