Creating Custom Controls

In order to create your own custom control, you need to create a new JavaScript class that inherits from the mobileViewer.Control base class. To do this, create a new file with a .js file extension, and populate it with the following code, replacing 'MyNewControl' with your own custom class name:

mobileViewer.MyNewControl = OpenLayers.Class(mobileViewer.Control, 
{	
	initializeControl: function(options)
	{
		// Perform any required initialization here when the control is
		// created.
	}
});

This file should be saved in the same folder as the other controls - the 'lib' folder. The build process will automatically pick up any file in this folder with a '.js' file extension. However, if you want to use the individual JavaScript files when debugging, it is important to add a reference to this file into the 'coreScripts' array defined at the end of the mobileViewer.js file.