[Chameleon] Map width/height based on clienthWidth/clientHeight
Brent Lund
Brent.Lund at state.mn.us
Fri Jun 16 16:04:19 EDT 2006
Derek,
Thanks. That leads me to my next question: Is there a php equivalent
to document.body.clientWidth?
Brent
________________________________
From: Bird, Derek (xwave) [mailto:Derek.Bird at xwave.com]
Sent: Friday, June 16, 2006 2:52 PM
To: Brent Lund; chameleon at lists.maptools.org
Subject: RE: [Chameleon] Map width/height based on
clienthWidth/clientHeight
Hi Brent...
It is loading the map twice because your JavaScript will run *AFTER* the
page/map finishes loading,. you can set the image width and height on
the server using PHP ... look at the code from the applyMapSize function
and put that code in your PHP file... (i.e. world.php not world.phtml)
I do stuff like that all the time for loading ctx and different map
files.... Just be careful when you make the cwc function calls .. it
has to be after you instantiate the application object ....
Cheers,
Derek
________________________________
From: chameleon-bounces at lists.maptools.org
[mailto:chameleon-bounces at lists.maptools.org] On Behalf Of Brent Lund
Sent: Friday, June 16, 2006 3:29 PM
To: chameleon at lists.maptools.org
Subject: RE: [Chameleon] Map width/height based on
clienthWidth/clientHeight
Here's what I've done. It's not real clean though (initially loads map
image twice).
function myOnLoad()
{
CWC2OnLoadFunction();
var oImage = CWCDHTML_GetImage( 'mapimage' );
var myWidth = document.body.clientWidth;
var myHeight = document.body.clientHeight;
if (myHeight<500)
myHeight = Math.round(myHeight /2);
else if (myHeight<620)
myHeight = Math.round(myHeight*0.66);
else
myHeight = Math.round(myHeight*0.75);
if (myWidth<800)
myWidth = Math.round(myWidth/2);
else
myWidth = Math.round(myWidth*0.66);
if (!((oImage.width== myWidth) && (oImage.height== myHeight)))
applyMapSize(myWidth,myHeight);
}
......
<cwc2 type="MapSize" visible="false"....
________________________________
From: chameleon-bounces at lists.maptools.org
[mailto:chameleon-bounces at lists.maptools.org] On Behalf Of Brent Lund
Sent: Friday, June 16, 2006 11:57 AM
To: chameleon at lists.maptools.org
Subject: [Chameleon] Map width/height based on clienthWidth/clientHeight
Is there a way to set the map (MapDHTML) width and height based on the
user's document.body.clientWidth (clientHeight)
Thanks,
Brent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/chameleon/attachments/20060616/c2102fc6/attachment.html
More information about the Chameleon
mailing list