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/ext/src/core/EventManager-more.js @ 76

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

Ajout du répertoire web

  • Property svn:executable set to *
Line 
1/*!
2 * Ext JS Library 3.4.0
3 * Copyright(c) 2006-2011 Sencha Inc.
4 * licensing@sencha.com
5 * http://www.sencha.com/license
6 */
7/**
8* @class Ext.EventManager
9*/
10Ext.apply(Ext.EventManager, function(){
11   var resizeEvent,
12       resizeTask,
13       textEvent,
14       textSize,
15       D = Ext.lib.Dom,
16       propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/,
17       unload = Ext.EventManager._unload,
18       curWidth = 0,
19       curHeight = 0,
20       // note 1: IE fires ONLY the keydown event on specialkey autorepeat
21       // note 2: Safari < 3.1, Gecko (Mac/Linux) & Opera fire only the keypress event on specialkey autorepeat
22       // (research done by @Jan Wolter at http://unixpapa.com/js/key.html)
23       useKeydown = Ext.isWebKit ?
24                   Ext.num(navigator.userAgent.match(/AppleWebKit\/(\d+)/)[1]) >= 525 :
25                   !((Ext.isGecko && !Ext.isWindows) || Ext.isOpera);
26
27   return {
28       _unload: function(){
29           Ext.EventManager.un(window, "resize", this.fireWindowResize, this);
30           unload.call(Ext.EventManager);   
31       },
32       
33       // private
34       doResizeEvent: function(){
35           var h = D.getViewHeight(),
36               w = D.getViewWidth();
37
38            //whacky problem in IE where the resize event will fire even though the w/h are the same.
39            if(curHeight != h || curWidth != w){
40               resizeEvent.fire(curWidth = w, curHeight = h);
41            }
42       },
43
44       /**
45        * Adds a listener to be notified when the browser window is resized and provides resize event buffering (100 milliseconds),
46        * passes new viewport width and height to handlers.
47        * @param {Function} fn      The handler function the window resize event invokes.
48        * @param {Object}   scope   The scope (<code>this</code> reference) in which the handler function executes. Defaults to the browser window.
49        * @param {boolean}  options Options object as passed to {@link Ext.Element#addListener}
50        */
51       onWindowResize : function(fn, scope, options){
52           if(!resizeEvent){
53               resizeEvent = new Ext.util.Event();
54               resizeTask = new Ext.util.DelayedTask(this.doResizeEvent);
55               Ext.EventManager.on(window, "resize", this.fireWindowResize, this);
56           }
57           resizeEvent.addListener(fn, scope, options);
58       },
59
60       // exposed only to allow manual firing
61       fireWindowResize : function(){
62           if(resizeEvent){
63               resizeTask.delay(100);
64           }
65       },
66
67       /**
68        * Adds a listener to be notified when the user changes the active text size. Handler gets called with 2 params, the old size and the new size.
69        * @param {Function} fn      The function the event invokes.
70        * @param {Object}   scope   The scope (<code>this</code> reference) in which the handler function executes. Defaults to the browser window.
71        * @param {boolean}  options Options object as passed to {@link Ext.Element#addListener}
72        */
73       onTextResize : function(fn, scope, options){
74           if(!textEvent){
75               textEvent = new Ext.util.Event();
76               var textEl = new Ext.Element(document.createElement('div'));
77               textEl.dom.className = 'x-text-resize';
78               textEl.dom.innerHTML = 'X';
79               textEl.appendTo(document.body);
80               textSize = textEl.dom.offsetHeight;
81               setInterval(function(){
82                   if(textEl.dom.offsetHeight != textSize){
83                       textEvent.fire(textSize, textSize = textEl.dom.offsetHeight);
84                   }
85               }, this.textResizeInterval);
86           }
87           textEvent.addListener(fn, scope, options);
88       },
89
90       /**
91        * Removes the passed window resize listener.
92        * @param {Function} fn        The method the event invokes
93        * @param {Object}   scope    The scope of handler
94        */
95       removeResizeListener : function(fn, scope){
96           if(resizeEvent){
97               resizeEvent.removeListener(fn, scope);
98           }
99       },
100
101       // private
102       fireResize : function(){
103           if(resizeEvent){
104               resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
105           }
106       },
107
108        /**
109        * The frequency, in milliseconds, to check for text resize events (defaults to 50)
110        */
111       textResizeInterval : 50,
112
113       /**
114        * Url used for onDocumentReady with using SSL (defaults to Ext.SSL_SECURE_URL)
115        */
116       ieDeferSrc : false,
117       
118       // protected, short accessor for useKeydown
119       getKeyEvent : function(){
120           return useKeydown ? 'keydown' : 'keypress';
121       },
122
123       // protected for use inside the framework
124       // detects whether we should use keydown or keypress based on the browser.
125       useKeydown: useKeydown
126   };
127}());
128
129Ext.EventManager.on = Ext.EventManager.addListener;
130
131
132Ext.apply(Ext.EventObjectImpl.prototype, {
133   /** Key constant @type Number */
134   BACKSPACE: 8,
135   /** Key constant @type Number */
136   TAB: 9,
137   /** Key constant @type Number */
138   NUM_CENTER: 12,
139   /** Key constant @type Number */
140   ENTER: 13,
141   /** Key constant @type Number */
142   RETURN: 13,
143   /** Key constant @type Number */
144   SHIFT: 16,
145   /** Key constant @type Number */
146   CTRL: 17,
147   CONTROL : 17, // legacy
148   /** Key constant @type Number */
149   ALT: 18,
150   /** Key constant @type Number */
151   PAUSE: 19,
152   /** Key constant @type Number */
153   CAPS_LOCK: 20,
154   /** Key constant @type Number */
155   ESC: 27,
156   /** Key constant @type Number */
157   SPACE: 32,
158   /** Key constant @type Number */
159   PAGE_UP: 33,
160   PAGEUP : 33, // legacy
161   /** Key constant @type Number */
162   PAGE_DOWN: 34,
163   PAGEDOWN : 34, // legacy
164   /** Key constant @type Number */
165   END: 35,
166   /** Key constant @type Number */
167   HOME: 36,
168   /** Key constant @type Number */
169   LEFT: 37,
170   /** Key constant @type Number */
171   UP: 38,
172   /** Key constant @type Number */
173   RIGHT: 39,
174   /** Key constant @type Number */
175   DOWN: 40,
176   /** Key constant @type Number */
177   PRINT_SCREEN: 44,
178   /** Key constant @type Number */
179   INSERT: 45,
180   /** Key constant @type Number */
181   DELETE: 46,
182   /** Key constant @type Number */
183   ZERO: 48,
184   /** Key constant @type Number */
185   ONE: 49,
186   /** Key constant @type Number */
187   TWO: 50,
188   /** Key constant @type Number */
189   THREE: 51,
190   /** Key constant @type Number */
191   FOUR: 52,
192   /** Key constant @type Number */
193   FIVE: 53,
194   /** Key constant @type Number */
195   SIX: 54,
196   /** Key constant @type Number */
197   SEVEN: 55,
198   /** Key constant @type Number */
199   EIGHT: 56,
200   /** Key constant @type Number */
201   NINE: 57,
202   /** Key constant @type Number */
203   A: 65,
204   /** Key constant @type Number */
205   B: 66,
206   /** Key constant @type Number */
207   C: 67,
208   /** Key constant @type Number */
209   D: 68,
210   /** Key constant @type Number */
211   E: 69,
212   /** Key constant @type Number */
213   F: 70,
214   /** Key constant @type Number */
215   G: 71,
216   /** Key constant @type Number */
217   H: 72,
218   /** Key constant @type Number */
219   I: 73,
220   /** Key constant @type Number */
221   J: 74,
222   /** Key constant @type Number */
223   K: 75,
224   /** Key constant @type Number */
225   L: 76,
226   /** Key constant @type Number */
227   M: 77,
228   /** Key constant @type Number */
229   N: 78,
230   /** Key constant @type Number */
231   O: 79,
232   /** Key constant @type Number */
233   P: 80,
234   /** Key constant @type Number */
235   Q: 81,
236   /** Key constant @type Number */
237   R: 82,
238   /** Key constant @type Number */
239   S: 83,
240   /** Key constant @type Number */
241   T: 84,
242   /** Key constant @type Number */
243   U: 85,
244   /** Key constant @type Number */
245   V: 86,
246   /** Key constant @type Number */
247   W: 87,
248   /** Key constant @type Number */
249   X: 88,
250   /** Key constant @type Number */
251   Y: 89,
252   /** Key constant @type Number */
253   Z: 90,
254   /** Key constant @type Number */
255   CONTEXT_MENU: 93,
256   /** Key constant @type Number */
257   NUM_ZERO: 96,
258   /** Key constant @type Number */
259   NUM_ONE: 97,
260   /** Key constant @type Number */
261   NUM_TWO: 98,
262   /** Key constant @type Number */
263   NUM_THREE: 99,
264   /** Key constant @type Number */
265   NUM_FOUR: 100,
266   /** Key constant @type Number */
267   NUM_FIVE: 101,
268   /** Key constant @type Number */
269   NUM_SIX: 102,
270   /** Key constant @type Number */
271   NUM_SEVEN: 103,
272   /** Key constant @type Number */
273   NUM_EIGHT: 104,
274   /** Key constant @type Number */
275   NUM_NINE: 105,
276   /** Key constant @type Number */
277   NUM_MULTIPLY: 106,
278   /** Key constant @type Number */
279   NUM_PLUS: 107,
280   /** Key constant @type Number */
281   NUM_MINUS: 109,
282   /** Key constant @type Number */
283   NUM_PERIOD: 110,
284   /** Key constant @type Number */
285   NUM_DIVISION: 111,
286   /** Key constant @type Number */
287   F1: 112,
288   /** Key constant @type Number */
289   F2: 113,
290   /** Key constant @type Number */
291   F3: 114,
292   /** Key constant @type Number */
293   F4: 115,
294   /** Key constant @type Number */
295   F5: 116,
296   /** Key constant @type Number */
297   F6: 117,
298   /** Key constant @type Number */
299   F7: 118,
300   /** Key constant @type Number */
301   F8: 119,
302   /** Key constant @type Number */
303   F9: 120,
304   /** Key constant @type Number */
305   F10: 121,
306   /** Key constant @type Number */
307   F11: 122,
308   /** Key constant @type Number */
309   F12: 123,
310
311   /** @private */
312   isNavKeyPress : function(){
313       var me = this,
314           k = this.normalizeKey(me.keyCode);
315       return (k >= 33 && k <= 40) ||  // Page Up/Down, End, Home, Left, Up, Right, Down
316       k == me.RETURN ||
317       k == me.TAB ||
318       k == me.ESC;
319   },
320
321   isSpecialKey : function(){
322       var k = this.normalizeKey(this.keyCode);
323       return (this.type == 'keypress' && this.ctrlKey) ||
324       this.isNavKeyPress() ||
325       (k == this.BACKSPACE) || // Backspace
326       (k >= 16 && k <= 20) || // Shift, Ctrl, Alt, Pause, Caps Lock
327       (k >= 44 && k <= 46);   // Print Screen, Insert, Delete
328   },
329
330   getPoint : function(){
331       return new Ext.lib.Point(this.xy[0], this.xy[1]);
332   },
333
334   /**
335    * Returns true if the control, meta, shift or alt key was pressed during this event.
336    * @return {Boolean}
337    */
338   hasModifier : function(){
339       return ((this.ctrlKey || this.altKey) || this.shiftKey);
340   }
341});
Note: See TracBrowser for help on using the repository browser.