rem: unregisterEvent("mousemove", birdArea, birdAreaMove); unregisterEvent("mouseup",   birdArea, birdAreaEndDrag); unregisterEvent("mousemove", birdImg, birdAreaMove); unregisterEvent("mouseup",   birdImg, birdAreaEndDrag); 
add: unregisterEvent("mousemove", document, birdAreaMove); unregisterEvent("mouseup",   document, birdAreaEndDrag); showElement(overlay, false); if (newRect == null) { startPos = birdAreaRect.getCenter(); birdAreaMove(evt); } 
context: function showBirdDiv(show) {    // show or hide "bird's eye" div    var startPos; // anchor for dragging    var newRect;  // position after drag    var birdImg = getElement("bird-image");    showElement(birdImg, show);    var birdArea = getElement("bird-area");    // dont show selector if area is full size    if (!show || isFullArea()) {        // hide area        showElement(birdArea, false);        return;        };    var birdImgRect = getElementRect(birdImg);    var area = parseArea();    // scale area down to img size    var birdAreaRect = new Rectangle(        // what about borders ??        birdImgRect.x + birdImgRect.width  * area.x,        birdImgRect.y + birdImgRect.height * area.y,        birdImgRect.width  * area.width,        birdImgRect.height * area.height        );    moveElement(birdArea, birdAreaRect);    showElement(birdArea, show);    registerEvent("mousedown", birdArea, birdAreaStartDrag);    function birdAreaStartDrag(evt) {    // mousedown handler: start drag        startPos = evtPosition(evt);        registerEvent("mousemove", birdArea, birdAreaMove);        registerEvent("mousemove", birdImg, birdAreaMove);        registerEvent("mouseup",   birdArea, birdAreaEndDrag);        registerEvent("mouseup",   birdImg, birdAreaEndDrag);                // debugProps(getElementRect(bird))        return stopEvent(evt);        }    function birdAreaMove(evt) {    // mousemove handler: drag        var pos = evtPosition(evt);        var dx = pos.x - startPos.x;        var dy = pos.y - startPos.y;        // move birdArea div, keeping size        newRect = new Rectangle(            birdAreaRect.x + dx,            birdAreaRect.y + dy,            birdAreaRect.width,            birdAreaRect.height);        // stay within image        newRect.stayInside(birdImgRect);        moveElement(birdArea, newRect);        showElement(birdArea, true);        return stopEvent(evt);        }    function birdAreaEndDrag(evt) {    // mouseup handler: reload page        unregisterEvent("mousemove", birdArea, birdAreaMove);        unregisterEvent("mouseup",   birdArea, birdAreaEndDrag);        unregisterEvent("mousemove", birdImg, birdAreaMove);        unregisterEvent("mouseup",   birdImg, birdAreaEndDrag);        setParameter("wx", cropFloat((newRect.x - birdImgRect.x) / birdImgRect.width));        setParameter("wy", cropFloat((newRect.y - birdImgRect.y) / birdImgRect.height));        // width and height parameters remain the same        // setParameter("ww", cropFloat(newRect.width / birdImgRect.width));        // setParameter("ww", cropFloat(newRect.height / birdImgRect.height));        // parseArea(); // why?        // zoomed is always fit        setParameter("ws", 1);        display();        return stopEvent(evt);        }    }
meta: 7747	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/7747/5927e0031d63b488f9d4630e16e2cc2c628c42e2/dllib.js/clean/client/digitallibrary/greyskin/dllib.js