Commit d896284a authored by techird's avatar techird

修复Firefox不响应mousewheel的问题

parent 3d19060c
......@@ -13,7 +13,7 @@ kity.extendClass( Minder, {
},
// TODO: mousemove lazy bind
_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 ) {
window.addEventListener( 'resize', this._firePharse.bind( this ) );
}
......@@ -27,6 +27,10 @@ kity.extendClass( Minder, {
_firePharse: function ( e ) {
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 );
if ( this._fire( beforeEvent ) ) {
......@@ -67,14 +71,14 @@ kity.extendClass( Minder, {
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;
}
var lastStatus = this.getStatus();
......@@ -92,14 +96,14 @@ kity.extendClass( Minder, {
},
on: function ( name, callback ) {
var km = this;
utils.each(name.split(/\s+/),function(i,n){
utils.each( name.split( /\s+/ ), function ( i, n ) {
km._listen( n.toLowerCase(), callback );
});
} );
return this;
},
off: function ( name, callback ) {
var types = name.split( /\s+/);
var types = name.split( /\s+/ );
var i, j, callbacks, removeIndex;
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