|
|
Quellcode |
1 |
<script type="text/javascript" src="krpanogyro.js"></script> |
Dieser Beitrag wurde bereits 5 mal editiert, zuletzt von »ahoeben« (4. April 2011, 22:05)
Benutzerinformationen überspringen
Wohnort: Netherlands
Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer
: https://pame.virtualtuur.comDieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Tuur« (2. Februar 2011, 02:58)
Not currently, but in a future version: sure.- is it possible to enable /disable this?
No, for a couple of reasons. Most importantly, the device just does not give me a "compass heading"; the "pan" component just starts at 0 every time. But having a hard alignment with a compass would also break initial views (ie: the starting viewpoint of your panorama) and it would conflict with manual navigation of the panorama.
Zitat
- does it use the heading as we use in maps with the radar?

of course! I'm already working on that, in the krpanoJS 1.0.8.14 pre-release there is already a first javascript plugin interface, it's not finish yet and there are still some interfaces missing (unloading, visible elements, resizing, ...), but I want to finish it for the final 1.0.8.14, then I will also provide example codes for it,Note to Klaus: In the future (for this and other html viewer plugins) it would be nice if the javascript viewer could include js files as plugins through the xml, like the flash viewer can load (code-only) swf files as plugin.
|
|
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
/*
krpanoJS javascript plugin template / example
1.0.8.14
*/
var krpanoplugin = function()
{
var krpano = null;
var plugin = null;
// registerplugin - startup point for the plugin
// - krpanointerface = krpano interface object
// - pluginpath = string with the krpano path of the plugin (e.g. "plugin[pluginname]")
// - pluginobject = the plugin object itself (the same as: krpano.get(pluginpath) )
this.registerplugin = function(krpanointerface, pluginpath, pluginobject)
{
krpano = krpanointerface;
plugin = pluginobject;
// say hello
krpano.trace(0,"hello from plugin[" + plugin.name + "]");
// add a global function to krpano (callable from xml by "test1()")
krpano.test1 = test1;
// add a local plugin function to krpano (callable from xml by "plugin[name].test2()" or just "test2()" when called from a plugin event)
plugin.test2 = test2;
// add a local plugin variable/attribute
plugin.var1 = "123";
// add a local plugin variable/attribute with getter/setter functions
plugin._var2 = 123;
plugin.__defineSetter__("var2", function(v){ plugin._var2=v; krpano.trace(0,"var2 was set to "+v); });
plugin.__defineGetter__("var2", function(){ return plugin._var2; });
}
function test1()
{
krpano.trace(0,"test1() called from xml");
krpano.trace(0,"view.hlookat = " + krpano.view.hlookat);
krpano.trace(0,"view.vlookat = " + krpano.view.vlookat);
krpano.trace(0,"view.fov = " + krpano.view.fov);
}
function test2()
{
krpano.trace(0,"test2() called from xml (plugin="+plugin.name+")");
}
};
|
|
|
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 27 |
if (!this.KrpanoGyro) {
var KrpanoGyro = function() {
var init = function init(krpanoObject) {
if (krpanoObject) gyro_objectname = krpanoObject.ptarget;
if( window["DeviceOrientationEvent"] ) {
var gyro_init_interval = setInterval( function() {
gyro_krpano = document.getElementById( gyro_objectname );
if(gyro_krpano) {
clearInterval(gyro_init_interval);
gyro_init();
}
}, 100 );
}
}
/* the rest of your script goes here */
return {
init: init
,toString: function() {
return "[object KrpanoGyro]";
}
};
}();
}
|
|
|
Quellcode |
1 2 3 4 5 6 7 8 |
var oViewer = createPanoViewer({swf:"krpano.swf", xml:"data/pano1/pano1.xml", target:'myElement'});
if (bForce||oViewer.isHTML5possible()) {
oViewer.useHTML5("always");
oViewer.embed();
KrpanoGyro.init(oViewer);
} else {
mPanoDiv.innerHTML = 'Lorem ipsum dolor sit amet';
}
|
Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »Sjeiti« (4. Februar 2011, 23:32)
Benutzerinformationen überspringen
Wohnort: Netherlands
Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

: https://pame.virtualtuur.com|
|
Quellcode |
1 2 3 4 5 6 7 |
krpano = createPanoViewer({swf:"krpano.swf", xml:"panorama.xml", target:'myHtmlElementId'});
if (krpano.isHTML5possible()) {
krpano.useHTML5("always");
krpano.embed();
gyro = KrpanoGyro(krpano);
//gyro.disable();
}
|
|
|
Quellcode |
1 |
<a href="javascript:!gyro.enabled()?gyro.enable():gyro.disable()">toggle</a> |
Benutzerinformationen überspringen
Wohnort: Netherlands
Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer
: https://pame.virtualtuur.com|
|
Quellcode |
1 2 3 4 5 6 7 |
<krpano ... onstart="initgyro()"> ... <plugin name="gyrotoggle" visible="false" ... onclick="gyro.toggle();" /> <action name="initgyro"> copy(plugin[gyrotoggle].visible, gyro.deviceAvailable); gyro.setAdaptiveV(true); </action> |
Benutzerinformationen überspringen
Wohnort: Netherlands
Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

: https://pame.virtualtuur.com