Hi,
You welcome, here is the code that draw the rectangle. Its part of long
js file. the complicate part is keeping the start and current mouse
coordinates and interact with ArcIMS .
function DrawRectangle(){
if (event.button==rightButton && pointCount==0){
return false;
}
if (event.button==leftButton && pointCount==0){
//Left click mouse - create a new point in the polyline
if (lastXX != get_x() || lastYY != get_y() ){ //This "IF"
check if you do DOUBLCLICK" alert ('Same Point') };
add_point(get_x(),get_y());
lastXX = get_x();
lastYY = get_y();
}
}
if
(arcims_poly!=null){document.all.arcims_draw.removeChild(arcims_poly);}
arcims_poly=document.createElement("<v
olyline filled=\"False\"
strokecolor=\"red\" strokeweight=\"2pt\" points=\"" +
arrPoint.toString() +"\"></v
olyline>");
document.all.arcims_draw.appendChild(arcims_poly);
if (event.button==leftButton && pointCount==1){
return false;
}
if (event.button==rightButton && pointCount == 1){
lastXX = get_x();
lastYY = get_y();
showDynamicRectangle(lastXX, lastYY);
// alert(arrCoord.toString() + " <>" + arrPoint.toString());
pointCount = 0;
return false;
}
pointCount++; //After the first point
arrPoint[1]=new Array(2);
arrPoint[2]=new Array(2);
arrPoint[3]=new Array(2);
arrPoint[4]=new Array(2);
arrCoord[1]=new Array(2);
arrCoord[2]=new Array(2);
arrCoord[3]=new Array(2);
arrCoord[4]=new Array(2);
}
Natty Gur, CTO
Dao2Com Ltd.
34th Elkalay st. Raanana
Israel , 43000
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377