diff options
author | Eric Guzman | 2012-06-20 13:10:40 -0700 |
---|---|---|
committer | Eric Guzman | 2012-06-20 13:10:40 -0700 |
commit | a5d93daf6fdccbfee160d6a8ba08f6b6d4b9d7cc (patch) | |
tree | ca2967965c54269492176b1c3c93acbca6131c1f /js | |
parent | 8ac2ce1566995c91fe4721df2b121ed6437b9e1c (diff) | |
parent | 5c770b772179cc2c3a0455f67025978b44e4b547 (diff) | |
download | ninja-a5d93daf6fdccbfee160d6a8ba08f6b6d4b9d7cc.tar.gz |
Merge branch 'binding' of github.com:dhg637/ninja-internal into binding
Diffstat (limited to 'js')
-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 cc94e844..dd88bef7 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 | |||
@@ -205,42 +205,54 @@ exports.BindingHud = Montage.create(Component, { | |||
205 | }, | 205 | }, |
206 | 206 | ||
207 | isOverScroller: { | 207 | isOverScroller: { |
208 | value: function(mousePoint) { | 208 | value: function(e) { |
209 | if(this.scrollSpace < this.properties.length) { | 209 | if(this.scrollSpace < this.properties.length) { |
210 | if (this.scrollInterval === null) { | 210 | var isOverScroller = false; |
211 | var newX = mousePoint.x - this.x; | 211 | var mousePoint = webkitConvertPointFromPageToNode(this.element, new WebKitPoint(e.pageX, e.pageY)); |
212 | var newY = mousePoint.y - this.y; | 212 | |
213 | var scrollUpStartX = 5; | 213 | var scrollUpStartX = 5; |
214 | var scrollUpEndX = scrollUpStartX + this.titleElement.offsetWidth; | 214 | var scrollUpEndX = scrollUpStartX + this.titleElement.offsetWidth; |
215 | var scrollUpStartY = this.titleElement.offsetHeight; | 215 | var scrollUpStartY = this.titleElement.offsetHeight; |
216 | var scrollUpEndY = scrollUpStartY + this.scrollUp.offsetHeight; | 216 | var scrollUpEndY = scrollUpStartY + this.scrollUp.offsetHeight; |
217 | 217 | if(scrollUpStartX < mousePoint.x && (scrollUpEndX) > mousePoint.x) { | |
218 | var scrollDownStartX = 5; | 218 | if(scrollUpStartY < mousePoint.y && (scrollUpEndY) > mousePoint.y) { |
219 | var scrollDownEndX = scrollUpStartX + this.titleElement.offsetWidth; | 219 | this.handleScroll("up"); |
220 | var scrollDownStartY = scrollUpEndY + this.optionsRepeater.element.offsetHeight; | 220 | isOverScroller = true; |
221 | //scrollDownEndy to small find out y; | 221 | } |
222 | var scrollDownEndY = scrollUpEndY + this.scrollDown.offsetHeight; | 222 | } |
223 | console.log(scrollDownStartX,scrollDownEndX, scrollDownStartY, scrollDownEndY, newX, newY ); | 223 | |
224 | if(scrollDownStartX < newX && (scrollDownEndX) > newX) { | 224 | var scrollDownStartX = 5; |
225 | if(scrollDownStartY < newY && (scrollDownEndY) > newY) { | 225 | var scrollDownEndX = scrollDownStartX + this.titleElement.offsetWidth; |
226 | debugger; | 226 | var scrollDownStartY = scrollUpEndY + this.optionsRepeater.element.offsetHeight; |
227 | } | 227 | var scrollDownEndY = scrollDownStartY + this.scrollDown.offsetHeight; |
228 | |||
229 | if(scrollDownStartX < mousePoint.x && (scrollDownEndX) > mousePoint.x) { | ||
230 | if(scrollDownStartY < mousePoint.y && (scrollDownEndY) > mousePoint.y) { | ||
231 | this.handleScroll("down"); | ||
232 | isOverScroller = true; | ||
228 | } | 233 | } |
229 | } | 234 | } |
235 | |||
236 | if(!isOverScroller) { | ||
237 | clearInterval(this.scrollInterval); | ||
238 | this.scrollInterval = null; | ||
239 | } | ||
230 | } | 240 | } |
231 | } | 241 | } |
232 | }, | 242 | }, |
233 | 243 | ||
234 | handleScroll: { | 244 | handleScroll: { |
235 | value: function(direction) { | 245 | value: function(direction) { |
236 | if(direction === "down") { | 246 | if (this.scrollInterval === null) { |
237 | this.scrollInterval = setInterval(function() { | 247 | if(direction === "down") { |
238 | self.optionsRepeater.element.scrollTop += 18; | 248 | this.scrollInterval = setInterval(function() { |
239 | }, 200); | 249 | this.optionsRepeater.element.scrollTop += 3; |
240 | } else { | 250 | }.bind(this), 50); |
241 | this.scrollInterval = setInterval(function() { | 251 | } else { |
242 | self.optionsRepeater.element.scrollTop -= 18; | 252 | this.scrollInterval = setInterval(function() { |
243 | }, 200); | 253 | this.optionsRepeater.element.scrollTop -= 3; |
254 | }.bind(this), 50); | ||
255 | } | ||
244 | } | 256 | } |
245 | } | 257 | } |
246 | }, | 258 | }, |
@@ -262,7 +274,7 @@ exports.BindingHud = Montage.create(Component, { | |||
262 | } | 274 | } |
263 | } | 275 | } |
264 | } | 276 | } |
265 | this.needsDraw = true; | 277 | //this.needsDraw = true; |
266 | } | 278 | } |
267 | }, | 279 | }, |
268 | 280 | ||
diff --git a/js/stage/binding-view.reel/binding-view.js b/js/stage/binding-view.reel/binding-view.js index e2bbb60b..505dd074 100755 --- a/js/stage/binding-view.reel/binding-view.js +++ b/js/stage/binding-view.reel/binding-view.js | |||
@@ -289,7 +289,7 @@ exports.BindingView = Montage.create(Component, { | |||
289 | if(obj.y < mousePoint.y && (obj.y + obj.element.offsetHeight) > mousePoint.y) { | 289 | if(obj.y < mousePoint.y && (obj.y + obj.element.offsetHeight) > mousePoint.y) { |
290 | overHud = true; | 290 | overHud = true; |
291 | if(this._isDrawingConnection) { | 291 | if(this._isDrawingConnection) { |
292 | obj.isOverScroller(mousePoint); | 292 | obj.isOverScroller(e); |
293 | } | 293 | } |
294 | } | 294 | } |
295 | } | 295 | } |