-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheventhandler.js
54 lines (44 loc) · 1.28 KB
/
eventhandler.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
function EventHandlerTracker()
{
this.groups = new Object();
}
EventHandlerTracker.prototype.addHandler =
function(group, object, handler)
{
if (this.groups[group] === undefined)
{
this.groups[group] = new Array();
}
object.setAttribute("onclick", handler);
//object.setAttribute("fill", "white");
this.groups[group].push(object);
}
EventHandlerTracker.prototype.removeAll =
function()
{
var i;
for (i = 0; i < this.groups.length; i++)
{
var object;
while (undefined != (object = this.groups[i].pop()))
{
object.removeAttribute("onclick");
//object.setAttribute("fill", "pink");
}
this.groups[i] = undefined;
}
}
EventHandlerTracker.prototype.removeAllFrom =
function(group)
{
var object;
if (this.groups[group] == undefined)
{
return;
}
while (undefined != (object = this.groups[group].pop()))
{
object.removeAttribute("onclick");
//object.setAttribute("fill", "red");
}
}