Hot.js 78 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000
  1. //合并热点和展览
  2. g_currentHot = null
  3. const playVideoWhenFlyOut = false
  4. //同时可播放的最大个数:
  5. const playVideoMax = window.isEdit ? 3 : browser.isMobile() ? 1 : 3;
  6. const playAniMax = window.isEdit ? 6 : browser.isMobile() ? 3 : 5;
  7. const playSyncGroup = [//需要播放同步的视频。 每次都单独定制
  8. // ['okh1UR466371', 'LGmLHP2615503' , 'VNyBI6614896'] //中,左,右 场景SHANGJJ
  9. ]
  10. window.initHot = function(model){
  11. var objLoader = new THREE.OBJLoader()
  12. var _planeGeometry = new THREE.PlaneGeometry(1,1)
  13. var _boxGeometry = new THREE.BoxBufferGeometry(1,1,1)
  14. {//ie的mesh 加了polygonOffset也是会重叠。所以去掉前面的face: (但是突然ie又播放不了videoTexture)
  15. var newIndex = [..._boxGeometry.index.array]
  16. newIndex.splice(4 * 6, 12)
  17. _boxGeometry.setIndex(new THREE.BufferAttribute(new Uint16Array(newIndex),1))
  18. }
  19. var originPhotoCount = photoLoaded = originModelCount = modelLoaded = 0;
  20. var defaultTex1 = Texture.load(g_HotImage.point);
  21. var defaultTex2 = Texture.load(g_HotImage.point2)
  22. dealMap(defaultTex1,{ignoreResize:true} );
  23. dealMap(defaultTex2,{ignoreResize:true} ); //这张图改为linear有黑边。 但即使不改,chrome调试手机版也有黑边和锯齿
  24. /* var _boxMat = new THREE.MeshBasicMaterial({
  25. color: "#eeeeee",
  26. transparent: !0,
  27. opacity: 0.8
  28. }) */
  29. var _boxMat = new THREE.MeshPhongMaterial({
  30. color: "#eeeeee",
  31. transparent: !0,
  32. opacity: 0.8,
  33. side:THREE.DoubleSide
  34. })
  35. var autoSizeInfo = /* {width2d:50}// */{minSize : 120, maxSize : 600, nearBound : 1 , farBound : 15}
  36. var hotGroup = new THREE.Object3D; hotGroup.name = "hotGroup"
  37. model.add(hotGroup); model.hotGroup = hotGroup
  38. var animateTexSrcs = {}
  39. var getLink = function(link){
  40. var src = '';
  41. var r = link.substring(link.indexOf("html") + 4)
  42. , o = "en" == manage.number("lang") ? "&lang=" + manage.number("lang") : "";
  43. -1 == r.indexOf("?") ? src = link + "?time=" + randomTime().getTime() + "&id=" + window.number + o : src = link + "&time=" + randomTime().getTime() + "&id=" + window.number + o
  44. return src.replace('https://www.4dmodel.com/SuperTwo/hot_online1',window.myTitUrl+'hot')
  45. }
  46. var removeSrcPostMark = function(url){//去除texture.load时自动加上的'?'
  47. var index = url.indexOf('?')
  48. if(index>-1){
  49. return url.slice(0, index)
  50. }else return url
  51. }
  52. {//get plane Bound
  53. var planeBound = new THREE.Box3()
  54. var cornerPoint = [
  55. new THREE.Vector3(-0.5, 0.5, 0),
  56. new THREE.Vector3(0.5, 0.5, 0),
  57. new THREE.Vector3(0.5, -0.5, 0),
  58. new THREE.Vector3(-0.5, -0.5, 0),
  59. ]
  60. cornerPoint.forEach(e=>{
  61. planeBound.expandByPoint(e)
  62. })
  63. }
  64. var shineMats = [];
  65. var getShineMat = function(texture1, texture2){
  66. var mat = shineMats.find(e=>e.uniforms.texture1.value == texture1 && e.uniforms.texture2.value == texture2)
  67. if(mat) return mat
  68. else{
  69. var mat = new THREE.ShaderMaterial({
  70. uniforms: {
  71. opac: {
  72. type: "f",
  73. value: 0
  74. },
  75. texture1: {
  76. type: "t",
  77. value: texture1
  78. },
  79. texture2: {
  80. type: "t",
  81. value: texture2
  82. }
  83. },
  84. vertexShader: "varying vec2 vUv;\n\nvoid main() {\n\n vUv = uv ;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n}\n",
  85. fragmentShader: "varying vec3 vNormal;\n\nvarying vec2 vUv;\n\nuniform float opac;\n\n uniform sampler2D texture1;\n\nuniform sampler2D texture2;\n\nvoid main() {\n\nvec4 tcolor1 = texture2D( texture1, vUv );\n\nvec4 tcolor2 = texture2D( texture2, vUv );\n\ngl_FragColor = mix(tcolor1,tcolor2 ,opac) + tcolor2*0.2; }\n"
  86. ,transparent: !0
  87. })
  88. shineMats.push(mat)
  89. return mat
  90. }
  91. }
  92. var modelGeos = [];
  93. var getModelGeo = function(url){
  94. var geo = modelGeos.find(e=>e.url = url )
  95. if(geo) return geo
  96. else{
  97. var geo = null;
  98. geo.url = url
  99. }
  100. }
  101. class Hot extends THREE.Object3D{
  102. constructor(info, source){
  103. super()
  104. this.sid = info.sid;
  105. this.preDeal(info, source)// source:旧版来源
  106. this.info = info
  107. this.cornerPoints = []
  108. this.build(info);
  109. this.name = "hot_" + this.sid ;
  110. model.hots[info.sid] = this
  111. }
  112. build(info) {
  113. hotGroup.add(this)
  114. this.setTitleElem()
  115. this.setFromInfo(info)
  116. }
  117. setFromInfo(info, media, objObject) {
  118. //1 恢复到编辑之前 2 初始加载
  119. var plane = this.plane;
  120. /* var transformAtPanos = {}
  121. for(var i in info.transformAtPanos){
  122. transformAtPanos[i] = {//只保留一个位移,主要原因是大小变化和热点大小设置冲突了, isSprite和qutaernion衝突
  123. pos : info.transformAtPanos[i].pos && info.transformAtPanos[i].pos.clone(),
  124. //qua : info.transformAtPanos[i].qua && info.transformAtPanos[i].qua.clone(),
  125. }
  126. }
  127. this.transformAtPanos = transformAtPanos */
  128. //2024.3.18恢复transformAtPanos三个属性,isSprite优先级高于quaternion, 全局的热点大小改变不会影响当前有transformAtPanos的大小
  129. //在每个漫游点独立设置的position。
  130. var curPanoTransform = this.info.transformAtPanos[ getTransformSid()] || {}
  131. //没有单独设置position的漫游点使用的position
  132. this.position.copy(curPanoTransform.pos || info.position)
  133. this.quaternion.copy(curPanoTransform.quaternion || info.quaternion)
  134. this.scale.copy(curPanoTransform.scale || info.scale)
  135. this.changeTexType(info.texType, media)
  136. if(!info.objSrc){
  137. this.addPlane()
  138. if (!!this.hasBox != !!info.hasBox) {
  139. this.addBox(!this.hasBox);
  140. }
  141. }else{
  142. this.addModel(objObject || new THREE.Mesh())//暂时创建个空的
  143. }
  144. this.updateMatrixWorld()
  145. /* if(!this.info.visiblePanos){//移到model.build时,在collider建好之后
  146. this.getVisiblePanos()
  147. } */
  148. {//gif
  149. if(this.animation){
  150. GifTexDeal.remove(this.animation)
  151. }
  152. if(this.info.animateInfo && this.material_.map){
  153. this.animation = GifTexDeal.addAnimation(this.material_.map, this, this.info.animateInfo, this.sid )
  154. this.visible && this.inSight() && GifTexDeal.start(this.animation)
  155. }
  156. }
  157. /* if(this.info.modelBound){
  158. this.mesh.updateMatrixWorld()
  159. this.mesh.boxHelper2 = new THREE.Box3Helper( new THREE.Box3().copy(this.info.modelBound.bound).applyMatrix4(this.mesh.matrixWorld), new THREE.Color("#00aaee"));
  160. model.add(this.mesh.boxHelper2)
  161. }else{
  162. var bound = new THREE.Box3()
  163. var cornerPoint = [
  164. new THREE.Vector3(-0.5, 0.5, 0),
  165. new THREE.Vector3(0.5, 0.5, 0),
  166. new THREE.Vector3(0.5, -0.5, 0),
  167. new THREE.Vector3(-0.5, -0.5, 0),
  168. ]
  169. cornerPoint.forEach(e=>{
  170. bound.expandByPoint(e)
  171. })
  172. this.mesh.updateMatrixWorld()
  173. this.mesh.boxHelper2 = new THREE.Box3Helper( bound.applyMatrix4(this.mesh.matrixWorld), new THREE.Color("#00aaee"));
  174. model.add(this.mesh.boxHelper2)
  175. } */
  176. }
  177. changeTexType(texType, media){
  178. var plane = this.plane;
  179. if( this.texType != texType || media == 'clear'){
  180. //删除旧的
  181. if(this.texType == 'shine'){
  182. /* this.material_.uniforms.texture1.value.dispose()
  183. this.material_.uniforms.texture2.value.dispose() */ //为了恢复 不删
  184. }else{
  185. //this.material_.map.dispose()
  186. if(this.texType == 'video'){
  187. this.texMedia && this.texMedia.pause()
  188. }else{
  189. }
  190. }
  191. if(this.material_ && !hotGroup.children.find(e=>e!=this && e.material_ == this.material_ )){
  192. this.material_.dispose()
  193. }
  194. //添加新的
  195. if(texType == 'shine'){
  196. }else{
  197. this.changeMaterial(new THREE.MeshBasicMaterial({
  198. color: "#00c8af",
  199. opacity: 0.4,
  200. transparent: !0,
  201. polygonOffset: true,
  202. //是否开启多边形偏移 //ie不开启时blank也不会闪烁
  203. polygonOffsetFactor: -0.9,
  204. //多边形偏移因子
  205. polygonOffsetUnits: -4.0,
  206. //多边形偏移单位
  207. }))
  208. if(texType == 'video'){
  209. }else{
  210. }
  211. }
  212. }
  213. this.texType = texType
  214. if(media == 'clear'){
  215. this.material_.opacity = 0.4;
  216. this.texMedia = null
  217. return
  218. }
  219. if(texType == 'video'){//视频不能共用一个,否则会一起播放暂停
  220. var video
  221. if(media){
  222. video = media
  223. }else{
  224. if(!this.info.texSrc)return
  225. var video = $(`<video controls="controls" loop x5-playsinline="" webkit-playsinline="true" playsinline="true" controlslist="nodownload" preload="meta" ></video>`)[0]
  226. if(window.isEdit) video.src = manage.dealURL(this.info.texSrc); //注意,src赋值就会自动加载, preload="meta" 只加载元数据,提高加载速度,否则一开始卡
  227. /* let src = this.info.texSrc
  228. if(window.isEdit) src = manage.dealURL(src);
  229. var video = window.videoPlayer.getVideo(src)*/
  230. video.name = this.info.fileName
  231. }
  232. video.setAttribute("crossOrigin", 'Anonymous')//要在src设置好前解决跨域
  233. $(video).on('contextmenu', function() {
  234. return false;
  235. });//禁止右键点击出
  236. this.texMedia = video;
  237. video.oncanplaythrough = (e)=> {
  238. if(this.texMedia == video){
  239. /* if(video.paused) *///console.log({str:'oncanplaythrough '+this.sid, level:1})
  240. //this.material_.map.needsUpdate = !0 //当初为何加这句?
  241. //this.update(player)
  242. }
  243. }
  244. /* video.onloadstart = (e)=> {
  245. console.log({str:'onloadstart '+this.sid, level:1})
  246. }
  247. video.onloadedmetadata = (e)=> {
  248. console.log({str:'onloadedmetadata '+this.sid, level:1})
  249. }
  250. video.onloadeddata = (e)=> {
  251. console.log({str:'onloadeddata '+this.sid, level:1})
  252. }
  253. video.oncanplay = (e)=> {
  254. console.log({str:'oncanplay '+this.sid, level:1})
  255. } */
  256. video.volume = 0
  257. video.muted = true
  258. video.currentTime = 0
  259. if(!window.isEdit) this.material_.opacity = 0.3;
  260. this.material_.map = new THREE.VideoTexture(video)
  261. this.material_.map.wrapS = this.material_.map.wrapT = THREE.ClampToEdgeWrapping;
  262. this.material_.map.generateMipmaps = true;
  263. }else if(texType == 'photo'){
  264. if(media){
  265. this.texMedia = media;
  266. this.info.texSrc = media.src;
  267. this.material_.map = new THREE.Texture(); //texture也不能共用一个,因为有的会有动画,就不一样
  268. this.material_.map.image = media //image可以共用
  269. this.material_.map.needsUpdate = !0
  270. this.material_.opacity = 1
  271. }else{
  272. if(!this.info.texSrc)return
  273. this._loadDones = []
  274. this.material_.opacity = 0.1;
  275. }
  276. }else if(texType == 'shine'){
  277. if(media){
  278. this.changeShineTex(media)
  279. }else{
  280. this.styleImg = /* this.styleImg || */ [];
  281. if(this.info.styleImg){
  282. this.styleImg = this.info.styleImg.map((src)=>{
  283. return {src:/* manage.dealURL( */src } //如果要dealURL,在predeal里
  284. })
  285. }
  286. this.changeShineTex(this.styleImg)
  287. }
  288. this.info.texSrc = null
  289. }
  290. if(this.material_.map){
  291. /* this.material_.map.minFilter = THREE.LinearFilter;
  292. this.material_.map.magFilter = THREE.LinearFilter; */
  293. dealMap(this.material_.map);
  294. this.material_.color.set("#FFFFFF");
  295. this.material_.needsUpdate = true
  296. }
  297. }
  298. changeShineTex(styleImg){
  299. styleImg = styleImg || this.styleImg
  300. var tex1, tex2
  301. if(styleImg.length){
  302. tex1 = Texture.load(styleImg[0].src);
  303. tex2 = Texture.load(styleImg[1]&&styleImg[1].src || styleImg[0].src);
  304. dealMap(tex1,{ignoreResize:true} )
  305. dealMap(tex2,{ignoreResize:true} )
  306. }else{
  307. tex1 = defaultTex1;
  308. tex2 = defaultTex2;
  309. }
  310. this.changeMaterial(getShineMat(tex1, tex2))
  311. this.styleImg = styleImg
  312. this.info.styleImg = styleImg.map(img=>img.src)
  313. }
  314. changeMaterial(mat){
  315. this.material_ = mat;
  316. this.mesh && this.mesh.traverse((mesh)=>{
  317. if(mesh.material && !(mesh instanceof THREE.Box3Helper)){
  318. mesh.material = this.material_;
  319. }
  320. })
  321. }
  322. preDeal(info, source){// source:来源
  323. var convertValue = function(v ,Type){
  324. var value;
  325. if(v instanceof Array){
  326. v.forEach((v1)=>{v1 = parseFloat(v1)})
  327. value = new Type().fromArray(v);
  328. }else{
  329. if(!(v instanceof Type)){
  330. for(let i in v){v[i] = parseFloat(v[i])}
  331. value = new Type().copy(v);
  332. }else{
  333. value = v
  334. }
  335. }
  336. return value
  337. }
  338. if (!info.transformAtPanos) info.transformAtPanos = {}
  339. if(source == 'byHot'){
  340. var infoAttribute = info.infoAttribute || {}
  341. info.title = infoAttribute.title || info.title
  342. info.model = infoAttribute.model || info.model || [] //模型链接
  343. info.images = infoAttribute.images || info.images || []
  344. info.video = infoAttribute.video || info.video || []
  345. info.bgName = infoAttribute.bgName || info.bgName
  346. info.backgroundMusic = info.backgroundMusic || info.backgroundMusic
  347. info.iframe = infoAttribute.iframe || info.iframe || []
  348. info.styleImg = infoAttribute.styleImg || info.styleImg || []
  349. info.content = infoAttribute.content || info.content
  350. {
  351. let action = CloneObject(settings.hotClickEvent.shine);
  352. if(info.actionType == 'noAction' || info.noAction){
  353. action.examine = false,
  354. action.openHot = false
  355. }else if(info.actionType == 'dontExam'){
  356. action.examine = false
  357. }
  358. info.actionType = action
  359. }
  360. if(info.quaternion){
  361. info.quaternion = convertValue(info.quaternion, THREE.Quaternion )
  362. }else{
  363. info.rotation = convertValue(info.rotation, THREE.Vector3 )
  364. info.quaternion = new THREE.Quaternion().setFromEuler( new THREE.Euler().setFromVector3(info.rotation)) //热点的旧数据很多是字符串
  365. }
  366. var s = Hot.getDefaulScale(info.hotIconScale) //旧版的大小,统一转换成新版
  367. info.scale = new THREE.Vector3(s,s,0.02)
  368. delete info.infoAttribute;
  369. /* for (let i in this.transformAtPanos) {
  370. info.transformAtPanos[i].pos = new THREE.Vector3().fromArray(info.transformAtPanos[i].pos)
  371. info.transformAtPanos[i].qua && (info.transformAtPanos[i].qua = new THREE.Quaternion().fromArray(info.transformAtPanos[i].qua))
  372. } */
  373. info.texType = "shine"
  374. }else{
  375. if(source == 'byOverlay'){
  376. info.texType = info.media[0]
  377. //info.title = info.texType == 'video'?'视频':'图片'
  378. info.texSrc = info.file
  379. info.actionType = CloneObject(settings.hotClickEvent[info.texType]);//给一个默认
  380. delete info.media
  381. info.quaternion = convertValue(info.qua, THREE.Quaternion)
  382. info.position = info.pos
  383. delete info.pos;
  384. delete info.qua;
  385. let a = info.texSrc.split('/');
  386. info.fileName = a.pop()
  387. info.scale = new THREE.Vector3(
  388. info.width,
  389. info.height,
  390. info.depth
  391. )
  392. delete info.width; delete info.height; delete info.depth;
  393. delete info.file
  394. }else{
  395. info.quaternion = new THREE.Quaternion().setFromEuler(new THREE.Euler().fromArray(info.rotation))//.setFromVector3(info.rotation)
  396. }
  397. info.model = info.model || [] //模型链接
  398. info.images = info.images || []
  399. info.video = info.video || []
  400. info.iframe = info.iframe || []
  401. info.styleImg = info.styleImg || []
  402. info.imagesDesc = info.imagesDesc || []
  403. info.videosDesc = info.videosDesc || []
  404. info.titleShowType = info.titleShowType || 'hover'
  405. info.titlePos = info.titlePos || 'right'
  406. }
  407. if(info.texSrc){
  408. info.texSrc = manage.removeSrcPostMark(info.texSrc)
  409. }
  410. //whole:
  411. //为了兼容旧数据,尽量和hot的数据靠近,最后保存在hot里
  412. info.position = convertValue(info.position, THREE.Vector3)
  413. info.scale = convertValue(info.scale, THREE.Vector3)
  414. delete info.rotation //暂时不用,只有保存时才存为roration
  415. info.linkType = info.linkType || "common"
  416. for (let i in info.transformAtPanos) {
  417. info.transformAtPanos[i].pos = new THREE.Vector3().fromArray(info.transformAtPanos[i].pos)
  418. info.transformAtPanos[i].qua && (info.transformAtPanos[i].qua = new THREE.Quaternion().fromArray(info.transformAtPanos[i].qua))
  419. info.transformAtPanos[i].scale && (info.transformAtPanos[i].scale = new THREE.Vector3().fromArray(info.transformAtPanos[i].scale))
  420. }
  421. }
  422. addBox(state) {
  423. if (state == !!this.hasBox) {
  424. return;
  425. }
  426. if (state) {
  427. var box = new THREE.Mesh(_boxGeometry,_boxMat)
  428. box.position.set(0, 0, 1 / 2);
  429. box.renderOrder = 3
  430. this.plane.position.set(0, 0, 1);
  431. this.add(box);
  432. this.box = box;
  433. } else {
  434. this.plane.position.set(0, 0, 0);
  435. this.remove(this.box);
  436. this.box = null;
  437. }
  438. this.hasBox = this.info.hasBox = state
  439. }
  440. /* getSizeByScale() {
  441. return {
  442. width: settings.defaultOverlaySize[0] * this.scale.x,
  443. height: settings.defaultOverlaySize[1] * this.scale.y
  444. }
  445. }
  446. getScaleBySize(width, height) {
  447. return {
  448. x: width / settings.defaultOverlaySize[0],
  449. y: height / settings.defaultOverlaySize[1],
  450. }
  451. }*/
  452. setVisiblePanos(visibleData){
  453. if(visibleData)this.info.visiblePanos = visibleData
  454. else if(!this.info.visiblePanos) this.getVisiblePanos()
  455. }
  456. getVisiblePanos(){//在不同点还不一样
  457. var depth = this.hasBox ? this.scale.z : 0;
  458. var width = this.scale.x, height = this.scale.y
  459. var cornerPoint
  460. if(this.plane){
  461. cornerPoint = [
  462. new THREE.Vector3(0, 0, depth),
  463. new THREE.Vector3(-width/2, height/2, depth),
  464. new THREE.Vector3(width/2, height/2, depth),
  465. new THREE.Vector3(width/2, -height/2, depth),
  466. new THREE.Vector3(-width/2, -height/2, depth),
  467. ]
  468. }else{
  469. var bound = new THREE.Box3().copy(this.info.modelBound.bound)
  470. var center = bound.center()
  471. cornerPoint = [
  472. new THREE.Vector3(center.x,center.y,center.z),
  473. new THREE.Vector3(bound.min.x, bound.min.y, bound.min.z ),
  474. new THREE.Vector3(bound.min.x, bound.min.y, bound.max.z ),
  475. new THREE.Vector3(bound.min.x, bound.max.y, bound.min.z ),
  476. new THREE.Vector3(bound.max.x, bound.min.y, bound.min.z ),
  477. new THREE.Vector3(bound.max.x, bound.max.y, bound.min.z ),
  478. new THREE.Vector3(bound.max.x, bound.min.y, bound.max.z ),
  479. new THREE.Vector3(bound.min.x, bound.max.y, bound.max.z ),
  480. new THREE.Vector3(bound.max.x, bound.max.y, bound.max.z ),
  481. ];
  482. }
  483. var getPos = (position)=>{//每个overlay位置对应5个坐标,plane中心和四个角的位置
  484. if(this.plane){
  485. return cornerPoint.map(e=>{
  486. return e.clone().applyQuaternion(this.info.quaternion).add(position)
  487. })
  488. }else{
  489. var matrixWorld = new THREE.Matrix4().compose(position, this.quaternion, this.scale)
  490. matrixWorld.multiplyMatrices(matrixWorld, this.mesh.matrix)
  491. return cornerPoint.map(e=>{
  492. return e.clone().applyMatrix4(matrixWorld);
  493. })
  494. }
  495. }
  496. this.info.visiblePanos = []
  497. var customPositions = getPos(this.info.position )
  498. var posAtPanos = {}
  499. for(let panoId in this.info.transformAtPanos){
  500. if(panoId == 'outSide')continue;
  501. posAtPanos[panoId] = getPos(this.info.transformAtPanos[panoId].pos )
  502. }
  503. let maxCount = browser.isMobile() ? 2000 : 5000
  504. let possiblePanos = model.panos.list
  505. if(this.plane){//目前都是单面,所以只要可以看到的一面的热点
  506. let dir1 = new THREE.Vector3(0,0,-1).applyQuaternion(this.quaternion).negate()
  507. possiblePanos = possiblePanos.filter(pano=>{
  508. let dir2 = new THREE.Vector3().subVectors(pano.position, this.position).normalize();
  509. return dir1.dot(dir2)>0
  510. })
  511. }
  512. let c = model.panos.list.length * model.colliders.length
  513. if(window.isEdit || c < maxCount){ //编辑页面保险起见还是全部算完后才可浏览,就能保证保存全部的visiblePano
  514. this.info.visiblePanos = common.getVisiblePano(customPositions, possiblePanos , {
  515. model: model.colliders , posAtPanos
  516. })
  517. }else{
  518. let start = 0
  519. let interval = setInterval(()=>{
  520. let end = start + Hot.visiPanosCountSlice;
  521. end = Math.min(end, possiblePanos.length)
  522. let i = start
  523. start = end
  524. let panos = possiblePanos.slice(i,end)
  525. this.info.visiblePanos = this.info.visiblePanos.concat( common.getVisiblePano(customPositions, panos, {
  526. model: model.colliders , posAtPanos
  527. }));
  528. if(end>=possiblePanos.length){
  529. //console.log(window.hotsi ?(++window.hotsi): (window.hotsi = 1))
  530. clearInterval(interval)
  531. }
  532. }, Hot.visiEveryDurSlice )// visiEveryDurSlice 等在main中定义
  533. }
  534. }
  535. updateVisible(panos, visibility, type) {
  536. if(window.isEdit && editTool.hotpoint.editSpot == this){
  537. return this.visible = true
  538. }
  539. this.visible = visibility != void 0 ? visibility : (!this.info.visiblePanos ||
  540. (type == 'every' ? panos.every(pano=>this.info.visiblePanos.includes(pano.id)) : panos.some(pano=>this.info.visiblePanos.includes(pano.id))))//type为every时,需要panos中每个都可见才显示
  541. this.titleElem && this.titleElem.setVisible(this.visible, 'hotVisible', 1)
  542. if (this.texType == 'video'){
  543. //this.switchPlay(this.visible, this.visible ? null : 'stop' );//可见时不操作;不可见时停止
  544. this.update(player)
  545. }
  546. }
  547. getBoundOri(){
  548. let bound
  549. if(this.objObject){
  550. bound = new THREE.Box3().copy(this.info.modelBound.bound)
  551. }else{
  552. bound = planeBound.clone()
  553. }
  554. return bound
  555. }
  556. getCornerPoint(){//获取在每个漫游点上的视觉边界点 可以打开boxHelper和addBall来观测是否准确
  557. if(this.cornerPoints[player.currentPano.id]){
  558. return this.cornerPoints[player.currentPano.id]
  559. }else{
  560. var boundPoint, cornerPoint
  561. var center//中心点
  562. if(this.plane){
  563. center = this.plane.getWorldPosition()
  564. boundPoint = [
  565. new THREE.Vector3(-0.5, 0.5, 0),
  566. new THREE.Vector3(0.5, 0.5, 0),
  567. new THREE.Vector3(0.5, -0.5, 0),
  568. new THREE.Vector3(-0.5, -0.5, 0),
  569. ]
  570. }else{
  571. var bound = new THREE.Box3().copy(this.info.modelBound.bound)
  572. boundPoint = [
  573. new THREE.Vector3(bound.min.x, bound.min.y, bound.min.z ),
  574. new THREE.Vector3(bound.min.x, bound.min.y, bound.max.z ),
  575. new THREE.Vector3(bound.min.x, bound.max.y, bound.min.z ),
  576. new THREE.Vector3(bound.max.x, bound.min.y, bound.min.z ),
  577. new THREE.Vector3(bound.max.x, bound.max.y, bound.min.z ),
  578. new THREE.Vector3(bound.max.x, bound.min.y, bound.max.z ),
  579. new THREE.Vector3(bound.min.x, bound.max.y, bound.max.z ),
  580. new THREE.Vector3(bound.max.x, bound.max.y, bound.max.z ),
  581. ];
  582. }
  583. var maxLon = -Infinity
  584. var minLon = +Infinity
  585. var maxLat = -Infinity
  586. var minLat = +Infinity
  587. var pos1 = player.currentPano.position.clone();
  588. center = this.position.clone() //模型bound的中心点已经位移到了hot中心点。 注意不能用getWorldPosition,得到的会是偏移的
  589. var dir = center.clone().sub(pos1).normalize()
  590. var centerDirInfo = { }
  591. player.cameraControls.controls.panorama.lookAt.call( centerDirInfo , null, dir )
  592. boundPoint.forEach(e=>{//lon左右
  593. var point = e.applyMatrix4(this.mesh.matrixWorld);
  594. var dir = point.clone().sub(pos1).normalize()
  595. var dirInfo = { }
  596. player.cameraControls.controls.panorama.lookAt.call( dirInfo , null, dir )
  597. var diffLon = (dirInfo.lon-centerDirInfo.lon) % 360
  598. if(Math.abs(diffLon)>180){//因为有时需要根据符号判断是在中心的左边还是右边,所以限制在180内
  599. diffLon += (diffLon>0 ? -360 : 360)
  600. }
  601. var diffLat = dirInfo.lat-centerDirInfo.lat
  602. maxLon = Math.max(diffLon, maxLon)
  603. minLon = Math.min(diffLon, minLon)
  604. maxLat = Math.max(diffLat, maxLat)
  605. minLat = Math.min(diffLat, minLat)
  606. })
  607. var diffLon = maxLon - minLon
  608. var diffLat = maxLat - minLat
  609. if(diffLat>180) {//可能是到了反面。不好算,直接返回所有boundPoint
  610. cornerPoint = boundPoint
  611. }else{
  612. //读取lon lat的最大最小值,勾勒出一个没有倾斜的矩形 。它比boundPoint看起来范围更大些
  613. maxLon = maxLon + centerDirInfo.lon
  614. maxLat = maxLat + centerDirInfo.lat
  615. minLon = minLon + centerDirInfo.lon
  616. minLat = minLat + centerDirInfo.lat
  617. var dirs = [
  618. math.getDirByLonLat(maxLon, maxLat),
  619. math.getDirByLonLat(minLon, minLat),
  620. math.getDirByLonLat(maxLon, minLat),
  621. math.getDirByLonLat(minLon, maxLat),
  622. ]
  623. cornerPoint = dirs.map(e=>{
  624. return e.clone().add(pos1)
  625. })
  626. cornerPoint = [center, ...cornerPoint] //最后增加一个中心点
  627. }
  628. /* if(this.objObject){
  629. cornerPoint = [pos2, ...cornerPoint]
  630. } */
  631. //addPoints(cornerPoint)
  632. this.cornerPoints[player.currentPano.id] = {cornerPoint, diffLon, diffLat}
  633. return this.cornerPoints[player.currentPano.id]
  634. }
  635. }
  636. getMediaSize(){
  637. let size = new THREE.Vector2;
  638. if(this.texMedia){
  639. if(this.texType == 'photo'){
  640. size.x = this.texMedia.width;
  641. size.y = this.texMedia.height;
  642. //动画的话再变
  643. if(this.info.animateInfo){
  644. size.x /= this.info.animateInfo.cellXcount
  645. size.y /= this.info.animateInfo.cellYcount
  646. }
  647. }else{
  648. size.x = this.texMedia.videoWidth || this.videoWidth
  649. size.y = this.texMedia.videoHeight || this.videoHeight
  650. }
  651. }
  652. return size
  653. }
  654. inSight(){
  655. //return true
  656. if(window.isEdit)return true // 太容易move了
  657. if(player.mode == 'panorama' && player.currentPano){
  658. if(!player.camera) return
  659. var cornerPointInfo = this.getCornerPoint();
  660. var cornerPoint
  661. let min = new THREE.Vector2(5,5)
  662. let scaleRatio = 1/player.zoomLevel;
  663. //根据media原始大小来调整阈值: media的原始大小能代表期望显示的大小,如果显示大小的远小于期望大小,就不显示(此时能感受到贴图锯齿严重,清晰度被浪费)。比如如果gif是一个很小的按钮,即使diffLon很小也要显示。缺点:需要用户根据所需上传合适清晰度的图。
  664. let size = this.getMediaSize()
  665. if(size.x>0){
  666. scaleRatio *= Math.sqrt(size.x * size.y) / 1000
  667. }
  668. min.multiplyScalar(scaleRatio)
  669. if(cornerPointInfo.diffLon < min.x || cornerPointInfo.diffLat < min.y ){
  670. //console.log('two far and small')
  671. return false
  672. }
  673. if(cornerPointInfo.diffLon < 15 && cornerPointInfo.diffLat < 15){//当很小的时候,只判断中心点即可
  674. cornerPoint = [cornerPointInfo.cornerPoint[0]];
  675. }else{
  676. cornerPoint = cornerPointInfo.cornerPoint
  677. }
  678. for(let i=0,j=cornerPoint.length;i<j;i++){//只要有一点可见就算看见
  679. var pos2d = math.getPos2d(cornerPoint[i], player.camera, $("#player")[0])
  680. if(pos2d.trueSide && pos2d.inSight) return true
  681. }
  682. }else{//飞出 只判断在不在画面内
  683. //return playVideoWhenFlyOut//true
  684. let frustumMatrix = new THREE.Matrix4
  685. frustumMatrix.multiplyMatrices(player.camera.projectionMatrix, player.camera.matrixWorldInverse)
  686. let frustum = new THREE.Frustum();
  687. frustum.setFromMatrix(frustumMatrix)
  688. let bound = this.getBoundOri()
  689. bound.applyMatrix4(this.matrixWorld)
  690. return frustum.intersectsBox(bound)
  691. }
  692. }
  693. update(player){
  694. if(this.info.isSprite){
  695. this.quaternion.copy(player.camera.quaternion)
  696. }
  697. this.updateScale()
  698. this.updateTitle()
  699. }
  700. updateScale(e, t) {//自适应调节大小
  701. if(!DATA.autoAdjustHotScale || this.texType != 'shine' || !this.plane )return
  702. var scale = convertTool.getScaleForConstantSize($.extend({},autoSizeInfo,{
  703. position: this.position.clone()
  704. }))
  705. this.plane.scale.set(scale,scale,scale)
  706. }
  707. switchPlay(state){//手动播放暂停
  708. this.pausedByUser = !state
  709. this.videoControl(state)
  710. }
  711. loadVideo(video){
  712. if(video.src_)return
  713. video.src = video.src_ = manage.dealURL(this.info.texSrc);
  714. }
  715. videoControl(state){
  716. if(this.texType != "video" || !this.material_.map)return
  717. var video = this.texMedia
  718. this.shouldPlay = state
  719. if(!state || state == 'stop'){
  720. if(!video.paused){
  721. video.pause()
  722. //console.log({str: "paused " + this.sid, level:1})
  723. }
  724. /* video.lastCurTime = state == 'stop' ? 0 : video.currentTime //记录
  725. video.src = video.src_ = '' */
  726. if(state == 'stop'){
  727. video.currentTime = 0;
  728. }
  729. }else if(state){
  730. if(/* !isVideoPlayed(video) */ video.paused ){
  731. //console.log({str: 'videoControl play ' +", "+ this.sid, level:1})
  732. this.loadVideo(video)
  733. video.play()
  734. //video.currentTime = video.lastCurTime || 0
  735. this.changeOpaWhenPlay(video)
  736. //处理同步播放
  737. let group = playSyncGroup.find(e=>e.includes(this.sid))
  738. if(group){
  739. let others = group.filter(e=>e != this.sid).map(e=>player.model.hots[e].texMedia)
  740. //console.log('controlVideo play', this.id, 'other currentTime', others.map(e=>e.currentTime))
  741. video.currentTime = others[0].currentTime
  742. }
  743. //if(isVideoPlayed(video))console.log({str:"played " + this.sid + video.duration ,level:1})
  744. }
  745. }
  746. }
  747. changeOpaWhenPlay(video){//当播放成功后,恢复为不透明
  748. if(isNaN(video.duration)){//未加载好
  749. return setTimeout(()=>{
  750. this.changeOpaWhenPlay(video)
  751. },100)
  752. }
  753. const minPlayedTime = Math.min(video.duration/10, 0.1); //到这个时间说明加载成功
  754. if(!video.hasInitedOpacity){
  755. setTimeout(e=>{
  756. //console.log('trychangeOpa ',this.sid,video.currentTime)
  757. if(video.currentTime>minPlayedTime){
  758. this.material_.opacity = 1
  759. video.hasInitedOpacity = true
  760. //console.log('changeOpaWhenPlay',this.sid)
  761. }else{
  762. if(!video.paused){//再次尝试
  763. return setTimeout(()=>{
  764. this.changeOpaWhenPlay(video)
  765. },500)
  766. }
  767. }
  768. },minPlayedTime*1000+500)
  769. }
  770. }
  771. /* setDefaultHotScale = function(){//设置成默认热点大小
  772. var w = DATA.hotIconScale) * g_HotMeshSize.g_HotMeshWidth
  773. this.scale.set( w, w, this.scale.z)
  774. } */
  775. setTitleElem(){
  776. var title = this.info.title;
  777. if(title){
  778. if(!this.titleElem){
  779. this.titleElem = new Label2D({position:this.position, innerHTML:`<div>${title}</div>`, domElement:$("#hot")[0], shelterByModel:true })
  780. }else{
  781. this.titleElem.elem.html(`<div>${title}</div>`)
  782. }
  783. this.titleElem.setVisible(this.visible, 'hotVisible')
  784. this.setHoverState(false)
  785. this.setTitleDir()
  786. }else{
  787. if(this.titleElem){
  788. this.titleElem.dispose()
  789. this.titleElem = null;
  790. }
  791. }
  792. }
  793. setTitleDir(){
  794. this.titleElem && this.titleElem.elem.attr('pos',this.info.titlePos)
  795. }
  796. updateTitle(){
  797. this.titleElem && this.titleElem.update()
  798. }
  799. setHoverState(state){
  800. if(!this.titleElem)return
  801. this.hovered = !!state
  802. var v = this.info.titleShowType != 'unvisible' && (this.info.titleShowType == 'always' || this.hovered)
  803. this.titleElem.setVisible(v, 'hoveredVisi', 1)
  804. //this.updateTitle()
  805. }
  806. closestPanoTowardTag(e, t) {
  807. var i = []
  808. , n = []
  809. , r = this.mesh.getWorldPosition();
  810. if (e === "panorama") {
  811. /* var o = t.position.clone().sub(r).normalize();
  812. n.push(function(t, i) {//scoreFunctions.direction 最好这个漫游点在currentPano到热点之间的路径上。但是这样的话可能就看不到热点正面,所以删掉
  813. return function(e) {
  814. return e.position.clone().sub(t).normalize().dot(i) * window._settings.navigation.directionFactor
  815. }}(r, o)
  816. ) */
  817. }
  818. var a = new THREE.Vector3;
  819. i.push(function(e) {
  820. return Math.abs(e.position.x - r.x) > window._settings.tags.visibility.cameraClearance || Math.abs(e.position.z - r.z) > window._settings.tags.visibility.cameraClearance
  821. },
  822. function(e) {
  823. a.copy(r).sub(e.position);
  824. var t = -THREE.Math.radToDeg(Math.atan(a.y / Math.sqrt(a.x * a.x + a.z * a.z)))
  825. , i = window._settings.tags.navigate.tiltTolerance
  826. return window._settings.insideLookLimitDown - i < t && t < window._settings.insideLookLimitUp + i
  827. },
  828. (pano)=>{ // add
  829. return player.checkHasNeighbor(pano)
  830. },
  831. (pano)=>{ // add
  832. // 周恩光改 解决visiblePanos为undefined时的bug
  833. return !this.info.visiblePanos || this.info.visiblePanos.includes(pano.id)
  834. }
  835. )
  836. n.push(
  837. (function(hot, i) { //scoreFunctions.distanceSquared
  838. return function(pano) {
  839. //i = a.navigation.distanceFactor
  840. return hot ? hot.position.distanceToSquared(pano.position) * i : 0
  841. }
  842. })(this, -2)
  843. ,
  844. (pano)=>{//尽量正对hot
  845. let dir = new THREE.Vector3(0,0,1).applyQuaternion(this.quaternion)
  846. let dir2 = new THREE.Vector3().subVectors(pano.position, this.position).normalize();
  847. let s = dir.dot(dir2) * 60;
  848. //console.log(pano.id + ":" + s)
  849. return s
  850. }
  851. );
  852. /* var tanD = player.domElement.clientWidth / player.domElement.clientHeight * Math.tan((THREE.Math.degToRad(player.zoomFov/2))) ;
  853. var goodDistance = overlay.width / 2 / tanD;
  854. n.push(
  855. function (pano) { //寻找正对着overlay的pano
  856. var overlayDir = new THREE.Vector3(0,0,1).applyQuaternion(overlay.quaternion)
  857. var v1 = overlayDir//.setY(0); 朝上的话set0会得到0,0,0 无法求angle
  858. var v2 = pano.position.clone().sub(overlay.position)//.setY(0)
  859. var angle = v1.angleTo(v2)
  860. angles[pano.id] = angle;
  861. angle = -angle * 100
  862. return angle
  863. },
  864. function (pano) { //寻找正对着overlay的pano
  865. var dis = pano.position.clone().distanceToSquared(overlay.position)
  866. var goodDistance2 = goodDistance * Math.abs(Math.cos(angles[pano.id]))//考虑了倾斜角度后的最佳距离
  867. var result = - 300 * Math.abs(dis-goodDistance2) / goodDistance2 //dis和goodDistance2差距越大分数越低
  868. return result;
  869. }
  870. ) */
  871. var s = t.model.panos.sortByScore(i, n);
  872. //console.log(s)
  873. return s && 0 < s.length && s[0].item
  874. }
  875. examine(options={}) {
  876. var openHot = this.info.link && this.info.actionType.openHot && !options.dontOpen
  877. var fastTran = !options.dontFastTran && ( this.info.actionType.fastTran || settings.hotFastTran || options.fastTran)
  878. if(fastTran){//瞬间过渡 1到固定方位 2到和普通过渡一样的位置,也就是最适合的位置
  879. let info = this.info.cameraData
  880. if(info){
  881. player.blackToPano({
  882. pano: player.model.panos.index[info.pano.uuid],
  883. quaternion: new THREE.Quaternion().fromArray(info.camera.quaternion)
  884. })
  885. }
  886. }
  887. var needExamine = !fastTran && (options.examine || (!settings.dontExamHot && this.info.actionType.examine))
  888. if(!openHot && !needExamine)return;
  889. if(openHot && this.info.linkType!="common" && this.info.iframe && this.info.iframe[0]){
  890. var src = getLink(this.info.iframe[0]);
  891. if(this.info.linkType=="jumpLink"){
  892. var newPage = window.open(src, "_blank" );
  893. newPage.focus();
  894. }else if(this.info.linkType=="iframeDiv"){
  895. var div = document.createElement("div");
  896. div.style.position = 'fixed';
  897. div.style.width = div.style.height = "100%";
  898. div.style.left = div.style.top = '0';
  899. div.style["z-index"] = "999"
  900. var exit = document.createElement("div");
  901. exit.style["background-image"] = "url(images/vrOffImg.png)";
  902. exit.style.position = 'absolute';
  903. exit.style.width = exit.style.height = "50px";
  904. exit.style.left = '17px'; exit.style.top = "20px"
  905. exit.style.cursor = "pointer";
  906. exit.style["background-repeat"] = "no-repeat";
  907. exit.style["background-size"] = "25%";
  908. exit.style["background-position"] = "center center";
  909. exit.style["background-color"] = "rgba(0, 0, 0, 0.2)";
  910. exit.style["border-radius"] = "50%";
  911. exit.style["z-index"] = "3"
  912. exit.onclick = ()=>{
  913. $(div).remove()
  914. Hot.closePopup()
  915. }
  916. var myElement = document.createElement("iframe");
  917. myElement.style.position = 'absolute';
  918. myElement.style.width = myElement.style.height = "100%";
  919. myElement.style.left = myElement.style.top = '0';
  920. myElement.src = src
  921. $("body").append(div);
  922. div.appendChild(exit);
  923. div.appendChild(myElement)
  924. SoundManager.play('hot')
  925. }
  926. return;
  927. }
  928. if(!player.currentPano)return;
  929. var popup = document.getElementById("popup");
  930. if (openHot) {
  931. g_currentHot = this,
  932. popup.style.display = "block",
  933. popup.classList.add("wait");
  934. var n = document.createElement("iframe");
  935. SoundManager.play('hot')
  936. var src = getLink(this.info.link )
  937. n.src = src;
  938. n.id = "id1",
  939. n.allowTransparency = "true";
  940. var a = document.getElementById("id1");
  941. if (void 0 === a || null == a) {
  942. document.querySelector(".popup-content").appendChild(n);
  943. var s = !1;
  944. window.loaddingSuccess = function() {
  945. s = !0
  946. }
  947. ,
  948. setTimeout(function e() {
  949. if (s) {
  950. var t = document.querySelector("#id1").contentWindow.document;
  951. t.querySelector("video") && (t.querySelector("video").play(),
  952. !t.querySelector("video").paused && t.querySelector(".playPause") && t.querySelector(".playPause").classList.add("fa-pause")),
  953. t.querySelector("audio") && t.querySelector("audio").play()
  954. } else
  955. setTimeout(e, 300)
  956. }, 800)
  957. }
  958. }
  959. var done = function() {
  960. player.flyingToTag = !1;
  961. openHot && popup.classList.remove("wait")
  962. }.bind(this);
  963. if(!needExamine){
  964. done()
  965. return;
  966. }
  967. var c = this.closestPanoTowardTag(player.mode, player.currentPano) || player.currentPano
  968. , h = this.mesh.getWorldPosition();
  969. player.flyingToTag = !0;
  970. if (player.mode === 'panorama') {
  971. var d = {
  972. pano: c,
  973. lookAtPoint: h,
  974. duration: options.duration,
  975. maxDistanceOverride: null,
  976. skipWarpingCheck: !1,
  977. aimDuration: options.aimDuration,
  978. };
  979. if(fastTran){
  980. let f = (new THREE.Matrix4).lookAt(c.position, h, new THREE.Vector3(0,1,0));
  981. let quaternion = (new THREE.Quaternion).setFromRotationMatrix(f)
  982. player.blackToPano({
  983. pano:c,
  984. quaternion,
  985. })
  986. done()
  987. }else{
  988. player.flyToPano(d, done)
  989. }
  990. } else {
  991. var p = {
  992. pano: c
  993. };
  994. if (h) {
  995. var f = (new THREE.Matrix4).lookAt(c.position, h, new THREE.Vector3(0,1,0));
  996. p.quaternion = (new THREE.Quaternion).setFromRotationMatrix(f)
  997. }
  998. p.callback = done,
  999. p.duration = options.duration || 1500,
  1000. p.mode = 'panorama',
  1001. p.aimDuration = options.aimDuration
  1002. player.flyToNewMode(p)
  1003. }
  1004. }
  1005. addModel(object){
  1006. if(this.objObject){
  1007. this.remove(this.objObject)
  1008. }
  1009. this.objObject = object;
  1010. /* object.traverse((mesh)=>{
  1011. if(mesh.material && mesh.type == "hotSprite"){
  1012. mesh.material = this.material_;
  1013. }
  1014. }) */
  1015. object.name = this.info.objName;
  1016. object.src = this.info.objSrc
  1017. this.info.hasBox = false
  1018. this.addBox(false)
  1019. this.remove(this.plane);
  1020. this.plane = null;
  1021. this.setMesh(this.objObject)
  1022. //this.adjustModelAuto()
  1023. if(this.info.modelBound){//应该不会改变
  1024. var s = this.info.modelBound.scaleRatio
  1025. this.mesh.scale.set(s,s,s)
  1026. this.mesh.position.fromArray(this.info.modelBound.position)
  1027. this.mesh.modelBound = this.info.modelBound
  1028. }
  1029. this.material_.side = THREE.FrontSide
  1030. this.changeBoxHelperDisplay(false)
  1031. //this.mesh.boxHelper.visible = true
  1032. }
  1033. addPlane(){//换成plane
  1034. if(this.plane)return
  1035. this.plane = new THREE.Mesh(_planeGeometry, this.material_)
  1036. this.remove(this.objObject)
  1037. this.objObject = null
  1038. delete this.info.objSrc
  1039. delete this.info.objName
  1040. delete this.info.modelBound
  1041. this.setMesh(this.plane)
  1042. //this.material_.side = THREE.DoubleSide //双面的话飞出来会看到悬空的
  1043. }
  1044. setMesh(mesh){
  1045. this.mesh = mesh
  1046. this.add(this.mesh);
  1047. this.changeMaterial(this.material_) //re applyTo every mesh
  1048. this.mesh.traverse((mesh)=>{
  1049. mesh.type = "hotSprite" //raycaster use
  1050. mesh.renderOrder = 3
  1051. })
  1052. if(!this.mesh.boxHelper){
  1053. var boxHelper = this.mesh.children.find(e=>e instanceof THREE.Box3Helper)
  1054. if(boxHelper){
  1055. this.mesh.boxHelper = boxHelper
  1056. }else{
  1057. var bound = this.getBoundOri()
  1058. bound.expandByVector(new THREE.Vector3(0.0001,0.0001,0.0001))
  1059. this.mesh.boxHelper = new THREE.Box3Helper( bound, new THREE.Color( "#00ffff"));
  1060. this.mesh.add(this.mesh.boxHelper)
  1061. this.mesh.boxHelper.material.depthTest = false;
  1062. this.mesh.boxHelper.material.transparent = true
  1063. this.mesh.boxHelper.visible = false
  1064. }
  1065. }
  1066. }
  1067. changeBoxHelperDisplay(show){
  1068. if(show){
  1069. this.visible_ = this.visible
  1070. this.visible = true
  1071. this.mesh.boxHelper.visible = true
  1072. }else{
  1073. if(this.visible_ != void 0){
  1074. this.visible = this.visible_
  1075. }
  1076. this.mesh.boxHelper.visible = false
  1077. }
  1078. }
  1079. /* addToLoadQueue() {
  1080. if (this.texType == 'photo') {
  1081. Hot.loadQueue.includes(this) || Hot.loadQueue.push(this)
  1082. }
  1083. } */
  1084. requestDownload(type, callback) {
  1085. var plane = this.plane;
  1086. if(type == 'photo'){
  1087. if(this.photoHasRequestLoad || this.texType != 'photo'){
  1088. return; //为什么之前1191需要在这加callback() 才能呢。现在又没事了
  1089. }
  1090. //console.log(' beginDownload : ' + this.sid)
  1091. /* this.material_.map = */Texture.load(this.info.texSrc, (tex)=>{
  1092. callback && callback()
  1093. if(!tex.image ){
  1094. return //只是单纯用了相同src的tex,但image仍未加载完
  1095. }
  1096. if(!this._loadDones){
  1097. return
  1098. }
  1099. dealMap(tex)
  1100. setTimeout(Hot.loadNext, 50)
  1101. hotGroup.children.forEach(e=>{
  1102. if(e.info.texSrc == this.info.texSrc && e.info.texType == type ){
  1103. e.material_.color.set("#FFFFFF")
  1104. e.material_.opacity = 1;
  1105. //console.log('overlay loaded: ' + e.sid + " - " + this.info.texSrc.split('/').pop());
  1106. e.texMedia = tex.image
  1107. {//animation不同致使的不能使用同一个texture
  1108. if(window.isEdit){
  1109. if(animateTexSrcs[e.info.texSrc]){
  1110. e.material_.map = tex.clone(); //编辑动画直接不用一个texture, 故而animation也不同
  1111. e.material_.map.needsUpdate = true
  1112. }else{
  1113. e.material_.map = tex
  1114. animateTexSrcs[e.info.texSrc] = 1
  1115. }
  1116. }else{
  1117. if(animateTexSrcs[e.info.texSrc]){//已有该texSrc
  1118. let finded = false
  1119. for(let i of animateTexSrcs[e.info.texSrc]){
  1120. if(ifSame(i[0], e.info.animateInfo)){
  1121. e.material_.map = i[1]; finded = true; break;
  1122. }
  1123. }
  1124. if(!finded){
  1125. let tex_ = tex.clone();
  1126. tex_.needsUpdate = true //clone后不写这句会黑块
  1127. animateTexSrcs[e.info.texSrc].set(e.info.animateInfo, tex_)
  1128. e.material_.map = tex_
  1129. }
  1130. }else{
  1131. let object = new Map();
  1132. object.set(e.info.animateInfo, tex)
  1133. animateTexSrcs[e.info.texSrc] = object//注册第一个texSrc
  1134. e.material_.map = tex
  1135. }
  1136. }
  1137. }
  1138. if(e.info.animateInfo && !e.animation){
  1139. e.animation = GifTexDeal.addAnimation(e.material_.map, e, e.info.animateInfo, e.sid )
  1140. e.visible && e.inSight() && GifTexDeal.start(e.animation)
  1141. }
  1142. if(++photoLoaded == originPhotoCount){//data2.js中的所有photo加载完毕
  1143. Hot.allPhotoLoaded = true;
  1144. Hot.whenAllFileLoaded && Hot.allModelLoaded && Hot.whenAllFileLoaded()
  1145. }
  1146. {
  1147. e._loadDones.forEach(a=>a())
  1148. e._loadDones = null
  1149. //e.photoHasRequestLoad = true //这句不能加,否则会无法执行callback
  1150. }
  1151. e.material_.needsUpdate = true
  1152. }
  1153. })
  1154. })
  1155. this.photoHasRequestLoad = true
  1156. }else if(type == 'model'){
  1157. if(this.modelHasRequestLoad || !this.info.objSrc)return;
  1158. //需要处理重复?
  1159. objLoader.load(this.info.objSrc, (object)=>{
  1160. this.remove(this.mesh)
  1161. this.addModel(object)
  1162. callback && callback()
  1163. if(++modelLoaded == originModelCount){//data2.js中的所有photo加载完毕
  1164. Hot.allModelLoaded = true;
  1165. Hot.whenAllFileLoaded && Hot.allPhotoLoaded && Hot.whenAllFileLoaded()
  1166. }
  1167. })
  1168. this.modelHasRequestLoad = true
  1169. }
  1170. }
  1171. dispose(){
  1172. this.parent.remove(this)
  1173. this.titleElem && this.titleElem.dispose()
  1174. delete player.model.hots[this.sid]
  1175. }
  1176. }
  1177. Hot.updateVisibles = function(panos, type) { //只显示没被遮挡的,否则会卡
  1178. if (panos === true) {
  1179. model.hotGroup.children.forEach(e=>e.updateVisible(null,true,type))
  1180. } else {
  1181. model.hotGroup.children.forEach(e=>e.updateVisible(panos, null, type))
  1182. }
  1183. }
  1184. Hot.beginShineHot = function(){
  1185. if(!window.isEdit && shineMats.length == 0)return
  1186. transitions.trigger({
  1187. func: function(e) {
  1188. var opa = e <= .5 ? 2 * e : -2 * e + 2
  1189. shineMats.forEach(mat=>{
  1190. mat.uniforms.opac.value = opa;
  1191. })
  1192. },
  1193. cycling: !0,
  1194. duration: 3e3,
  1195. name: "hotShine"
  1196. })
  1197. }
  1198. Hot.getDefaulScale = function(hotIconScale){
  1199. return (hotIconScale || DATA.hotIconScale) * g_HotMeshSize.g_HotMeshWidth
  1200. }
  1201. var loadings = [];
  1202. Hot.loadQueue = []; //等待下载的overlay,目前只针对photo
  1203. Hot.maxLoadingCount = 3; //同时正在load图片的数量
  1204. Hot.loadNext = ()=>{//继续requestDownload loadQueue中前排的item
  1205. let count = Hot.maxLoadingCount - loadings.length
  1206. Hot.loadQueue.slice(0, count).forEach(e=>{
  1207. loadings.push(e)
  1208. //console.log('requestDownload', e.hot.info.texSrc)
  1209. e.hot.requestDownload(e.type, ()=>{
  1210. var i = loadings.indexOf(e)
  1211. //console.log('requestDownloaded index', i)
  1212. i > -1 && loadings.splice(i,1)
  1213. })
  1214. })
  1215. Hot.loadQueue.splice(0, count)
  1216. }
  1217. Hot.getNeedLoad = function() {//计算获取loadQueue,每次都重新计算,覆盖旧的
  1218. if (!player || !player.domElement || !player.mode)
  1219. return;
  1220. var hots1, hots2
  1221. if (player.mode != 'panorama') {
  1222. if (Hot.loadQueue.length == 0) {
  1223. hots1 = model.hotGroup.children.filter(e=>e.texType == 'photo' && !e.photoHasRequestLoad )
  1224. hots2 = model.hotGroup.children.filter(e=>e.info.objSrc && !e.modelHasRequestLoad )
  1225. Hot.loadQueue = hots1.map(e=>{return {hot:e, type:"photo"}}).concat(
  1226. hots2.map(e=>{return {hot:e, type:"model"}})
  1227. )
  1228. }
  1229. return
  1230. }
  1231. //Hot.loadWhenOutside = true
  1232. hots1 = model.hotGroup.children.filter(e=>e.texType == 'photo' && !e.photoHasRequestLoad && (!e.info.visiblePanos || e.info.visiblePanos.includes(player.currentPano.id)))
  1233. hots2 = model.hotGroup.children.filter(e=>e.info.objSrc && !e.modelHasRequestLoad && (!e.info.visiblePanos || e.info.visiblePanos.includes(player.currentPano.id)))
  1234. if(hots1.length+hots2.length == 0){
  1235. hots1 = model.hotGroup.children.filter(e=>e.texType == 'photo' && !e.photoHasRequestLoad )
  1236. hots2 = model.hotGroup.children.filter(e=>e.info.objSrc && !e.modelHasRequestLoad )
  1237. }
  1238. var cameraDir = player.getDirection()
  1239. Hot.loadQueue = hots1.map(e=>{return {hot:e, type:"photo"}}).concat(
  1240. hots2.map(e=>{return {hot:e, type:"model"}})
  1241. )
  1242. var request = [(item)=>{
  1243. return true
  1244. }];
  1245. var rank = [(item)=>{
  1246. var dis = item.hot.mesh.getWorldPosition().distanceTo(player.position);
  1247. return -dis
  1248. }
  1249. , (item)=>{
  1250. var tagDir = item.hot.mesh.getWorldPosition().sub(player.position)
  1251. var angle = tagDir.angleTo(cameraDir)
  1252. return -angle * 20
  1253. }]
  1254. var result = common.sortByScore(Hot.loadQueue, request, rank);
  1255. //Hot.loadQueue = result ? result.slice(0, 5).map(e=>e.item) : model.hotGroup.children.filter(e=>e.texType == 'photo' && !e.hasRequestLoad).slice(0, 2);
  1256. Hot.loadQueue = result ? result.slice(0, 5).map(e=>e.item) : []
  1257. }
  1258. Hot.load = ()=>{//开始下载图片
  1259. Hot.getNeedLoad()
  1260. Hot.loadNext()
  1261. var hots1 = model.hotGroup.children.filter(e=>e.texType == 'photo' && !e.photoHasRequestLoad )
  1262. var hots2 = model.hotGroup.children.filter(e=>e.info.objSrc && !e.modelHasRequestLoad )
  1263. if (hots1.length+hots2.length > 0) {
  1264. setTimeout(Hot.load, 200)
  1265. } else {
  1266. Hot.allRequestLoad = true
  1267. console.log('allRequestLoad')
  1268. }
  1269. }
  1270. Hot.startLoad = ()=>{
  1271. originPhotoCount = hotGroup.children.filter(e=>e.texType == 'photo').length
  1272. originModelCount = hotGroup.children.filter(e=>!!e.info.objSrc).length
  1273. if(originPhotoCount == 0 )Hot.allPhotoLoaded = true
  1274. if(originModelCount == 0) Hot.allModelLoaded = true;
  1275. if(Hot.allModelLoaded && Hot.allPhotoLoaded) Hot.whenAllFileLoaded && Hot.whenAllFileLoaded()//所有加载完毕
  1276. else{
  1277. Hot.load()
  1278. }
  1279. setTimeout(Hot.beginShineHot, 1000)
  1280. if(!window.isEdit){
  1281. if(playSyncGroup.length){
  1282. //每过一段时间校准同步视频的时间,使与第一个视频同步
  1283. setInterval(()=>{
  1284. playSyncGroup.forEach(group=>{
  1285. group = group.map(e=>player.model.hots[e].texMedia).filter(e=>!e.paused)
  1286. if(group.length < 2)return
  1287. //console.log('同步',group.map(e=>e.currentTime))
  1288. for(let i=group.length-1;i>0;i--){
  1289. group[i].currentTime = group[0].currentTime
  1290. }
  1291. })
  1292. },4000)
  1293. }
  1294. }
  1295. player.emit('gotHotAndStartload')
  1296. }
  1297. window.Hot = Hot
  1298. /* var ball = new THREE.Mesh(new THREE.SphereBufferGeometry(0.01),new THREE.MeshBasicMaterial({color:"#f00",depthTest:false,transparent:true}))
  1299. var balls = []
  1300. var addPoint = function(point){
  1301. console.log(point)
  1302. var ball1 = ball.clone()
  1303. model.add(ball1);
  1304. ball1.position.copy(point)
  1305. balls.push(ball1)
  1306. }
  1307. var addPoints = function(points){
  1308. balls.forEach(e=>model.remove(e))
  1309. balls = []
  1310. points.forEach(e=>addPoint(e))
  1311. }
  1312. */
  1313. //判断是否是移动端,如果是给关闭按钮添加touchstart事件
  1314. Hot.closePopup = ()=>{// 关闭热点页面
  1315. if(!g_currentHot) return;
  1316. g_currentHot = null;
  1317. var hotPop = document.getElementById('popup');
  1318. hotPop.style.display = "none";
  1319. document.querySelector(".popup-content").removeChild(document.getElementById("id1"));
  1320. $("#popup iframe:last").remove();
  1321. SoundManager.pause('hot', true)//自动播放被中断的音频 (bgm
  1322. return false
  1323. }
  1324. if(browser.isMobile()){
  1325. $('#closepop').on("touchstart",Hot.closePopup);
  1326. }else{
  1327. $('#closepop').on("click",Hot.closePopup);
  1328. }
  1329. Hot.createHotList = function() {
  1330. if(!window.DATA.showHotListSta)return
  1331. var docFragment = document.createDocumentFragment();
  1332. var hots = hotGroup.children.filter(hot=>hot.info.actionType.openHot);
  1333. hots = hots.sort((a,b)=>{return a.order - b.order});
  1334. hots.forEach((hot)=>{
  1335. var li = document.createElement('li');
  1336. var span = document.createElement('span');
  1337. span.innerHTML = hot.info.title || '热点';
  1338. // console.log(span.innerHTML);
  1339. li.hot = hot; // 列表每一项对应一个热点
  1340. li.appendChild(span);
  1341. docFragment.appendChild(li);
  1342. })
  1343. setTimeout(()=>{
  1344. var ul = document.querySelector('#hotListContent ul');
  1345. ul && ul.appendChild(docFragment);
  1346. },3000) //部分安卓手机的钉钉和支付宝浏览器如果立即添加到列表会卡住
  1347. }
  1348. Hot.mobileAutoPlay = function(player){//移动端。不这么写video不会播放 . (2022.11.29: 可为何加了Hot.updateHots之后又会自动播了?https有关?
  1349. if(browser.isMobile()){
  1350. hotGroup.children.forEach((hot)=>{
  1351. /* if(hot.texType == 'video' && hot.shouldPlay){
  1352. console.log(1)
  1353. } */
  1354. if(!hot.clickToPlayInited && hot.texType == 'video' && !isVideoPlayed(hot.texMedia) && hot.shouldPlay){
  1355. //hot.update(player)
  1356. console.log({str:'try mobileAutoPlay '+ hot.sid, level:1})
  1357. hot.videoControl(true)
  1358. if(isVideoPlayed(hot.texMedia)){
  1359. console.log({str:'clickToPlayInited '+ hot.sid, level:1})
  1360. hot.clickToPlayInited = true
  1361. hot.changeOpaWhenPlay(video)
  1362. }
  1363. }
  1364. })
  1365. }
  1366. }
  1367. Hot.updateHots = function(){
  1368. for(var i in player.model.hots){
  1369. player.model.hots[i].update(player)
  1370. }
  1371. if( !player.ready)return
  1372. this.needUpdate = true
  1373. common.intervalTool.isWaiting('updateHots', ()=>{ //延时update,防止卡顿
  1374. if(!this.needUpdate)return
  1375. this.needUpdate = false
  1376. let videoCanPlay = [], aniCanPlay = [];
  1377. for(var i in player.model.hots){
  1378. let hot = player.model.hots[i]
  1379. {//实时监测播放
  1380. if(hot.texType == "video" && !player.flying){ //飞行时不判断
  1381. if(hot.visible && !hot.pausedByUser && hot.inSight()){ //注意edit时insight一直为true
  1382. //this.videoControl(true)
  1383. videoCanPlay.push(hot)
  1384. }else{
  1385. hot.videoControl(false)
  1386. }
  1387. }else if(hot.info.animateInfo){
  1388. if(hot.visible && hot.inSight()){
  1389. aniCanPlay.push(hot)
  1390. }else{
  1391. GifTexDeal.stop(hot.animation)
  1392. }
  1393. }
  1394. }
  1395. }
  1396. let filter = (type,max,list,playFun)=>{
  1397. if(list.length < max){
  1398. list.forEach(hot=>type == 'video' ? hot.videoControl(true) : GifTexDeal.start(hot.animation))
  1399. }else{
  1400. let playerDir = player.getDirection()
  1401. let request = []
  1402. let planeDir = new Map()
  1403. if(player.mode != 'panorama'){
  1404. request.push((hot)=>{
  1405. if(hot.plane){//考虑plane的方向,它甚至可能背对镜头
  1406. let dir = new THREE.Vector3(0,0,-1).applyQuaternion(hot.quaternion)
  1407. let angle = dir.dot(playerDir)
  1408. planeDir.set(hot, angle)
  1409. return angle > 0
  1410. }else return true
  1411. })
  1412. }
  1413. let r = common.sortByScore(list,request,[(hot)=>{ //方向因素
  1414. var cornerPointInfo = hot.getCornerPoint(); //仅支持漫游模式
  1415. let dir = new THREE.Vector3().subVectors(hot.position, player.position).normalize()
  1416. score = dir.dot(playerDir)
  1417. player.mode == 'panorama' && (score *= Math.pow(cornerPointInfo.diffLat,0.5))// pow降低高度的权重,因为宽度更重要些。之所以两个函数都乘以diffLat,也是为了防止在两个item的分数相同diffLon不同时,diffLat增长相同倍数却能造成分数差异的情况
  1418. return score
  1419. },
  1420. (hot)=>{//面积因素
  1421. if(player.mode == 'panorama'){
  1422. var cornerPointInfo = hot.getCornerPoint(); //仅支持漫游模式
  1423. let area = cornerPointInfo.diffLon * Math.pow(cornerPointInfo.diffLat,0.5) / 1000 //占据面积
  1424. return area
  1425. }else{
  1426. let dis = player.position.distanceTo(hot.position);
  1427. let size = hot.getBoundOri().applyMatrix4(hot.matrixWorld).size(new THREE.Vector3).length() / 2
  1428. let score = Math.atan(size / Math.pow(dis,1.2)) * 50 // 在镜头中所占fov angle 的一半 。 pow是因为实际感受还是尽量显示近处的
  1429. if(hot.plane){//考虑plane的方向,越倾斜分越低
  1430. score *= planeDir.get(hot)
  1431. }
  1432. return score
  1433. }
  1434. } ])
  1435. //getCornerPoint仅支持漫游模式 Lat高度(纬度).
  1436. //console.log(r)
  1437. r && r.forEach((e,j)=>{
  1438. let hot = e.item
  1439. if(j<max){
  1440. type == 'video' ? hot.videoControl(true) : GifTexDeal.start(hot.animation)
  1441. }else{
  1442. type == 'video' ? hot.videoControl(false) : GifTexDeal.stop(hot.animation)
  1443. }
  1444. })
  1445. }
  1446. }
  1447. filter('video',playVideoMax, videoCanPlay);
  1448. filter('animateInfo',playAniMax, aniCanPlay);
  1449. //console.log('updateHots')
  1450. return true
  1451. }, 800)
  1452. }
  1453. }
  1454. function isVideoPlayed(video){
  1455. return !video.paused && !isNaN(video.duration) //注意,有的手机首次play时会立即paused为false,但其实没加载好, duration为NAN
  1456. }
  1457. /*
  1458. 保存 JSON.stringify(editTool.hotpoint.getSavingInfo())
  1459. 可能需要再写一份保存到overlay 给旧场景项目使用
  1460. 最好后台有针对手机版的做一个压缩。压缩成几个档位。
  1461. 安卓手机firefox出现过视频mesh不可见或者闪烁的情况。
  1462. 视频最容易导致崩溃, 模型还好
  1463. 数据速率为4064kbps,1920*1080px 时测试部门电脑崩溃
  1464. 数据速率为1824kbps,720 *576px 时正常
  1465. 所以尽量降到2000以下 同时播放个数最好不超过2个 可能需要将src归零 并延迟加载、不自动播放
  1466. 有遇到某张图在ios里显示不出,但在ps重新输出后就可以。这张图的dpi高达500,不知道是否与此有关。
  1467. 遇到过ios14.8.1、14.7.1 无法播放webm(来自1050)。 onloadedmetadata失败
  1468. 显示故障的机型:
  1469. 视频黑屏(4dkk视频漫游点也无法播放):小米10(自带浏览器)、红米K40(微信浏览器)、
  1470. */