[dbox] problem in dbox resizing

myunghwa Hwang mhwang4 at UIUC.EDU
Fri Jan 19 15:45:00 PST 2007


Hello, list!

I'm trying to make dbox resizable.
For that, I assigned ids to several components which should have  
fixed sizes,
then I added a function for recalculating and assigning the dbox size:

   function adjustMapsize() {
   	// test just width adjustment
   	var leftcol_table = document.getElementById("leftcol_table");
   	var tools_table = document.getElementById("tools_table");
   	var move_button = document.getElementById("move_button");
   	var scale_table = document.getElementById("scale_table");
   	var coords_div = document.getElementById("coords_div");
   	var measure_div = document.getElementById("measure_div");
   	var measure_toggle = document.getElementById("measure_toggle");
   	
   	var new_width = document.body.offsetWidth -  
(leftcol_table.offsetWidth + tools_table.offsetWidth +  
move_button.offsetWidth*2);
   	var new_height = document.body.offsetHeight -  
(scale_table.offsetHeight + move_button.offsetHeight*3 +  
coords_div.offsetHeight + measure_div.offsetHeight + 			 
measure_toggle.offsetHeight + document.getElementById 
("ms_url").offsetHeight);
   	var anchor = document.getElementById("main");
   	main.width = anchor.width = new_width;
   	main.height = anchor.height = new_height;
   	main.anchor = xGetElementById("main");
   	ms.width = new_width;
   	ms.height = new_height;
   }

Then, I added this function to onload and onresize event of window:

   window.onresize = function() {

   	// resize map image
   	adjustMapsize();
   	xResizeTo(main.container, main.width, main.height);
   	main.sync();
   	xResizeTo(main.image, main.width, main.height);
   	xMoveTo(main.image, 0, 0);
   	xShow(main.image);
   	xResizeTo(main.canvas, main.width, main.height);
   	xMoveTo(main.canvas, 0, 0);
     xClip(main.canvas, 0, main.width, main.height, 0);
     xShow(main.canvas);
   	ms.draw();
   	
     reference.sync();
     container.sync();
   }

   window.onload = function() {
   	
   	// resize map image
   	adjustMapsize();

     main.initialize();
     reference.initialize();
     container.initialize();

     domouseclick('zoomin');

     // legend setup
     var legend_xml = get_content(config.dlegend_xml_executable + "? 
map=" + config.mapfile + "&server=" + config.dlegend_server);
     legend.initialize("legend_container", legend_xml);
     legend.setHandler(DLEGEND_CLICK, ms.setLayer);
	
	ms.setLayer('ortho', true);
	legend.changeNodeStatus('ortho', true);
     ms.draw();		
   }

My problem is that this solution works when I try to reduce the size  
of window,
but whenever I tried to increase the window size
the size of something on the top of dbox (which consists of  
container, image, canvas, and something else) does not change,
so I get white extra space on the right and bottom side of dbox.
How can I solve this problem?
Maybe someone already asked this problem, if so please let me know  
which post I should check.
I hope my explanation of the problem will be understood well.

from Myunghwa Hwang



More information about the MapServer-users mailing list