diff options
Diffstat (limited to 'js/stage/binding-view.reel/binding-hud.reel/binding-hud.js')
-rwxr-xr-x | js/stage/binding-view.reel/binding-hud.reel/binding-hud.js | 167 |
1 files changed, 167 insertions, 0 deletions
diff --git a/js/stage/binding-view.reel/binding-hud.reel/binding-hud.js b/js/stage/binding-view.reel/binding-hud.reel/binding-hud.js new file mode 100755 index 00000000..a8c3ae68 --- /dev/null +++ b/js/stage/binding-view.reel/binding-hud.reel/binding-hud.js | |||
@@ -0,0 +1,167 @@ | |||
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 | /** | ||
8 | @requires montage/core/core | ||
9 | @requires montage/ui/component | ||
10 | */ | ||
11 | var Montage = require("montage/core/core").Montage, | ||
12 | Component = require("montage/ui/component").Component; | ||
13 | |||
14 | exports.BindingHud = Montage.create(Component, { | ||
15 | _bindingArgs: { | ||
16 | value: null | ||
17 | }, | ||
18 | |||
19 | titleElement: { | ||
20 | value: null | ||
21 | }, | ||
22 | |||
23 | _userComponent: { value: null }, | ||
24 | userComponent: { | ||
25 | get: function() { | ||
26 | return this._userComponent; | ||
27 | }, | ||
28 | set: function(val) { | ||
29 | this._userComponent = val; | ||
30 | } | ||
31 | }, | ||
32 | |||
33 | |||
34 | bindingArgs: { | ||
35 | get: function() { | ||
36 | return this._bindingArgs; | ||
37 | }, | ||
38 | set: function(val) { | ||
39 | if (typeof(val) !== "undefined") { | ||
40 | this._bindingArgs = val; | ||
41 | this.userComponent = this.bindingArgs.component; | ||
42 | this.title = this.bindingArgs.component.identifier; | ||
43 | this.x = this._bindingArgs.component.element.offsetLeft; | ||
44 | this.y = this._bindingArgs.component.element.offsetTop; | ||
45 | this.properties = this._bindingArgs.properties; | ||
46 | this.needsDraw = true; | ||
47 | } else { | ||
48 | this.properties = []; | ||
49 | } | ||
50 | } | ||
51 | }, | ||
52 | |||
53 | properties: { | ||
54 | value: [ | ||
55 | ] | ||
56 | }, | ||
57 | |||
58 | _isResizing: { | ||
59 | value: null | ||
60 | }, | ||
61 | |||
62 | _resizedX : { | ||
63 | value: 0 | ||
64 | }, | ||
65 | |||
66 | _resizedY: { | ||
67 | value: 0 | ||
68 | }, | ||
69 | |||
70 | handleResizeStart: { | ||
71 | value:function(e) { | ||
72 | this.isResizing = true; | ||
73 | this.x = parseInt(this.x); | ||
74 | this.y = parseInt(this.y); | ||
75 | this.needsDraw = true; | ||
76 | this.parentComponent.parentComponent.needsDraw = true; | ||
77 | } | ||
78 | }, | ||
79 | |||
80 | handleResizeMove: { | ||
81 | value:function(e) { | ||
82 | this._resizedY = e._event.dY; | ||
83 | this._resizedX = e._event.dX; | ||
84 | this.needsDraw = true; | ||
85 | this.parentComponent.parentComponent.needsDraw = true; | ||
86 | } | ||
87 | }, | ||
88 | |||
89 | handleResizeEnd: { | ||
90 | value: function(e) { | ||
91 | this.x += this._resizedX; | ||
92 | this.y += this._resizedY; | ||
93 | this._resizedX = 0; | ||
94 | this._resizedY = 0; | ||
95 | this.isResizing = false; | ||
96 | this.needsDraw = true; | ||
97 | this.parentComponent.parentComponent.needsDraw = true; | ||
98 | } | ||
99 | }, | ||
100 | |||
101 | _x: { | ||
102 | value: 20 | ||
103 | }, | ||
104 | |||
105 | _y: { | ||
106 | value: 100 | ||
107 | }, | ||
108 | |||
109 | x: { | ||
110 | get: function() { | ||
111 | return this._x; | ||
112 | }, | ||
113 | set: function(val) { | ||
114 | this._x = val; | ||
115 | this.needsDraw = true; | ||
116 | } | ||
117 | }, | ||
118 | |||
119 | y: { | ||
120 | get: function() { | ||
121 | return this._y; | ||
122 | }, | ||
123 | set: function(val) { | ||
124 | this._y = val; | ||
125 | this.needsDraw = true; | ||
126 | } | ||
127 | }, | ||
128 | |||
129 | _title: { | ||
130 | value: "default" | ||
131 | }, | ||
132 | |||
133 | title: { | ||
134 | get: function() { | ||
135 | return this._title; | ||
136 | }, | ||
137 | set: function(val) { | ||
138 | this._title = val; | ||
139 | } | ||
140 | }, | ||
141 | |||
142 | prepareForDraw: { | ||
143 | value: function() { | ||
144 | // var arrProperties = this.application.ninja.objectsController.getEnumerableProperties(this._bindingArgs.sourceObject, true); | ||
145 | // arrProperties.forEach(function(obj) { | ||
146 | // var objBound = false; | ||
147 | // if(this._bindingArgs._boundObjectPropertyPath === obj) { | ||
148 | // objBound = true; | ||
149 | // } | ||
150 | // this.properties.push({"title":obj, "bound": objBound}); | ||
151 | // }.bind(this)); | ||
152 | } | ||
153 | }, | ||
154 | |||
155 | draw: { | ||
156 | value: function() { | ||
157 | this.titleElement.innerHTML = this.title; | ||
158 | |||
159 | // if(this.isResizing) { | ||
160 | // this.timelineSplitter.collapsed = this.height - this._resizedHeight < 46; | ||
161 | // this.panelSplitter.collapsed = this.width - this._resizedWidth < 30; | ||
162 | // } | ||
163 | this.element.style.top = (this.y + this._resizedY) + "px"; | ||
164 | this.element.style.left = (this.x + this._resizedX) + "px"; | ||
165 | } | ||
166 | } | ||
167 | }); \ No newline at end of file | ||