123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283 |
- var settings = {};
- settings["onstart"] = "trace('on start...')";
- settings["view.hlookat"] = 30;
- const house ={
- // curr_id:2,
- idx:0,
- // direction:'B',
- nextId:null,
- isLoading:false,
- numLoaded:0,
- mode:'full',
- texture:{
- id:-1,
- curr:null,
- next:null,
- isloading:false,
- },
- config:{
- lat_step:10,
- lon_step:10,
- },
- title:"南京世茂项目",
- src:[
- {id:1,name:"01frontGate",title:'01正门',home:{T:50,R:70},view:0,image:"panos/01frontGate.png",
- ath: 192.7678496377909,atv: 3.342656268019511,
- direction:[
- {id:14,name:'L',angle:{lat: -10, lon: 16.3},offset:180},
- {id:25,name:'R',angle:{lat: -13.7, lon: 75.3},offset:-70},
- {id:null,name:'F'},
- {id:null,name:'B'},
- {id:null,name:'LF'},
- {id:null,name:'LB'},
- {id:null,name:'RF'},
- {id:null,name:'RB'}
- ],
- // L:{id:14,angle:{lat: -10, lon: 16.3},offset:180},R:{id:25,angle:{lat: -13.7, lon: 75.3},offset:-70},F:null,B:null,LF:null,
- // LB:null,RF:null,RB:null,
- spots:[
- {name:'spot1',id:14,ath: -151.72625593816582 ,atv: 17.778666220467294 },
- {name:'spot2',id:25,ath: -98.82302271267214 ,atv: 5.022944264223217}
- ]},
-
- {id:2,name:"02masterBedroom",title:'02主卧',home:{T:83,R:45},view:-90,image:"panos/02masterBedroom.png",
- ath: 0,atv: 0,
- direction:[
- {id:null,name:'L'},
- {id:4,name:'R',angle:{lat: -9.5, lon: 50},offset:180},
- {id:6,name:'F',angle:{lat: -4, lon: -77},offset:-90},
- {id:3,name:'B',angle:{lat: -3.7, lon: 0.5},offset:0},
- {id:null,name:'LF'},
- {id:null,name:'LB'},
- {id:null,name:'RF'},
- {id:null,name:'RB'}
- ],
- spots:[
- {name:'spot1',id:3,ath: 133.13789336284296 ,atv: 4.413364336761442},
- {name:'spot2',id:4,ath: -96.33845818870535 ,atv: 9.822282761777577},
- {name:'spot3',id:6,ath: 60.349644552524836 ,atv: 2.0688887045111275}
- ],},
- {id:3,name:"03masterBedroom",title:'03主卧',home:{T:85,R:36},view:-180,
- ath: 0 ,atv: 0 ,
- image:"panos/03masterBedroom.png",
- direction:[
- {id:null,name:'L'},
- {id:4,name:'R',angle:{lat: -13.6, lon: 54},offset:180},
- {id:2,name:'F',angle:{lat: 2.7, lon: 16.7},offset:90},
- {id:null,name:'B'},
- {id:null,name:'LF'},
- {id:null,name:'LB'},
- {id:null,name:'RF'},
- {id:null,name:'RB'}
- ],
- // L:null,R:{id:4,angle:{lat: -13.6, lon: 54},offset:180},F:{id:2,angle:{lat: 2.7, lon: 16.7},
- // offset:90},B:null,LF:null,LB:null,RF:null,RB:null,
- spots:[
- {name:'spot1',id:2,ath: -87.28296784192219 ,atv: 0.39869598547481716}
- ]},
- {id:4,name:"04masterBedroom",title:'04主卧',home:{T:75,R:30},view:0,
- ath: 0 ,atv: 0 ,
- image:"panos/04masterBedroom.png",
- direction:[
- {id:null,name:'L'},
- {id:3,name:'R',angle:{lat: 0, lon: 13.5},offset:0},
- {id:null,name:'F'},
- {id:2,name:'B',angle:{lat: 3, lon: 17.1},offset:90},
- {id:null,name:'LF'},
- {id:null,name:'LB'},
- {id:null,name:'RF'},
- {id:null,name:'RB'}
- ],
- // L:null,R:{id:3,angle:{lat: 0, lon: 13.5},offset:0},F:null,B:{id:2,angle:{lat: 3, lon: 17.1},offset:90},
- // LF:null,LB:null,RF:null,RB:null,
- spots:[
- {name:'spot1',ath: 116.66721467605558 ,atv: 6.234077010079432}
- ]},
- {id:5,name:"05masterBedroomToilet",title:'05主卧卫生间',home:{T:60,R:30},view:162,
- ath: 0 ,atv: 0 ,
- image:"panos/05masterBedroomToilet.png",
- direction:[
- {id:null,name:'L'},
- {id:null,name:'R'},
- {id:7,name:'F',angle:{lat: -13, lon: 50},offset:0},
- {id:null,name:'B'},
- {id:null,name:'LF'},
- {id:null,name:'LB'},
- {id:null,name:'RF'},
- {id:null,name:'RB'}
- ],
- // L:null,R:null,F:{id:7,angle:{lat: -13, lon: 50},offset:0},B:null,LF:null,LB:null,
- // RF:null,RB:null,
- spots:[
- {name:'spot1',ath: 201.88304453026302 ,atv: 15.237691096136444}
- ]},
- {id:6,name:"06masterBedroomPorch",title:'06主卧门廊',home:{T:66,R:45},view:82,
- ath: 0 ,atv: 0 ,
- image:"panos/06masterBedroomPorch.png",
- direction:[
- {id:null,name:'L'},
- {id:25,name:'R',angle:{lat: -10, lon: 150},offset:-75},
- {id:2,name:'F',angle:{lat: -6.5, lon: -86},offset:90},
- {id:7,name:'B',angle:{lat: -2, lon: 146},offset:35},
- {id:null,name:'LF'},
- {id:null,name:'LB'},
- {id:null,name:'RF'},
- {id:null,name:'RB'}
- ],
- // L:null,R:{id:25,angle:{lat: -10, lon: 150},offset:-75},F:{id:2,angle:{lat: -6.5, lon: -86},
- // offset:90},B:{id:7,angle:{lat: -2, lon: 146},offset:35},LF:null,LB:null,RF:null,RB:null,
- spots:[
- {name:'spot1',ath: 94.50577474627525 ,atv: 13.840215177648496},
- {name:'spot2',ath: -1.7020717516536996 ,atv: 9.14341656185524},
- {name:'spot3',ath: -18.006209788374164 ,atv: 9.440229909461376}
- ]},
- {id:7,name:"07masterBedroomCloakroom",title:'07主卧衣帽间',home:{T:60,R:48},view:-117,
- ath: 137.87124014202362 ,atv: 4.554532782347062 ,
- image:"panos/07masterBedroomCloakroom.png",
- direction:[
- {id:6,name:'L',angle:{lat: 1.9, lon: 86},offset:-90},
- {id:null,name:'R'},
- {id:null,name:'F'},
- {id:null,name:'B'},
- {id:null,name:'LF'},
- {id:6,name:'LB',angle:{lat: 1.9, lon: 86},offset:-90},
- {id:null,name:'RF'},
- {id:5,name:'RB',angle:{lat: -3.2, lon: -80},offset:0}
- ],
- // L:{id:6,angle:{lat: 1.9, lon: 86},offset:-90},R:null,F:null,B:null,LF:null,LB:{id:6,
- // angle:{lat: 1.9, lon: 86},offset:-90},RF:null,RB:{id:5,angle:{lat: -3.2, lon: -80},offset:0},
- spots:[
- {name:'spot1',ath: 96.20953150513165 ,atv: 4.985635364720976},
- {name:'spot2',ath: -93.74469395101436 ,atv: 4.428720411954739}
- ]},
- {id:8,name:"08AguestRoom",title:'08客房',home:{T:90,R:100},view:216,image:"panos/08AguestRoom.png",
- ath: 0 ,atv: 0 ,
- direction:[
- {id:null,name:'L'},
- {id:9,name:'R',angle:{lat: -4.5, lon: -48},offset:-90},
- {id:null,name:'F'},
- {id:null,name:'B'},
- {id:null,name:'LF'},
- {id:null,name:'LB'},
- {id:null,name:'RF'},
- {id:null,name:'RB'}
- ],
- // L:null,R:{id:9,angle:{lat: -4.5, lon: -48},offset:-90},F:null,B:null,LF:null,LB:null,RF:null,RB:null,
- spots:[
- {name:'spot1',ath: 109.16957231125022 ,atv: 12.40371665877947}
-
- ]},
- {id:9,name:"09guestRoomA",title:'09客房A',home:{T:80,R:90},view:82,image:"panos/09guestRoomA.png",
- ath: 0 ,atv: 0 ,
- direction:[
- {id:null,name:'L'},
- {id:null,name:'R'},
- {id:8,name:'F',angle:{lat: -5.7, lon: -25},offset:30},
- {id:10,name:'B',angle:{lat: -6.4, lon: 187},offset:-90},
- {id:null,name:'LF'},
- {id:null,name:'LB'},
- {id:null,name:'RF'},
- {id:null,name:'RB'}
- ],
- // L:null,R:null,F:{id:8,angle:{lat: -5.7, lon: -25},offset:30},B:{id:10,angle:{lat: -6.4, lon: 187},offset:-90},LF:null,LB:null,RF:null,
- // RB:null,
- spots:[
- {name:'spot1',ath: -130.3400553399444 ,atv: 9.438736212478796},
- {name:'spot2',ath: 274.56764156555914 ,atv: 9.440470721743205}
- ]},
- {id:10,name:"10guestRoomAToilet",title:'10客房卫生间',home:{T:70,R:100},view:87,
- ath: 0 ,atv: 0 ,
- image:"panos/10guestRoomAToilet.png",
- direction:[
- {id:null,name:'L'},
- {id:null,name:'R'},
- {id:25,name:'F',angle:{lat: 3.8, lon: -15},offset:-90},
- {id:null,name:'B'},
- {id:null,name:'LF'},
- {id:null,name:'LB'},
- {id:null,name:'RF'},
- {id:null,name:'RB'}
- ],
- // L:null,R:null,F:{id:25,angle:{lat: 3.8, lon: -15},offset:-90},B:null,LF:null,LB:null,
- // RF:null,RB:null,
- spots:[
- {name:'spot1',ath: 151.61586215506478 ,atv: -0.45354419026090353}
-
- ]},
- {id:11,name:"11guestRoomB",title:'11客房B',home:{T:85,R:70},view:-122,
- ath: -42.73263618598905 ,atv: 6.204768550626101 ,
- image:"panos/11guestRoomB.png",
- direction:[
- {id:null,name:'L'},
- {id:12,name:'R',angle:{lat: -2.8, lon: 17},offset:180},
- {id:25,name:'F',angle:{lat: -7, lon: -118},offset:-60},
- {id:null,name:'B'},
- {id:null,name:'LF'},
- {id:13,name:'LB',angle:{lat: -1.4, lon: -172},offset:160},
- {id:null,name:'RF'},
- {id:null,name:'RB'}
- ],
- // L:null,R:{id:12,angle:{lat: -2.8, lon: 17},offset:180},F:{id:25,angle:{lat: -7, lon: -118},offset:-60},
- // B:null,LF:null,LB:{id:13,angle:{lat: -1.4, lon: -172},offset:160},RF:null,RB:null,
- spots:[
- {name:'spot1',ath: -7.909766096794434 ,atv: 2.941497893049414},
- {name:'spot2',ath: 184.60326417337728 ,atv: 9.006718467442129},
- {name:'spot3',ath: 65.1465767375114 ,atv: 4.286209242983865}
- ]},
- {id:12,name:"12guestRoomB",title:'12客房B',home:{T:80,R:60},view:0,image:"panos/12guestRoomB.png",
- ath: 0 ,atv: 0 ,
- direction:[
- {id:null,name:'L'},
- {id:11,name:'R',angle:{lat: -10, lon: -43},offset:90},
- {id:null,name:'F'},
- {id:null,name:'B'},
- {id:null,name:'LF'},
- {id:null,name:'LB'},
- {id:null,name:'RF'},
- {id:null,name:'RB'}
- ],
- // L:null,R:{id:11,angle:{lat: -10, lon: -43},offset:90},F:null,B:null,LF:null,LB:null,RF:null,RB:null,
- spots:[
- {name:'spot1',ath: 164.12603590034158 ,atv: 8.112912774069422}
-
- ]},
- {id:13,name:"13guestRoomB",title:'13客房B',home:{T:95,R:70},view:0,
- ath: 0 ,atv: 0 ,
- image:"panos/13guestRoomB.png",
- direction:[
- {id:11,name:'L',angle:{lat: -6, lon: 120},offset:60},
- {id:null,name:'R'},
- {id:null,name:'F'},
- {id:null,name:'B'},
- {id:null,name:'LF'},
- {id:null,name:'LB'},
- {id:null,name:'RF'},
- {id:null,name:'RB'}
- ],
- // L:{id:11,angle:{lat: -6, lon: 120},offset:60},R:null,F:null,B:null,LF:null,LB:null,RF:null,RB:null,
- spots:[
- {name:'spot1',ath: -60.01092914454077 ,atv: 5.090054004721674}
- ]},
- {id:14,name:"14livingRoom",title:'14客厅',home:{T:20,R:70},view:0,image:"panos/14livingRoom.png",
- ath: -159.27567207943517 ,atv: 2.528526758360995 ,
- direction:[
- {id:null,name:'L'},
- {id:null,name:'R'},
- {id:16,name:'F',angle:{lat: 1.4, lon: 80},offset:180},
- {id:null,name:'B'},
- {id:17,name:'LF',angle:{lat: -2.4, lon: 36},offset:150},
- {id:null,name:'LB'},
- {id:15,name:'RF',angle:{lat: -6, lon: 148},offset:130},
- {id:1,name:'RB',angle:{lat: -2.1, lon: 187},offset:180}
- ],
- // L:null,R:null,
- // F:{id:16,angle:{lat: 1.4, lon: 80},offset:180},B:null,LF:{id:17,angle:{lat: -2.4, lon: 36},offset:150},LB:null,RF:{id:15,
- // angle:{lat: -6, lon: 148},offset:130},RB:{id:1,angle:{lat: -2.1, lon: 187},offset:180},
- spots:[
- {name:'spot1',ath: 0 ,atv: 0},
- {name:'spot2',ath: -34.1113442467674 ,atv: 1.2404792099651585},
- {name:'spot3',ath: -160.35289454417364 ,atv: 5.634326613316236}
- ]},
- {id:15,name:"15livingRoom",title:'15客厅',home:{T:30,R:50},view:-32,image:"panos/15livingRoom.png",
- ath: 47.69703936335866 ,atv: 2.3057414659561863 ,
- direction:[
- {id:null,name:'L'},
- {id:null,name:'R'},
- {id:null,name:'F'},
- {id:null,name:'B'},
- {id:16,name:'LF',angle:{lat: -7.2, lon: -13},offset:180},
- {id:14,name:'LB',angle:{lat: 0, lon: -57},offset:150},
- {id:22,name:'RF',angle:{lat: -1.4, lon: 73},offset:180},
- {id:20,name:'RB',angle:{lat: 0, lon: 0},offset:0}
- ],
- // L:null,R:null,F:null,B:null,LF:{id:16,angle:{lat: -7.2, lon: -13},offset:180},LB:{id:14,angle:{lat: 0, lon: -57},offset:150},
- // RF:{id:22,angle:{lat: -1.4, lon: 73},offset:180},RB:{id:20,angle:{lat: 0, lon: 0},offset:0},
- spots:[
- {name:'spot1',ath: 86.3591887709863 ,atv: 8.985133895285943},
- {name:'spot2',ath: 184.14294012777333 ,atv: 12.990747276430952},
- {name:'spot3',ath: -105.87657622463723 ,atv: 4.238607961667052},
- {name:'spot4',ath: -192.37100866081815 ,atv: 13.779938500215556}
- ]},
- {id:16,name:"16livingRoom",title:'16客厅',home:{T:20,R:50},view:0,
- ath: 0 ,atv: 0 ,
- image:"panos/16livingRoom.png",
- direction:[
- {id:19,name:'L',angle:{lat: -2, lon: -3},offset:180},
- {id:15,name:'R',angle:{lat: -3, lon: 230},offset:120},
- {id:22,name:'F',angle:{lat: 4.5, lon: 119},offset:180},
- {id:14,name:'B',angle:{lat: 2.5, lon: -80},offset:160},
- {id:18,name:'LF',angle:{lat: -10, lon: -20},offset:-130},
- {id:17,name:'LB',angle:{lat: 0, lon: 0},offset:160},
- {id:null,name:'RF'},
- {id:null,name:'RB'}
- ],
- // L:{id:19,angle:{lat: -2, lon: -3},offset:180},R:{id:15,angle:{lat: -3, lon: 230},offset:120},
- // F:{id:22,angle:{lat: 4.5, lon: 119},offset:180},B:{id:14,angle:{lat: 2.5, lon: -80},offset:160},LF:{id:18,angle:{lat: -10, lon: -20},
- // offset:-130},LB:{id:17,angle:{lat: 0, lon: 0},offset:160},RF:null,RB:null,
- spots:[
- {name:'spot1',ath: 51.63316742817771 ,atv: 5.736857709477558},
- {name:'spot2',ath: 82.21482834381248 ,atv: 6.968294282167136}
- ]},
- {id:17,name:"17livingRoom",title:'17客厅',home:{T:8,R:60},view:-20,image:"panos/17livingRoom.png",
- ath: 0 ,atv: 0 ,
- direction:[
- {id:23,name:'L',angle:{lat: -1, lon: -236},offset:30},
- {id:16,name:'R',angle:{lat: -8.2, lon: 178},offset:180},
- {id:null,name:'F'},
- {id:null,name:'B'},
- {id:23,name:'LF',angle:{lat: -1.4, lon: -210},offset:80},
- {id:null,name:'LB'},
- {id:19,name:'RF',angle:{lat: -2, lon: 75},offset:180},
- {id:14,name:'RB',angle:{lat: -6.3, lon: 221},offset:150}
- ],
- // L:{id:23,angle:{lat: -1, lon: -236},offset:30},R:{id:16,angle:{lat: -8.2, lon: 178},offset:180},F:null,B:null,LF:{id:23,
- // angle:{lat: -1.4, lon: -210},offset:80},LB:null,RF:{id:19,angle:{lat: -2, lon: 75},offset:180},RB:{id:14,
- // angle:{lat: -6.3, lon: 221},offset:150},
- spots:[
- {name:'spot1',ath: -70.81558713811852 ,atv: 10.759984298964255},
- {name:'spot2',ath: -96.12639873331034 ,atv: 9.263834623023362}
- ]},
- {id:18,name:"18livingRoom",title:'18客厅',home:{T:8,R:40},view:34,
- ath: 0 ,atv: 0 ,
- image:"panos/18livingRoom.png",
- direction:[
- {id:null,name:'L'},
- {id:null,name:'R'},
- {id:null,name:'F'},
- {id:null,name:'B'},
- {id:null,name:'LF'},
- {id:24,name:'LB',angle:{lat: -3, lon: -52},offset:-120},
- {id:16,name:'RF',angle:{lat: 5.2, lon: 179},offset:180},
- {id:19,name:'RB',angle:{lat: -1.2, lon: -81},offset:180}
- ],
- // L:null,R:null,F:null,B:null,LF:null,LB:{id:24,angle:{lat: -3, lon: -52},offset:-120},
- // RF:{id:16,angle:{lat: 5.2, lon: 179},offset:180},RB:{id:19,angle:{lat: -1.2, lon: -81},offset:180},
- spots:[
- {name:'spot1',ath: 134.77850440502587 ,atv: 5.364103665080412},
- {name:'spot2',ath: 92.86339414071163 ,atv: 9.792108196602182}
-
- ]},
- {id:19,name:"19livingRoom",title:'19客厅',home:{T:8,R:50},view:16,
- ath: 0 ,atv: 0 ,
- image:"panos/19livingRoom.png",
- direction:[
- {id:null,name:'L'},
- {id:16,name:'R',angle:{lat: -8.2, lon: 178},offset:180},
- {id:18,name:'F',angle:{lat: -2, lon: 75},offset:180},
- {id:17,name:'B',angle:{lat: -1.2, lon: -81},offset:180},
- {id:null,name:'LF'},
- {id:23,name:'LB',angle:{lat: -1, lon: -236},offset:0},
- {id:null,name:'RF'},
- {id:14,name:'RB',angle:{lat: -7, lon: 251},offset:120}
- ],
- // L:null,R:{id:16,angle:{lat: -8.2, lon: 178},offset:180},F:{id:18,angle:{lat: -2, lon: 75},offset:180},
- // B:{id:17,angle:{lat: -1.2, lon: -81},offset:180},LF:null,LB:{id:23,angle:{lat: -1, lon: -236},offset:0},RF:null,
- // RB:{id:14,angle:{lat: -7, lon: 251},offset:120},
- spots:[
- {name:'spot1',ath: -128.32247090615235 ,atv: -0.5647930758786627},
- {name:'spot2',ath: 109.80857804731679 ,atv: 5.539688389992394},
- {name:'spot3',ath: -4.651827901703093 ,atv: -1.3955474335607447}
- ]},
- {id:20,name:"20livingRoom",title:'20客厅',home:{T:40,R:45},view:170,
- ath: 0 ,atv: 0 ,
- image:"panos/20livingRoom.png",
- direction:[
- {id:21,name:'L',angle:{lat: -0.6, lon: -117},offset:150},
- {id:15,name:'R',angle:{lat: 2, lon: 55},offset:120},
- {id:null,name:'F'},
- {id:22,name:'B',angle:{lat: -1, lon: 70},offset:180},
- {id:null,name:'LF'},
- {id:null,name:'LB'},
- {id:14,name:'RF',angle:{lat: -1.8, lon: -44},offset:180},
- {id:null,name:'RB'}
- ],
- // L:{id:21,angle:{lat: -0.6, lon: -117},offset:150},R:{id:15,angle:{lat: 2, lon: 55},offset:120},
- // F:null,B:{id:22,angle:{lat: -1, lon: 70},offset:180},LF:null,LB:null,RF:{id:14,angle:{lat: -1.8, lon: -44},offset:180},RB:null,
- spots:[
- {name:'spot1',ath: 78.95542730570243 ,atv: 6.367749153204735},
- {name:'spot2',ath: -127.6284013542717 ,atv: 7.7561750263021505}
- ]},
- {id:21,name:"21livingRoom",title:'21客厅',home:{T:42,R:55},view:28,
- ath: 0 ,atv: 0 ,
- image:"panos/21livingRoom.png",
- direction:[
- {id:null,name:'L'},
- {id:null,name:'R'},
- {id:20,name:'F',angle:{lat: 0, lon: -179},offset:0},
- {id:null,name:'B'},
- {id:20,name:'LF',angle:{lat: -1.1, lon: -190},offset:0},
- {id:null,name:'LB'},
- {id:null,name:'RF'},
- {id:null,name:'RB'}
- ],
- // L:null,R:null,F:{id:20,angle:{lat: 0, lon: -179},offset:0},B:null,LF:{id:20,angle:{lat: -1.1, lon: -190},
- // offset:0},LB:null,RF:null,RB:null,
- spots:[
- {name:'spot1',ath: -5.271215815194857 ,atv: -0.3104829540388001}
- ]},
- {id:22,name:"22livingRoom",title:'22客厅',home:{T:23,R:20},view:0,
- ath: 0 ,atv: 0 ,
- image:"panos/22livingRoom.png",
- direction:[
- {id:null,name:'L'},
- {id:null,name:'R'},
- {id:null,name:'F'},
- {id:null,name:'B'},
- {id:null,name:'LF'},
- {id:null,name:'LB'},
- {id:null,name:'RF'},
- {id:20,name:'RB',id:20,angle:{lat: -2, lon: 84},offset:0}
- ],
- // L:null,R:null,F:null,B:null,LF:null,LB:null,RF:null,RB:{id:20,angle:{lat: -2, lon: 84},offset:0},
- spots:[
- {name:'spot1',ath: -127.25382000507834 ,atv: 5.000840647364074},
- ]},
- {id:23,name:"23kitchen",title:'23厨房',home:{T:-5,R:65},view:-113,image:"panos/23kitchen.png",
- ath: -26.247969873262953 ,atv: 1.9511418415203767 ,
- direction:[
- {id:null,name:'L'},
- {id:null,name:'R'},
- {id:null,name:'F'},
- {id:17,name:'B',angle:{lat: 0, lon: 165},offset:180},
- {id:null,name:'LF'},
- {id:17,name:'LB',angle:{lat: -5.7, lon: 197},offset:160},
- {id:null,name:'RF'},
- {id:null,name:'RB'}
- ],
- // L:null,R:null,F:null,B:{id:17,angle:{lat: 0, lon: 165},offset:180},LF:null,LB:{id:17,angle:{lat: -5.7, lon: 197},offset:160},
- // RF:null,RB:null,
- spots:[
- {name:'spot1',ath: 11.318635649670778 ,atv: -4.031145651752962}
- ]},
- {id:24,name:"24laundry",title:'24洗衣间',home:{T:-5,R:40},view:65,image:"panos/24laundry.png",
- ath: 67.48094136994914 ,atv: 1.300446246164014 ,
- direction:[
- {id:null,name:'L'},
- {id:null,name:'R'},
- {id:null,name:'F'},
- {id:null,name:'B'},
- {id:null,name:'LF'},
- {id:null,name:'LB'},
- {id:18,name:'RF',angle:{lat: 1.3, lon: 152},offset:230},
- {id:null,name:'RB'}
- ],
- // L:null,R:null,F:null,B:null,LF:null,LB:null,RF:{id:18,angle:{lat: 1.3, lon: 152},offset:230},RB:null,
- spots:[
- {name:'spot1',ath: -15.195869050543152 ,atv: 0.46518191001488113}
-
- ]},
- {id:25,name:"25frontGatePorch",title:'25前门门廊',home:{T:65,R:75},view:86,
- ath: 70.61235161030685 ,atv: 3.5989063222258157 ,
- image:"panos/25frontGatePorch.jpg",
- direction:[
- {id:6,name:'L',angle:{lat: -6, lon: 47},offset:-90},
- {id:10,name:'R',angle:{lat: 2.2, lon: -85},offset:180},
- {id:11,name:'F',angle:{lat: -5, lon: -67},offset:60},
- {id:1,name:'B',angle:{lat: 1.7, lon: 17},offset:180},
- {id:null,name:'LF'},
- {id:null,name:'LB'},
- {id:9,name:'RF',angle:{lat: -10, lon: -230},offset:-90},
- {id:1,name:'RB',angle:{lat: 0, lon: 0},offset:180}
- ],
- // L:{id:6,angle:{lat: -6, lon: 47},offset:-90},R:{id:10,angle:{lat: 2.2, lon: -85},offset:180},
- // F:{id:11,angle:{lat: -5, lon: -67},offset:60},B:{id:1,angle:{lat: 1.7, lon: 17},offset:180},LF:null,LB:null,
- // RF:{id:9,angle:{lat: -10, lon: -230},offset:-90},RB:{id:1,angle:{lat: 0, lon: 0},offset:180},
- spots:[
- {name:'spot1',ath: 208.84654004725317 ,atv: -1.6201573883004305},
- {name:'spot2',ath: 238.06985082121847 ,atv: 9.05712968309981},
- {name:'spot3',ath: -56.2838380127777 ,atv: 8.217283259609147},
- {name:'spot4',ath: 110.2991070639365 ,atv: 7.7864420999452335}
- ]},
- ],
- direction:[
- {id:1,name:"B",at:{x:0,y:0,z:-1}},
- {id:2,name:"F",at:{x:0,y:0,z:1}},
- {id:3,name:"R",at:{x:-1,y:0,z:0}},
- {id:4,name:"L",at:{x:1,y:0,z:0}},
- {id:5,name:"down",at:{x:0,y:1,z:0}},
- {id:6,name:"up",at:{x:0,y:-1,z:0}},
- {id:1,name:"LF",at:{x:1,y:0,z:1}},
- {id:2,name:"RF",at:{x:-1,y:0,z:1}},
- {id:3,name:"LB",at:{x:1,y:0,z:-1}},
- {id:4,name:"RB",at:{x:-1,y:0,z:-1}},
- ],
- playList:{
- idx:0,
- orders:[
- {id:1},{id:14},{id:17},{id:23},{id:19},{id:24},{id:18},{id:16},{id:22},{id:20},{id:21},{id:15},
- {id:25},{id:2},{id:3},{id:4},{id:5},{id:6},{id:7},{id:8},{id:9},{id:10},{id:11},{id:12},
- {id:13}
- ]
- },
- menuList:[
- {id:1},{id:2},{id:5},{id:9},{id:12},{id:14},{id:16},{id:17},{id:20}
- ]
- }
- embedpano({ id: "krpanoSWFObject_",swf:"lib/tour.swf", xml:"js/tour.xml", target:"pano", html5:"auto", mobilescale:1.0,
- passQueryParameters:true, onready: krpanoReady, vars:settings});
- function krpanoReady(krpano){
- // var krpano = document.getElementById('krpanoSWFObject_');
- window.krpano = krpano
- // krpano.call("trace(krpano is ready...)");
- changeTourMode()
- krpano.set("events.onviewchange", function()
- {
- updateHome()
- });
- krpano.set("events.onloadcomplete", function(e)
- {
- const scene_full_name = krpano.get('xml.scene')
- for(let i=0;i<house.src.length;i++){
- if(scene_full_name.toLowerCase().indexOf(house.src[i].name.toLowerCase())>=0 ){
- house.idx = i
- i = house.src.length
- }
- }
- setHomePosition()
- updateHome()
- });
- }
- function changeTourMode(){
- if(house.mode==='menu'){
- // krpano.set('autorotate.enabled',true)
- }else{
- }
- }
- function onKeyEvent(e){
- }
- init();
- animate();
- function init() {
- const queryString = window.location.search;
- const urlParams = new URLSearchParams(queryString);
- const panoId = urlParams.get('id')?urlParams.get('id'):0
- house.idx = panoId
- const backurl = urlParams.get('backurl')?urlParams.get('backurl'):'ybf.html'
- house.backurl = backurl
- const scene_name = 'scene_' + house.src[house.idx ].name
- changeScene(scene_name)
- const ath = house.src[house.idx].ath
- const atv = house.src[house.idx].atv
- krpano.call('lookat('+ath+','+atv+')')
- initMenu()
- setHomePosition()
-
- document.addEventListener('mousedown', onPointerStart, false);
- document.addEventListener('mousemove', onPointerMove, false);
- document.addEventListener('mouseup', onPointerUp, false);
- document.addEventListener('wheel', onDocumentMouseWheel, false);
- document.addEventListener('touchstart', onPointerStart, false);
- document.addEventListener('touchmove', onPointerMove, false);
- document.addEventListener('touchend', onPointerUp, false);
-
- // document.getElementById("menuTip").style.display='flex';
- // setTimeout( function(){
- // document.getElementById("menuTip").style.display='none';
- // }, 5000 );
- // document.addEventListener('keydown', onKeyDown);
- // document.addEventListener('keyup', onKeyUp);
- // window.addEventListener('resize', onWindowResize, false);
- }
- // function updateDirection(){
- // for(let d of house.src[house.idx].direction){
-
- // switch(d.name){
- // case 'F':
- // if(d.id!=null){
- // document.getElementById("directionTop").innerHTML = house.src[d.id-1].title
- // // document.getElementById("directionTop").style.visibility = true
- // document.getElementById("direct_top").style.color = '#ffffff'
- // document.getElementById("direct_top_img").src = './yaoimages/direction_top.png'
- // }else{
- // document.getElementById("directionTop").innerHTML = ''
- // // document.getElementById("directionTop").style.visibility = false
- // document.getElementById("direct_top").style.color = '#c1c1c1'
- // document.getElementById("direct_top_img").src = './yaoimages/direction_top_disable.png'
- // }
- // break
- // case 'B':
- // if(d.id!=null){
- // document.getElementById("directionLeft").innerHTML = house.src[d.id-1].title
- // document.getElementById("direct_left").style.color = '#ffffff'
- // document.getElementById("direct_left_img").src = './yaoimages/direction_left.png'
- // }else{
- // document.getElementById("directionLeft").innerHTML = ''
- // document.getElementById("direct_left").style.color = '#c1c1c1'
- // document.getElementById("direct_left_img").src = './yaoimages/direction_left_disable.png'
- // }
- // break
- // case 'L':
- // if(d.id!=null){
- // document.getElementById("directionBottom").innerHTML = house.src[d.id-1].title
- // document.getElementById("direct_bottom").style.color = '#ffffff'
- // document.getElementById("direct_bottom_img").src = './yaoimages/direction_bottom.png'
- // }else{
- // document.getElementById("directionBottom").innerHTML = ''
- // document.getElementById("direct_bottom").style.color = '#c1c1c1'
- // document.getElementById("direct_bottom_img").src = './yaoimages/direction_bottom_disable.png'
- // }
- // break
- // case 'R':
- // if(d.id!=null){
- // document.getElementById("directionRight").innerHTML = house.src[d.id-1].title
- // document.getElementById("direct_right").style.color = '#ffffff'
- // document.getElementById("direct_right_img").src = './yaoimages/direction_right.png'
- // }else{
- // document.getElementById("directionRight").innerHTML = ''
- // document.getElementById("direct_right").style.color = '#c1c1c1'
- // document.getElementById("direct_right_img").src = './yaoimages/direction_right_disable.png'
- // }
- // break
- // default:
- // break
- // }
- // }
- // // }
- // changeSpots()
- // }
- // function directionBack(){
- // const parent_id = house.src[house.idx].parent
- // if(parent_id){
- // const idx = getIdxFromId(parent_id)
- // changeTexture(idx)
- // }
- // }
- // function createText(textWord){
- // let canvas = document.getElementById('textCanvas')
- // // let canvas = document.createElement('canvas')
- // canvas.width = 320
- // canvas.height = 60
- // let ctx = canvas.getContext('2d')
- // ctx.fillStyle = "#fffff0";
- // // // ctx.font = 'normal 24pt "Microsoft Yahei"'
- // // // // const name = clientZhou.country[clientZhou.idx].name
- // // // ctx.fillText(name, 120, 60)
- // // // let textWord = clientZhou.country[clientZhou.idx].description
- // ctx.font = 'normal 24pt "Microsoft Yahei"'
- // let len = parseInt(textWord.length / 35)
- // const offset = (320 - 30*parseInt(textWord.length))/2
- // for (let i = 0; i < (len + 1); i++) {
- // let space = (320 - 40*parseInt(textWord.length))/2
- // if (i === len) {
- // space = textWord.length - len * 35
- // }
- // let word = textWord.substr(i * 20, space)
- // ctx.fillText(word, offset, 15+35*(i+1))
- // }
- // let url = canvas.toDataURL('image/png')
- // let texture = new THREE.TextureLoader().load( url);
- // const tmaterial = new THREE.SpriteMaterial( {map:texture,transparent : true,opacity:1, side: THREE.DoubleSide} );
- // let text_plane2 = new THREE.Sprite( tmaterial );
- // text_plane2.scale.set(32,10,1);
- // // text_plane.position.set(30,30,30)
- // return text_plane2;
- // }
- function initMenu(){
- var menu=document.getElementById("menu");
- while (menu.firstChild) {
- menu.removeChild(menu.firstChild);
- }
- let mid = 0
- for(let item of house.menuList){
- const dpano = document.createElement("div");
- dpano.className = 'pano'
- // dpano.attr({'data-id':item.id})
- for(let i in house.src){
- if(house.src[i].id===item.id){
- mid = i
- break
- }
- }
- dpano.setAttribute('data-id',mid);
- const title = document.createElement("div");
- title.className = 'title'
- title.innerHTML = house.src[mid].title
- const thumb = document.createElement("div");
- thumb.className = 'thumb'
- // thumb.innerHTML = house.src[i].name
- const img=document.createElement("img");
- img.src= './thumb1k/'+house.src[mid].name + '1k_f.jpg';
- thumb.appendChild(img);
- dpano.appendChild(title);
- dpano.appendChild(thumb);
- menu.appendChild(dpano);
- }
- const ddiv = document.createElement("div");
- ddiv.innerHTML='-'
- ddiv.className = 'panoEnd'
- menu.appendChild(ddiv);
- // displayMenuNone()
- // house.menu_control_select = 0
- // const firstChild = document.getElementById('menu').firstChild
- // firstChild.className = 'panoSelect'
- // document.getElementById('menu').scrollLeft = 0
- }
- // function walkingCamera(){
- // const d = getCameraDirection()
- // walkOn(d)
- // }
- // function zoomIn(){
- // fov = camera.fov + 10
- // fov = THREE.MathUtils.clamp(fov, 15, 75);
- // if(fov!==camera.fov){
- // updateCameraTo(fov)
- // }
- // }
- // function zoomOut(){
- // fov = camera.fov - 10
- // fov = THREE.MathUtils.clamp(fov, 15, 75);
- // if(fov!==camera.fov){
- // updateCameraTo(fov)
- // }
- // }
- function displayMenu(){
- house.mode = 'menu'
- document.getElementById("menu").style.display='flex';
- //
- // document.getElementById("menuTitle").style.display='flex';
- // document.getElementById("menuControl").style.display='flex';
- // document.getElementById("wholeDirection").style.display='none';
- const control = krpano.get("control");
- control.keybaccelerate =0
- krpano.set("control",control);
- }
- function displayMenuNone(){
- house.mode = 'full'
- document.getElementById("menu").style.display='none';
- // document.getElementById("menuTip").style.display='none';
- // document.getElementById("menuTitle").style.display='none';
- // document.getElementById("menuControl").style.display='none';
- // document.getElementById("wholeDirection").style.display='flex';
- // document.getElementById("menuTip").style.display='flex';
- // setTimeout( function(){
- // document.getElementById("menuTip").style.display='none';
- // }, 5000 );
- // let fov = 75
- // camera.fov = fov
- // camera.updateProjectionMatrix();
- // house.zoom.is_selected = false
- // house.zoom.status = 'zoom'
- // document.getElementById('zoom').src="./yaoimages/zoomin.png"
- // document.getElementById('zoom_title').innerHTML='放大'
- const control = krpano.get("control");
- control.keybaccelerate =0.5
- krpano.set("control",control);
- }
- // function doubleDelay(doubleCallback,callback,p){
- // timeId = setTimeout( function(){
- // if(Date.now()-delta<400){
- // for(let i in timeIds){
- // clearTimeout(timeIds[i])
- // }
- // // const d = getCameraDirection()
- // // walkOn(d)
- // if(doubleCallback){
- // // doubleCallback()
- // }
- // }else{
- // // lookDirection(2)
- // callback(p)
- // }
- // }, 400 );
- // timeIds.push(timeId)
- // }
- function onKeyDown(e){
- // key_down_frequency++
- // delta = Date.now()
- // if(key_down_frequency>LONG_PRESS_TIMES){
- // switch(e.keyCode){
- // case 38://ArrowUp
- // lat +=1.5
- // break
- // case 40: //ArrowDown
- // lat -=1.5
- // break
- // case 37: //ArrowLeft
- // lon -= 1.5
- // break
- // case 39://ArrowRight
- // lon += 1.5
- // break
- // case 13://Enter
- // house.is_auto_play = true
- // break
- // default:
- // break
- // }
- // }
- }
- function setHomePosition(){
- // const angle = house.src[house.idx].home.A
- const top = house.src[house.idx].home.T
- const right = house.src[house.idx].home.R
- document.getElementById('cam').style.top = top + 'px';
- document.getElementById('cam').style.right = right+ 'px';
- // const offset = house.nextId!==null?house.nextId.offset:180
- const angle = house.src[house.idx].view.h//+house.src[house.idx].view.offset
- document.getElementById('cam').style.transform = 'rotate('+angle+'deg)';
- // if(!isAutoPlay){
- // updateMapPoint()
- // changeSpots()
- // }
- }
- function updateHome(){
- if(!house.isLoading){
- let angle = house.src[house.idx].view
- angle += krpano.get("view.hlookat")
- document.getElementById('cam').style.transform = 'rotate('+angle+'deg)';
- }
- }
- function arrowUp(){
- if(house.mode==='full'){
- // doubleDelay(walkingCamera,lookDirection,2)
- }else if(house.mode==='menu'){
- }
- }
- function arrowDown(){
- if(house.mode==='full'){
- // doubleDelay(null,lookDirection,1)
- }else if(house.mode==='menu'){
- // const firstChild = document.getElementById('menu').firstChild
- // firstChild.className = 'panoSelect'
- }
- }
- function arrowLeft(){
- if(house.mode==='full'){
- // doubleDelay(zoomIn,lookDirection,3)
- }else if(house.mode==='menu'){
- let pano_select = -1
- const nodess = document.getElementById("menu").childNodes;
- for(let i =0;i<nodess.length-1;i++){
- if(nodess[i].className==='panoSelect'){
- pano_select=i===0?nodess.length -2:i-1
- nodess[i].className = 'pano'
- nodess[pano_select].className = 'panoSelect'
- const fromLeft = document.getElementById('menu').scrollLeft
- const toLeft = 270*pano_select;
- const coords = {x: fromLeft, y: 0} // Start at (0, 0)
- const tween = new TWEEN.Tween(coords) // Create a new tween that modifies 'coords'.
- .to({x: toLeft, y: 200}, 1000) // Move to (300, 200) in 1 second.
- .easing(TWEEN.Easing.Quadratic.Out) // Use an easing function to make the animation smooth.
- .onUpdate(() => {
- // Called after tween.js updates 'coords'.
- // Move 'box' to the position described by 'coords' with a CSS translation.
- document.getElementById('menu').scrollLeft = coords.x
- })
- .start() // Start the tween immediately.
- i = nodess.length
-
- }
- }
- if(pano_select==-1){
- for(let i=0;i<house.menuList.length;i++){
- if(house.menuList[i].id===house.idx){
- pano_select = i
- i = house.menuList.length
- }
- }
- if(pano_select==-1){
- pano_select=0
- }
-
- nodess[pano_select].className = 'panoSelect'
- const fromLeft = document.getElementById('menu').scrollLeft
- const toLeft = 270*pano_select;
- const coords = {x: fromLeft, y: 0} // Start at (0, 0)
- const tween = new TWEEN.Tween(coords) // Create a new tween that modifies 'coords'.
- .to({x: toLeft, y: 200}, 1000) // Move to (300, 200) in 1 second.
- .easing(TWEEN.Easing.Quadratic.Out) // Use an easing function to make the animation smooth.
- .onUpdate(() => {
- // Called after tween.js updates 'coords'.
- // Move 'box' to the position described by 'coords' with a CSS translation.
- document.getElementById('menu').scrollLeft = coords.x
- })
- .start() // Start the tween immediately.
- }
- }
- }
- function arrowRight(){
- if(house.mode==='full'){
- // doubleDelay(zoomOut,lookDirection,4)
- }else if(house.mode==='menu'){
- let pano_select = -1
- const nodess = document.getElementById("menu").childNodes;
- for(let i =0;i<nodess.length-1;i++){
- if(nodess[i].className==='panoSelect'){
- pano_select=nodess.length-2===i?0:i+1
- // document.getElementById('menu').scrollLeft =270*pano_select;
- const fromLeft = document.getElementById('menu').scrollLeft
- const toLeft = 270*pano_select;
- const coords = {x: fromLeft, y: 0} // Start at (0, 0)
- const tween = new TWEEN.Tween(coords) // Create a new tween that modifies 'coords'.
- .to({x: toLeft, y: 200}, 1000) // Move to (300, 200) in 1 second.
- .easing(TWEEN.Easing.Quadratic.Out) // Use an easing function to make the animation smooth.
- .onUpdate(() => {
- // Called after tween.js updates 'coords'.
- // Move 'box' to the position described by 'coords' with a CSS translation.
- document.getElementById('menu').scrollLeft = coords.x
- })
- .start() // Start the tween immediately.
- nodess[i].className = 'pano'
- nodess[pano_select].className = 'panoSelect'
- i = nodess.length
- }
- }
- if(pano_select==-1){
- for(let i=0;i<house.menuList.length;i++){
- if(house.menuList[i].id===house.idx){
- pano_select = i
- i = house.menuList.length
- }
- }
- if(pano_select==-1){
- pano_select=0
- }
-
- nodess[pano_select].className = 'panoSelect'
- const fromLeft = document.getElementById('menu').scrollLeft
- const toLeft = 270*pano_select;
- const coords = {x: fromLeft, y: 0} // Start at (0, 0)
- const tween = new TWEEN.Tween(coords) // Create a new tween that modifies 'coords'.
- .to({x: toLeft, y: 200}, 1000) // Move to (300, 200) in 1 second.
- .easing(TWEEN.Easing.Quadratic.Out) // Use an easing function to make the animation smooth.
- .onUpdate(() => {
- // Called after tween.js updates 'coords'.
- // Move 'box' to the position described by 'coords' with a CSS translation.
- document.getElementById('menu').scrollLeft = coords.x
- })
- .start() // Start the tween immediately.
- }
-
- }
- }
- window.onMenuEvent= function(){
- changeMode()
- // if(house.mode==='full'){
- // }else if(house.mode==='menu'){
-
- // }
- }
- function onKeyUp(e){
- // if(key_down_frequency<LONG_PRESS_TIMES){
- // switch(e.keyCode){
- // case 38://ArrowUp
- // arrowUp()
- // break
- // case 40: //
- // arrowDown()
- // break
- // case 37: //ArrowLeft
- // arrowLeft()
- // break
- // case 39://ArrowRight
- // arrowRight()
- // break
- // case 13://Enter
- // // console.log('house.mode',house.mode)
- // // enterPano()
- // walkingCamera()
- // break
- // case 48: //0
- // directionBack()
- // break
- // case 49://1
- // walkOn('F')
- // break
- // case 50://2
- // walkOn('B')
- // break
- // case 51://3
- // walkOn('L')
- // break
- // case 52://4
- // walkOn('R')
- // break
- // case 53:
- // window.onMenuEvent()
- // break
- // default:
- // break
- // }
-
- // }
- // key_down_frequency = 0
- }
- function onWindowResize() {
- // camera.aspect = window.innerWidth / window.innerHeight;
- // camera.updateProjectionMatrix();
- // renderer.setSize(window.innerWidth, window.innerHeight);
- }
- function onPointerStart(event) {
- // isUserInteracting = true;
- // if(is_pc){
- // // pauseEvent(event)
- // }
- // var clientX = event.clientX || event.touches[0].clientX;
- // var clientY = event.clientY || event.touches[0].clientY;
- // onMouseDownMouseX = clientX;
- // onMouseDownMouseY = clientY;
- // onMouseDownLon = lon;
- // onMouseDownLat = lat;
- }
- function onPointerMove(event) {
- // if (isUserInteracting === true) {
- // var clientX = event.clientX || (typeof(event.touches)!=='undefined'?event.touches[0].clientX:0);
- // var clientY = event.clientY || (typeof(event.touches)!=='undefined'?event.touches[0].clientY:0);
- // // lon = (onMouseDownMouseX - clientX) * 0.1 + onMouseDownLon;
- // // lat = (clientY - onMouseDownMouseY) * 0.1 + onMouseDownLat;
- // if(house.mode==='full'){
- // lon = (onMouseDownMouseX - clientX) * 0.075 + onMouseDownLon;
- // lat = (clientY - onMouseDownMouseY) * 0.075 + onMouseDownLat;
- // }else if(house.mode==='menu'){
- // const deltaX = (onMouseDownMouseX - clientX) * 0.031
- // const fromLeft = document.getElementById('menu').scrollLeft
- // const toLeft = fromLeft + deltaX
- // document.getElementById('menu').scrollLeft = toLeft
- // }
- // }
- }
- function onPointerUp() {
- // isUserInteracting = false;
- // mouse.x = ( event.clientX / window.innerWidth ) * 2 - 1;
- // mouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1;
-
- // onRay()
- }
- function onRay() {
- // update the picking ray with the camera and mouse position
- // raycaster.setFromCamera( mouse, camera );
- // // calculate objects intersecting the picking ray
- // const intersects = raycaster.intersectObjects( scene.children );
- // if(intersects.length>0){
- // // console.log(intersects[0])
- // }
- }
- function onDocumentMouseWheel(event) {
- // var fov = camera.fov + event.deltaY * 0.05;
- // camera.fov = THREE.MathUtils.clamp(fov, 15, 75);
- // camera.updateProjectionMatrix();
- }
- function IsPC(){
- var userAgentInfo = navigator.userAgent;
- var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");
- var flag = true;
- for (var v = 0; v < Agents.length; v++) {
- if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; }
- }
- return flag;
- }
- //------------------------------------------
- function getCameraDirection(){
-
- // let min_angle = Math.PI/2
- // let target_name = null
- // const cameraTarget = camera.target.normalize()
-
- // for(const d in house.direction){
- // const dat = new THREE.Vector3(house.direction[d].at.x,house.direction[d].at.y,house.direction[d].at.z).normalize()
- // const angle = cameraTarget.angleTo(dat)
- // if(min_angle>angle){
- // for(let direct of house.src[house.idx].direction){
- // if(direct.name==house.direction[d].name&&direct.id!=null){
- // min_angle = angle
- // target_name = direct
- // }
- // }
- // }
- // }
- // return target_name
- }
- function walkOn(d){
- // // const arr = ['F','B','L','R']
- // let next_d = d
- // if(typeof(d) == 'string'){
- // for(let dd of house.src[house.idx].direction){
- // if(dd.name===d){
- // next_d = dd
- // break
- // }
- // }
- // }
- // const nextId = next_d
- // if(nextId&&!house.isLoading){
- // const idx = getIdxFromId(nextId.id)
- // // changeTexture(idx)
- // preChangeTexture(idx)
- // }else{
- // moveNull()
- // }
- }
- //------------------------------------------------------
- function preChangeTexture(idx){
- // if(idx>=0){
- // for(let i=spotGroup.children.length-1;i>=0;i--){
- // spotGroup.remove(spotGroup.children[i])
- // }
-
- // house.numLoaded = 0
- // house.isLoading = true
- // // document.getElementById('tip').style.display = 'flex'
-
- // preUpdateFaceTexture(idx,'f')
- // preUpdateFaceTexture(idx,'b')
- // preUpdateFaceTexture(idx,'l')
- // preUpdateFaceTexture(idx,'r')
- // preUpdateFaceTexture(idx,'u')
- // preUpdateFaceTexture(idx,'d')
- // }
- }
- function preUpdateFaceTexture(idx, face){
- // const imgPath = house.src[idx].name +"1k_"+face+'.jpg'
- // // load a resource
- // loader.load(
- // // resource URL
- // imgPath,
- // // onLoad callback
- // function ( texture ) {
- // house.numLoaded++
- // updateFaceMaterial(texture,face)
- // if(house.numLoaded===mesh.material.length){
- // house.numLoaded = 0
- // // console.log('sssssssssss')
- // // updateFaceCamera(texture,idx,face)
- // // changeTexture(idx)
- // changeTexture2k(idx)
- // }
- // },
- // // onProgress callback currently not supported
- // undefined,
- // // onError callback
- // function ( err ) {
- // console.error( 'An error happened.' );
- // }
- // );
- }
- function changeTexture2k(idx){
- // for(let i=spotGroup.children.length-1;i>=0;i--){
- // spotGroup.remove(spotGroup.children[i])
- // }
- // house.numLoaded = 0
- // house.isLoading = true
- // // document.getElementById('tip').style.display = 'flex'
- // updateFaceTexture2k(idx,'f')
- // updateFaceTexture2k(idx,'b')
- // updateFaceTexture2k(idx,'l')
- // updateFaceTexture2k(idx,'r')
- // updateFaceTexture2k(idx,'u')
- // updateFaceTexture2k(idx,'d')
- }
- function updateFaceTexture2k(idx, face){
- // const imgPath = house.src[idx].name +"2k_"+face+'.jpg'
- // // load a resource
- // loader.load(
- // // resource URL
- // imgPath,
- // // onLoad callback
- // function ( texture ) {
- // house.numLoaded++
- // updateFaceMaterial(texture,face)
- // if(house.numLoaded===mesh.material.length){
- // house.numLoaded=0
- // // updateFaceCamera(texture,idx,face)
- // changeTexture(idx)
- // }
- // },
- // // onProgress callback currently not supported
- // undefined,
- // // onError callback
- // function ( err ) {
- // console.error( 'An error happened.' );
- // }
- // );
- }
- function changeTexture(idx){
- // for(let i=spotGroup.children.length-1;i>=0;i--){
- // spotGroup.remove(spotGroup.children[i])
- // }
- // house.numLoaded = 0
- // house.isLoading = true
- // // document.getElementById('tip').style.display = 'flex'
- // updateFaceTexture(idx,'f')
- // updateFaceTexture(idx,'b')
- // updateFaceTexture(idx,'l')
- // updateFaceTexture(idx,'r')
- // updateFaceTexture(idx,'u')
- // updateFaceTexture(idx,'d')
- }
- function updateFaceTexture(idx, face){
- // const imgPath = house.src[idx].name +"8k_"+face+'.jpg'
- // // load a resource
- // loader.load(
- // // resource URL
- // imgPath,
- // // onLoad callback
- // function ( texture ) {
- // house.numLoaded++
- // updateFaceMaterial(texture,face)
- // if(house.numLoaded===mesh.material.length){
- // updateFaceCamera(texture,idx,face)
- // }
- // },
- // // onProgress callback currently not supported
- // undefined,
- // // onError callback
- // function ( err ) {
- // console.error( 'An error happened.' );
- // }
- // );
- }
- function updateFaceMaterial(texture,face){
- // for(let i=0;i<mesh.material.length;i++){
- // if(mesh.material[i].name===face){
- // mesh.material[i].map.dispose()
- // mesh.material[i].map = texture
- // mesh.material[i].map.needsUpdate = true;
- // i=mesh.material.length
- // }
- // }
- }
- function updateFaceCamera(texture,idx,face){
-
- // const coords = {x: camera.fov*35/20, y: lat,z:lon} // Start at (0, 0)
- // const fov = camera.fov
- // lat = house.src[idx].view.lat
- // lon = house.src[idx].view.lon
- // const tween = new TWEEN.Tween(coords) // Create a new tween that modifies 'coords'.
- // .to({x:fov}, 1200) // Move to (300, 200) in 1 second.
- // .easing(TWEEN.Easing.Quadratic.Out) // Use an easing function to make the animation smooth.
- // .onUpdate((e,t) => {
- // camera.fov = coords.x
- // camera.updateProjectionMatrix();
- // })
- // .onComplete(()=>{
- // // house.nextId = nextId
- // house.idx = idx
- // camera.fov = THREE.MathUtils.clamp(fov, 15, 75);
- // camera.updateProjectionMatrix();
- // house.isLoading = false
- // updateDirection()
- // })
- // .start() // Start the tween immediately.
- }
- function range360(a){
- while(a>360){
- a -=360
- }
- while(a<0){
- a +=360
- }
- return a
- }
- function defaultCameraFov(){
- // let ilat = range360(lat)
- // let ilon = range360(lon)
- // const coords = {x: camera.fov, y: ilat,z:ilon} // Start at (0, 0)
- // // const fov = 45
- // const fov = 75
- // const tween = new TWEEN.Tween(coords) // Create a new tween that modifies 'coords'.
- // .to({x:fov,y:0,z:0}, 1200) // Move to (300, 200) in 1 second.
- // .easing(TWEEN.Easing.Quadratic.Out) // Use an easing function to make the animation smooth.
- // .onUpdate((e,t) => {
- // camera.fov = coords.x
- // camera.updateProjectionMatrix();
- // // lat = coords.y
- // lon = coords.z
- // })
- // .onComplete(()=>{
- // })
- // .start() // Start the tween immediately.
- }
- // ------------- auto update material ------------
- function autoLoadNextTexture(idx,face){
- // const imgPath = house.src[idx].name +"8k_"+face+'.jpg'
- // // load a resource
- // loader.load(
- // // resource URL
- // imgPath,
- // // onLoad callback
- // function ( texture ) {
- // house.numLoaded++
- // updateFaceMaterial(texture,face)
- // if(house.numLoaded===mesh.material.length){
- // house.isLoading = false
- // // document.getElementById('tip').style.display = 'none'
- // lat = house.src[idx].view.lat
- // lon = house.src[idx].view.lon
- // // setHomePosition()
- // updateDirection()
- // }
- // },
- // // onProgress callback currently not supported
- // undefined,
- // // onError callback
- // function ( err ) {
- // console.error( 'An error happened.' );
- // }
- // );
- }
- function autoUpdateMaterial(idx){
- // house.numLoaded = 0
- // house.isLoading = true
- // // document.getElementById('tip').style.display = 'flex'
- // autoLoadNextTexture(idx,'f')
- // autoLoadNextTexture(idx,'b')
- // autoLoadNextTexture(idx,'l')
- // autoLoadNextTexture(idx,'r')
- // autoLoadNextTexture(idx,'u')
- // autoLoadNextTexture(idx,'d')
- }
- function updateCameraTo(fov){
- // const coords = {x: camera.fov, y: 0} // Start at (0, 0)
- // const tween = new TWEEN.Tween(coords) // Create a new tween that modifies 'coords'.
- // .to({x:fov,y:0}, 600) // Move to (300, 200) in 1 second.
- // .easing(TWEEN.Easing.Quadratic.Out) // Use an easing function to make the animation smooth.
- // .delay(300)
- // .onUpdate((e,t) => {
- // camera.fov = coords.x
- // camera.updateProjectionMatrix();
- // })
- // .onComplete(()=>{
- // })
- // .start() // Start the tween immediately.
- }
- function moveNull(){
- var fov = Number( krpano.get("view.fov") );
- const t_fov = fov - 5
- const coords= {x:fov}
- const tween = new TWEEN.Tween(coords) // Create a new tween that modifies 'coords'.
- .to({x:t_fov}, 500) // Move to (300, 200) in 1 second.
- .easing(TWEEN.Easing.Quadratic.Out) // Use an easing function to make the animation smooth.
- .onUpdate((e,t) => {
- krpano.set("view.fov", coords.x);
- })
- .start() // Start the tween immediately.
- const coords2= {x:t_fov}
- const tween2 = new TWEEN.Tween(coords2) // Create a new tween that modifies 'coords'.
- .to({x:fov}, 500) // Move to (300, 200) in 1 second.
- .easing(TWEEN.Easing.Quadratic.Out) // Use an easing function to make the animation smooth.
- .onUpdate((e,t) => {
- krpano.set("view.fov", coords2.x);
- })
- // .start() // Start the tween immediately.
- tween.chain(tween2)
- }
- function lookZoom(z=5,t=600){
- // const fromX = camera.fov
- // const coords = {x: fromX, y: 0} // Start at (0, 0)
- // const toX = camera.fov + z
- // const tween = new TWEEN.Tween(coords) // Create a new tween that modifies 'coords'.
- // .to({x:toX,y:0}, t) // Move to (300, 200) in 1 second.
- // .easing(TWEEN.Easing.Quadratic.Out) // Use an easing function to make the animation smooth.
- // .onUpdate((e,t) => {
- // camera.fov = coords.x
- // camera.updateProjectionMatrix();
- // })
- // .start() // Start the tween immediately.
- }
- // direction 1/up 2/down 3/left 4/right
- function lookDirection(d=1){
- // const fromX = d===1||d===2?lat:lon
- // const coords = {x: fromX, y: 0} // Start at (0, 0)
- // const toX = d===1?lat-house.config.lat_step:d===2?lat+house.config.lat_step:d===3?lon-house.config.lon_step:lon+house.config.lon_step
- // const tween = new TWEEN.Tween(coords) // Create a new tween that modifies 'coords'.
- // .to({x:toX,y:0}, 600) // Move to (300, 200) in 1 second.
- // .easing(TWEEN.Easing.Quadratic.Out) // Use an easing function to make the animation smooth.
- // .onUpdate((e,t) => {
- // if(d===1||d===2){
- // lat = coords.x
- // }else{
- // lon = coords.x
- // }
-
- // })
- // .start() // Start the tween immediately.
- }
- function updateMapPoint(){
- // const idx = house.idx
- // let id = -1
- // var points=document.getElementById("redPoints");
- // while (points.firstChild) {
- // points.removeChild(points.firstChild);
- // }
- // // points.remove();
- // if(house.src[idx].D1){
- // id = house.src[idx].D1.id - 1
- // createMapPoint(id)
- // }
- // if(house.src[idx].D2){
- // id = house.src[idx].D2.id - 1
- // createMapPoint(id)
- // }
- // if(house.src[idx].D3){
- // id = house.src[idx].D3.id - 1
- // createMapPoint(id)
- // }
- // if(house.src[idx].D4){
- // id = house.src[idx].D4.id - 1
- // createMapPoint(id)
- // }
- }
- function createMapPoint(id){
- // const top = house.src[id].home.T
- // const right = house.src[id].home.D2
-
- // const img=document.createElement("img");
- // img.src="panos/redPoint.png";
- // img.style.position = 'absolute'
- // img.style.top = top +15+ 'px';
- // img.style.right = right-5+ 'px';
- // img.style.width = 8+ 'px';
- // img.style.height = 8+ 'px';
- // const points=document.getElementById("redPoints");
- // points.appendChild(img);
- }
- function getIdxFromId(id){
- let idx = -1
- for(const item in house.src){
- if(house.src[item].id===id){
- idx = item
- break
- }
- }
- return idx
- }
- function animate() {
- requestAnimationFrame(animate);
- // updateHome()
- TWEEN.update()
- // update();
- }
- function update() {
- // // controls.update();
- // if (isUserInteracting === false) {
- // // lon += 0.1;
- // }
- // if(house.is_auto_play){
- // // if(lon>360&&!house.texture.isloading){
- // if(lon>360&&!house.isloading){
- // lon = 0
- // // house.idx++
- // // if(house.idx>=house.src.length){
- // // house.idx = 0
- // // }
- // house.playList.idx++
- // if(house.playList.idx>=house.playList.orders.length){
- // house.playList.idx = 0
- // }
- // for(let i in house.src){
- // if(house.src[i].id===house.playList.orders[house.playList.idx].id){
- // house.idx = i
- // break
- // }
- // }
- // // house.idx = house.playList.orders[house.playList.idx].id-1
- // autoUpdateMaterial(house.idx)
- // }else{
- // lon += 0.2;
- // }
- // }
- // lat = Math.max(-85, Math.min(85, lat));
- // phi = THREE.MathUtils.degToRad(90 - lat);
- // theta = THREE.MathUtils.degToRad(lon);
- // camera.target.x = 512 * Math.sin(phi) * Math.cos(theta);
- // camera.target.y = 512 * Math.cos(phi);
- // camera.target.z = 512 * Math.sin(phi) * Math.sin(theta);
- // // updateHome()
- // camera.lookAt(camera.target);
-
- // renderer.render(scene, camera);
- }
- window.onBackEvent= function(){
-
- }
- var btn = new tvSysBtnBind({
- id: "Jdoc",
- className: "ctrlBtn",
- currentClass: "current",
- keyRemoveDefault: false,
- effect: "base",
- currentIndex: 0,
- onLoad: function(e) {
- // console.log(e);
- },
- onPress:function() {
- var keyCode = this.event.keyCode;
- // console.log('keyCode:'+keyCode)
- switch (keyCode) {
- case 37: // left
- // reloadData();
- arrowLeft()
- break;
- case 39: // right
- arrowRight()
- break;
- case 38: //up
- arrowUp()
- break;
- case 40: //down
- arrowDown()
- break;
- // case 13: //enter
-
- // break;
- case 33: //chanel +
-
- break;
- case 34: //chanel -
-
- break;
- case 48: //0
- // console.log('ddddd')
- // displayMenu()
- break;
- case 49://1
- walkingOn('F')
- break
- case 50://2
- walkingOn('B')
- break
- case 51://3
- walkingOn('L')
- break
- case 52://4
- walkingOn('R')
- break;
- case 53: //5
- const hlookat = krpano.get("view.hlookat")
- const vlookat = krpano.get("view.vlookat")
- // console.log(',ath:',hlookat,',atv:',vlookat)
- // var hotspotID = krpano.get('hotspot[spot1].atv');
- // var hotspotID = krpano.get('hotspot');
- // console.log(hotspotID);
- break;
- case 54: //6
- walkingDirection()
- break;
- case 55: //7
- break;
- case 57: //9
- changeMode()
- break;
- default:
- break;
- }
- },
- onEnterPress: function() {
- changeMode()
- },
- onBack: function() {
- if(house.is_auto_play){
- house.is_auto_play = false
- }else{
- if(house.mode==='menu'){
-
- displayMenuNone()
- }else{
- // window.location.href="index2.html?id="+house.idx
- const url = "index.html?id="+house.idx +"&backurl="+house.backurl
- window.location.href = url
- // VrBrowserToJS.vrBrowerExit()
- }
- }
-
- }
- });
- //----------------------------------------------
- function makeZoom(tfov){
- var fov = Number( krpano.get("view.fov") );
- const t_fov = tfov
- // krpano.set("view.fov", fov);
- console.log('fov',fov,'tfov',tfov)
- const coords= {x:fov}
- const tween = new TWEEN.Tween(coords) // Create a new tween that modifies 'coords'.
- .to({x:t_fov}, 500) // Move to (300, 200) in 1 second.
- .easing(TWEEN.Easing.Quadratic.Out) // Use an easing function to make the animation smooth.
- .onUpdate((e,t) => {
- // camera.fov = coords.x
- // camera.updateProjectionMatrix();
- krpano.set("view.fov", coords.x);
- })
- .onComplete(()=>{
- })
- .start() // Start the tween immediately.
- }
- // function zoomOut(){
- // makeZoom(75)
- // }
- // function zoomIn(){
- // makeZoom(30)
- // }
- function makeRotationAuto(is_auto){
- krpano.set('autorotate.enabled',is_auto)
- }
- function changeScene(scene_name){
- // krpano.call("loadscene('scene_gushu',null,MERGE,BLEND(1));");
- krpano.call("loadscene("+scene_name+",null,MERGE,BLEND(1));");
- updateDirection()
- setHomePosition()
- }
- function changeMode(){
- // krpano.call("stopmovements();");
- // krpano.call("stoplookto();");
- // console.log('menuMode')
- // house.mode = 'menu'
- if(house.mode==='full'){
- fullMode()
- }else{
- menuMode()
- }
- }
- function menuMode(){
- if(house.mode=='menu'){
- // if(house.menu_control_select==0||house.menu_control_select == -1){
- displayMenuNone()
- let pano_select = -1
- const nodess = document.getElementById("menu").childNodes;
- for(let i =0;i<nodess.length;i++){
- if(nodess[i].className==='panoSelect'){
- pano_select=nodess[i].getAttribute('data-id')
- i = nodess.length
- house.idx = pano_select
- }
- }
- const scene_name = 'scene_'+house.src[house.idx].name
- changeScene(scene_name)
- const ath = house.src[house.idx].ath
- const atv = house.src[house.idx].atv
- krpano.call('lookat('+ath+','+atv+')')
- // }else if(house.menu_control_select==1){ // zoom
- // let zoom_title = 0
- // let zoom_image = 0
- // switch(house.zoom.status){
- // case 'zoom':
- // zoom_title = '放大'
- // house.zoom.status = 'x0.9'
- // house.zoom.direction = 1
- // house.zoom.factor = 1 // 1.5
- // zoom_image="./yaoimages/zoomin.png"
- // house.menu_control_select=0
- // break
- // case 'x0.9':
- // zoom_title = 'x1'
- // house.zoom.status = 'x1'
- // house.zoom.direction = 1
- // house.zoom.factor = 1 // 1.5
- // zoom_image="./yaoimages/zoomin_click.png"
- // break
- // case 'x1':
- // zoom_title = 'x1.5'
- // house.zoom.status = 'x1.5'
- // house.zoom.direction = 1
- // house.zoom.factor = 1.5 // 1.5
- // zoom_image="./yaoimages/zoomin_click.png"
- // break
- // case 'x1.5':
- // zoom_title = 'x2'
- // house.zoom.status = 'x2'
- // house.zoom.direction = 1
- // house.zoom.factor = 2
- // house.zoom.is_selected = false // 1
- // zoom_image="./yaoimages/zoomout_click.png"
- // break
- // case 'x2':
- // zoom_title = 'x1.5'
- // house.zoom.status = 'x-1.5'
- // house.zoom.direction = -1
- // house.zoom.factor = 1.5
- // house.zoom.is_selected = false // 1
- // zoom_image="./yaoimages/zoomout_click.png"
- // break
- // case 'x-1.5':
- // zoom_title = 'x1'
- // house.zoom.status = 'zoom'
- // house.zoom.direction = -1
- // house.zoom.factor = 1
- // house.zoom.is_selected = false // 1
- // zoom_image="./yaoimages/zoomout_click.png"
- // break
- // case 'x-1':
- // zoom_title = 'zoom'
- // house.zoom.status = 'zoom'
- // house.zoom.direction = 0
- // house.zoom.factor = 1
- // house.zoom.is_selected = false // 1
- // zoom_image="./yaoimages/zoomout_click.png"
- // break
- // default:
- // break
- // }
-
- // document.getElementById('zoom_title').innerHTML=zoom_title
- // document.getElementById('zoom').src=zoom_image
- // let fov = house.zoom.factor==1?120:house.zoom.factor==2?30:75
- // console.log('fov',fov)
- // makeZoom(fov)
- // // // let fov = 75 - house.zoom.factor * house.zoom.step
- // // // console.log('factor',house.zoom.factor, 'step',house.zoom.step,'fov',fov)
- // // fov = THREE.MathUtils.clamp(fov, 15, 75);
- // // camera.fov = fov
- // // camera.updateProjectionMatrix();
- // }else if(house.menu_control_select==2){ //rotation
- // displayMenuNone()
- // house.is_auto_play = true
- // house.menu_control_select=0
- // makeRotationAuto(true)
- // // house.menu_control_select=0
- // }else{
- // // displayMenuNone()
- // }
-
- }
- }
- function fullMode(){
- if(house.is_auto_play){
- house.is_auto_play = false
- if(house.rotation.is_auto==true){
- house.rotation.is_auto==false
- document.getElementById('auto_rotation').src="./yaoimages/auto_rotation.png"
- }
- makeRotationAuto(false)
- }
- const nodess = document.getElementById("menu").childNodes;
- for(let i =0;i<nodess.length-1;i++){
- if(nodess[i].getAttribute('data-id')==house.idx){
- // pano_select=i===0?nodess.length -2:i-1
- // nodess[i].className = 'pano'
- nodess[i].className = 'panoSelect'
- // document.getElementById('menu').scrollLeft = 270*i;
- const fromLeft = document.getElementById('menu').scrollLeft
- const toLeft = 270*i;
- const coords = {x: fromLeft, y: 0} // Start at (0, 0)
- const tween = new TWEEN.Tween(coords) // Create a new tween that modifies 'coords'.
- .to({x: toLeft, y: 200}, 1000) // Move to (300, 200) in 1 second.
- .easing(TWEEN.Easing.Quadratic.Out) // Use an easing function to make the animation smooth.
- .onUpdate(() => {
- // Called after tween.js updates 'coords'.
- // Move 'box' to the position described by 'coords' with a CSS translation.
- document.getElementById('menu').scrollLeft = coords.x
- })
- .start() // Start the tween immediately.
- // i = nodess.length
- } else{
- nodess[i].className = 'pano'
- }
- }
- displayMenu()
- // doubleDelay(defaultCameraFov,displayMenu,null)
- }
- function updateDirection(){
- // for(let d of house.src[house.idx].direction){
- // switch(d.name){
- // case 'F':
- // if(d.id!=null){
- // document.getElementById("directionTop").innerHTML = house.src[d.id-1].title
- // // document.getElementById("directionTop").style.visibility = true
- // document.getElementById("direct_top").style.color = '#ffffff'
- // document.getElementById("direct_top_img").src = './yaoimages/direction_top.png'
- // }else{
- // document.getElementById("directionTop").innerHTML = ''
- // // document.getElementById("directionTop").style.visibility = false
- // document.getElementById("direct_top").style.color = '#c1c1c1'
- // document.getElementById("direct_top_img").src = './yaoimages/direction_top_disable.png'
- // }
- // break
- // case 'B':
- // if(d.id!=null){
- // document.getElementById("directionLeft").innerHTML = house.src[d.id-1].title
- // document.getElementById("direct_left").style.color = '#ffffff'
- // document.getElementById("direct_left_img").src = './yaoimages/direction_left.png'
- // }else{
- // document.getElementById("directionLeft").innerHTML = ''
- // document.getElementById("direct_left").style.color = '#c1c1c1'
- // document.getElementById("direct_left_img").src = './yaoimages/direction_left_disable.png'
- // }
- // break
- // case 'L':
- // if(d.id!=null){
- // document.getElementById("directionBottom").innerHTML = house.src[d.id-1].title
- // document.getElementById("direct_bottom").style.color = '#ffffff'
- // document.getElementById("direct_bottom_img").src = './yaoimages/direction_bottom.png'
- // }else{
- // document.getElementById("directionBottom").innerHTML = ''
- // document.getElementById("direct_bottom").style.color = '#c1c1c1'
- // document.getElementById("direct_bottom_img").src = './yaoimages/direction_bottom_disable.png'
- // }
- // break
- // case 'R':
- // if(d.id!=null){
- // document.getElementById("directionRight").innerHTML = house.src[d.id-1].title
- // document.getElementById("direct_right").style.color = '#ffffff'
- // document.getElementById("direct_right_img").src = './yaoimages/direction_right.png'
- // }else{
- // document.getElementById("directionRight").innerHTML = ''
- // document.getElementById("direct_right").style.color = '#c1c1c1'
- // document.getElementById("direct_right_img").src = './yaoimages/direction_right_disable.png'
- // }
- // break
- // default:
- // break
- // }
- // }
- // // }
- // changeSpots()
- }
- function compareAngle(angle_1,angle_2){
- let max_a = Math.max(angle_1,angle_2)
- let min_a = Math.min(angle_1,angle_2)
- let theta = max_a-min_a>180?(360-max_a)-min_a:max_a-min_a
- return theta
- }
- function getCameraDirection(){
- const hlookat = range360(krpano.get("view.hlookat"))
- // const vlookat = range360(krpano.get("view.vlookat"))
- const spots = house.src[house.idx].spots
- let min_dis = 100000
- let min_spot = null
- for(let spot of spots){
- const name = spot.name
- var hotspot = krpano.get('hotspot['+name+']');
- const spot_h = range360(hotspot.ath*1)
- // const spot_v = range360(hotspot.atv*1)
- const theta = compareAngle(hlookat,spot_h)
- const distance = Math.pow(theta, 2)
- if(min_dis>distance){
- min_dis = distance
- min_spot = hotspot
- min_spot.wath = spot.ath
- min_spot.watv = spot.atv
- }
- }
- return min_spot
- }
- function walkingDirection(){
- const spot = getCameraDirection()
- if(spot){
- const scene_name = spot.linkedscene
- for(let g of house.src){
- if(scene_name.indexOf(g.name.toLowerCase())>=0){
- house.idx = g.id - 1
- }
- }
- //
- changeScene(scene_name)
- const ath = spot.wath
- const atv = spot.watv
- krpano.call('lookat('+ath+','+atv+')')
- }else{
- console.log('no walking')
- moveNull()
- }
- }
- function walkingOn(d){
- let next_d = d
- if(typeof(d) == 'string'){
- for(let dd of house.src[house.idx].direction){
- if(dd.name===d){
- next_d = dd
- break
- }
- }
- }
- if(next_d&&typeof(next_d.id)!='undefined'&&next_d.id){
- house.idx = next_d.id - 1
- const scene_name = 'scene_' + house.src[house.idx].name
- changeScene(scene_name)
- const ath = house.src[house.idx].ath
- const atv = house.src[house.idx].atv
- krpano.call('lookat('+ath+','+atv+')')
- }else{
- console.log('no walking')
- moveNull()
- }
- }
|