| 351 | | var self = this; |
| 352 | | var paragraphes = this.LDRize.getParagraphes(); |
| 353 | | var paragraph = paragraphes[getter](); |
| 354 | | var current = paragraphes.current; |
| 355 | | |
| 356 | | var innerHeight = window.content.innerHeight; |
| 357 | | var scrollY = window.content.scrollY; |
| 358 | | |
| 359 | | var limit = window.content.innerHeight * (self.skipHeight + 0.5); |
| 360 | | |
| 361 | | if(paragraph.paragraph == undefined) return true ; |
| 362 | | if(current.paragraph == undefined) return false ; |
| 363 | | if(current.paragraph.y - window.content.scrollY == this.LDRize.getScrollHeight() && getter == "getPrev") return false; |
| 364 | | |
| 365 | | var [x, y] = paragraph.paragraph.getOffset(); |
| 366 | | //var [x2, y2] = [x + paragraph.paragraph.node.offsetWidth, y + paragraph.paragraph.node.offsetHeight]; |
| 367 | | var [cx, cy] = current.paragraph.getOffset(); |
| 368 | | //var [cx2, cy2] = [cx + current.paragraph.node.offsetWidth, cy + current.paragraph.node.offsetHeight]; |
| 369 | | var [cx2, cy2] = [x, y]; |
| 370 | | |
| 371 | | /* |
| 372 | | *log("next y:"+y); |
| 373 | | *log("limit:"+limit); |
| 374 | | *log("distance:" + Math.abs(y - (window.content.scrollY + window.content.innerHeight/2))); |
| 375 | | */ |
| 376 | | |
| 377 | | //check current paragraph |
| 378 | | if(!(scrollY < cy2 && cy < scrollY + innerHeight)) return false; // bind |
| 379 | | //check next/prev paragraph |
| 380 | | if(Math.abs(y -(scrollY + innerHeight/2)) < innerHeight * 0.5) return false; // bind |
| 381 | | if(Math.abs(y -(scrollY + innerHeight/2)) > limit) return true; // scroll |
| 382 | | else return false; // bind |
| | 352 | try{ |
| | 353 | var self = this; |
| | 354 | var paragraphes = this.LDRize.getParagraphes(); |
| | 355 | var paragraph = paragraphes[getter](); |
| | 356 | var current = paragraphes.current; |
| | 357 | var next = paragraphes.getNext(); |
| | 358 | |
| | 359 | var innerHeight = window.content.innerHeight; |
| | 360 | var scrollY = window.content.scrollY; |
| | 361 | |
| | 362 | var limit = window.content.innerHeight * (self.skipHeight + 0.5); |
| | 363 | |
| | 364 | if(paragraph.paragraph == undefined) return true; // scroll |
| | 365 | if(current.paragraph == undefined) return false; // bind |
| | 366 | if(current.paragraph.y - window.content.scrollY == this.LDRize.getScrollHeight() |
| | 367 | && getter == "getPrev") return false; // bind |
| | 368 | |
| | 369 | var p = this.getClientPosition(paragraph.paragraph.node); |
| | 370 | var np = next && next.paragraph.node != undefined ? |
| | 371 | this.getClientPosition(next.paragraph.node) : |
| | 372 | {top: window.content.scrollMaxY + window.content.innerHeight,left: 0}; |
| | 373 | var cp = this.getClientPosition(current.paragraph.node); |
| | 374 | |
| | 375 | /* |
| | 376 | *log(p); |
| | 377 | *log(np); |
| | 378 | *log(cp); |
| | 379 | */ |
| | 380 | |
| | 381 | //check current paragraph |
| | 382 | if(!(scrollY < np.top && cp.top < scrollY + innerHeight)) return false; // bind |
| | 383 | //check next/prev paragraph |
| | 384 | if(Math.abs(p.top - (scrollY + innerHeight/2)) < innerHeight * 0.5) return false; // bind |
| | 385 | if(Math.abs(p.top - (scrollY + innerHeight/2)) > limit) return true; // scroll |
| | 386 | else return false; // bind |
| | 387 | }catch(e){ |
| | 388 | log(e); |
| | 389 | } |