You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Tuur

Sage

Posts: 3,128

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

21

Monday, May 16th 2011, 3:41pm

he sacha,

but how to achieve that?

Quoted

Turn the iphone accessibilty zoom to off.

Or reset the size of your pano div to 100% width and height.


i have this in the index:

Source code

1
2
3
4
5
6
7
8
9
<script>
function resizekrpano() 
{
 
 document.getElementById("pano").style.height = document.body.clientHeight + "px";;
 document.getElementById("pano").style.width = document.body.clientWidth + "px";;
 
}
</script>


an dthis in the xml:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<plugin name="orientation" 
        url="../skin/orientation.js" 	
        keep="true"
        devices="HTML5"
        onorientationchange="updateorientation();js(resizekrpano());"
        />	
	
	
	
	

	<action name="updateorientation">
if(plugin[gyro].visible == true,			
			copy(plugin[mail].visible, plugin[orientation].portrait);
			copy(plugin[www].visible, plugin[orientation].portrait);
			copy(plugin[rotate].visible, plugin[orientation].portrait);
	<!--		copy(plugin[landscape-ui].visible, plugin[orientation].landscape);
			copy(plugin[portrait-ui].visible, plugin[orientation].portrait);	-->
			trace(get(plugin[orientation].orientation));
		,
			copy(plugin[mail].visible, false);
			copy(plugin[www].visible, false);
			copy(plugin[rotate].visible, false);
	<!--		copy(plugin[landscape-ui].visible, false);
			copy(plugin[portrait-ui].visible, false);	
					-->
					
		);
	</action>


seems not to work ... but i'm not good in .js..

Tuur *thumbsup*
http://www.virtualtuur.com
Skype:studiotuur

This post has been edited 1 times, last edit by "Tuur" (May 16th 2011, 4:19pm)


22

Tuesday, May 31st 2011, 12:31pm

First of all, thanks for your effort you put into this plugin, ahoeben! But I can´t get it to work, either on iPad nor on iPod touch. Even the demo you have on your page is´nt working on these devices, because it shows only "the device is in portrait orientation", no matter how I rotate the device *sad* Any idea where the problem might be?

And does anybody else got this plugin to work?

Thanks in advance,
Nupsi

23

Tuesday, May 31st 2011, 10:59pm

Hey, it doesn't work (anymore). I'll look in to it.

24

Thursday, June 2nd 2011, 11:04am

The reason the demo wasn't working was because it is running inside an iframe on the documentation page, and the orientationchange event is not propagating across the iframe. I have changed the plugin to look at the top window instead. This should work, as long as the krpano page and the containing page are on the same domain.

jeromebg

Professional

Posts: 734

Location: Angers - France

Occupation: Photographer

  • Send private message

25

Saturday, August 4th 2018, 3:33pm

Hi, looks this great plugin doesn't work anymore ?
Is there a new alternative ? (haven't seen this event in native krpano functions ?)
THX !

26

Saturday, August 4th 2018, 4:36pm

hm, i do that much simpler:
if the orientation changes a resize event will fire, so you can just do something like:

<events onresize="if(stage.height GT stage.width, debug("portrait"), debug("landscape"));" />

jeromebg

Professional

Posts: 734

Location: Angers - France

Occupation: Photographer

  • Send private message

27

Saturday, August 4th 2018, 4:38pm

hm, i do that much simpler:
if the orientation changes a resize event will fire, so you can just do something like:

<events onresize="if(stage.height GT stage.width, debug("portrait"), debug("landscape"));" />

THX, but I need to knwo if the device is upside down, not only portrait or landscape ;)

28

Saturday, August 4th 2018, 7:01pm

:) oki, thats something else then :)

interesting, i just noticed, if you turn an iphone upside down, you dont get a resize event.
only if its 0, +90 or -90

29

Sunday, August 5th 2018, 11:48pm

Hi,

here a simplified example for getting the device orientation (for latest browsers only, older browser have also different ways of storing that information):

Source code

1
2
3
4
5
6
7
<action name="get_orientation" type="Javascript"><![CDATA[
  krpano.display.orientation = screen.orientation && screen.orientation.type ? screen.orientation.angle : window.orientation;
]]></action>

<events name="test" keep="true"
  onresize="get_orientation(); trace('orientation=',display.orientation);"
  />
Should work on Android Chrome, Firefox and iOS.

Best regards,
Klaus