Commit d896284a authored by techird's avatar techird

修复Firefox不响应mousewheel的问题

parent 3d19060c
...@@ -13,7 +13,7 @@ kity.extendClass( Minder, { ...@@ -13,7 +13,7 @@ kity.extendClass( Minder, {
}, },
// TODO: mousemove lazy bind // TODO: mousemove lazy bind
_bindPaperEvents: function () { _bindPaperEvents: function () {
this._paper.on( 'click dblclick mousedown contextmenu mouseup mousemove mousewheel touchstart touchmove touchend', this._firePharse.bind( this ) ); this._paper.on( 'click dblclick mousedown contextmenu mouseup mousemove mousewheel DOMMouseScroll touchstart touchmove touchend', this._firePharse.bind( this ) );
if ( window ) { if ( window ) {
window.addEventListener( 'resize', this._firePharse.bind( this ) ); window.addEventListener( 'resize', this._firePharse.bind( this ) );
} }
...@@ -27,6 +27,10 @@ kity.extendClass( Minder, { ...@@ -27,6 +27,10 @@ kity.extendClass( Minder, {
_firePharse: function ( e ) { _firePharse: function ( e ) {
var beforeEvent, preEvent, executeEvent; var beforeEvent, preEvent, executeEvent;
if ( e.type == 'DOMMouseScroll' ) {
e.type = 'mousewheel';
e.wheelDelta = e.originEvent.wheelDelta = e.originEvent.detail * 120;
}
beforeEvent = new MinderEvent( 'before' + e.type, e, true ); beforeEvent = new MinderEvent( 'before' + e.type, e, true );
if ( this._fire( beforeEvent ) ) { if ( this._fire( beforeEvent ) ) {
...@@ -67,14 +71,14 @@ kity.extendClass( Minder, { ...@@ -67,14 +71,14 @@ kity.extendClass( Minder, {
var callbacks = this._eventCallbacks[ e.type.toLowerCase() ] || []; var callbacks = this._eventCallbacks[ e.type.toLowerCase() ] || [];
if(status){ if ( status ) {
callbacks = callbacks.concat(this._eventCallbacks[ status + '.' + e.type.toLowerCase() ] || []); callbacks = callbacks.concat( this._eventCallbacks[ status + '.' + e.type.toLowerCase() ] || [] );
} }
if(callbacks.length == 0){ if ( callbacks.length === 0 ) {
return; return;
} }
var lastStatus = this.getStatus(); var lastStatus = this.getStatus();
...@@ -92,14 +96,14 @@ kity.extendClass( Minder, { ...@@ -92,14 +96,14 @@ kity.extendClass( Minder, {
}, },
on: function ( name, callback ) { on: function ( name, callback ) {
var km = this; var km = this;
utils.each(name.split(/\s+/),function(i,n){ utils.each( name.split( /\s+/ ), function ( i, n ) {
km._listen( n.toLowerCase(), callback ); km._listen( n.toLowerCase(), callback );
}); } );
return this; return this;
}, },
off: function ( name, callback ) { off: function ( name, callback ) {
var types = name.split( /\s+/); var types = name.split( /\s+/ );
var i, j, callbacks, removeIndex; var i, j, callbacks, removeIndex;
for ( i = 0; i < types.length; i++ ) { for ( i = 0; i < types.length; i++ ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment