Thursday, June 11, 2009

my gsoc2009 @ June 11

As doc-editor has many sub-components open a code-mirror editor.. i'm trying to make the editor becomes a reusable ui component.

Today ... i'm working on that and trying to allows two editor to synchronize their scroll bar...

BUT... problemsssssssssssssssssssssssssssss :)

Let's consider this!
Editor-A scroll for 40px from top
Editor-A's scroll listener catch the event and ask Editor-B to scroll to 40px from top
Editor-B scroll for 40px from top
Editor-B's scroll listener catch the event and ask Editor-A to scroll to 40px from top
Editor-A scroll for 40px from top
:
:
:
who scroll NEXT?

in Chrome ... the logic seems working.... but in Firefox ... the logic breaks.

To handle this.... I added a "scroll-lock" to the editors :] (just a conventional solution to handle synchronization problem)

New logic follows....

Editor-A scroll for 40px from top
Editor-A listener gains lock as Editor-B is not scrolling
Editor-B scroll for 40px from top asked by Editor-A listener
Editor-B listener cannot gain lock as Editor-A gained
Editor-B listener gives up asking Editor-A to scroll and force Editor-A to release the lock

So... scrolling won't be propagated
if Editor-A/Editor-B scroll again, lock can be gained and logic applies

Sync is FUNNY XD

No response to “my gsoc2009 @ June 11”

 
© 2009 Emptiness Blogging. All Rights Reserved | Powered by Blogger
Design by psdvibe | Bloggerized By LawnyDesignz