JavaScript Interface

Usually you will not need to use the javascript interface.

Even if you modify an images src parameter at runtime, the tool will notice that and replace the magnified image accordingly.


If you on the other hand add images to the DOM tree at runtime or modify the position of images by script, the following interface is available to update the images and positions:


Initialization:
FSITouchZoom = new $FSI.TouchZoom();
FSITouchZoom.init();


Public Methods


void

scanForNewImages();


Calling the scanForNewImages method will make the script look for single source images that have not been present in the DOM tree when the document finished loading. If you e.g. add <img> tags at runtime, you need to call this method in order to make the script aware of new image(s).




void

addImage(elImg);


This adds a single <img> node to the list of dynamic touch zoom images. elImg: the <img> node object


Note: you can as well call scanForNewImages() after adding an <img> node.




void

removeImages(arImageDOMElements, bSilent);


Removes one or more touch zoom images and restores their original state.

arImageDOMElements: an <img> node object or an array of <img> node objects




nImagesRemoved

removeAllImages();


Removes all touch zoom images and restores their original state.





void

updateImagePositions();


This makes the tool update all image positions and refresh images if needed. You might want to call this after modifying the DOM tree by script.




void

printAPI();


Shows all API methods in the console in alphabetical order.




mixed

getConfigValue(strName);


Returns the value of the configuration parameter "strName".




mixed

traceConfigValue(strName);


Traces a config value and enables you to see where (in config files, the _default.xml, etc) a specific value is set.




void

setZoomPrecision(fPrecision);


Use this method to modify the parameter zoomPrecision at runtime.




void

destroy();


Destroys FSI TouchZoom.




void

init();


Initializes FSI TouchZoom.




strVersion

getVersion();


Returns a string containing the FSI ImageFlow software version.




strVersion

getBuild();


Returns a string containing theFSI ImageFlow software build number.




strInstanceName

getInstanceName();


Returns the name of the viewer object.




nInstanceID

getInstanceID();


Returns the number of the viewer object.




oParameters

getParameters();


Returns an object containing all parameters set via javascript or custom tag attributes.




void

enable(bEnable);


Enables FSI TouchZoom.




nRegisteredImages

getImageCount();


Returns the amount of registered images available for FSI TouchZoom.




void

lockImage(elImage, bLock);


Locks a certain image .




void

lockImageSourceDimension(elImage, bLock);


Locks a certain image to it's source dimensions.




void

lockUpdates(bLock);


Locks updates .




void

resetImage(elImg);


Resets a certain image.



void

triggerRefresh();


Triggers a refresh.



bSuccess

addListener(strListenerName, fn, iScope);


Adds a listener.



bSuccess

removeListener( strListenerName, fn )


Removes a listener.



void

dumpListeners();


Dumps all listeners.



void

testAPIListenersStart()


Starts the API test and shows all called listeners and the parameters which they return.



void

testAPIListenersStop()


Stops the API test.





Callbacks




void

onConfigsReady(oConfigValues);


Called when the configuration is ready.



void

onDestroy();


Called when the instance is destroyed.



void

onInit();


Called as soon as the viewer is initialized.



void

onZoomChanged(fDocumentScale, fDocumentScalePixelRatio);


Called as soon as the zoom scope is changed.

FSI TouchZoom JavaScript Interface