Bienvenue sur PostGIS.fr

Bienvenue sur PostGIS.fr , le site de la communauté des utilisateurs francophones de PostGIS.

PostGIS ajoute le support d'objets géographique à la base de données PostgreSQL. En effet, PostGIS "spatialise" le serverur PostgreSQL, ce qui permet de l'utiliser comme une base de données SIG.

Maintenu à jour, en fonction de nos disponibilités et des diverses sorties des outils que nous testons, nous vous proposons l'ensemble de nos travaux publiés en langue française.

source: trunk/workshop-routing-foss4g/web/GeoExt/lib/GeoExt/widgets/tips/SliderTip.js @ 76

Revision 76, 3.0 KB checked in by djay, 12 years ago (diff)

Ajout du répertoire web

  • Property svn:executable set to *
Line 
1/**
2 * Copyright (c) 2008-2010 The Open Source Geospatial Foundation
3 *
4 * Published under the BSD license.
5 * See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text
6 * of the license.
7 */
8
9/** api: (define)
10 *  module = GeoExt
11 *  class = SliderTip
12 *  base_link = `Ext.Tip <http://dev.sencha.com/deploy/dev/docs/?class=Ext.slider.Tip>`_
13 */
14Ext.namespace("GeoExt");
15
16/** api: example
17 *  Sample code to create a slider tip to display slider value on hover:
18 *
19 *  .. code-block:: javascript
20 *     
21 *      var slider = new Ext.Slider({
22 *          renderTo: document.body,
23 *          width: 200,
24 *          plugins: new GeoExt.SliderTip()
25 *      });
26 */
27
28/** api: constructor
29 *  .. class:: SliderTip(config)
30 *   
31 *      Create a slider tip displaying ``Ext.Slider`` values over slider thumbs.
32 */
33GeoExt.SliderTip = Ext.extend(Ext.slider.Tip, {
34
35    /** api: config[hover]
36     *  ``Boolean``
37     *  Display the tip when hovering over the thumb.  If ``false``, tip will
38     *  only be displayed while dragging.  Default is ``true``.
39     */
40    hover: true,
41   
42    /** api: config[minWidth]
43     *  ``Number``
44     *  Minimum width of the tip.  Default is 10.
45     */
46    minWidth: 10,
47
48    /** api: config[offsets]
49     *  ``Array(Number)``
50     *  A two item list that provides x, y offsets for the tip.  Default is
51     *  [0, -10].
52     */
53    offsets : [0, -10],
54   
55    /** private: property[dragging]
56     *  ``Boolean``
57     *  The thumb is currently being dragged.
58     */
59    dragging: false,
60
61    /** private: method[init]
62     *  :param slider: ``Ext.Slider``
63     * 
64     *  Called when the plugin is initialized.
65     */
66    init: function(slider) {
67        GeoExt.SliderTip.superclass.init.apply(this, arguments);
68        if (this.hover) {
69            slider.on("render", this.registerThumbListeners, this);
70        }
71        this.slider = slider;
72    },
73
74    /** private: method[registerThumbListeners]
75     *  Set as a listener for 'render' if hover is true.
76     */
77    registerThumbListeners: function() {
78        var thumb, el;
79        for (var i=0, ii=this.slider.thumbs.length; i<ii; ++i) {
80            thumb = this.slider.thumbs[i];
81            el = thumb.tracker.el;
82            (function(thumb, el) {
83                el.on({
84                    mouseover: function(e) {
85                        this.onSlide(this.slider, e, thumb);
86                        this.dragging = false;
87                    },
88                    mouseout: function() {
89                        if (!this.dragging) {
90                            this.hide.apply(this, arguments);
91                        }
92                    },
93                    scope: this
94                })
95            }).apply(this, [thumb, el]);
96        }
97    },
98
99    /** private: method[onSlide]
100     *  :param slider: ``Ext.Slider``
101     *
102     *  Listener for dragstart and drag.
103     */
104    onSlide: function(slider, e, thumb) {
105        this.dragging = true;
106        return GeoExt.SliderTip.superclass.onSlide.apply(this, arguments);
107    }
108
109});
Note: See TracBrowser for help on using the repository browser.