Print at Mar 7, 2021, 6:37:52 AM

Posted by boe666 at Dec 3, 2018, 1:44:47 PM
Re: Export HTML5 plug-in
My changed code:
var HPC = viewHome("viewerCanvas",
homeUrl,
onerror,
onprogression,
{roundsPerMinute: 0,
navigationPanel: "none",
aerialViewButtonId: "aerialView",
virtualVisitButtonId: "virtualVisit",
levelsAndCamerasListId: "levelsAndCameras",
activateCameraSwitchKey: true
});




function myfunction() {
var UP = HPC.getUserPreferences();
var HOME = HPC.getHome();
var items = HOME.getSelectableViewableItems();
console.log(items);
UP.setAerialViewCenteredOnSelectionEnabled(true);
var itemSel = [items[89]];
HOME.setSelectedItems(itemSel);
//ITS WORKING!


viewerCanvas.addEventListener("mouseup", function (e) {
//console.log(e);
var rect = HPC.getBoundingClientRect;
var x = e.clientX ;//- e.layerX;
var y = e.clientY ;//- e.layerY;
//log the x and y
console.log('mouse:' + x + ', ' + y );
//chceck item closest
console.log("Zaznaczono objekt:")
var obj = HPC.getComponent3D().getClosestItemAt(x,y);
console.log(obj);
// NOT WORKING, ALWAYS NULL

});
}
</script>

I can select item by "finger" (in code), but still i can;t do it by mouse. Please help.