Home : Annotations : Manipulating : How to move annotations foward, backward, to the front or back in JavaScript (Legacy Web Controls)
Q10295 - HOWTO: How to move annotations foward, backward, to the front or back in JavaScript (Legacy Web Controls)

Legacy Controls NOTICE

This article references our legacy Web Forms Web Viewing controls (WebImageViewer, WebAnnotationViewer, WebThumbnailViewer). It is preserved for archival purposes, but support strongly recommends using our modern HTML5 web controls: WebDocumentViewer, WebDocumentThumbnailer instead)

http://atalasupport.net/demos/LegacyDemos-11.1/WebViewingDemo.zip

Main Article Content

 

First, declare a _currentAnno var

   var _currentAnno = null;

and set it in the clicked event (or where ever you want -- WebAnnotationViewer1 should be replaced by your anno viewer's name). For example:

   WebAnnotationViewer1.AnnotationClicked = function(e) { _currentAnno = e.annotation;}

Then,


function MoveSelectedAnnoToPos(i)

 var layer = _currentAnno.getParent(); 
 var count = layer.getAnnotations().length; 
 if (i >= 0 && i <= count) {  
  layer.Insert(_currentAnno, i); 
 }
}
 
// move one position forward
function MoveSelectedAnnoForward()
{
 MoveSelectedAnnoToPos(_currentAnno.getZIndex() + 1); 
}
 
// move to the front
function MoveSelectedAnnoFront()
{
 MoveSelectedAnnoToPos(_currentAnno.getParent().getAnnotations().length); 
}
 
// move one position backward
function MoveSelectedAnnoBackward()
{
 MoveSelectedAnnoToPos(_currentAnno.getZIndex() - 1);
}
 
// move to the back
function MoveSelectedAnnoBack()
{
 MoveSelectedAnnoToPos(0);
}
Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.

Powered By InstantKB.NET v1.3
Copyright © 2002, 2019. InstantASP Ltd. All Rights Reserved