diff options
author | Armen Kesablyan | 2012-06-20 13:06:11 -0700 |
---|---|---|
committer | Armen Kesablyan | 2012-06-20 13:06:11 -0700 |
commit | 5c770b772179cc2c3a0455f67025978b44e4b547 (patch) | |
tree | 9c7a21332b3036235f7a89e5757ca839df94fad9 /js/stage | |
parent | 7cd6ad42bbe799a66124344a463b5a571a2e892a (diff) | |
download | ninja-5c770b772179cc2c3a0455f67025978b44e4b547.tar.gz |
binding-hud Scroll Up
Signed-off-by: Armen Kesablyan <armen@motorola.com>
Diffstat (limited to 'js/stage')
-rwxr-xr-x | js/stage/binding-view.reel/binding-hud.reel/binding-hud.js | 68 | ||||
-rwxr-xr-x | js/stage/binding-view.reel/binding-view.js | 2 |
2 files changed, 41 insertions, 29 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 index 4b40d4da..0893e8d8 100755 --- a/js/stage/binding-view.reel/binding-hud.reel/binding-hud.js +++ b/js/stage/binding-view.reel/binding-hud.reel/binding-hud.js | |||
@@ -175,42 +175,54 @@ exports.BindingHud = Montage.create(Component, { | |||
175 | }, | 175 | }, |
176 | 176 | ||
177 | isOverScroller: { | 177 | isOverScroller: { |
178 | value: function(mousePoint) { | 178 | value: function(e) { |
179 | if(this.scrollSpace < this.properties.length) { | 179 | if(this.scrollSpace < this.properties.length) { |
180 | if (this.scrollInterval === null) { | 180 | var isOverScroller = false; |
181 | var newX = mousePoint.x - this.x; | 181 | var mousePoint = webkitConvertPointFromPageToNode(this.element, new WebKitPoint(e.pageX, e.pageY)); |
182 | var newY = mousePoint.y - this.y; | 182 | |
183 | var scrollUpStartX = 5; | 183 | var scrollUpStartX = 5; |
184 | var scrollUpEndX = scrollUpStartX + this.titleElement.offsetWidth; | 184 | var scrollUpEndX = scrollUpStartX + this.titleElement.offsetWidth; |
185 | var scrollUpStartY = this.titleElement.offsetHeight; | 185 | var scrollUpStartY = this.titleElement.offsetHeight; |
186 | var scrollUpEndY = scrollUpStartY + this.scrollUp.offsetHeight; | 186 | var scrollUpEndY = scrollUpStartY + this.scrollUp.offsetHeight; |
187 | 187 | if(scrollUpStartX < mousePoint.x && (scrollUpEndX) > mousePoint.x) { | |
188 | var scrollDownStartX = 5; | 188 | if(scrollUpStartY < mousePoint.y && (scrollUpEndY) > mousePoint.y) { |
189 | var scrollDownEndX = scrollUpStartX + this.titleElement.offsetWidth; | 189 | this.handleScroll("up"); |
190 | var scrollDownStartY = scrollUpEndY + this.optionsRepeater.element.offsetHeight; | 190 | isOverScroller = true; |
191 | //scrollDownEndy to small find out y; | ||
192 | var scrollDownEndY = scrollUpEndY + this.scrollDown.offsetHeight; | ||
193 | console.log(scrollDownStartX,scrollDownEndX, scrollDownStartY, scrollDownEndY, newX, newY ); | ||
194 | if(scrollDownStartX < newX && (scrollDownEndX) > newX) { | ||
195 | if(scrollDownStartY < newY && (scrollDownEndY) > newY) { | ||
196 | debugger; | ||
197 | } | ||
198 | } | 191 | } |
199 | } | 192 | } |
193 | |||
194 | var scrollDownStartX = 5; | ||
195 | var scrollDownEndX = scrollDownStartX + this.titleElement.offsetWidth; | ||
196 | var scrollDownStartY = scrollUpEndY + this.optionsRepeater.element.offsetHeight; | ||
197 | var scrollDownEndY = scrollDownStartY + this.scrollDown.offsetHeight; | ||
198 | |||
199 | if(scrollDownStartX < mousePoint.x && (scrollDownEndX) > mousePoint.x) { | ||
200 | if(scrollDownStartY < mousePoint.y && (scrollDownEndY) > mousePoint.y) { | ||
201 | this.handleScroll("down"); | ||
202 | isOverScroller = true; | ||
203 | } | ||
204 | } | ||
205 | |||
206 | if(!isOverScroller) { | ||
207 | clearInterval(this.scrollInterval); | ||
208 | this.scrollInterval = null; | ||
209 | } | ||
200 | } | 210 | } |
201 | } | 211 | } |
202 | }, | 212 | }, |
203 | 213 | ||
204 | handleScroll: { | 214 | handleScroll: { |
205 | value: function(direction) { | 215 | value: function(direction) { |
206 | if(direction === "down") { | 216 | if (this.scrollInterval === null) { |
207 | this.scrollInterval = setInterval(function() { | 217 | if(direction === "down") { |
208 | self.optionsRepeater.element.scrollTop += 18; | 218 | this.scrollInterval = setInterval(function() { |
209 | }, 200); | 219 | this.optionsRepeater.element.scrollTop += 3; |
210 | } else { | 220 | }.bind(this), 50); |
211 | this.scrollInterval = setInterval(function() { | 221 | } else { |
212 | self.optionsRepeater.element.scrollTop -= 18; | 222 | this.scrollInterval = setInterval(function() { |
213 | }, 200); | 223 | this.optionsRepeater.element.scrollTop -= 3; |
224 | }.bind(this), 50); | ||
225 | } | ||
214 | } | 226 | } |
215 | } | 227 | } |
216 | }, | 228 | }, |
@@ -232,7 +244,7 @@ exports.BindingHud = Montage.create(Component, { | |||
232 | } | 244 | } |
233 | } | 245 | } |
234 | } | 246 | } |
235 | this.needsDraw = true; | 247 | //this.needsDraw = true; |
236 | } | 248 | } |
237 | }, | 249 | }, |
238 | 250 | ||
diff --git a/js/stage/binding-view.reel/binding-view.js b/js/stage/binding-view.reel/binding-view.js index 9bd99176..1d5ef4db 100755 --- a/js/stage/binding-view.reel/binding-view.js +++ b/js/stage/binding-view.reel/binding-view.js | |||
@@ -281,7 +281,7 @@ exports.BindingView = Montage.create(Component, { | |||
281 | if(obj.y < mousePoint.y && (obj.y + obj.element.offsetHeight) > mousePoint.y) { | 281 | if(obj.y < mousePoint.y && (obj.y + obj.element.offsetHeight) > mousePoint.y) { |
282 | overHud = true; | 282 | overHud = true; |
283 | if(this._isDrawingConnection) { | 283 | if(this._isDrawingConnection) { |
284 | obj.isOverScroller(mousePoint); | 284 | obj.isOverScroller(e); |
285 | } | 285 | } |
286 | } | 286 | } |
287 | } | 287 | } |