소스 검색

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


불러오는 중...
취소
저장