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.

1

Dienstag, 22. Juni 2010, 01:38

Unexpected results in trying to set custom settings for the area.

Hi Klaus,

I got strange results in trying to set custom settings for the area.
I try to set the area.x to 50% and the area.with to half of stagewidth (the rest of the stage width)...
Like this:

Quellcode

1
2
set(area.x,50%);
sub(area.width,stagewidth,area.pixelx);

But, in this code, the resulting area is not as I expect:

Quellcode

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
<krpano version="1.0.8" onstart="showlog(); area_settings();" > 

	<view fov="120" fovtype="DFOV" />

	<preview type="grid(cube, 20, 20, 200, 0xCCCCCC, 0xFFFFFF, 0x000000)" details="12" />

	<events onresize="trace_area(from_onresize);" />	
			
	<action name="area_settings">
		trace('-- call to area_settings() --');
		set(area.x,50%);
		sub(area.width,stagewidth,area.pixelx);
		trace_area(from_area_settings);
	</action>
			
	<action name="trace_area">
		trace('-- trace_area %1 --');
		trace('area.x = ',area.x);
		trace('area.pixelx = ',area.pixelx);
		trace('area.width = ',area.width);
		trace('area.pixelwidth = ',area.pixelwidth);
		trace('stagewidth = ',stagewidth);
	</action>

</krpano>

with this code, the area is displayed correctly beginning at the middle of the screen but the width is displayed only half (the other half it is out of the screen).
The resulting trace are:

Zitat

INFO: krpano 1.0.8.11 (build 2010-05-31)
INFO: Flashplayer WIN 10,1,53,64 PlugIn
WARNING: not local trusted - ExternalInterface disabled!
INFO: -- call to area_settings() --
INFO: -- trace_area from_area_settings --
INFO: area.x = 50%
INFO: area.pixelx = 0
INFO: area.width = 1024
INFO: area.pixelwidth = 1024
INFO: stagewidth = 1024
INFO: -- trace_area from_onresize --
INFO: area.x = 50%
INFO: area.pixelx = 512
INFO: area.width = 1024
INFO: area.pixelwidth = 1024
INFO: stagewidth = 1024
Adding in line 12 a wait(0); inside the action that sets the area:

Quellcode

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
<krpano version="1.0.8" onstart="showlog(); area_settings();" > 

	<view fov="120" fovtype="DFOV" />

	<preview type="grid(cube, 20, 20, 200, 0xCCCCCC, 0xFFFFFF, 0x000000)" details="12" />

	<events onresize="trace_area(from_onresize);" />	
			
	<action name="area_settings">
		trace('-- call to area_settings() --');
		set(area.x,50%);
		wait(0);
		sub(area.width,stagewidth,area.pixelx);
		trace_area(from_area_settings);
	</action>
			
	<action name="trace_area">
		trace('-- trace_area %1 --');
		trace('area.x = ',area.x);
		trace('area.pixelx = ',area.pixelx);
		trace('area.width = ',area.width);
		trace('area.pixelwidth = ',area.pixelwidth);
		trace('stagewidth = ',stagewidth);
	</action>

</krpano>

Using this wait(0); the area displays correctly beginning at the middle of the screen and the width is egal to half of the stagewidth as expected.
And the resulting trace are:

Zitat

INFO: krpano 1.0.8.11 (build 2010-05-31)
INFO: Flashplayer WIN 10,1,53,64 PlugIn
WARNING: not local trusted - ExternalInterface disabled!
INFO: -- call to area_settings() --
INFO: -- trace_area from_area_settings --
INFO: area.x = 50%
INFO: area.pixelx = 512
INFO: area.width = 512
INFO: area.pixelwidth = 1024
INFO: stagewidth = 1024
INFO: -- trace_area from_onresize --
INFO: area.x = 50%
INFO: area.pixelx = 512
INFO: area.width = 512
INFO: area.pixelwidth = 1024
INFO: stagewidth = 1024
INFO: -- trace_area from_onresize --
INFO: area.x = 50%
INFO: area.pixelx = 512
INFO: area.width = 512
INFO: area.pixelwidth = 512
INFO: stagewidth = 1024
only at the end of the trace, the area variables are as expected...
*question* *question* *question* I am doing something wrong *confused*

SAlut.

2

Dienstag, 22. Juni 2010, 09:38

Hi,

the "area.pixel*" values were not updated immediately,
they will be updated during the next screen refresh (or during a browser resize) and then also the onresize event will be called,
(note - inside then onresize event the area values can be adjusted/changed again, but then there will be no second onresize event),

best regards,
Klaus

Beiträge: 1 857

Beruf: Virtual Tours - Photography - Krpano developer

  • Nachricht senden

3

Samstag, 19. März 2011, 18:23

Hi,

the "area.pixel*" values were not updated immediately,
they will be updated during the next screen refresh (or during a browser resize) and then also the onresize event will be called,
(note - inside then onresize event the area values can be adjusted/changed again, but then there will be no second onresize event),

best regards,
Klaus
There seems to be a bug with the area variables.
Using the trace plugin, you can see when using window maximize/minimize the calculated values are for the previous state, not the current state.
Is there a way to force an update to these variables onresize?
The stage variables are fine.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

4

Mittwoch, 23. März 2011, 09:59

Hi,
There seems to be a bug with the area variables.
which bug?


Is there a way to force an update to these variables onresize?
in the onresize event itself, the values are already updated,
but when changing the the area values inside the onresize event again there is no second onresize event,
a wait(0) or delayedcall(0,..) could help to wait until the screen has been redrawn and the pixel values are updated again, but when changing the area values inside the onresize event it would be better the calculate all values manually, e.g. %50 width would mean mul(yourwidth, stagewidth, 0.5);

best regards,
Klaus

Beiträge: 1 857

Beruf: Virtual Tours - Photography - Krpano developer

  • Nachricht senden

5

Mittwoch, 23. März 2011, 21:10

Well in the examples where you are tracing the area.pixelwidth etc.
Dragging the window shows the area pixel width correctly.
However, on using the browser windows maximize and minimize, the trace shows incorrectly.

For instance a 400px window then maximize shows area.pixelwidth = 400px not 1920
Then when you unmaximize it will show 1920.
Yes, manual calculations aren't so terrible HOWEVER, it can be difficult to calculated heights that have been removed do to the additions of browser toolbars etc.


So for a real world example, if you have a panorama set to occupy an area 80% width and height of the stage, and you want a graphic element 75% height of the area, and the user maximizes the screen, your element will be calculated wrong using area.pixelheight which is one step behind.
Or I'm probably mis-understanding proper usage of area.pixel[]. Im assuming its the area of space where the panorama is drawn.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

Beiträge: 1 857

Beruf: Virtual Tours - Photography - Krpano developer

  • Nachricht senden

6

Mittwoch, 23. März 2011, 21:16

using delayedcall(0, to get the area.sizes on in onresize event works a treat.
Good FYI!
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

Ähnliche Themen