LEADTOOLS JavaScript (Leadtools.Controls)
LEAD Technologies, Inc

OnSizeChanged Method (ImageViewer)

Example 

Event data.
Inform the control that the size of the container has changed.
Syntax
 function Leadtools.Controls.ImageViewer.onSizeChanged( 
   e 
)
!MISSING Scrap '_RTJavaScript_Method_SYNTAX'!

Parameters

ParameterTypeDescription
eLeadEventArgsEvent data.
Remarks

The viewer hooks to standard HTML Window "sizechanged" or "orientationchange" events depending on the browser being used. This will allow the viewer to recalculate the transformation matrix and cause a render if the size of the control (container DIV) changes. If however, the size of the control is changed programmatically or due to CSS rules that do not fire "sizechanged" or "orientationchange", then the control will not be updated. You must call OnSizeChanged to trigger the control to update its transformation.

The control size is stored in ControlSize.

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 size of the container is reduced by half and OnSizeChanged is called to reflect the new size into the viewer.

  • JavaScript
  •   
     
    example: function SiteLibrary_DefaultPage$example(viewer) {
       // Get the container
       var imageViewerDiv = document.getElementById("imageViewerDiv");
       // Change the size to 200 by 200 pixels
       imageViewerDiv.style.width = "200px";
       imageViewerDiv.style.height = "200px";
       // If you comment out the code below, then the viewer will not be in a correct size
       // Inform the viewer of the new size
       viewer.onSizeChanged(null);
    },
See Also

Reference

ImageViewer Object
ImageViewer Members

 

 


Products | Support | Contact Us | Copyright Notices

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