--- ECHO_content/Attic/ECHO_graphicalOverview.py 2004/04/18 19:29:08 1.3 +++ ECHO_content/Attic/ECHO_graphicalOverview.py 2004/04/19 10:35:14 1.4 @@ -7,6 +7,13 @@ var Red; var Img; var state, p1, p2; +// fixing Array.push +if (! Array.prototype.push) { + Array.prototype.push = function(val) { + this[this.length] = val; + } +} + function Init() { Selection = -1; state = 0; @@ -96,11 +103,21 @@ function NoRedFrame(spot) { function Point(event) { - this.pageX = parseInt(event.pageX); - this.pageY = parseInt(event.pageY); - this.x = this.pageX - parseInt(Img.x); - this.y = this.pageY - parseInt(Img.y); - return this; + var x, y; + if (event) { + // Netscape + x = parseInt(event.pageX); + y = parseInt(event.pageY); + } else { + // IE4 + x = parseInt(window.event.clientX); + y = parseInt(window.event.clientY); + } + this.pageX = x; + this.pageY = y; + this.x = this.pageX - parseInt(Img.x); + this.y = this.pageY - parseInt(Img.y); + return this; } function DrawFrame() { @@ -198,7 +215,7 @@ function getCoords(event, element, coord var p = new Point(event, element); var AR = element.area; var i = 0; - Highlight(coords, Selection, undefined); // unselect last index + Highlight(coords, Selection, false); // unselect last index Selection = -1; while (i < coords.length) { var coord = coords[i]; @@ -208,7 +225,7 @@ var i = 0; } i += 1; }; - Highlight(coords, Selection, 1); // select new index + Highlight(coords, Selection, true); // select new index } function Link() { @@ -263,12 +280,19 @@ function highlightPair(name, highlight) javaHandler=""" function installHandlers() { %s -// event handler für Img installieren - Img.obj.addEventListener("mousemove", onMouseMove, true); - Img.obj.addEventListener("mousedown", Link, true); -// event handler für Red installieren - Red.obj.addEventListener("mousemove", onMouseMove, true); - Red.obj.addEventListener("mousedown", Link, true); + if (Img.obj.addEventListener) { + // event handler fuer Img installieren + Img.obj.addEventListener("mousemove", onMouseMove, true); + Img.obj.addEventListener("mousedown", Link, true); + // event handler fuer Red installieren + Red.obj.addEventListener("mousemove", onMouseMove, true); + Red.obj.addEventListener("mousedown", Link, true); + } else { + //Img.obj.captureEvents(Event.MOUSEMOVE); + Img.obj.onmousemove = onMouseMove; + //Red.obj.captureEvents(Event.MOUSEMOVE); + Red.obj.onmousemove = onMouseMove; + } }; """