krpano点击场景获取点击位置的场景坐标
生活随笔
收集整理的這篇文章主要介紹了
krpano点击场景获取点击位置的场景坐标
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
實(shí)現(xiàn)目標(biāo)
在一個(gè)krpano全景作品中,通過(guò)點(diǎn)擊作品場(chǎng)景中任意的一個(gè)位置,獲取到鼠標(biāo)點(diǎn)擊的全景中的坐標(biāo)位置,ath,atv。
代碼
<krpano>···沒(méi)有寫(xiě)出一些其他的xml代碼<action name="mytest">screentosphere(mouse.x, mouse.y, toh, tov);jscall(calc('console.log("'+toh+'")'));jscall(calc('console.log("'+tov+'")'));</action><events onclick="mytest();"/> </krpano>- events指定了點(diǎn)擊事件,當(dāng)點(diǎn)擊后執(zhí)行mytest動(dòng)作;
- screentosphere動(dòng)作是krpano自帶的動(dòng)作,將鼠標(biāo)點(diǎn)擊的坐標(biāo)位置,mouse.x和mouse.y轉(zhuǎn)化成了場(chǎng)景坐標(biāo)位置,并將ath存放在toh變量中,atv存放在tov變量中。
- jscall動(dòng)作是krpano自帶的動(dòng)作,與具體的實(shí)現(xiàn)無(wú)關(guān),只是方便查看打印的內(nèi)容進(jìn)行調(diào)試。
總結(jié)
以上是生活随笔為你收集整理的krpano点击场景获取点击位置的场景坐标的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: TQ210——常见问题
- 下一篇: i3wm nm-applet每次开机都要