/** A simple toggle control with a callback function
* OpenLayers 3 Layer Switcher Control.
*
* @constructor
* @extends {ol.control.Control}
* @param {Object=} opt_options Control options.
* class {String} class of the control
* html {String} html code to insert in the control
* on {bool} the control is on
* toggleFn {function} callback when control is clicked
*/
ol.control.Toggle = function(options)
{ var element = $("
").addClass(options['class'] + ' ol-unselectable ol-control');
var self = this;
this.togglefn_ = function(e)
{ element.toggleClass("ol-active");
if (e && e.preventDefault) e.preventDefault();
if (self.interaction_) self.interaction_.setActive (self.isOn());
if (options.toggleFn) options.toggleFn.call (self, self.isOn());
self.dispatchEvent({ type:'activate', active:self.isOn() });
};
this.interaction = this.interaction_ = options.interaction;
this.title = options.title;
$("