/** * Copyright (c) 2008-2010 The Open Source Geospatial Foundation * * Published under the BSD license. * See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text * of the license. */ /** * @requires GeoExt/widgets/tips/SliderTip.js */ /** api: (extends) * GeoExt/widgets/tips/SliderTip.js */ /** api: (define) * module = GeoExt * class = LayerOpacitySliderTip * base_link = `Ext.Tip `_ */ Ext.namespace("GeoExt"); /** api: example * Sample code to create a slider tip to display scale and resolution: * * .. code-block:: javascript * * var slider = new GeoExt.LayerOpacitySlider({ * renderTo: document.body, * width: 200, * layer: layer, * plugins: new GeoExt.LayerOpacitySliderTip({ * template: "Opacity: {opacity}%" * }) * }); */ /** api: constructor * .. class:: LayerOpacitySliderTip(config) * * Create a slider tip displaying :class:`GeoExt.LayerOpacitySlider` values. */ GeoExt.LayerOpacitySliderTip = Ext.extend(GeoExt.SliderTip, { /** api: config[template] * ``String`` * Template for the tip. Can be customized using the following keywords in * curly braces: * * * ``opacity`` - the opacity value in percent. */ template: '
{opacity}%
', /** private: property[compiledTemplate] * ``Ext.Template`` * The template compiled from the ``template`` string on init. */ compiledTemplate: null, /** private: method[init] * Called to initialize the plugin. */ init: function(slider) { this.compiledTemplate = new Ext.Template(this.template); GeoExt.LayerOpacitySliderTip.superclass.init.call(this, slider); }, /** private: method[getText] * :param slider: ``Ext.Slider`` The slider this tip is attached to. */ getText: function(thumb) { var data = { opacity: thumb.value }; return this.compiledTemplate.apply(data); } });