如何在set()上解除绑定mousemove

Raphael.js: How to unbind mousemove on set()?

本文关键字:绑定 mousemove set      更新时间:2023-09-26

我有拉斐尔.js代码:

var set = paper.set();
// ... here push some elements to set: path, circles, etc.
set.mousedown(function() { ... });
set.mousemove(function() { ... });
set.mouseup(function() { ... });

一切正常…但如何做unbind, .mousemove事件上的"集"和bind吗?

在事件名称前添加un http://raphaeljs.com/reference.html#Element.unmousemove

// Pass the handler to install it
set.mousemove(handler);
// Pass the same handler to remove it
set.unmousemove(handler);

拉斐尔JS:如何删除事件?

不能像以前那样传入匿名函数,因为在删除处理程序时必须传递对该函数的引用