LEADTOOLS JavaScript (Leadtools.Controls)
LEAD Technologies, Inc

NewImageResetOptions Property

Example 

Gets or sets a value that determines which properties to reset when a new image is set into the viewer.
Syntax
  get_newImageResetOptions();
 set_newImageResetOptions(value);
!MISSING Scrap '_RTJavaScript_PROPERTY_SYNTAX'!

Property Value

TypeDescription
ImageViewerNewImageResetOptionsValue that determines which properties to reset when a new image is set into the viewer. Default value is ImageViewerNewImageResetOptions.All.
Remarks

You can use this property to control which of the display properties of the controls resets back to its default value when a new image is set into the ImageUrl property or when the user changes ImageSize directly.

Example

Start with the ImageViewer example, remove all the code inside the example function (search for the // TODO: add example code here comment) and insert the following code:

Open the HTML page in your browser, now when you click the Example button, the image will be zoomed (its scale factor and scroll offset will be changed) to a certain value, then the viewer will use NewImageResetOptions to not change these values when a new image is set.

  • JavaScript
  •   
     
    example: function SiteLibrary_DefaultPage$example(viewer) {
       // Assume this is a value image, you can also use the same Url in the image:
       // viewer.set_imageUrl(viewer.get_imageUrl());
       // However, the display will not change, so for the purpose of this example
       // we will use a completely new image
       var newUrl = "Images/PngImage2.png";
    
       // Zoom current image by a 2
       viewer.zoom(Leadtools.Controls.ImageViewerSizeMode.none, 2, viewer.get_imageControlCenter());
    
       // Scroll by 100 and 200 pixels
       viewer.scrollBy(Leadtools.LeadPointD.create(100, 200));
    
       // Tell the viewer to not change the scale factor and scroll position when a new image is set
       // The easiest way is to get all options then remove the ones you do not want to change
       var resetOptions = Leadtools.Controls.ImageViewerNewImageResetOptions.all;
       resetOptions &= ~(Leadtools.Controls.ImageViewerNewImageResetOptions.scaleFactor | Leadtools.Controls.ImageViewerNewImageResetOptions.scrollOffset);
       viewer.set_newImageResetOptions(resetOptions);
    
       viewer.set_imageUrl(newUrl);
    },
See Also

Reference

ImageViewer Object
ImageViewer Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.