This repository was archived by the owner on Feb 7, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,16 @@ var annotationsViewer = {
111
111
$ ( '#sg-annotation-container' ) . css ( 'bottom' , - pos ) ;
112
112
} ,
113
113
114
+ /**
115
+ * moves to a particular item in the viewer
116
+ */
117
+ moveTo : function ( number ) {
118
+ if ( document . getElementById ( "annotation-" + number ) !== undefined ) {
119
+ var top = document . getElementById ( "annotation-" + number ) . offsetTop ;
120
+ $ ( '#sg-annotation-container' ) . animate ( { scrollTop : top - 10 } , 600 ) ;
121
+ }
122
+ } ,
123
+
114
124
/**
115
125
* when turning on or switching between patterns with annotations view on make sure we get
116
126
* the annotations from from the pattern via post message
@@ -202,8 +212,7 @@ var annotationsViewer = {
202
212
} else if ( data . annotationState !== undefined ) {
203
213
document . getElementById ( "annotation-state-" + data . displayNumber ) . innerHTML = ( data . annotationState == true ) ? "" : " hidden" ;
204
214
} else if ( data . displaynumber !== undefined ) {
205
- var top = document . getElementById ( "annotation-" + data . displaynumber ) . offsetTop ;
206
- $ ( '#sg-annotation-container' ) . animate ( { scrollTop : top - 10 } , 600 ) ;
215
+ annotationsViewer . moveTo ( data . displaynumber ) ;
207
216
} else if ( data . keyPress !== undefined ) {
208
217
if ( data . keyPress == 'ctrl+shift+a' ) {
209
218
annotationsViewer . toggleComments ( ) ;
You can’t perform that action at this time.
0 commit comments