I would love to unbind this:
$("body").mousemove(_.bind(this.mousemove, this));
Due to a complicated mix between backbone.js and raphael.js I need to do the bind via underscore.js:
var NodeView = Backbone.View.extend({
dx: 0,
dy: 0,
click: function(event){
alert( hello )
},
mousedown: function(event){
this.dx = event.pageX - this.el.attr( x );
this.dy = event.pageY - this.el.attr( y );
this.el.attr({fill: "#0099FF"});
$("body").mousemove(_.bind(this.mousemove, this));
},
mousemove: function(event){
this.el.attr({ x: event.pageX - this.dx,
y: event.pageY - this.dy});
},
mouseup: function(event){
this.el.attr({fill: "#EEEEEE"});
$("body").mousemove(_.bind(this.mousenotmove, this));
},
render: function(){
this.el = canvas.rect(this.model.get( xPos ), this.model.get( yPos ), 50, 50).attr({
fill: "#EEEEEE",
stroke: "none",
cursor: "move"
});
$(this.el.node).mousedown(_.bind(this.mousedown, this));
$(this.el.node).mouseup(_.bind(this.mouseup, this));
return this;
}
});
Any suggestions?