Browse Source

improved drag listener

pull/880/head
Nico Höllerich 7 years ago
parent
commit
74503c2010
1 changed files with 14 additions and 14 deletions
  1. +14
    -14
      src/js/pannellum.js

+ 14
- 14
src/js/pannellum.js View 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;


Loading…
Cancel
Save