Hi everyone.
I want to add hotspot via js after touchstart event been executed. So this hotspot should appear exactly in the place where user touched. So in desktop browser with click event it works fine. But in mobile browser with touchstart event it's not. In some case hotspot appear in wrong place not where user made touch. Here code that I use for this taks
Code
$(document).on('click touchstart', function(e) {
instance.chooseAttachmentPosMobile(e);
});
createHotspotMobile = function (name, posX, posY) {
var hotspot = this.krpano.addhotspot(name);
hotspot.loadstyle('hotspot_icon');
hotspot.ath = posX;
hotspot.atv = posY;
hotspot.onhover="showtext('test-name', hotspottextstyle);";
hotspot.scale = 1;
hotspot.renderer="css3d";
};
chooseAttachmentPosMobile = function(e){
var touch = e.originalEvent.touches;
var x = touch ? touch[0].pageX : e.pageX;
var y = touch ? touch[0].pageY : e.pageY;
var degreeCoordinates = this.krpano.screentosphere(x,y);
this.createHotspotMobile('test-name', degreeCoordinates.x, degreeCoordinates.y);
};
Display More
So here I grab pageX and pageY parameters from touch or click event and then by using screentosphere krpano method convert it to spherical coords. But like I said such approach works fine only for
click event In mobile browsers hotspot appear in wrong place.
So I wondering what i do wrong or maybe it some bug that related with krpano screentosphere method and mobile browsers?