Skip to content

Commit

Permalink
Add click callback to touch
Browse files Browse the repository at this point in the history
  • Loading branch information
slowe committed Aug 6, 2019
1 parent 3fcd54c commit aa554a3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 12 additions & 5 deletions virtualsky.js
Original file line number Diff line number Diff line change
Expand Up @@ -1401,17 +1401,19 @@ VirtualSky.prototype.createSky = function(){
}.bind(this)
};


function getXY(sky,o,el,e){
e.x = o.pageX - el.offset().left - window.scrollX;
e.y = o.pageY - el.offset().top - window.scrollY;
function getXYProperties(e,sky){
e.matched = sky.whichPointer(e.x,e.y);
var skyPos = sky.xy2radec(e.x,e.y);
if(skyPos){
e.ra = skyPos.ra / sky.d2r;
e.dec = skyPos.dec / sky.d2r;
}
return e;
return e;
}
function getXY(sky,o,el,e){
e.x = o.pageX - el.offset().left - window.scrollX;
e.y = o.pageY - el.offset().top - window.scrollY;
return getXYProperties(e,sky);
}

S("#"+this.idinner).on('click',{sky:this},function(e){
Expand Down Expand Up @@ -1533,6 +1535,11 @@ VirtualSky.prototype.createSky = function(){
x = x - this.offset().left - window.scrollX;
y = y - this.offset().top - window.scrollY;
contextMenuHandler.longPressStart(x, y);
if(e.data.sky.callback.click){
e.x = x;
e.y = y;
e.data.sky.callback.click.call(e.data.sky,getXYProperties(e,e.data.sky));
}
}
}).on('touchend',{sky:this},function(e){
e.data.sky.debug('touchend');
Expand Down
2 changes: 1 addition & 1 deletion virtualsky.min.js

Large diffs are not rendered by default.

0 comments on commit aa554a3

Please sign in to comment.