LEADTOOLS JavaScript (Leadtools.Controls)

NewImageResetOptions Property

Show in webframe
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);
Object.defineProperty('newImageResetOptions');

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

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.

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(lt.Controls.ImageViewerSizeMode.none, 2, viewer.get_imageControlCenter());

   // Scroll by 100 and 200 pixels
   viewer.scrollBy(lt.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 = lt.Controls.ImageViewerNewImageResetOptions.all;
   resetOptions &= ~(lt.Controls.ImageViewerNewImageResetOptions.scaleFactor | lt.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-2014 All Rights Reserved. LEAD Technologies, Inc.