Changeset 2293
- Timestamp:
- 03/01/07 12:06:20 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/emanuel/animatedZooming/lib/OpenLayers/Control/KeyboardDefaults.js
r2292 r2293 14 14 15 15 /** @type int */ 16 slideFactor: 100,16 slideFactor: 75, 17 17 18 18 /** … … 27 27 */ 28 28 draw: function() { 29 //keypress30 29 OpenLayers.Event.observe(document, 31 30 'keypress', 32 31 this.defaultKeyDown.bindAsEventListener(this)); 33 OpenLayers.Event.observe(document,34 'keyup',35 this.defaultKeyUp.bindAsEventListener(this));36 32 }, 37 33 … … 42 38 switch(evt.keyCode) { 43 39 case OpenLayers.Event.KEY_LEFT: 44 this.map.pan(- 75, 0);40 this.map.pan(-this.slideFactor, 0); 45 41 break; 46 42 case OpenLayers.Event.KEY_RIGHT: 47 this.map.pan( 75, 0);43 this.map.pan(this.slideFactor, 0); 48 44 break; 49 45 case OpenLayers.Event.KEY_UP: 50 this.map.pan(0, - 75);46 this.map.pan(0, -this.slideFactor); 51 47 break; 52 48 case OpenLayers.Event.KEY_DOWN: 53 this.map.pan(0, 75);49 this.map.pan(0, this.slideFactor); 54 50 break; 55 51 case 33: // Page Up … … 72 68 switch(evt.charCode) { 73 69 case 43: // + 74 // get and set some settings for zoom animation 75 this.map.prepareZoomAnimation(); 76 this.map.zoomlevel_scale += 0.2; 77 // run zoom animation -> scale tile(s) 78 this.map.runZoomAnimation(); 70 this.map.zoomIn(); 79 71 break; 80 72 case 45: // - 81 // get and set some settings for zoom animation 82 this.map.prepareZoomAnimation(); 83 this.map.zoomlevel_scale -= 0.2; 84 // run zoom animation -> scale tile(s) 85 this.map.runZoomAnimation(); 73 this.map.zoomOut(); 86 74 break; 87 75 } 88 76 }, 89 77 90 defaultKeyUp: function (evt) {91 switch(evt.keyCode) {92 case 107:93 if((this.map.zoomlevel_scale-this.map.zoomlevel_startScale) < 1)94 {95 //this.map.zoomlevel_scale = Math.ceil(this.map.zoomlevel_scale);96 //this.map.runZoomAnimation();97 this.map.zoomTo(this.map.zoomlevel_startScale+1);98 }99 //this.map.finishZoomAnimation(Math.round(this.map.zoomlevel_scale));100 101 case 109:102 if((this.map.zoomlevel_scale-this.map.zoomlevel_startScale) < 1)103 {104 Math.floor(this.map.zoomlevel_scale);105 this.map.runZoomAnimation();106 }107 // finish zoom animation108 this.map.finishZoomAnimation(Math.round(this.map.zoomlevel_scale));109 break;110 111 }112 113 114 115 },116 78 117 79
