Преглед на файлове

Add dragHandlerArgs.

pull/881/head
Nico Höllerich преди 4 години
родител
ревизия
9d51591f73
променени са 2 файла, в които са добавени 10 реда и са изтрити 7 реда
  1. +5
    -2
      doc/json-config-parameters.md
  2. +5
    -5
      src/js/pannellum.js

+ 5
- 2
doc/json-config-parameters.md Целия файл

@@ -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 Целия файл

@@ -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;
})
}


Зареждане…
Отказ
Запис