Community
Participate
Working Groups
I have written a blog post that contains the orion editor embedded to show code snippets: http://aniefer.blogspot.com/2011/02/overriding-pdebuild-with-ant-import.html If you scroll down the page using the mouse wheel, as soon as the mouse cursor is over top of an editor, then editor starts consuming the scroll and the page stops moving. If the editor contains a verticle scrollbar (there is one at the bottom of the post with one), then the wheel scrolls the editor. However, if there is no scrollbar in the editor, then nothing happens. We should expect that if the editor does not contain a verticle scrollbar, then the page should continue scrolling.
Looking at your blog in FF 3.6, all the snippets have vertical scrollbars... Maybe the editor needs an option to disable scrollbars.
What browser/platform are you using ? John, it is possible to disable the scrollbar for the editor, it is a CSS attribute. Andrew, is that something that you would like to do (I can go find the correct attribute name and value for you) ? Personally I find it would look nicer if: - the height was set to lineCount*lineHeight (no scrollbars, no waste white space at bottom) - a nice border around the editor, set it on the parent div.
I don't mind having the scroll bars when the editor contains more content. The trick here is that I'm not sure how to determine the lineheight. If I can find the lineheight using javascript, then what I could do is set the div height to some number in the html, and then in javascript when I create the editor adjust the height according to the length of the text.
btw, I'm looking at the post on windows xp with firefox 3.6.13. I was also using firefox 3.6.12 on SLES and Chrome 6.0.472.63 on SLES when I wrote it.
Not sure I follow the whole picture but I hope this can help: http://orion.eclipse.org/jsdoc/symbols/eclipse.Editor.html#getLineHeight
Thanks Felipe, here is what I'm using to set the height: div.style.height = (editor.getLineHeight() * (editor.getModel().getLineCount() + 1)) + 2 + 'px'; Before adding the +1 to the linecount, I found I had to add the + 2 to make the vertical scroll bar not appear, there must be a border. I added the +1 to the lineCount to make room for a horizontal scrollbar. As for scrolling the page with the mouse wheel, none of my editors have vertical scrollbars, and firefox 3.6.13 on windows doesn't scroll past the editor. However, IE 8 is scrolling past the editor just fine.
(In reply to comment #6) > Thanks Felipe, here is what I'm using to set the height: > div.style.height = (editor.getLineHeight() * (editor.getModel().getLineCount() > + 1)) + 2 + 'px'; > Before adding the +1 to the linecount, I found I had to add the + 2 to make the > vertical scroll bar not appear, there must be a border. I added the +1 to the > lineCount to make room for a horizontal scrollbar. I knew you would need some "extra" space in there. lineCount*lineHeight gives the size for the client area. You would need something of "computeTrim" to compute the bounding box size (add the space for the scrollbars, borders, etc). I will take a look in what can be done here to help the app to solve this prolem. The problem with your approach is that it assumes that height of hscrollbar is lineHeight, that can fail (changing the font size for example would break the code). > As for scrolling the page with the mouse wheel, none of my editors have > vertical scrollbars, and firefox 3.6.13 on windows doesn't scroll past the > editor. However, IE 8 is scrolling past the editor just fine. That is a bug, I'll take a look at it.
Fixed http://git.eclipse.org/c/e4/org.eclipse.orion.client.git/commit/?id=7de6fcca7acd0f6ed417dd1efd5279ede27932e8
fixed
Thanks Felipe, I updated with your changes and scrolling works great for me now.