Sie sind nicht angemeldet.

Lieber Besucher, herzlich willkommen bei: krpano.com Forum. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.

Jonnie

Anfänger

  • »Jonnie« ist der Autor dieses Themas

Beiträge: 37

Wohnort: Denmark

Beruf: ex Software Architect 20 years (Aerospace Industry), then hotel owner now campground owner, I do some IT consultancy

  • Nachricht senden

1

Sonntag, 26. Februar 2012, 01:26

Sizing a plugin on tablet/mobile with portrait/landscape considerations

Hi

I am trying to show a graphic ( Help screen ) I would prefer it to be displayed reasonably large as possible, for example 75% of the smallest dimension
of the device viewport

My graphic is not square but to simplify lets say it is..

If I could assume landscape I might write....

width="prop" height="75%"

However since the aspect ratio of tablets and smart phones can flip as the device is rotated I would in effect need to modify the above line to

height="prop" width="75%"

Any ideas how these two statements can be replaced with a statement that ensures that the graphic is not more than 75% of the device viewport
in either direction?

I was sure this would have been asked previously but I could not find any leads in the forum - perhaps being dumb or searching with the wrong words?

Thanks in advance

Jon

2

Montag, 27. Februar 2012, 16:45

Hi,

the direct detection of the device orientation is currently not possible (but I think I will had a variable for getting the origination),
but the screen size could be used to decide how the device is orientated,
e.g. width > height = landscape - or - height > width = portrait

with xml:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
<events onresize="if(stagewidth GT stageheight, landscape(), portrait());" />

<action name="landscape">
set(plugin[...].width, ...);
set(plugin[...].height, ...);
...
</action>

<action name="portrait">
set(plugin[...].width, ...);
set(plugin[...].height, ...);
 ...
</action>


best regards,
Klaus

Jonnie

Anfänger

  • »Jonnie« ist der Autor dieses Themas

Beiträge: 37

Wohnort: Denmark

Beruf: ex Software Architect 20 years (Aerospace Industry), then hotel owner now campground owner, I do some IT consultancy

  • Nachricht senden

3

Montag, 27. Februar 2012, 23:23

Thanks for the reply Klaus

I will experiment with the options you have suggested and report back on how it went.

Kind regards

Jon

Jonnie

Anfänger

  • »Jonnie« ist der Autor dieses Themas

Beiträge: 37

Wohnort: Denmark

Beruf: ex Software Architect 20 years (Aerospace Industry), then hotel owner now campground owner, I do some IT consultancy

  • Nachricht senden

4

Dienstag, 28. Februar 2012, 14:32

Hi Klaus

I used your code and it worked just fine - thanks.

The only thing I added in addition was to add the line

if(stagewidth GT stageheight, landscape(), portrait());


into the krpano startup action.

I figured it was simply easier to add this line rather than to risk the possibility that devices can start up in either
portrait or landscape without the resize event handler being called.

Thanks again

Kind regards

Jonnie

jschrader

Fortgeschrittener

Beiträge: 237

Wohnort: Bavaria, Germany

Beruf: Photographer, Producer

  • Nachricht senden

5

Mittwoch, 27. Juni 2012, 12:15

Just perfect *thumbsup*