瀏覽代碼

improved drag listener

pull/880/head
Nico Höllerich 7 年之前
父節點
當前提交
74503c2010
共有 1 個文件被更改,包括 14 次插入14 次删除
  1. +14
    -14
      src/js/pannellum.js

+ 14
- 14
src/js/pannellum.js 查看文件

@@ -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…
取消
儲存