Couple of issues:
1. The second parameter of fromRotated needs to be the page in question, so the page where the annotation is located.
2. As the nY parameter of scroll use the third object in the rect array, not the second. That would make the annotation visible when you scroll to it.
3. Centering the view on the annotation will be difficult, as you need to take into consideration the zoom level, view setting, page size, and possibly even things like window size and resolution (the latter you can't actually know)...
Thanks for your reply!
1. I fixed the parameter of fromRotated to refer to the correct page. Thanks for that!
2. I am confused about this comment. The third object of the Rect array is xur, is it not? Why would we be passing an x coordinate to the nY parameter of the scroll method?
3. Centering the view is actually not entirely important, but certainly desired. At a minumum I expect to have the annotation in view but it doesn't have to be centered.
My desired behavior can be duplicated by the following: when the comment sidepane is shown, one can click on any annotation and the view scrolls the document enough such that the annotation is completely visible (and keeps the current zoom level).
2. Sorry, I meant the fourth item. Doing so will cause the annotation to be visible on the page. If you want, add a certain fixed margin to it, so it looks nicer.
This is workable, thank you! I added a static buffer of +100 to each comment; for most pages that number seems to work out just fine. Not perfect, but it's much better than it was. Marked your reply as "Correct".