浏览代码

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


正在加载...
取消
保存