[Mapbender-commits] r3103 - branches/noframes/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri Oct 3 08:08:24 EDT 2008
Author: nimix
Date: 2008-10-03 08:08:23 -0400 (Fri, 03 Oct 2008)
New Revision: 3103
Modified:
branches/noframes/http/javascripts/map_obj.js
branches/noframes/http/javascripts/mod_box1.js
branches/noframes/http/javascripts/mod_pan.php
branches/noframes/http/javascripts/mod_selArea1.php
Log:
make mod_box1.js and mod_selArea1.php noframe compartible
Modified: branches/noframes/http/javascripts/map_obj.js
===================================================================
--- branches/noframes/http/javascripts/map_obj.js 2008-10-03 10:37:33 UTC (rev 3102)
+++ branches/noframes/http/javascripts/map_obj.js 2008-10-03 12:08:23 UTC (rev 3103)
@@ -75,8 +75,6 @@
this.epsg = wms[0].gui_wms_epsg;
this.extent = setExtent(this.width,this.height,this.epsg);
this.mapURL = [];
- console.log(this.frameName);
- console.log(this.elementName);
if(this.frameName){
this.domElement = window.frames[this.frameName].document.getElementById(this.elementName);
}
@@ -411,5 +409,27 @@
return this.domElement;
}
+ this.getMousePos = function(e){
+ if(ie){
+ if(this.frameName){
+ clickX = window.frames[fName].event.clientX;
+ clickY = window.frames[fName].event.clientY;
+ }
+ else{
+ clickX = event.clientX;
+ clickY = event.clientY;
+ }
+ }
+ else{
+ clickX = e.pageX;
+ clickY = e.pageY;
+ }
+
+ //remove divtag offset
+ clickX -= parseInt(this.getDomElement().style.left);
+ clickY -= parseInt(this.getDomElement().style.top);
+
+ return new Point(clickX, clickY);
+ }
eventAfterMapObjectConstruction.trigger();
}
\ No newline at end of file
Modified: branches/noframes/http/javascripts/mod_box1.js
===================================================================
--- branches/noframes/http/javascripts/mod_box1.js 2008-10-03 10:37:33 UTC (rev 3102)
+++ branches/noframes/http/javascripts/mod_box1.js 2008-10-03 12:08:23 UTC (rev 3103)
@@ -7,6 +7,7 @@
var mb_isActive = false;
var mb_isBF = false;
var mb_zF = false;
+var mb_boxMapObj = null;
var mb_offset_top = 0;
var mb_offset_right = 0;
@@ -14,8 +15,9 @@
var mb_offset_left = 0;
function mod_box_start(e){
+ mb_boxMapObj = getMapObjByName(mb_isBF);
mb_isActive = true;
- mb_getMousePos(e,mb_isBF);
+ mb_boxMapObj.getMousePos(e);
mb_start_x = clickX;
mb_start_y = clickY;
mb_end_x = mb_start_x+1;
@@ -29,13 +31,10 @@
}
function mod_box_run(e){
if(mb_isActive){
- mb_getMousePos(e,mb_isBF);
- for(var i=0; i<mb_mapObj.length; i++){
- if(mb_mapObj[i].frameName == mb_isBF){
- var width = mb_mapObj[i].width;
- var height = mb_mapObj[i].height;
- }
- }
+ mb_boxMapObj.getMousePos(e);
+ var width = mb_boxMapObj.width;
+ var height = mb_boxMapObj.height;
+
if (((clickX>width) || (clickY>height) || (clickX<=0) ||(clickY<=0))){
isActive = false;
mod_box_stop(e);
@@ -60,6 +59,37 @@
mb_isActive = false;
}
function mb_drawBox(left,top,right,bottom){
+ //Look if we have the Box elements
+ mb_boxMapObj = getMapObjByName(mb_isBF);
+ var map_el = mb_boxMapObj.getDomElement();
+ if(!map_el.ownerDocument.getElementById(mb_boxMapObj.elementName+"_l_top")){
+ //create Box Elements
+ el_top = map_el.ownerDocument.createElement("div");
+ el_top.style.position = "absolute";
+ el_top.style.top = "0px";
+ el_top.style.left = "0px";
+ el_top.style.width = "0px";
+ el_top.style.height = "0px";
+ el_top.style.overflow = "hidden";
+ el_top.style.zIndex = "10";
+ el_top.style.visibility = "hidden";
+ el_top.style.cursor = "crosshair";
+ el_top.style.backgroundColor = "#ff0000";
+
+ el_left = el_top.cloneNode(false);
+ el_right = el_top.cloneNode(false);
+ el_bottom = el_top.cloneNode(false);
+
+ el_top.id = mb_boxMapObj.elementName+"_l_top";
+ el_left.id = mb_boxMapObj.elementName+"_l_left";
+ el_right.id = mb_boxMapObj.elementName+"_l_right";
+ el_bottom.id = mb_boxMapObj.elementName+"_l_bottom";
+
+ map_el.appendChild(el_top);
+ map_el.appendChild(el_left);
+ map_el.appendChild(el_right);
+ map_el.appendChild(el_bottom);
+ }
mb_arrangeBox("l_top",left,top,right,top+2);
mb_arrangeBox("l_left",left,top,left+2,bottom);
mb_arrangeBox("l_right",right-2,top,right,bottom);
@@ -70,17 +100,20 @@
mb_displayElement("l_bottom");
}
function mb_arrangeBox(name, left, top, right, bottom){
- var el = window.frames[mb_isBF].document.getElementById(name).style;
+ var map_el = mb_boxMapObj.getDomElement();
+ var el = map_el.ownerDocument.getElementById(mb_boxMapObj.elementName+"_"+name).style;
el.height = Math.abs(bottom - top);
el.width = Math.abs(right - left);
el.top = top + "px";
el.left = left + "px";
}
function mb_displayElement(name){
- window.frames[mb_isBF].document.getElementById(name).style.visibility = "visible";
+ var map_el = mb_boxMapObj.getDomElement();
+ var el = map_el.ownerDocument.getElementById(mb_boxMapObj.elementName+"_"+name).style.visibility = "visible";
}
function mb_hideElement(name) {
- window.frames[mb_isBF].document.getElementById(name).style.visibility = "hidden";
+ var map_el = mb_boxMapObj.getDomElement();
+ var el = map_el.ownerDocument.getElementById(mb_boxMapObj.elementName+"_"+name).style.visibility = "hidden";
}
function evalExtent(){
if(mb_start_x>mb_end_x){
Modified: branches/noframes/http/javascripts/mod_pan.php
===================================================================
--- branches/noframes/http/javascripts/mod_pan.php 2008-10-03 10:37:33 UTC (rev 3102)
+++ branches/noframes/http/javascripts/mod_pan.php 2008-10-03 12:08:23 UTC (rev 3103)
@@ -63,8 +63,6 @@
mb_panActive = true;
mb_getMousePos(e,mod_pan_target);
var el = mod_pan_MapObj.getDomElement();
- mb_element_x = parseInt(el.style.left);
- mb_element_y = parseInt(el.style.top);
mb_start_x=clickX;
mb_start_y=clickY;
mb_end_x = clickX;
Modified: branches/noframes/http/javascripts/mod_selArea1.php
===================================================================
--- branches/noframes/http/javascripts/mod_selArea1.php 2008-10-03 10:37:33 UTC (rev 3102)
+++ branches/noframes/http/javascripts/mod_selArea1.php 2008-10-03 12:08:23 UTC (rev 3103)
@@ -22,7 +22,7 @@
var mod_selArea_elName = "selArea1";
var mod_selArea_frameName = "";
var mod_selArea_target = "<?php echo $e_target[0]; ?>";
-
+var mos_selArea_MapObj = null;
var mod_selArea_img_on = new Image();
mod_selArea_img_on.src = "<?php echo preg_replace("/_off/","_on",$e_src); ?>";
var mod_selArea_img_off = new Image();
@@ -31,6 +31,7 @@
mod_selArea_img_over.src = "<?php echo preg_replace("/_off/","_over",$e_src); ?>";
function init_selArea1(ind){
+ mod_selArea_MapObj = getMapObjByName(mod_selArea_target);
mb_button[ind] = document.getElementById(mod_selArea_elName);
mb_button[ind].img_over = mod_selArea_img_over.src;
mb_button[ind].img_on = mod_selArea_img_on.src;
@@ -42,19 +43,15 @@
mb_button[ind].stop = new Function ("mod_selArea_disable()");
}
function mod_selArea_click(){
- if(mod_pan_target)
- var el = window.frames[mod_pan_target].document;
- else
- var el = document.getElementById("mapDiv"); el.onmouseover = mod_selArea_init;
+ var el = mod_selArea_MapObj.getDomElement();
+ el.onmouseover = mod_selArea_init;
el.onmousedown = mod_box_start;
el.onmouseup = mod_selArea_get;
el.onmousemove = mod_box_run;
}
function mod_selArea_disable(){
- if(mod_pan_target)
- var el = window.frames[mod_pan_target].document;
- else
- var el = document.getElementById("mapDiv"); el.onmousedown = null;
+ var el = mod_selArea_MapObj.getDomElement();
+ el.onmousedown = null;
el.onmouseup = null;
el.onmousemove = null;
}
More information about the Mapbender_commits
mailing list