Sfoglia il codice sorgente

improved drag listener

pull/880/head
Nico Höllerich 7 anni fa
parent
commit
74503c2010
1 ha cambiato i file con 14 aggiunte e 14 eliminazioni
  1. +14
    -14
      src/js/pannellum.js

+ 14
- 14
src/js/pannellum.js Vedi File

@@ -1713,21 +1713,21 @@ function createHotSpot(hs) {
span.style.cursor = 'pointer';
}
if(hs.draggable){
var dragListener = function(e){
var coords = mouseEventToCoords(e);
hs.pitch = coords[0];
hs.yaw = coords[1];
renderHotSpot(hs);
}
div.addEventListener('mousedown', (e) => {
div.addEventListener('mouseleave', (e) => {
div.removeEventListener('mousemove', dragListener);
var dragListener = function (e) {
var coords = mouseEventToCoords(e);
hs.pitch = coords[0];
hs.yaw = coords[1];
renderHotSpot(hs);
}
div.addEventListener('mousedown', (e) => {
div.addEventListener('mouseleave', (e) => {
div.removeEventListener('mousemove', dragListener);
});
div.addEventListener('mouseup', (e) => {
div.removeEventListener('mousemove', dragListener);
});
div.addEventListener('mousemove', dragListener);
});
div.addEventListener('mouseup', (e) => {
div.removeEventListener('mousemove', dragListener);
});
div.addEventListener('mousemove', dragListener);
});
}
hs.div = div;


Caricamento…
Annulla
Salva