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.

Karotte

Beginner

  • "Karotte" started this thread

Posts: 39

Location: Leipzig

Occupation: Selbständig

  • Send private message

1

Wednesday, September 28th 2011, 9:31am

iPhone 4 und iPad 2 only Button

Hallo,
da ja leider nur iPhone 4 und iPad 2 über einen Gyroscopesensor verfügen würde ich gerne nur bei diesen Geräten einen Button anzeigen lassen.
Mit dem devices Parameter kann ich es zwar für iPhone und iPad regeln aber das betrifft ja dann auch ältere Versionen (iPad 1 und iPhone 3)...

Hat jemand einen Tipp?

Grüße aus Leipzig
Marcus

2

Wednesday, September 28th 2011, 1:37pm

Hi,

eine echte Erkennung per Javascript ob es sich um ein iPad1 oder iPad2 handelt ist leider nicht möglich,
es wäre zwar möglich z.B. zu erkennen ob Gryoscope-Unterstützung vorhanden ist, aber dann darauf auf ein iPad2 zu schließen wäre falsch, es könnte sich ja beispielsweise auch um ein iPad3 oder sonstiges neues iPad handeln...

falls es aber nur um die Gryoscope Erkennung geht, dann könnte auch ein Code wie folgender verwendet werden - dieser verwendet den "available" Wert des Plugins (welche aber nach der Erkennung selbst zur Verfügung steht, deshalb das delayedcall):

Source code

1
2
3
<plugin name="gyro" url="../../gyro.js" enabled="true" camroll="true" friction="0.5" velastic="0.2" devices="html5" keep="true"
        onloaded="delayedcall(1,ifnot(available, showgyrowarning()));"
/>


dieser Code wird z.B. hier in diesem Beispiel verwendet:
http://krpano.com/plugins/userplugins/fi…mples/gyro.html
xml:
http://krpano.com/plugins/userplugins/fi…amples/gyro.xml

Schöne Grüße,
Klaus

opticalfx

Trainee

Posts: 48

Location: Peterborough, UK

Occupation: Virtual Tour Photographer

  • Send private message

3

Friday, February 17th 2012, 9:57am

I think this answers a question of mine about Gyro not working on iPad1 and how to set a difference but as it's not in English I can't read it *sad*

Klaus, could you please let me see your answer in English please.

Many thanks,

Adrian
Many thanks,

Adrian Salisbury, UK
Smart Virtual Tours

4

Monday, February 20th 2012, 7:24pm

Hi,

the answer is about how to detect the availability of the gryo sensor on the device:

when the "available" variable of the plugin is "true" then the device has a gryo sensor,
but it takes a bit until the plugin is setting that value, so the "delayedcall" before checking it,

best regards,
Klaus

Posts: 48

Location: Peterborough, UK

Occupation: Virtual Tour Photographer

  • Send private message

5

Tuesday, February 21st 2012, 12:43pm

Thanks for explaining this Klaus but could you help a little more please.

Rather than popping up a warning I want to only make my gyro button appear if gyro is available and by default have it turned off on load.

Currently I have this script for the button so that it can be turned on/off.

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
<plugin name="gyro" url="gyro.js" enabled="false" camroll="true" friction="0.5" velastic="0.2" devices="html5" keep="true" />

<plugin name="gyro-button" style="gyrobutton" devices="iphone|ipad" align="righttop" x="30" y="30" width="120" html="[p]Gyro on[/p]" onclick="switch(plugin[gyro].enabled); set(view.camroll,0.0); if(plugin[gyro].enabled == false, set(html,[p]Gyro on[/p]), set(html,[p]Gyro off[/p]));"/> /> 

	<style name="gyrobutton"
		url="plugins/textfield.swf"
		keep="true"
		children="false"
		height="22"
		onloaded="set(alpha,0); set(textblur,15); set(blur,15); tween(alpha,1.0,0.3); tween(textblur,0,0.3); tween(blur,0,0.3);"
		onover="tween(alpha,0.7,distance(0.3,0.2));"
		onout="tween(alpha,1.0,distance(0.3,0.2));"
		autosize="none"
		css="p{color:#FFFFFF; font-family:Arial; font-size:14; margin-left:5; margin-right:5; text-align:center; }"
		background="true" backgroundcolor="0x000000" backgroundalpha="0.7"
		bordercolor="0" borderwidth="0"
		blur="0"
		glow="4"
		glowcolor="16777215"
		roundedge="5"
		shadow="1"
		textblur="0" textglow="0" textglowcolor="16777215" textshadow="0"
	/>


Could you explain how your plugin and action would make this work please? *unsure*
Many thanks,

Adrian Salisbury, UK
Smart Virtual Tours

6

Tuesday, February 21st 2012, 3:36pm

Hi,

just add an onloaded event to the gyro plugin and check there after a delayedcall the available variable,
then e.g. when when available=true show your gyro button, and by default set your gyro button to invisible,

e.g.

Source code

1
2
3
4
5
6
7
<plugin name="gyro" ...
onloaded="delayedcall(1,if(available, set(plugin[gyro-button].visible,true); ));"
/>

<plugin name="gyro-button" ...
	visible="false"
/>


best regards,
Klaus

Posts: 48

Location: Peterborough, UK

Occupation: Virtual Tour Photographer

  • Send private message

7

Wednesday, February 22nd 2012, 11:23am

Excellent, that works a treat, thanks!
Many thanks,

Adrian Salisbury, UK
Smart Virtual Tours

Posts: 48

Location: Peterborough, UK

Occupation: Virtual Tour Photographer

  • Send private message

8

Wednesday, February 22nd 2012, 11:58am

Just to complicate this further, my client wants autorotate set true but that messes up the gyro. If I want to add a second command to the if statement how do I write it?

Current code:

Source code

1
onloaded="delayedcall(1,if(available, set(plugin[gyro-button].visible,true); ));"/>


Does this look right? I can't test it as I dont have access to an iPad1.

Source code

1
onloaded="delayedcall(1,if(available, set(plugin[gyro-button].visible,true); set(autorotate.enabled,false); ));"/>


Will this override the default autorotate enabled="true" ?

I really appreciate your help.
Many thanks,

Adrian Salisbury, UK
Smart Virtual Tours

9

Monday, February 27th 2012, 4:31pm

Hi,
Will this override the default autorotate enabled="true" ?
yes

best regards,
Klaus

10

Monday, October 8th 2012, 6:11pm

mark,
thinks