Changeset 13739
- Timestamp:
- 05/15/08 07:45:16 (6 months ago)
- Location:
- dijit/trunk/form
- Files:
-
- 2 modified
-
Slider.js (modified) (3 diffs)
-
_Spinner.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dijit/trunk/form/Slider.js
r13547 r13739 174 174 // summary 175 175 // decrement slider by 1 unit 176 this._bumpValue(e.charOrCode == dojo.keys.PAGE_DOWN ?-this.pageIncrement:-1);176 this._bumpValue(e.charOrCode == dojo.keys.PAGE_DOWN ? -this.pageIncrement : -1); 177 177 }, 178 178 … … 180 180 // summary 181 181 // increment slider by 1 unit 182 this._bumpValue(e.charOrCode == dojo.keys.PAGE_UP ?this.pageIncrement:1);182 this._bumpValue(e.charOrCode == dojo.keys.PAGE_UP ? this.pageIncrement : 1); 183 183 }, 184 184 185 185 _mouseWheeled: function(/*Event*/ evt){ 186 // summary: Event handler for mousewheel where supported 186 187 dojo.stopEvent(evt); 187 var scrollAmount = 0; 188 if(typeof evt.wheelDelta == 'number'){ // IE 189 scrollAmount = evt.wheelDelta; 190 }else if(typeof evt.detail == 'number'){ // Mozilla+Firefox 191 scrollAmount = -evt.detail; 192 } 193 if(scrollAmount > 0){ 194 this.increment(evt); 195 }else if(scrollAmount < 0){ 196 this.decrement(evt); 197 } 188 // FIXME: this adds mouse wheel support for safari, though stopEvent doesn't prevent 189 // it from bleeding to window?! 190 var janky = !dojo.isMozilla; 191 var scroll = evt[(janky ? "wheelDelta" : "detail")] * (janky ? 1 : -1); 192 this[(scroll < 0 ? "decrement" : "increment")](evt); 198 193 }, 199 194 … … 211 206 this.decrementButton.style.display=""; 212 207 } 213 this.connect(this.domNode, dojo.isIE ? "onmousewheel" : 'DOMMouseScroll', "_mouseWheeled");208 this.connect(this.domNode, !dojo.isMozilla ? "onmousewheel" : "DOMMouseScroll", "_mouseWheeled"); 214 209 215 210 // define a custom constructor for a SliderMover that points back to me -
dijit/trunk/form/_Spinner.js
r13547 r13739 65 65 _wheelTimer: null, 66 66 _mouseWheeled: function(/*Event*/ evt){ 67 68 dojo.stopEvent(evt); 69 var scrollAmount = evt[(dojo.isIE ? "wheelDelta" : "detail")] * (dojo.isIE ? 1 : -1); 67 // summary: Mouse wheel listener where supported 68 dojo.stopEvent(evt); 69 // FIXME: Safari bubbles 70 var janky = !dojo.isMozilla; 71 var scrollAmount = evt[(janky ? "wheelDelta" : "detail")] * (janky ? 1 : -1); 70 72 if(scrollAmount !== 0){ 71 73 var node = this[(scrollAmount > 0 ? "upArrowNode" : "downArrowNode" )]; … … 86 88 87 89 // extra listeners 88 this.connect(this. textbox, dojo.isIE? "onmousewheel" : 'DOMMouseScroll', "_mouseWheeled");90 this.connect(this.domNode, !dojo.isMozilla ? "onmousewheel" : 'DOMMouseScroll', "_mouseWheeled"); 89 91 this._connects.push(dijit.typematic.addListener(this.upArrowNode, this.textbox, {charOrCode:dojo.keys.UP_ARROW,ctrlKey:false,altKey:false,shiftKey:false}, this, "_typematicCallback", this.timeoutChangeRate, this.defaultTimeout)); 90 92 this._connects.push(dijit.typematic.addListener(this.downArrowNode, this.textbox, {charOrCode:dojo.keys.DOWN_ARROW,ctrlKey:false,altKey:false,shiftKey:false}, this, "_typematicCallback", this.timeoutChangeRate, this.defaultTimeout));