Sie sind nicht angemeldet.

1

Mittwoch, 8. Juli 2015, 11:06

unable to scroll inside of html5/js plugin?

Hello Klaus,

I've developed a certain js plugin for krpano, which has a specific layout that uses an "overflow-y: auto" css setting, and when certain minimum dimensions are not met, a scrollbar appears and I'm perfectly able to scroll the contents of the plugin with it - by clicking and dragging the scrollbar. The mousewheel doesn't work however, instead it goes on to zoom in/out the panorama behind the plugin.

Is it possible to enable the mousewheel scrolling inside the plugin? I thought I remembered there was some kind of a capture parameter for plugins/hotspots, but seems like those are not in the documentation now except for bgcapture, which is a different story.

I also looked at the mwheel embed parameter, but that's different too, if I understand it correctly it just stops the whole viewer from receiving the wheel events.

So, is there a way? Thanks in advance!

2

Mittwoch, 8. Juli 2015, 11:27

Hi,

it's unfortunately not possible to simply 'enable' mouse wheel scrolling, the plugin would need to handle the mouse wheel events by its own - e.g. this way:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
plugin.sprite.addEventListener("DOMMouseScroll", handle_mousewheel, true);
plugin.sprite.addEventListener("mousewheel",     handle_mousewheel, true);
plugin.sprite.addEventListener("wheel",          handle_mousewheel, true);

...

function handle_mousewheel(event)
{
  var delta = 0;
  
  event.preventDefault();
  event.stopPropagation();
  
  if (event.type == "wheel")
    delta = event.deltaY;
  else if (event.type == "mousewheel")
    delta = -event.wheelDelta;
  else if (event.type == "DOMMouseScroll")
    delta = event.detail;
	
  // ... 
}


Best regards,
Klaus

3

Mittwoch, 8. Juli 2015, 11:46

Thank you very much, it seems to be working just fine!

Cheers!