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.

1

Monday, September 17th 2012, 3:39am

control scroll speed and doesn't work with android.

Two questions, not my code but found in the forums. This works well on desktop browsers but not on my android tablet, partial load. second question, do you see how to control the scrolling speed, better yet have it not move until the cursor is moved from side to side.

here it is on the web
http://astimegoesby.us/panoramas/fgconco…ages/index.html



<?xml version="1.0" encoding="utf-8"?>
<!--
krpano 1.0.8
- a xml driven image gallery example
- click a small image to view it large
-->

<krpano version="1.0.8" onstart="start();">

<action name="start">

<!--
syntax:
create_thumbbar(numberofimages, align, orientation, x,y, width,height, border,scroll);

numberofimages ... number of images
align ... position of the imagebar (left,right or center for vertical orientation of theimage bar,
top,bottom or center for horisontal orientanion of the imagebar)
orientation ... orientation of the imagebar (h or v)
x,y ...NOTE! position offsets (for correct operation of the gallery :
if orientation of the imagebar = vertical,set y=0;
if orientation of the imagebar = horisontal,set x=0;);
width,height ... thumbnail imagesize
border ... border around images
scroll ... cursor or mouse wheell scroll(cur or mw)
-->
create_thumbbar(21,center, h, 0,400, 120,90, 6,cur);

thumbbar_addimage('images/forestgrove_001.jpg');
thumbbar_addimage('images/forestgrove_002.jpg');
thumbbar_addimage('images/forestgrove_003.jpg');
thumbbar_addimage('images/forestgrove_004.jpg');
thumbbar_addimage('images/forestgrove_005.jpg');
thumbbar_addimage('images/forestgrove_006.jpg');
thumbbar_addimage('images/forestgrove_007.jpg');
thumbbar_addimage('images/forestgrove_008.jpg');
thumbbar_addimage('images/forestgrove_009.jpg');
thumbbar_addimage('images/forestgrove_010.jpg');
thumbbar_addimage('images/forestgrove_011.jpg');
thumbbar_addimage('images/forestgrove_012.jpg');
thumbbar_addimage('images/forestgrove_013.jpg');
thumbbar_addimage('images/forestgrove_014.jpg');
thumbbar_addimage('images/forestgrove_015.jpg');
thumbbar_addimage('images/forestgrove_016.jpg');
thumbbar_addimage('images/forestgrove_017.jpg');
thumbbar_addimage('images/forestgrove_018.jpg');
thumbbar_addimage('images/forestgrove_019.jpg');
thumbbar_addimage('images/forestgrove_020.jpg');
thumbbar_addimage('images/forestgrove_021.jpg');

set_parent();
copy(max_scroll,stageheight);
copy(max_scroll_h,stagewidth);
copy(start_y,plugin[thumbbar].y);
copy(start_x,plugin[thumbbar].x);




</action>
<plugin name="logo4" url="plugins/logo4.png" keep="true" align="righttop" x="20" y="20" onclick= "openurl(http://rhmpano.com,_blank)"/>


<action name="follow_mouse">
sub(max_scroll,stageheight,plugin[thumbbar].height);
div(dec_lim,max_scroll,2);
sub(inc_lim,0,dec_lim);

div(get_center,stageheight,2);
sub(get_center,65);
if(mouse.y LT get_center,
div(tween_time,mouse.y,get_center);
mul(tween_time,20);
tween(plugin[thumbbar].y,get(inc_lim),get(tween_time) );
,
add(get_center,130);
if(mouse.y GT get_center,
sub(get_center,130);
sub(temp,mouse.y,stageheight);
div(tween_time,temp,get_center);
sub(temp,tween_time,tween_time);
sub(tween_time,temp,tween_time);
mul(tween_time,20);
tween(plugin[thumbbar].y,get(dec_lim),get(tween_time) );
,
stoptween(plugin[thumbbar].y);
);
);
</action>

<action name="follow_mouse_h">
sub(max_scroll_h,stagewidth,plugin[thumbbar].width);
div(dec_lim,max_scroll_h,2);
sub(inc_lim,0,dec_lim);

div(get_center,stagewidth,2);
sub(get_center,65);
if(mouse.x LT get_center,
div(tween_time,mouse.x,get_center);
mul(tween_time,20);
tween(plugin[thumbbar].x,get(inc_lim),get(tween_time) );
,
add(get_center,130);
if(mouse.x GT get_center,
sub(get_center,130);
sub(temp,mouse.x,stagewidth);
div(tween_time,temp,get_center);
sub(temp,tween_time,tween_time);
sub(tween_time,temp,tween_time);
mul(tween_time,20);
tween(plugin[thumbbar].x,get(dec_lim),get(tween_time) );
,
stoptween(plugin[thumbbar].x);
);
);
</action>
<action name="tween_thumb_stage">
add(offset,get(thumbbar_thumbheight),get(thumbbar_border));
sub(max_scroll,stageheight,plugin[thumbbar].height);
div(dec_lim,max_scroll,2);
sub(inc_lim,0,dec_lim);
copy(ypos,plugin[thumbbar].y);
if(wheeldelta LT 0,
inc(ypos,get(offset),get(inc_lim),get(inc_lim));
tween(plugin[thumbbar].y,get(ypos),0.6);
,
dec(ypos,get(offset),get(dec_lim),get(dec_lim));
tween(plugin[thumbbar].y,get(ypos),0.6);

)
</action>
<action name="tween_thumb_stage_h">
add(offset,get(thumbbar_thumbwidth),get(thumbbar_border));
sub(max_scroll_h,stagewidth,plugin[thumbbar].width);
div(dec_lim,max_scroll_h,2);
sub(inc_lim,0,dec_lim);
copy(xpos,plugin[thumbbar].x);
if(wheeldelta LT 0,
inc(xpos,get(offset),get(inc_lim),get(inc_lim));
tween(plugin[thumbbar].x,get(xpos),0.6);
,
dec(xpos,get(offset),get(dec_lim),get(dec_lim));
tween(plugin[thumbbar].x,get(xpos),0.6);

)
</action>


<action name="create_thumbbar">
set(thumbbar_images, %1);
set(thumbbar_align, %2);
set(thumbbar_orientation, %3);
set(thumbbar_x, %4);
set(thumbbar_y, %5);
set(thumbbar_thumbwidth, %6);
set(thumbbar_thumbheight, %7);
set(thumbbar_border, %8);
set(scrolling_type, %9);
set(thumbbar_image_index, 0);

set(thumbbar_xoffset, get(thumbbar_border) );
set(thumbbar_yoffset, get(thumbbar_border) );
set(thumbbar_xborder, 0);
set(thumbbar_yborder, 0);

if(thumbbar_orientation == h,
add(thumbbar_yborder, thumbbar_y, thumbbar_thumbheight);
add(thumbbar_yborder, thumbbar_yborder, thumbbar_border);
add(thumbbar_yborder, thumbbar_yborder, thumbbar_border);
add(thumbbar_yborder, thumbbar_yborder, thumbbar_border);
mul(thumbbar_yborder, thumbbar_yborder, 2);
mul(thumbbar_xborder, thumbbar_border, 2);
if(%2 == left, set(thumbbar_yoffset,0); );
if(%2 == right, set(thumbbar_yoffset,0); );
if(%2 == top, mul(thumbbar_xoffset,thumbbar_border,0.5); );
if(%2 == bottom, mul(thumbbar_xoffset,thumbbar_border,0.5); );
if(%2 == center, mul(thumbbar_xoffset,thumbbar_border,0.5); set(thumbbar_yoffset,0); mul(thumbbar_yborder,thumbbar_border,2); );
,
add(thumbbar_xborder, thumbbar_x, thumbbar_thumbwidth);
add(thumbbar_xborder, thumbbar_xborder, thumbbar_border);
add(thumbbar_xborder, thumbbar_xborder, thumbbar_border);
add(thumbbar_xborder, thumbbar_xborder, thumbbar_border);
mul(thumbbar_xborder, thumbbar_xborder, 2);
mul(thumbbar_yborder, thumbbar_border, 2);
if(%2 == left, mul(thumbbar_yoffset,thumbbar_border,0.5); );
if(%2 == right, mul(thumbbar_yoffset,thumbbar_border,0.5); );
if(%2 == top, set(thumbbar_xoffset,0); );
if(%2 == bottom, set(thumbbar_xoffset,0); );
if(%2 == center, set(thumbbar_xoffset,0); mul(thumbbar_yoffset,thumbbar_border,0.5); mul(thumbbar_xborder,thumbbar_border,2); );
);

addplugin(thumbbar);
set(plugin[thumbbar].onover,if(thumbbar_orientation == v,
if(scrolling_type == cur,
set(current_mouse_y,get(mouse.y));
,
set(events.onmousewheel,'tween_thumb_stage()');
action(toggle_freezeview,true);
);
,
if(scrolling_type == cur,
set(current_mouse_x,get(mouse.x));
,
set(events.onmousewheel,'tween_thumb_stage_h()');
action(toggle_freezeview,true);
);
);
);
set(plugin[thumbbar].onhover,if(scrolling_type == cur,
if(thumbbar_orientation == v,
if(current_mouse_y != mouse.y,
follow_mouse();
set(current_mouse_y,get(mouse.y));
)
,
if(current_mouse_x != mouse.x,
follow_mouse_h();
set(current_mouse_x,get(mouse.x));
);
);
);
);
set(plugin[thumbbar].onout,if(thumbbar_orientation == v,
if(scrolling_type == cur,
stoptween(plugin[thumbbar].y);
,
set(events.onmousewheel,null);
action(toggle_freezeview,false);
);
,
if(scrolling_type == cur,
stoptween(plugin[thumbbar].x);
,
set(events.onmousewheel,null);
action(toggle_freezeview,false);
);
);
);
set(plugin[thumbbar].align, get(thumbbar_align));
set(plugin[thumbbar].x, get(thumbbar_x));
set(plugin[thumbbar].y, get(thumbbar_y));
set(plugin[thumbbar].url, '%CURRENTXML%/clear.png');
set(plugin[thumbbar].alpha, 1);
set(plugin[thumbbar].zorder, 1);
set(plugin[thumbbar].enabled, true);
</action>


<action name="thumbbar_addimage">
txtadd(pname, 'thumbbar_image_', get(thumbbar_image_index));
addplugin(get(pname));
set(plugin[%pname].zorder, 2);
set(plugin[%pname].url, %CURRENTXML%/%1);
set(plugin[%pname].align, get(thumbbar_align));
set(plugin[%pname].width, get(thumbbar_thumbwidth));
set(plugin[%pname].height, get(thumbbar_thumbheight));
set(plugin[%pname].flystate, 0);



if (thumbbar_orientation == 'v',
<!-- vertical thumbs -->
add(plugin[%pname].x, 0, thumbbar_xoffset);

add(tmp, thumbbar_border, thumbbar_thumbheight);
mul(tmp, tmp, thumbbar_image_index);
add(tmp, tmp, thumbbar_yoffset);
add(plugin[%pname].y, thumbbar_y, tmp );

set(thumbbar_vcenter,false);
if(thumbbar_align == left, set(thumbbar_vcenter,true));
if(thumbbar_align == center, set(thumbbar_vcenter,true));
if(thumbbar_align == right, set(thumbbar_vcenter,true));

if(thumbbar_vcenter,
add(tmp2, thumbbar_border, thumbbar_thumbheight);
mul(tmp2, tmp2, thumbbar_images);
mul(tmp2, tmp2, 0.5);
sub(plugin[%pname].y, plugin[%pname].y, tmp2 );
mul(tmp3, thumbbar_thumbheight, 0.5);
add(plugin[%pname].y, plugin[%pname].y, tmp3 );
);

sub(tmp, tmp, thumbbar_yoffset);
add(tmp, tmp, thumbbar_border);
add(tmp, tmp, thumbbar_thumbheight);
add(tmp, tmp, thumbbar_border);
set(plugin[thumbbar].height, get(tmp));

mul(tmp, thumbbar_border, 2);
add(plugin[thumbbar].width, tmp, thumbbar_thumbwidth);
,

<!-- horizontal thumbs -->
add(plugin[%pname].y, 0, thumbbar_yoffset);

add(tmp, thumbbar_border, thumbbar_thumbwidth);
mul(tmp, tmp, thumbbar_image_index);
add(tmp, tmp, thumbbar_xoffset);
add(plugin[%pname].x, thumbbar_x, tmp );

set(thumbbar_hcenter,false);
if(thumbbar_align == top, set(thumbbar_hcenter,true));
if(thumbbar_align == center, set(thumbbar_hcenter,true));
if(thumbbar_align == bottom, set(thumbbar_hcenter,true));

if(thumbbar_hcenter,
add(tmp2, thumbbar_border, thumbbar_thumbwidth);
mul(tmp2, tmp2, thumbbar_images);
mul(tmp2, tmp2, 0.5);
sub(plugin[%pname].x, plugin[%pname].x, tmp2 );
mul(tmp3, thumbbar_thumbwidth, 0.5);
add(plugin[%pname].x, plugin[%pname].x, tmp3 );
);

sub(tmp, tmp, thumbbar_xoffset);
add(tmp, tmp, thumbbar_border);
add(tmp, tmp, thumbbar_thumbwidth);
add(tmp, tmp, thumbbar_border);
set(plugin[thumbbar].width, get(tmp));

mul(tmp, thumbbar_border, 2);
add(plugin[thumbbar].height, tmp, thumbbar_thumbheight);
);

copy(plugin[%pname].thumbx, plugin[%pname].x);
copy(plugin[%pname].thumby, plugin[%pname].y);

set(plugin[%pname].onclick, thumbbar_showimage(get(name)) );

inc(thumbbar_image_index);
</action>
<action name="set_parent">
for(set(i,0),
i LT thumbbar_images,
inc(i),
txtadd(pname,'thumbbar_image_',get(i));
set(plugin[get(pname)].parent,plugin[thumbbar]);
);
</action>

<action name="toggle_freezeview">
freezeview(%1);
</action>


<action name="thumbbar_showimage">
thumbbar_hide_allimages();

if(thumbbar_orientation == v,
if(plugin[%1].flystate ==0,
set(back_y,get(plugin[%1].y) );
sub(diff_y,get(start_y),get(plugin[thumbbar].y));
sub(new_y,get(plugin[%1].y),get(diff_y));
set(plugin[%1].y,get(new_y));
add(plugin[%1].x,get(thumbbar_x));
);
,
if(plugin[%1].flystate ==0,
set(back_x,get(plugin[%1].x) );
sub(diff_x,get(start_x),get(plugin[thumbbar].x));
sub(new_x,get(plugin[%1].x),get(diff_x));
set(plugin[%1].x,get(new_x));
add(plugin[%1].y,get(thumbbar_y));
);
);


set(plugin[%1].parent,null);


set(plugin[%1].zorder, 3);

push(plugin[%1].width);
push(plugin[%1].height);
plugin[%1].resetsize();
copy(plugin[%1].originalwidth, plugin[%1].width);
copy(plugin[%1].originalheight, plugin[%1].height);
pop(plugin[%1].height);
pop(plugin[%1].width);

set(imgwidth, get(plugin[%1].originalwidth));
set(imgheight, get(plugin[%1].originalheight));

set(maxwidth, get(stagewidth));
sub(maxwidth, maxwidth, thumbbar_xborder);

set(maxheight, get(stageheight));
sub(maxheight, maxheight, thumbbar_yborder);

if(imgwidth GT maxwidth,
mul(imgheight, imgheight, maxwidth);
div(imgheight, imgheight, imgwidth);
copy(imgwidth, maxwidth);
);

if(imgheight GT maxheight,
mul(imgwidth, imgwidth, maxheight);
div(imgwidth, imgwidth, imgheight);
copy(imgheight, maxheight);
);

tween(plugin[%1].width, get(imgwidth));
tween(plugin[%1].height, get(imgheight));

mul(tmp, thumbbar_border, 3);
add(tmp, tmp, thumbbar_thumbwidth);

plugin[%1].changeorigin(center,center);

tween(plugin[%1].x, 0);
tween(plugin[%1].y, 0);


set(plugin[%1].onclick, thumbbar_hideimage(get(name)); );
set(plugin[%1].flystate, 2);

</action>


<action name="thumbbar_hideimage">
set(plugin[%1].flystate, 3);
tween(plugin[%1].width, get(thumbbar_thumbwidth));
tween(plugin[%1].height, get(thumbbar_thumbheight));

plugin[%1].changeorigin(get(thumbbar_align),get(thumbbar_align));
set(plugin[%1].parent,plugin[thumbbar]);
set(plugin[%1].zorder, 2);

if(thumbbar_orientation == v,
add(new_y_y,get(plugin[%1].y),get(diff_y));
set(plugin[%1].y,get(new_y_y));
sub(plugin[%1].x,get(thumbbar_x));
,
add(new_x_x,get(plugin[%1].x),get(diff_x));
set(plugin[%1].x,get(new_x_x));
sub(plugin[%1].y,get(thumbbar_y));
);


set(plugin[%1].onclick,if(plugin[%1].flystate == 0,thumbbar_showimage(get(name));) );
if(thumbbar_orientation == v,
tween(plugin[%1].y, get(back_y));
tween(plugin[%1].x, get(plugin[%1].thumbx),0.5,default,set(plugin[%1].flystate,0););
,
tween(plugin[%1].x, get(back_x));
tween(plugin[%1].y, get(plugin[%1].thumby),0.5,default,set(plugin[%1].flystate,0););
);
</action>


<action name="thumbbar_hide_allimages">
if(%1 != NEXT, set(i,0));
txtadd(pname, 'thumbbar_image_', get(i));

if(plugin[get(pname)].flystate == 2,thumbbar_hideimage(get(pname)););

inc(i);
if(i LT thumbbar_images, thumbbar_hide_allimages(NEXT));
</action>



</krpano>
Bill


http://rhmpano.com Panoramas and gigapixel images
http://astimegoesby.us Personal family history back to the 1800's

2

Wednesday, September 19th 2012, 5:05pm

Hi,

for Android the 'touchfriction' setting would need to be changed:
http://krpano.com/docu/xml/#control.touchfriction

Best regards,
Klaus