Selaa lähdekoodia

Add dragHandlerArgs.

pull/881/head
Nico Höllerich 4 vuotta sitten
vanhempi
commit
9d51591f73
2 muutettua tiedostoa jossa 10 lisäystä ja 7 poistoa
  1. +5
    -2
      doc/json-config-parameters.md
  2. +5
    -5
      src/js/pannellum.js

+ 5
- 2
doc/json-config-parameters.md Näytä tiedosto

@@ -327,10 +327,13 @@ for the hot spot's `click` event. The event object and the contents of

If specified, the hotspot can moved using the mouse or by touch.

#### `dragHandlerFunc` (function)
#### `dragHandlerFunc` (function) and `dragHandlerArgs` (object)

If `dragHandlerFunc` is specified, this function is added as an event handler
when dragging of the hotspot starts and ends. The event object are passed to the function as arguments.
when dragging of the hotspot starts and ends. The event object and the contents of
`dragHandlerArgs` are passed to the function as arguments. Possible types of the
event object are: `mousedown`, `pointerdown`, `touchend`, `pointerup`, `pointerleave`,
`mouseup`, and `mouseleave`.

#### `scale` (boolean)



+ 5
- 5
src/js/pannellum.js Näytä tiedosto

@@ -832,7 +832,7 @@ function onDocumentMouseMove(event) {
*/
function onDocumentMouseUp(event) {
if (draggingHotSpot && draggingHotSpot.dragHandlerFunc)
draggingHotSpot.dragHandlerFunc(event);
draggingHotSpot.dragHandlerFunc(event, draggingHotSpot.dragHandlerArgs);
draggingHotSpot = null;

if (!isUserInteracting) {
@@ -1016,7 +1016,7 @@ function onDocumentPointerMove(event) {
*/
function onDocumentPointerUp(event) {
if (draggingHotSpot && draggingHotSpot.dragHandlerFunc)
draggingHotSpot.dragHandlerFunc(event);
draggingHotSpot.dragHandlerFunc(event, draggingHotSpot.dragHandlerArgs);
draggingHotSpot = null;

if (event.pointerType == 'touch') {
@@ -1843,7 +1843,7 @@ function createHotSpot(hs) {
// handle mouse by container event listeners
div.addEventListener('mousedown', function (e) {
if (hs.dragHandlerFunc)
hs.dragHandlerFunc(e);
hs.dragHandlerFunc(e, hs.dragHandlerArgs);
draggingHotSpot = hs;
});

@@ -1851,7 +1851,7 @@ function createHotSpot(hs) {
document.documentElement.style.touchAction === '') {
div.addEventListener('pointerdown', function (e) {
if (hs.dragHandlerFunc)
hs.dragHandlerFunc(e);
hs.dragHandlerFunc(e, hs.dragHandlerArgs);
draggingHotSpot = hs;
});
}
@@ -1862,7 +1862,7 @@ function createHotSpot(hs) {
});
div.addEventListener('touchend', function (e) {
if (hs.dragHandlerFunc)
hs.dragHandlerFunc(e);
hs.dragHandlerFunc(e, hs.dragHandlerArgs);
draggingHotSpot = null;
})
}


Ladataan…
Peruuta
Tallenna