javascript - Unexpected results when multiplying window.innerHeight by a nonwhole number in Firefox -


firstly, i'm no means web designer have little idea i'm doing.

i'm working on html/javascript unity webplayer application trying make webplayer take (not all) of browser's viewable area. <body> of page set have no margins nor scroll bars so,

<body margin="0" marginwidth="0" marginheight="0" scroll="no"> 

i'm getting values browser's viewable area this,

winwidth = window.innerwidth; winheight = window.innerheight; 

and call unity webplayer this,

unityobject.embedunity("unityplayer", "webplayer.unity3d", winwidth, winheight, params); 

everything seems work setup. however, when multiply winwidth , winheight non-whole numbers (i.e., 0.5 or 1.9) height not scaled in firefox 12. regardless of value put in there, it's same (wrong) vertical height. in picture, both innerheight , innerwidth multiplied 0.9 and, can see, height wrong—and wrong height no matter non-whole number multiply by. innerheight * 0.9

this code works fine in chrome 19 , ie 9. how fix this?

i don't know exact situation is, i'm not familiar unity javascript interface using, think there's chance need specify integer width , height player, whereas calculation producing non-integral number.

simply write math.round(winwidth * 0.9) instead of winwidth * 0.9 nearest integer result.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -