Javascript dojox绘制矩形连接方法
Dojox绘图api将矩形作为模板,我们可以在绘图画布上使用该模板。文档中提到了一个名为connect的函数。我如何使用它<代码>连接(o、e、s、m、一次) 以下是未压缩的dojo代码Javascript dojox绘制矩形连接方法,javascript,dojo,dom-events,Javascript,Dojo,Dom Events,Dojox绘图api将矩形作为模板,我们可以在绘图画布上使用该模板。文档中提到了一个名为connect的函数。我如何使用它连接(o、e、s、m、一次) 以下是未压缩的dojo代码 // TODO: connect to a Shape event from outside class connect: function(o, e, s, m, /* Boolean*/once){ // summary: // Convenience method for quick connects
// TODO: connect to a Shape event from outside class
connect: function(o, e, s, m, /* Boolean*/once){
// summary:
// Convenience method for quick connects
// See comments below for possiblities
// functions can be strings
// once:
// If true, the connection happens only
// once then disconnects. Five args are required
// for this functionality.
不清楚为什么以及如何使用此功能。有人可以帮助我了解函数的用法和功能。前四个方法将传递给
dojo.connect
- o-对象
- 电子事件
- s范围或上下文
- m-方法
dojo.connect(domNode, 'click', { test: 1}, function() {
var t = this test;
// is one because 'this' is the scope we pass the connect method.
});
每次单击特定的dom节点时,都将执行该函数
最后一个参数
once
特定于便利方法。如果为true,则该函数将仅执行一次。执行后,处理程序将断开连接。因为我在绘图api中使用矩形。我的domNode是完整的绘图画布。我无法单独获得矩形的domNode。所以我知道矩形的数据点,我基于event.localX和localY坐标。我发现单击是否发生在矩形内。这在internet Explorer中不起作用。你知道原因吗?你能用小提琴再现这个问题吗?