babylon.gui.module.d.ts 392 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452
  1. declare module "babylonjs-gui/2D/controls/focusableControl" {
  2. import { IKeyboardEvent } from "babylonjs/Events/deviceInputEvents";
  3. import { Nullable } from "babylonjs/types";
  4. import { Control } from "babylonjs-gui/2D/controls/control";
  5. /**
  6. * Interface used to define a control that can receive focus
  7. */
  8. export interface IFocusableControl {
  9. /**
  10. * Function called when the control receives the focus
  11. */
  12. onFocus(): void;
  13. /**
  14. * Function called when the control loses the focus
  15. */
  16. onBlur(): void;
  17. /**
  18. * Function called to let the control handle keyboard events
  19. * @param evt defines the current keyboard event
  20. */
  21. processKeyboard(evt: IKeyboardEvent): void;
  22. /**
  23. * Function called to get the list of controls that should not steal the focus from this control
  24. * @returns an array of controls
  25. */
  26. keepsFocusWith(): Nullable<Control[]>;
  27. /**
  28. * Function to focus the control programmatically
  29. */
  30. focus(): void;
  31. /**
  32. * Function to unfocus the control programmatically
  33. */
  34. blur(): void;
  35. }
  36. }
  37. declare module "babylonjs-gui/2D/valueAndUnit" {
  38. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  39. /**
  40. * Class used to specific a value and its associated unit
  41. */
  42. export class ValueAndUnit {
  43. /** defines the unit to store */
  44. unit: number;
  45. /** defines a boolean indicating if the value can be negative */
  46. negativeValueAllowed: boolean;
  47. private _value;
  48. private _originalUnit;
  49. /**
  50. * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
  51. * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
  52. */
  53. ignoreAdaptiveScaling: boolean;
  54. /**
  55. * Creates a new ValueAndUnit
  56. * @param value defines the value to store
  57. * @param unit defines the unit to store
  58. * @param negativeValueAllowed defines a boolean indicating if the value can be negative
  59. */
  60. constructor(value: number,
  61. /** defines the unit to store */
  62. unit?: number,
  63. /** defines a boolean indicating if the value can be negative */
  64. negativeValueAllowed?: boolean);
  65. /** Gets a boolean indicating if the value is a percentage */
  66. get isPercentage(): boolean;
  67. /** Gets a boolean indicating if the value is store as pixel */
  68. get isPixel(): boolean;
  69. /** Gets direct internal value */
  70. get internalValue(): number;
  71. /**
  72. * Gets value as pixel
  73. * @param host defines the root host
  74. * @param refValue defines the reference value for percentages
  75. * @returns the value as pixel
  76. */
  77. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  78. /**
  79. * Update the current value and unit. This should be done cautiously as the GUi won't be marked as dirty with this function.
  80. * @param value defines the value to store
  81. * @param unit defines the unit to store
  82. * @returns the current ValueAndUnit
  83. */
  84. updateInPlace(value: number, unit?: number): ValueAndUnit;
  85. /**
  86. * Gets the value accordingly to its unit
  87. * @param host defines the root host
  88. * @returns the value
  89. */
  90. getValue(host: AdvancedDynamicTexture): number;
  91. /**
  92. * Gets a string representation of the value
  93. * @param host defines the root host
  94. * @param decimals defines an optional number of decimals to display
  95. * @returns a string
  96. */
  97. toString(host: AdvancedDynamicTexture, decimals?: number): string;
  98. /**
  99. * Store a value parsed from a string
  100. * @param source defines the source string
  101. * @returns true if the value was successfully parsed
  102. */
  103. fromString(source: string | number): boolean;
  104. private static _Regex;
  105. private static _UNITMODE_PERCENTAGE;
  106. private static _UNITMODE_PIXEL;
  107. /** UNITMODE_PERCENTAGE */
  108. static get UNITMODE_PERCENTAGE(): number;
  109. /** UNITMODE_PIXEL */
  110. static get UNITMODE_PIXEL(): number;
  111. }
  112. }
  113. declare module "babylonjs-gui/2D/style" {
  114. import { Observable } from "babylonjs/Misc/observable";
  115. import { IDisposable } from "babylonjs/scene";
  116. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  117. import { ValueAndUnit } from "babylonjs-gui/2D/valueAndUnit";
  118. /**
  119. * Define a style used by control to automatically setup properties based on a template.
  120. * Only support font related properties so far
  121. */
  122. export class Style implements IDisposable {
  123. private _fontFamily;
  124. private _fontStyle;
  125. private _fontWeight;
  126. /** @hidden */
  127. _host: AdvancedDynamicTexture;
  128. /** @hidden */
  129. _fontSize: ValueAndUnit;
  130. /**
  131. * Observable raised when the style values are changed
  132. */
  133. onChangedObservable: Observable<Style>;
  134. /**
  135. * Creates a new style object
  136. * @param host defines the AdvancedDynamicTexture which hosts this style
  137. */
  138. constructor(host: AdvancedDynamicTexture);
  139. /**
  140. * Gets or sets the font size
  141. */
  142. get fontSize(): string | number;
  143. set fontSize(value: string | number);
  144. /**
  145. * Gets or sets the font family
  146. */
  147. get fontFamily(): string;
  148. set fontFamily(value: string);
  149. /**
  150. * Gets or sets the font style
  151. */
  152. get fontStyle(): string;
  153. set fontStyle(value: string);
  154. /** Gets or sets font weight */
  155. get fontWeight(): string;
  156. set fontWeight(value: string);
  157. /** Dispose all associated resources */
  158. dispose(): void;
  159. }
  160. }
  161. declare module "babylonjs-gui/2D/math2D" {
  162. import { Nullable } from "babylonjs/types";
  163. import { Vector2 } from "babylonjs/Maths/math.vector";
  164. /**
  165. * Class used to transport Vector2 information for pointer events
  166. */
  167. export class Vector2WithInfo extends Vector2 {
  168. /** defines the current mouse button index */
  169. buttonIndex: number;
  170. /**
  171. * Creates a new Vector2WithInfo
  172. * @param source defines the vector2 data to transport
  173. * @param buttonIndex defines the current mouse button index
  174. */
  175. constructor(source: Vector2,
  176. /** defines the current mouse button index */
  177. buttonIndex?: number);
  178. }
  179. /** Class used to provide 2D matrix features */
  180. export class Matrix2D {
  181. /** Gets the internal array of 6 floats used to store matrix data */
  182. m: Float32Array;
  183. /**
  184. * Creates a new matrix
  185. * @param m00 defines value for (0, 0)
  186. * @param m01 defines value for (0, 1)
  187. * @param m10 defines value for (1, 0)
  188. * @param m11 defines value for (1, 1)
  189. * @param m20 defines value for (2, 0)
  190. * @param m21 defines value for (2, 1)
  191. */
  192. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  193. /**
  194. * Fills the matrix from direct values
  195. * @param m00 defines value for (0, 0)
  196. * @param m01 defines value for (0, 1)
  197. * @param m10 defines value for (1, 0)
  198. * @param m11 defines value for (1, 1)
  199. * @param m20 defines value for (2, 0)
  200. * @param m21 defines value for (2, 1)
  201. * @returns the current modified matrix
  202. */
  203. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  204. /**
  205. * Gets matrix determinant
  206. * @returns the determinant
  207. */
  208. determinant(): number;
  209. /**
  210. * Inverses the matrix and stores it in a target matrix
  211. * @param result defines the target matrix
  212. * @returns the current matrix
  213. */
  214. invertToRef(result: Matrix2D): Matrix2D;
  215. /**
  216. * Multiplies the current matrix with another one
  217. * @param other defines the second operand
  218. * @param result defines the target matrix
  219. * @returns the current matrix
  220. */
  221. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  222. /**
  223. * Applies the current matrix to a set of 2 floats and stores the result in a vector2
  224. * @param x defines the x coordinate to transform
  225. * @param y defines the x coordinate to transform
  226. * @param result defines the target vector2
  227. * @returns the current matrix
  228. */
  229. transformCoordinates(x: number, y: number, result: Vector2): Matrix2D;
  230. /**
  231. * Creates an identity matrix
  232. * @returns a new matrix
  233. */
  234. static Identity(): Matrix2D;
  235. /**
  236. * Creates a translation matrix and stores it in a target matrix
  237. * @param x defines the x coordinate of the translation
  238. * @param y defines the y coordinate of the translation
  239. * @param result defines the target matrix
  240. */
  241. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  242. /**
  243. * Creates a scaling matrix and stores it in a target matrix
  244. * @param x defines the x coordinate of the scaling
  245. * @param y defines the y coordinate of the scaling
  246. * @param result defines the target matrix
  247. */
  248. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  249. /**
  250. * Creates a rotation matrix and stores it in a target matrix
  251. * @param angle defines the rotation angle
  252. * @param result defines the target matrix
  253. */
  254. static RotationToRef(angle: number, result: Matrix2D): void;
  255. private static _TempPreTranslationMatrix;
  256. private static _TempPostTranslationMatrix;
  257. private static _TempRotationMatrix;
  258. private static _TempScalingMatrix;
  259. private static _TempCompose0;
  260. private static _TempCompose1;
  261. private static _TempCompose2;
  262. /**
  263. * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
  264. * @param tx defines the x coordinate of the translation
  265. * @param ty defines the y coordinate of the translation
  266. * @param angle defines the rotation angle
  267. * @param scaleX defines the x coordinate of the scaling
  268. * @param scaleY defines the y coordinate of the scaling
  269. * @param parentMatrix defines the parent matrix to multiply by (can be null)
  270. * @param result defines the target matrix
  271. */
  272. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: Nullable<Matrix2D>, result: Matrix2D): void;
  273. }
  274. }
  275. declare module "babylonjs-gui/2D/measure" {
  276. import { Matrix2D } from "babylonjs-gui/2D/math2D";
  277. /**
  278. * Class used to store 2D control sizes
  279. */
  280. export class Measure {
  281. /** defines left coordinate */
  282. left: number;
  283. /** defines top coordinate */
  284. top: number;
  285. /** defines width dimension */
  286. width: number;
  287. /** defines height dimension */
  288. height: number;
  289. /**
  290. * Creates a new measure
  291. * @param left defines left coordinate
  292. * @param top defines top coordinate
  293. * @param width defines width dimension
  294. * @param height defines height dimension
  295. */
  296. constructor(
  297. /** defines left coordinate */
  298. left: number,
  299. /** defines top coordinate */
  300. top: number,
  301. /** defines width dimension */
  302. width: number,
  303. /** defines height dimension */
  304. height: number);
  305. /**
  306. * Copy from another measure
  307. * @param other defines the other measure to copy from
  308. */
  309. copyFrom(other: Measure): void;
  310. /**
  311. * Copy from a group of 4 floats
  312. * @param left defines left coordinate
  313. * @param top defines top coordinate
  314. * @param width defines width dimension
  315. * @param height defines height dimension
  316. */
  317. copyFromFloats(left: number, top: number, width: number, height: number): void;
  318. /**
  319. * Computes the axis aligned bounding box measure for two given measures
  320. * @param a Input measure
  321. * @param b Input measure
  322. * @param result the resulting bounding measure
  323. */
  324. static CombineToRef(a: Measure, b: Measure, result: Measure): void;
  325. /**
  326. * Computes the axis aligned bounding box of the measure after it is modified by a given transform
  327. * @param transform the matrix to transform the measure before computing the AABB
  328. * @param addX number to add to left
  329. * @param addY number to add to top
  330. * @param addWidth number to add to width
  331. * @param addHeight number to add to height
  332. * @param result the resulting AABB
  333. */
  334. addAndTransformToRef(transform: Matrix2D, addX: number, addY: number, addWidth: number, addHeight: number, result: Measure): void;
  335. /**
  336. * Computes the axis aligned bounding box of the measure after it is modified by a given transform
  337. * @param transform the matrix to transform the measure before computing the AABB
  338. * @param result the resulting AABB
  339. */
  340. transformToRef(transform: Matrix2D, result: Measure): void;
  341. /**
  342. * Check equality between this measure and another one
  343. * @param other defines the other measures
  344. * @returns true if both measures are equals
  345. */
  346. isEqualsTo(other: Measure): boolean;
  347. /**
  348. * Creates an empty measure
  349. * @returns a new measure
  350. */
  351. static Empty(): Measure;
  352. }
  353. }
  354. declare module "babylonjs-gui/2D/advancedDynamicTexture" {
  355. import { Nullable } from "babylonjs/types";
  356. import { Observable } from "babylonjs/Misc/observable";
  357. import { Vector2, Vector3, Matrix } from "babylonjs/Maths/math.vector";
  358. import { ClipboardInfo } from "babylonjs/Events/clipboardEvents";
  359. import { DynamicTexture } from "babylonjs/Materials/Textures/dynamicTexture";
  360. import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
  361. import { Layer } from "babylonjs/Layers/layer";
  362. import { Scene } from "babylonjs/scene";
  363. import { Container } from "babylonjs-gui/2D/controls/container";
  364. import { Control } from "babylonjs-gui/2D/controls/control";
  365. import { IFocusableControl } from "babylonjs-gui/2D/controls/focusableControl";
  366. import { Style } from "babylonjs-gui/2D/style";
  367. import { Viewport } from 'babylonjs/Maths/math.viewport';
  368. /**
  369. * Class used to create texture to support 2D GUI elements
  370. * @see https://doc.babylonjs.com/how_to/gui
  371. */
  372. export class AdvancedDynamicTexture extends DynamicTexture {
  373. /** Define the Uurl to load snippets */
  374. static SnippetUrl: string;
  375. /** Snippet ID if the content was created from the snippet server */
  376. snippetId: string;
  377. private _isDirty;
  378. private _renderObserver;
  379. private _resizeObserver;
  380. private _preKeyboardObserver;
  381. private _pointerMoveObserver;
  382. private _pointerObserver;
  383. private _canvasPointerOutObserver;
  384. private _canvasBlurObserver;
  385. private _background;
  386. /** @hidden */
  387. _rootContainer: Container;
  388. /** @hidden */
  389. _lastPickedControl: Control;
  390. /** @hidden */
  391. _lastControlOver: {
  392. [pointerId: number]: Control;
  393. };
  394. /** @hidden */
  395. _lastControlDown: {
  396. [pointerId: number]: Control;
  397. };
  398. /** @hidden */
  399. _capturingControl: {
  400. [pointerId: number]: Control;
  401. };
  402. /** @hidden */
  403. _shouldBlockPointer: boolean;
  404. /** @hidden */
  405. _layerToDispose: Nullable<Layer>;
  406. /** @hidden */
  407. _linkedControls: Control[];
  408. private _isFullscreen;
  409. private _fullscreenViewport;
  410. private _idealWidth;
  411. private _idealHeight;
  412. private _useSmallestIdeal;
  413. private _renderAtIdealSize;
  414. private _focusedControl;
  415. private _blockNextFocusCheck;
  416. private _renderScale;
  417. private _rootElement;
  418. private _cursorChanged;
  419. private _defaultMousePointerId;
  420. /** @hidden */
  421. _numLayoutCalls: number;
  422. /** Gets the number of layout calls made the last time the ADT has been rendered */
  423. get numLayoutCalls(): number;
  424. /** @hidden */
  425. _numRenderCalls: number;
  426. /** Gets the number of render calls made the last time the ADT has been rendered */
  427. get numRenderCalls(): number;
  428. /**
  429. * Define type to string to ensure compatibility across browsers
  430. * Safari doesn't support DataTransfer constructor
  431. */
  432. private _clipboardData;
  433. /**
  434. * Observable event triggered each time an clipboard event is received from the rendering canvas
  435. */
  436. onClipboardObservable: Observable<ClipboardInfo>;
  437. /**
  438. * Observable event triggered each time a pointer down is intercepted by a control
  439. */
  440. onControlPickedObservable: Observable<Control>;
  441. /**
  442. * Observable event triggered before layout is evaluated
  443. */
  444. onBeginLayoutObservable: Observable<AdvancedDynamicTexture>;
  445. /**
  446. * Observable event triggered after the layout was evaluated
  447. */
  448. onEndLayoutObservable: Observable<AdvancedDynamicTexture>;
  449. /**
  450. * Observable event triggered before the texture is rendered
  451. */
  452. onBeginRenderObservable: Observable<AdvancedDynamicTexture>;
  453. /**
  454. * Observable event triggered after the texture was rendered
  455. */
  456. onEndRenderObservable: Observable<AdvancedDynamicTexture>;
  457. /**
  458. * Gets or sets a boolean defining if alpha is stored as premultiplied
  459. */
  460. premulAlpha: boolean;
  461. /**
  462. * Gets or sets a boolean indicating that the canvas must be reverted on Y when updating the texture
  463. */
  464. applyYInversionOnUpdate: boolean;
  465. /**
  466. * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
  467. * Useful when you want more antialiasing
  468. */
  469. get renderScale(): number;
  470. set renderScale(value: number);
  471. /** Gets or sets the background color */
  472. get background(): string;
  473. set background(value: string);
  474. /**
  475. * Gets or sets the ideal width used to design controls.
  476. * The GUI will then rescale everything accordingly
  477. * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
  478. */
  479. get idealWidth(): number;
  480. set idealWidth(value: number);
  481. /**
  482. * Gets or sets the ideal height used to design controls.
  483. * The GUI will then rescale everything accordingly
  484. * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
  485. */
  486. get idealHeight(): number;
  487. set idealHeight(value: number);
  488. /**
  489. * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
  490. * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
  491. */
  492. get useSmallestIdeal(): boolean;
  493. set useSmallestIdeal(value: boolean);
  494. /**
  495. * Gets or sets a boolean indicating if adaptive scaling must be used
  496. * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
  497. */
  498. get renderAtIdealSize(): boolean;
  499. set renderAtIdealSize(value: boolean);
  500. /**
  501. * Gets the ratio used when in "ideal mode"
  502. * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
  503. * */
  504. get idealRatio(): number;
  505. /**
  506. * Gets the underlying layer used to render the texture when in fullscreen mode
  507. */
  508. get layer(): Nullable<Layer>;
  509. /**
  510. * Gets the root container control
  511. */
  512. get rootContainer(): Container;
  513. /**
  514. * Returns an array containing the root container.
  515. * This is mostly used to let the Inspector introspects the ADT
  516. * @returns an array containing the rootContainer
  517. */
  518. getChildren(): Array<Container>;
  519. /**
  520. * Will return all controls that are inside this texture
  521. * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
  522. * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
  523. * @return all child controls
  524. */
  525. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  526. /**
  527. * Gets or sets the current focused control
  528. */
  529. get focusedControl(): Nullable<IFocusableControl>;
  530. set focusedControl(control: Nullable<IFocusableControl>);
  531. /**
  532. * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
  533. */
  534. get isForeground(): boolean;
  535. set isForeground(value: boolean);
  536. /**
  537. * Gets or set information about clipboardData
  538. */
  539. get clipboardData(): string;
  540. set clipboardData(value: string);
  541. /**
  542. * Creates a new AdvancedDynamicTexture
  543. * @param name defines the name of the texture
  544. * @param width defines the width of the texture
  545. * @param height defines the height of the texture
  546. * @param scene defines the hosting scene
  547. * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
  548. * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
  549. * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)
  550. */
  551. constructor(name: string, width: number | undefined, height: number | undefined, scene: Nullable<Scene>, generateMipMaps?: boolean, samplingMode?: number, invertY?: boolean);
  552. /**
  553. * Get the current class name of the texture useful for serialization or dynamic coding.
  554. * @returns "AdvancedDynamicTexture"
  555. */
  556. getClassName(): string;
  557. /**
  558. * Function used to execute a function on all controls
  559. * @param func defines the function to execute
  560. * @param container defines the container where controls belong. If null the root container will be used
  561. */
  562. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  563. private _useInvalidateRectOptimization;
  564. /**
  565. * Gets or sets a boolean indicating if the InvalidateRect optimization should be turned on
  566. */
  567. get useInvalidateRectOptimization(): boolean;
  568. set useInvalidateRectOptimization(value: boolean);
  569. private _invalidatedRectangle;
  570. /**
  571. * Invalidates a rectangle area on the gui texture
  572. * @param invalidMinX left most position of the rectangle to invalidate in the texture
  573. * @param invalidMinY top most position of the rectangle to invalidate in the texture
  574. * @param invalidMaxX right most position of the rectangle to invalidate in the texture
  575. * @param invalidMaxY bottom most position of the rectangle to invalidate in the texture
  576. */
  577. invalidateRect(invalidMinX: number, invalidMinY: number, invalidMaxX: number, invalidMaxY: number): void;
  578. /**
  579. * Marks the texture as dirty forcing a complete update
  580. */
  581. markAsDirty(): void;
  582. /**
  583. * Helper function used to create a new style
  584. * @returns a new style
  585. * @see https://doc.babylonjs.com/how_to/gui#styles
  586. */
  587. createStyle(): Style;
  588. /**
  589. * Adds a new control to the root container
  590. * @param control defines the control to add
  591. * @returns the current texture
  592. */
  593. addControl(control: Control): AdvancedDynamicTexture;
  594. /**
  595. * Removes a control from the root container
  596. * @param control defines the control to remove
  597. * @returns the current texture
  598. */
  599. removeControl(control: Control): AdvancedDynamicTexture;
  600. /**
  601. * Release all resources
  602. */
  603. dispose(): void;
  604. private _onResize;
  605. /** @hidden */
  606. _getGlobalViewport(scene: Scene): Viewport;
  607. /**
  608. * Get screen coordinates for a vector3
  609. * @param position defines the position to project
  610. * @param worldMatrix defines the world matrix to use
  611. * @returns the projected position
  612. */
  613. getProjectedPosition(position: Vector3, worldMatrix: Matrix): Vector2;
  614. /**
  615. * Get screen coordinates for a vector3
  616. * @param position defines the position to project
  617. * @param worldMatrix defines the world matrix to use
  618. * @returns the projected position with Z
  619. */
  620. getProjectedPositionWithZ(position: Vector3, worldMatrix: Matrix): Vector3;
  621. private _checkUpdate;
  622. private _clearMeasure;
  623. private _render;
  624. /** @hidden */
  625. _changeCursor(cursor: string): void;
  626. /** @hidden */
  627. _registerLastControlDown(control: Control, pointerId: number): void;
  628. private _doPicking;
  629. /** @hidden */
  630. _cleanControlAfterRemovalFromList(list: {
  631. [pointerId: number]: Control;
  632. }, control: Control): void;
  633. /** @hidden */
  634. _cleanControlAfterRemoval(control: Control): void;
  635. /** Attach to all scene events required to support pointer events */
  636. attach(): void;
  637. /** @hidden */
  638. private onClipboardCopy;
  639. /** @hidden */
  640. private onClipboardCut;
  641. /** @hidden */
  642. private onClipboardPaste;
  643. /**
  644. * Register the clipboard Events onto the canvas
  645. */
  646. registerClipboardEvents(): void;
  647. /**
  648. * Unregister the clipboard Events from the canvas
  649. */
  650. unRegisterClipboardEvents(): void;
  651. /**
  652. * Connect the texture to a hosting mesh to enable interactions
  653. * @param mesh defines the mesh to attach to
  654. * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
  655. */
  656. attachToMesh(mesh: AbstractMesh, supportPointerMove?: boolean): void;
  657. /**
  658. * Move the focus to a specific control
  659. * @param control defines the control which will receive the focus
  660. */
  661. moveFocusToControl(control: IFocusableControl): void;
  662. private _manageFocus;
  663. private _attachToOnPointerOut;
  664. private _attachToOnBlur;
  665. /**
  666. * Serializes the entire GUI system
  667. * @returns an object with the JSON serialized data
  668. */
  669. serializeContent(): any;
  670. /**
  671. * Recreate the content of the ADT from a JSON object
  672. * @param serializedObject define the JSON serialized object to restore from
  673. */
  674. parseContent(serializedObject: any): void;
  675. /**
  676. * Recreate the content of the ADT from a snippet saved by the GUI editor
  677. * @param snippetId defines the snippet to load
  678. * @returns a promise that will resolve on success
  679. */
  680. parseFromSnippetAsync(snippetId: string): Promise<void>;
  681. /**
  682. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
  683. * @param mesh defines the mesh which will receive the texture
  684. * @param width defines the texture width (1024 by default)
  685. * @param height defines the texture height (1024 by default)
  686. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  687. * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)
  688. * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)
  689. * @returns a new AdvancedDynamicTexture
  690. */
  691. static CreateForMesh(mesh: AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, onlyAlphaTesting?: boolean, invertY?: boolean): AdvancedDynamicTexture;
  692. /**
  693. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh) BUT do not create a new material for the mesh. You will be responsible for connecting the texture
  694. * @param mesh defines the mesh which will receive the texture
  695. * @param width defines the texture width (1024 by default)
  696. * @param height defines the texture height (1024 by default)
  697. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  698. * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)
  699. * @returns a new AdvancedDynamicTexture
  700. */
  701. static CreateForMeshTexture(mesh: AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, invertY?: boolean): AdvancedDynamicTexture;
  702. /**
  703. * Creates a new AdvancedDynamicTexture in fullscreen mode.
  704. * In this mode the texture will rely on a layer for its rendering.
  705. * This allows it to be treated like any other layer.
  706. * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
  707. * LayerMask is set through advancedTexture.layer.layerMask
  708. * @param name defines name for the texture
  709. * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
  710. * @param scene defines the hsoting scene
  711. * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
  712. * @returns a new AdvancedDynamicTexture
  713. */
  714. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>, sampling?: number): AdvancedDynamicTexture;
  715. }
  716. }
  717. declare module "babylonjs-gui/2D/controls/control" {
  718. import { Nullable } from "babylonjs/types";
  719. import { Observable } from "babylonjs/Misc/observable";
  720. import { Vector2, Vector3 } from "babylonjs/Maths/math.vector";
  721. import { PointerInfoBase } from 'babylonjs/Events/pointerEvents';
  722. import { TransformNode } from "babylonjs/Meshes/transformNode";
  723. import { Scene } from "babylonjs/scene";
  724. import { Container } from "babylonjs-gui/2D/controls/container";
  725. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  726. import { ValueAndUnit } from "babylonjs-gui/2D/valueAndUnit";
  727. import { Measure } from "babylonjs-gui/2D/measure";
  728. import { Style } from "babylonjs-gui/2D/style";
  729. import { Matrix2D, Vector2WithInfo } from "babylonjs-gui/2D/math2D";
  730. /**
  731. * Root class used for all 2D controls
  732. * @see https://doc.babylonjs.com/how_to/gui#controls
  733. */
  734. export class Control {
  735. /** defines the name of the control */
  736. name?: string | undefined;
  737. /**
  738. * Gets or sets a boolean indicating if alpha must be an inherited value (false by default)
  739. */
  740. static AllowAlphaInheritance: boolean;
  741. private _alpha;
  742. private _alphaSet;
  743. private _zIndex;
  744. /** @hidden */
  745. _host: AdvancedDynamicTexture;
  746. /** Gets or sets the control parent */
  747. parent: Nullable<Container>;
  748. /** @hidden */
  749. _currentMeasure: Measure;
  750. private _fontFamily;
  751. private _fontStyle;
  752. private _fontWeight;
  753. private _fontSize;
  754. private _font;
  755. /** @hidden */
  756. _width: ValueAndUnit;
  757. /** @hidden */
  758. _height: ValueAndUnit;
  759. /** @hidden */
  760. protected _fontOffset: {
  761. ascent: number;
  762. height: number;
  763. descent: number;
  764. };
  765. private _color;
  766. private _style;
  767. private _styleObserver;
  768. /** @hidden */
  769. protected _horizontalAlignment: number;
  770. /** @hidden */
  771. protected _verticalAlignment: number;
  772. /** @hidden */
  773. protected _isDirty: boolean;
  774. /** @hidden */
  775. protected _wasDirty: boolean;
  776. /** @hidden */
  777. _tempParentMeasure: Measure;
  778. /** @hidden */
  779. _prevCurrentMeasureTransformedIntoGlobalSpace: Measure;
  780. /** @hidden */
  781. protected _cachedParentMeasure: Measure;
  782. private _paddingLeft;
  783. private _paddingRight;
  784. private _paddingTop;
  785. private _paddingBottom;
  786. /** @hidden */
  787. _left: ValueAndUnit;
  788. /** @hidden */
  789. _top: ValueAndUnit;
  790. private _scaleX;
  791. private _scaleY;
  792. private _rotation;
  793. private _transformCenterX;
  794. private _transformCenterY;
  795. /** @hidden */
  796. _transformMatrix: Matrix2D;
  797. /** @hidden */
  798. protected _invertTransformMatrix: Matrix2D;
  799. /** @hidden */
  800. protected _transformedPosition: Vector2;
  801. private _isMatrixDirty;
  802. private _cachedOffsetX;
  803. private _cachedOffsetY;
  804. private _isVisible;
  805. private _isHighlighted;
  806. /** @hidden */
  807. _linkedMesh: Nullable<TransformNode>;
  808. private _fontSet;
  809. private _dummyVector2;
  810. private _downCount;
  811. private _enterCount;
  812. private _doNotRender;
  813. private _downPointerIds;
  814. protected _isEnabled: boolean;
  815. protected _disabledColor: string;
  816. protected _disabledColorItem: string;
  817. /** @hidden */
  818. protected _rebuildLayout: boolean;
  819. /** @hidden */
  820. _customData: any;
  821. /** @hidden */
  822. _isClipped: boolean;
  823. /** @hidden */
  824. _automaticSize: boolean;
  825. /** @hidden */
  826. _tag: any;
  827. /**
  828. * Gets or sets the unique id of the node. Please note that this number will be updated when the control is added to a container
  829. */
  830. uniqueId: number;
  831. /**
  832. * Gets or sets an object used to store user defined information for the node
  833. */
  834. metadata: any;
  835. /** Gets or sets a boolean indicating if the control can be hit with pointer events */
  836. isHitTestVisible: boolean;
  837. /** Gets or sets a boolean indicating if the control can block pointer events */
  838. isPointerBlocker: boolean;
  839. /** Gets or sets a boolean indicating if the control can be focusable */
  840. isFocusInvisible: boolean;
  841. /**
  842. * Gets or sets a boolean indicating if the children are clipped to the current control bounds.
  843. * Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
  844. */
  845. clipChildren: boolean;
  846. /**
  847. * Gets or sets a boolean indicating that control content must be clipped
  848. * Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
  849. */
  850. clipContent: boolean;
  851. /**
  852. * Gets or sets a boolean indicating that the current control should cache its rendering (useful when the control does not change often)
  853. */
  854. useBitmapCache: boolean;
  855. private _cacheData;
  856. private _shadowOffsetX;
  857. /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
  858. get shadowOffsetX(): number;
  859. set shadowOffsetX(value: number);
  860. private _shadowOffsetY;
  861. /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
  862. get shadowOffsetY(): number;
  863. set shadowOffsetY(value: number);
  864. private _shadowBlur;
  865. /** Gets or sets a value indicating the amount of blur to use to render the shadow */
  866. get shadowBlur(): number;
  867. set shadowBlur(value: number);
  868. private _shadowColor;
  869. /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
  870. get shadowColor(): string;
  871. set shadowColor(value: string);
  872. /** Gets or sets the cursor to use when the control is hovered */
  873. hoverCursor: string;
  874. /** @hidden */
  875. protected _linkOffsetX: ValueAndUnit;
  876. /** @hidden */
  877. protected _linkOffsetY: ValueAndUnit;
  878. /** Gets the control type name */
  879. get typeName(): string;
  880. /**
  881. * Get the current class name of the control.
  882. * @returns current class name
  883. */
  884. getClassName(): string;
  885. /**
  886. * An event triggered when pointer wheel is scrolled
  887. */
  888. onWheelObservable: Observable<Vector2>;
  889. /**
  890. * An event triggered when the pointer move over the control.
  891. */
  892. onPointerMoveObservable: Observable<Vector2>;
  893. /**
  894. * An event triggered when the pointer move out of the control.
  895. */
  896. onPointerOutObservable: Observable<Control>;
  897. /**
  898. * An event triggered when the pointer taps the control
  899. */
  900. onPointerDownObservable: Observable<Vector2WithInfo>;
  901. /**
  902. * An event triggered when pointer up
  903. */
  904. onPointerUpObservable: Observable<Vector2WithInfo>;
  905. /**
  906. * An event triggered when a control is clicked on
  907. */
  908. onPointerClickObservable: Observable<Vector2WithInfo>;
  909. /**
  910. * An event triggered when pointer enters the control
  911. */
  912. onPointerEnterObservable: Observable<Control>;
  913. /**
  914. * An event triggered when the control is marked as dirty
  915. */
  916. onDirtyObservable: Observable<Control>;
  917. /**
  918. * An event triggered before drawing the control
  919. */
  920. onBeforeDrawObservable: Observable<Control>;
  921. /**
  922. * An event triggered after the control was drawn
  923. */
  924. onAfterDrawObservable: Observable<Control>;
  925. /**
  926. * An event triggered when the control has been disposed
  927. */
  928. onDisposeObservable: Observable<Control>;
  929. /**
  930. * Get the hosting AdvancedDynamicTexture
  931. */
  932. get host(): AdvancedDynamicTexture;
  933. /** Gets or set information about font offsets (used to render and align text) */
  934. get fontOffset(): {
  935. ascent: number;
  936. height: number;
  937. descent: number;
  938. };
  939. set fontOffset(offset: {
  940. ascent: number;
  941. height: number;
  942. descent: number;
  943. });
  944. /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
  945. get alpha(): number;
  946. set alpha(value: number);
  947. /**
  948. * Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)
  949. */
  950. get isHighlighted(): boolean;
  951. set isHighlighted(value: boolean);
  952. /** Gets or sets a value indicating the scale factor on X axis (1 by default)
  953. * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  954. */
  955. get scaleX(): number;
  956. set scaleX(value: number);
  957. /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
  958. * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  959. */
  960. get scaleY(): number;
  961. set scaleY(value: number);
  962. /** Gets or sets the rotation angle (0 by default)
  963. * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  964. */
  965. get rotation(): number;
  966. set rotation(value: number);
  967. /** Gets or sets the transformation center on Y axis (0 by default)
  968. * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  969. */
  970. get transformCenterY(): number;
  971. set transformCenterY(value: number);
  972. /** Gets or sets the transformation center on X axis (0 by default)
  973. * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  974. */
  975. get transformCenterX(): number;
  976. set transformCenterX(value: number);
  977. /**
  978. * Gets or sets the horizontal alignment
  979. * @see https://doc.babylonjs.com/how_to/gui#alignments
  980. */
  981. get horizontalAlignment(): number;
  982. set horizontalAlignment(value: number);
  983. /**
  984. * Gets or sets the vertical alignment
  985. * @see https://doc.babylonjs.com/how_to/gui#alignments
  986. */
  987. get verticalAlignment(): number;
  988. set verticalAlignment(value: number);
  989. /**
  990. * Gets or sets a fixed ratio for this control.
  991. * When different from 0, the ratio is used to compute the "second" dimension.
  992. * The first dimension used in the computation is the last one set (by setting width / widthInPixels or height / heightInPixels), and the
  993. * second dimension is computed as first dimension * fixedRatio
  994. */
  995. fixedRatio: number;
  996. private _fixedRatioMasterIsWidth;
  997. /**
  998. * Gets or sets control width
  999. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1000. */
  1001. get width(): string | number;
  1002. set width(value: string | number);
  1003. /**
  1004. * Gets or sets the control width in pixel
  1005. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1006. */
  1007. get widthInPixels(): number;
  1008. set widthInPixels(value: number);
  1009. /**
  1010. * Gets or sets control height
  1011. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1012. */
  1013. get height(): string | number;
  1014. set height(value: string | number);
  1015. /**
  1016. * Gets or sets control height in pixel
  1017. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1018. */
  1019. get heightInPixels(): number;
  1020. set heightInPixels(value: number);
  1021. /** Gets or set font family */
  1022. get fontFamily(): string;
  1023. set fontFamily(value: string);
  1024. /** Gets or sets font style */
  1025. get fontStyle(): string;
  1026. set fontStyle(value: string);
  1027. /** Gets or sets font weight */
  1028. get fontWeight(): string;
  1029. set fontWeight(value: string);
  1030. /**
  1031. * Gets or sets style
  1032. * @see https://doc.babylonjs.com/how_to/gui#styles
  1033. */
  1034. get style(): Nullable<Style>;
  1035. set style(value: Nullable<Style>);
  1036. /** @hidden */
  1037. get _isFontSizeInPercentage(): boolean;
  1038. /** Gets or sets font size in pixels */
  1039. get fontSizeInPixels(): number;
  1040. set fontSizeInPixels(value: number);
  1041. /** Gets or sets font size */
  1042. get fontSize(): string | number;
  1043. set fontSize(value: string | number);
  1044. /** Gets or sets foreground color */
  1045. get color(): string;
  1046. set color(value: string);
  1047. /** Gets or sets z index which is used to reorder controls on the z axis */
  1048. get zIndex(): number;
  1049. set zIndex(value: number);
  1050. /** Gets or sets a boolean indicating if the control can be rendered */
  1051. get notRenderable(): boolean;
  1052. set notRenderable(value: boolean);
  1053. /** Gets or sets a boolean indicating if the control is visible */
  1054. get isVisible(): boolean;
  1055. set isVisible(value: boolean);
  1056. /** Gets a boolean indicating that the control needs to update its rendering */
  1057. get isDirty(): boolean;
  1058. /**
  1059. * Gets the current linked mesh (or null if none)
  1060. */
  1061. get linkedMesh(): Nullable<TransformNode>;
  1062. /**
  1063. * Gets or sets a value indicating the padding to use on the left of the control
  1064. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1065. */
  1066. get paddingLeft(): string | number;
  1067. set paddingLeft(value: string | number);
  1068. /**
  1069. * Gets or sets a value indicating the padding in pixels to use on the left of the control
  1070. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1071. */
  1072. get paddingLeftInPixels(): number;
  1073. set paddingLeftInPixels(value: number);
  1074. /**
  1075. * Gets or sets a value indicating the padding to use on the right of the control
  1076. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1077. */
  1078. get paddingRight(): string | number;
  1079. set paddingRight(value: string | number);
  1080. /**
  1081. * Gets or sets a value indicating the padding in pixels to use on the right of the control
  1082. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1083. */
  1084. get paddingRightInPixels(): number;
  1085. set paddingRightInPixels(value: number);
  1086. /**
  1087. * Gets or sets a value indicating the padding to use on the top of the control
  1088. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1089. */
  1090. get paddingTop(): string | number;
  1091. set paddingTop(value: string | number);
  1092. /**
  1093. * Gets or sets a value indicating the padding in pixels to use on the top of the control
  1094. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1095. */
  1096. get paddingTopInPixels(): number;
  1097. set paddingTopInPixels(value: number);
  1098. /**
  1099. * Gets or sets a value indicating the padding to use on the bottom of the control
  1100. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1101. */
  1102. get paddingBottom(): string | number;
  1103. set paddingBottom(value: string | number);
  1104. /**
  1105. * Gets or sets a value indicating the padding in pixels to use on the bottom of the control
  1106. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1107. */
  1108. get paddingBottomInPixels(): number;
  1109. set paddingBottomInPixels(value: number);
  1110. /**
  1111. * Gets or sets a value indicating the left coordinate of the control
  1112. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1113. */
  1114. get left(): string | number;
  1115. set left(value: string | number);
  1116. /**
  1117. * Gets or sets a value indicating the left coordinate in pixels of the control
  1118. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1119. */
  1120. get leftInPixels(): number;
  1121. set leftInPixels(value: number);
  1122. /**
  1123. * Gets or sets a value indicating the top coordinate of the control
  1124. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1125. */
  1126. get top(): string | number;
  1127. set top(value: string | number);
  1128. /**
  1129. * Gets or sets a value indicating the top coordinate in pixels of the control
  1130. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1131. */
  1132. get topInPixels(): number;
  1133. set topInPixels(value: number);
  1134. /**
  1135. * Gets or sets a value indicating the offset on X axis to the linked mesh
  1136. * @see https://doc.babylonjs.com/how_to/gui#tracking-positions
  1137. */
  1138. get linkOffsetX(): string | number;
  1139. set linkOffsetX(value: string | number);
  1140. /**
  1141. * Gets or sets a value indicating the offset in pixels on X axis to the linked mesh
  1142. * @see https://doc.babylonjs.com/how_to/gui#tracking-positions
  1143. */
  1144. get linkOffsetXInPixels(): number;
  1145. set linkOffsetXInPixels(value: number);
  1146. /**
  1147. * Gets or sets a value indicating the offset on Y axis to the linked mesh
  1148. * @see https://doc.babylonjs.com/how_to/gui#tracking-positions
  1149. */
  1150. get linkOffsetY(): string | number;
  1151. set linkOffsetY(value: string | number);
  1152. /**
  1153. * Gets or sets a value indicating the offset in pixels on Y axis to the linked mesh
  1154. * @see https://doc.babylonjs.com/how_to/gui#tracking-positions
  1155. */
  1156. get linkOffsetYInPixels(): number;
  1157. set linkOffsetYInPixels(value: number);
  1158. /** Gets the center coordinate on X axis */
  1159. get centerX(): number;
  1160. /** Gets the center coordinate on Y axis */
  1161. get centerY(): number;
  1162. /** Gets or sets if control is Enabled */
  1163. get isEnabled(): boolean;
  1164. set isEnabled(value: boolean);
  1165. /** Gets or sets background color of control if it's disabled */
  1166. get disabledColor(): string;
  1167. set disabledColor(value: string);
  1168. /** Gets or sets front color of control if it's disabled */
  1169. get disabledColorItem(): string;
  1170. set disabledColorItem(value: string);
  1171. /**
  1172. * Creates a new control
  1173. * @param name defines the name of the control
  1174. */
  1175. constructor(
  1176. /** defines the name of the control */
  1177. name?: string | undefined);
  1178. /** @hidden */
  1179. protected _getTypeName(): string;
  1180. /**
  1181. * Gets the first ascendant in the hierarchy of the given type
  1182. * @param className defines the required type
  1183. * @returns the ascendant or null if not found
  1184. */
  1185. getAscendantOfClass(className: string): Nullable<Control>;
  1186. /** @hidden */
  1187. _resetFontCache(): void;
  1188. /**
  1189. * Determines if a container is an ascendant of the current control
  1190. * @param container defines the container to look for
  1191. * @returns true if the container is one of the ascendant of the control
  1192. */
  1193. isAscendant(container: Control): boolean;
  1194. /**
  1195. * Gets coordinates in local control space
  1196. * @param globalCoordinates defines the coordinates to transform
  1197. * @returns the new coordinates in local space
  1198. */
  1199. getLocalCoordinates(globalCoordinates: Vector2): Vector2;
  1200. /**
  1201. * Gets coordinates in local control space
  1202. * @param globalCoordinates defines the coordinates to transform
  1203. * @param result defines the target vector2 where to store the result
  1204. * @returns the current control
  1205. */
  1206. getLocalCoordinatesToRef(globalCoordinates: Vector2, result: Vector2): Control;
  1207. /**
  1208. * Gets coordinates in parent local control space
  1209. * @param globalCoordinates defines the coordinates to transform
  1210. * @returns the new coordinates in parent local space
  1211. */
  1212. getParentLocalCoordinates(globalCoordinates: Vector2): Vector2;
  1213. /**
  1214. * Move the current control to a vector3 position projected onto the screen.
  1215. * @param position defines the target position
  1216. * @param scene defines the hosting scene
  1217. */
  1218. moveToVector3(position: Vector3, scene: Scene): void;
  1219. /**
  1220. * Will store all controls that have this control as ascendant in a given array
  1221. * @param results defines the array where to store the descendants
  1222. * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
  1223. * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
  1224. */
  1225. getDescendantsToRef(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  1226. /**
  1227. * Will return all controls that have this control as ascendant
  1228. * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
  1229. * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
  1230. * @return all child controls
  1231. */
  1232. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  1233. /**
  1234. * Link current control with a target mesh
  1235. * @param mesh defines the mesh to link with
  1236. * @see https://doc.babylonjs.com/how_to/gui#tracking-positions
  1237. */
  1238. linkWithMesh(mesh: Nullable<TransformNode>): void;
  1239. /**
  1240. * Shorthand funtion to set the top, right, bottom, and left padding values on the control.
  1241. * @param { string | number} paddingTop - The value of the top padding.
  1242. * @param { string | number} paddingRight - The value of the right padding. If omitted, top is used.
  1243. * @param { string | number} paddingBottom - The value of the bottom padding. If omitted, top is used.
  1244. * @param { string | number} paddingLeft - The value of the left padding. If omitted, right is used.
  1245. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1246. */
  1247. setPadding(paddingTop: string | number, paddingRight?: string | number, paddingBottom?: string | number, paddingLeft?: string | number): void;
  1248. /**
  1249. * Shorthand funtion to set the top, right, bottom, and left padding values in pixels on the control.
  1250. * @param { number} paddingTop - The value in pixels of the top padding.
  1251. * @param { number} paddingRight - The value in pixels of the right padding. If omitted, top is used.
  1252. * @param { number} paddingBottom - The value in pixels of the bottom padding. If omitted, top is used.
  1253. * @param { number} paddingLeft - The value in pixels of the left padding. If omitted, right is used.
  1254. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1255. */
  1256. setPaddingInPixels(paddingTop: number, paddingRight?: number, paddingBottom?: number, paddingLeft?: number): void;
  1257. /** @hidden */
  1258. _moveToProjectedPosition(projectedPosition: Vector3): void;
  1259. /** @hidden */
  1260. _offsetLeft(offset: number): void;
  1261. /** @hidden */
  1262. _offsetTop(offset: number): void;
  1263. /** @hidden */
  1264. _markMatrixAsDirty(): void;
  1265. /** @hidden */
  1266. _flagDescendantsAsMatrixDirty(): void;
  1267. /** @hidden */
  1268. _intersectsRect(rect: Measure): boolean;
  1269. /** @hidden */
  1270. protected invalidateRect(): void;
  1271. /** @hidden */
  1272. _markAsDirty(force?: boolean): void;
  1273. /** @hidden */
  1274. _markAllAsDirty(): void;
  1275. /** @hidden */
  1276. _link(host: AdvancedDynamicTexture): void;
  1277. /** @hidden */
  1278. protected _transform(context?: CanvasRenderingContext2D): void;
  1279. /** @hidden */
  1280. _renderHighlight(context: CanvasRenderingContext2D): void;
  1281. /** @hidden */
  1282. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  1283. /** @hidden */
  1284. protected _applyStates(context: CanvasRenderingContext2D): void;
  1285. /** @hidden */
  1286. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  1287. /** @hidden */
  1288. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1289. protected _evaluateClippingState(parentMeasure: Measure): void;
  1290. /** @hidden */
  1291. _measure(): void;
  1292. /** @hidden */
  1293. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1294. /** @hidden */
  1295. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1296. /** @hidden */
  1297. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1298. /** @hidden */
  1299. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  1300. private static _ClipMeasure;
  1301. private _tmpMeasureA;
  1302. private _clip;
  1303. /** @hidden */
  1304. _render(context: CanvasRenderingContext2D, invalidatedRectangle?: Nullable<Measure>): boolean;
  1305. /** @hidden */
  1306. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Nullable<Measure>): void;
  1307. /**
  1308. * Tests if a given coordinates belong to the current control
  1309. * @param x defines x coordinate to test
  1310. * @param y defines y coordinate to test
  1311. * @returns true if the coordinates are inside the control
  1312. */
  1313. contains(x: number, y: number): boolean;
  1314. /** @hidden */
  1315. _processPicking(x: number, y: number, pi: PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
  1316. /** @hidden */
  1317. _onPointerMove(target: Control, coordinates: Vector2, pointerId: number, pi: PointerInfoBase): void;
  1318. /** @hidden */
  1319. _onPointerEnter(target: Control, pi: PointerInfoBase): boolean;
  1320. /** @hidden */
  1321. _onPointerOut(target: Control, pi: Nullable<PointerInfoBase>, force?: boolean): void;
  1322. /** @hidden */
  1323. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, pi: PointerInfoBase): boolean;
  1324. /** @hidden */
  1325. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi?: PointerInfoBase): void;
  1326. /** @hidden */
  1327. _forcePointerUp(pointerId?: Nullable<number>): void;
  1328. /** @hidden */
  1329. _onWheelScroll(deltaX?: number, deltaY?: number): void;
  1330. /** @hidden */
  1331. _onCanvasBlur(): void;
  1332. /** @hidden */
  1333. _processObservables(type: number, x: number, y: number, pi: PointerInfoBase, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
  1334. private _prepareFont;
  1335. /**
  1336. * Serializes the current control
  1337. * @param serializationObject defined the JSON serialized object
  1338. */
  1339. serialize(serializationObject: any): void;
  1340. /** @hidden */
  1341. _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture): void;
  1342. /** Releases associated resources */
  1343. dispose(): void;
  1344. private static _HORIZONTAL_ALIGNMENT_LEFT;
  1345. private static _HORIZONTAL_ALIGNMENT_RIGHT;
  1346. private static _HORIZONTAL_ALIGNMENT_CENTER;
  1347. private static _VERTICAL_ALIGNMENT_TOP;
  1348. private static _VERTICAL_ALIGNMENT_BOTTOM;
  1349. private static _VERTICAL_ALIGNMENT_CENTER;
  1350. /** HORIZONTAL_ALIGNMENT_LEFT */
  1351. static get HORIZONTAL_ALIGNMENT_LEFT(): number;
  1352. /** HORIZONTAL_ALIGNMENT_RIGHT */
  1353. static get HORIZONTAL_ALIGNMENT_RIGHT(): number;
  1354. /** HORIZONTAL_ALIGNMENT_CENTER */
  1355. static get HORIZONTAL_ALIGNMENT_CENTER(): number;
  1356. /** VERTICAL_ALIGNMENT_TOP */
  1357. static get VERTICAL_ALIGNMENT_TOP(): number;
  1358. /** VERTICAL_ALIGNMENT_BOTTOM */
  1359. static get VERTICAL_ALIGNMENT_BOTTOM(): number;
  1360. /** VERTICAL_ALIGNMENT_CENTER */
  1361. static get VERTICAL_ALIGNMENT_CENTER(): number;
  1362. private static _FontHeightSizes;
  1363. /** @hidden */
  1364. static _GetFontOffset(font: string): {
  1365. ascent: number;
  1366. height: number;
  1367. descent: number;
  1368. };
  1369. /**
  1370. * Creates a Control from parsed data
  1371. * @param serializedObject defines parsed data
  1372. * @param host defines the hosting AdvancedDynamicTexture
  1373. * @returns a new Control
  1374. */
  1375. static Parse(serializedObject: any, host: AdvancedDynamicTexture): Control;
  1376. /**
  1377. * Creates a stack panel that can be used to render headers
  1378. * @param control defines the control to associate with the header
  1379. * @param text defines the text of the header
  1380. * @param size defines the size of the header
  1381. * @param options defines options used to configure the header
  1382. * @returns a new StackPanel
  1383. * @ignore
  1384. * @hidden
  1385. */
  1386. static AddHeader: (control: Control, text: string, size: string | number, options: {
  1387. isHorizontal: boolean;
  1388. controlFirst: boolean;
  1389. }) => any;
  1390. /** @hidden */
  1391. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  1392. }
  1393. }
  1394. declare module "babylonjs-gui/2D/controls/container" {
  1395. import { Nullable } from "babylonjs/types";
  1396. import { Control } from "babylonjs-gui/2D/controls/control";
  1397. import { Measure } from "babylonjs-gui/2D/measure";
  1398. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  1399. import { PointerInfoBase } from 'babylonjs/Events/pointerEvents';
  1400. /**
  1401. * Root class for 2D containers
  1402. * @see https://doc.babylonjs.com/how_to/gui#containers
  1403. */
  1404. export class Container extends Control {
  1405. name?: string | undefined;
  1406. /** @hidden */
  1407. _children: Control[];
  1408. /** @hidden */
  1409. protected _measureForChildren: Measure;
  1410. /** @hidden */
  1411. protected _background: string;
  1412. /** @hidden */
  1413. protected _adaptWidthToChildren: boolean;
  1414. /** @hidden */
  1415. protected _adaptHeightToChildren: boolean;
  1416. /**
  1417. * Gets or sets a boolean indicating that layout cycle errors should be displayed on the console
  1418. */
  1419. logLayoutCycleErrors: boolean;
  1420. /**
  1421. * Gets or sets the number of layout cycles (a change involved by a control while evaluating the layout) allowed
  1422. */
  1423. maxLayoutCycle: number;
  1424. /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
  1425. get adaptHeightToChildren(): boolean;
  1426. set adaptHeightToChildren(value: boolean);
  1427. /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
  1428. get adaptWidthToChildren(): boolean;
  1429. set adaptWidthToChildren(value: boolean);
  1430. /** Gets or sets background color */
  1431. get background(): string;
  1432. set background(value: string);
  1433. /** Gets the list of children */
  1434. get children(): Control[];
  1435. /**
  1436. * Creates a new Container
  1437. * @param name defines the name of the container
  1438. */
  1439. constructor(name?: string | undefined);
  1440. protected _getTypeName(): string;
  1441. _flagDescendantsAsMatrixDirty(): void;
  1442. /**
  1443. * Gets a child using its name
  1444. * @param name defines the child name to look for
  1445. * @returns the child control if found
  1446. */
  1447. getChildByName(name: string): Nullable<Control>;
  1448. /**
  1449. * Gets a child using its type and its name
  1450. * @param name defines the child name to look for
  1451. * @param type defines the child type to look for
  1452. * @returns the child control if found
  1453. */
  1454. getChildByType(name: string, type: string): Nullable<Control>;
  1455. /**
  1456. * Search for a specific control in children
  1457. * @param control defines the control to look for
  1458. * @returns true if the control is in child list
  1459. */
  1460. containsControl(control: Control): boolean;
  1461. /**
  1462. * Adds a new control to the current container
  1463. * @param control defines the control to add
  1464. * @returns the current container
  1465. */
  1466. addControl(control: Nullable<Control>): Container;
  1467. /**
  1468. * Removes all controls from the current container
  1469. * @returns the current container
  1470. */
  1471. clearControls(): Container;
  1472. /**
  1473. * Removes a control from the current container
  1474. * @param control defines the control to remove
  1475. * @returns the current container
  1476. */
  1477. removeControl(control: Control): Container;
  1478. /** @hidden */
  1479. _reOrderControl(control: Control): void;
  1480. /** @hidden */
  1481. _offsetLeft(offset: number): void;
  1482. /** @hidden */
  1483. _offsetTop(offset: number): void;
  1484. /** @hidden */
  1485. _markAllAsDirty(): void;
  1486. /** @hidden */
  1487. protected _localDraw(context: CanvasRenderingContext2D): void;
  1488. /** @hidden */
  1489. _link(host: AdvancedDynamicTexture): void;
  1490. /** @hidden */
  1491. protected _beforeLayout(): void;
  1492. /** @hidden */
  1493. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1494. /** @hidden */
  1495. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  1496. protected _postMeasure(): void;
  1497. /** @hidden */
  1498. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Measure): void;
  1499. getDescendantsToRef(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  1500. /** @hidden */
  1501. _processPicking(x: number, y: number, pi: PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
  1502. /** @hidden */
  1503. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1504. /**
  1505. * Serializes the current control
  1506. * @param serializationObject defined the JSON serialized object
  1507. */
  1508. serialize(serializationObject: any): void;
  1509. /** Releases associated resources */
  1510. dispose(): void;
  1511. /** @hidden */
  1512. _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture): void;
  1513. }
  1514. }
  1515. declare module "babylonjs-gui/2D/controls/rectangle" {
  1516. import { Container } from "babylonjs-gui/2D/controls/container";
  1517. import { Measure } from "babylonjs-gui/2D/measure";
  1518. /** Class used to create rectangle container */
  1519. export class Rectangle extends Container {
  1520. name?: string | undefined;
  1521. private _thickness;
  1522. private _cornerRadius;
  1523. /** Gets or sets border thickness */
  1524. get thickness(): number;
  1525. set thickness(value: number);
  1526. /** Gets or sets the corner radius angle */
  1527. get cornerRadius(): number;
  1528. set cornerRadius(value: number);
  1529. /**
  1530. * Creates a new Rectangle
  1531. * @param name defines the control name
  1532. */
  1533. constructor(name?: string | undefined);
  1534. protected _getTypeName(): string;
  1535. protected _localDraw(context: CanvasRenderingContext2D): void;
  1536. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1537. private _drawRoundedRect;
  1538. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  1539. }
  1540. }
  1541. declare module "babylonjs-gui/2D/controls/textBlock" {
  1542. import { Observable } from "babylonjs/Misc/observable";
  1543. import { Measure } from "babylonjs-gui/2D/measure";
  1544. import { Control } from "babylonjs-gui/2D/controls/control";
  1545. import { Nullable } from "babylonjs/types";
  1546. /**
  1547. * Enum that determines the text-wrapping mode to use.
  1548. */
  1549. export enum TextWrapping {
  1550. /**
  1551. * Clip the text when it's larger than Control.width; this is the default mode.
  1552. */
  1553. Clip = 0,
  1554. /**
  1555. * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.
  1556. */
  1557. WordWrap = 1,
  1558. /**
  1559. * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.
  1560. */
  1561. Ellipsis = 2
  1562. }
  1563. /**
  1564. * Class used to create text block control
  1565. */
  1566. export class TextBlock extends Control {
  1567. /**
  1568. * Defines the name of the control
  1569. */
  1570. name?: string | undefined;
  1571. private _text;
  1572. private _textWrapping;
  1573. private _textHorizontalAlignment;
  1574. private _textVerticalAlignment;
  1575. private _lines;
  1576. private _resizeToFit;
  1577. private _lineSpacing;
  1578. private _outlineWidth;
  1579. private _outlineColor;
  1580. private _underline;
  1581. private _lineThrough;
  1582. /**
  1583. * An event triggered after the text is changed
  1584. */
  1585. onTextChangedObservable: Observable<TextBlock>;
  1586. /**
  1587. * An event triggered after the text was broken up into lines
  1588. */
  1589. onLinesReadyObservable: Observable<TextBlock>;
  1590. /**
  1591. * Function used to split a string into words. By default, a string is split at each space character found
  1592. */
  1593. wordSplittingFunction: Nullable<(line: string) => string[]>;
  1594. /**
  1595. * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
  1596. */
  1597. get lines(): any[];
  1598. /**
  1599. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  1600. */
  1601. get resizeToFit(): boolean;
  1602. /**
  1603. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  1604. */
  1605. set resizeToFit(value: boolean);
  1606. /**
  1607. * Gets or sets a boolean indicating if text must be wrapped
  1608. */
  1609. get textWrapping(): TextWrapping | boolean;
  1610. /**
  1611. * Gets or sets a boolean indicating if text must be wrapped
  1612. */
  1613. set textWrapping(value: TextWrapping | boolean);
  1614. /**
  1615. * Gets or sets text to display
  1616. */
  1617. get text(): string;
  1618. /**
  1619. * Gets or sets text to display
  1620. */
  1621. set text(value: string);
  1622. /**
  1623. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  1624. */
  1625. get textHorizontalAlignment(): number;
  1626. /**
  1627. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  1628. */
  1629. set textHorizontalAlignment(value: number);
  1630. /**
  1631. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  1632. */
  1633. get textVerticalAlignment(): number;
  1634. /**
  1635. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  1636. */
  1637. set textVerticalAlignment(value: number);
  1638. /**
  1639. * Gets or sets line spacing value
  1640. */
  1641. set lineSpacing(value: string | number);
  1642. /**
  1643. * Gets or sets line spacing value
  1644. */
  1645. get lineSpacing(): string | number;
  1646. /**
  1647. * Gets or sets outlineWidth of the text to display
  1648. */
  1649. get outlineWidth(): number;
  1650. /**
  1651. * Gets or sets outlineWidth of the text to display
  1652. */
  1653. set outlineWidth(value: number);
  1654. /**
  1655. * Gets or sets a boolean indicating that text must have underline
  1656. */
  1657. get underline(): boolean;
  1658. /**
  1659. * Gets or sets a boolean indicating that text must have underline
  1660. */
  1661. set underline(value: boolean);
  1662. /**
  1663. * Gets or sets an boolean indicating that text must be crossed out
  1664. */
  1665. get lineThrough(): boolean;
  1666. /**
  1667. * Gets or sets an boolean indicating that text must be crossed out
  1668. */
  1669. set lineThrough(value: boolean);
  1670. /**
  1671. * Gets or sets outlineColor of the text to display
  1672. */
  1673. get outlineColor(): string;
  1674. /**
  1675. * Gets or sets outlineColor of the text to display
  1676. */
  1677. set outlineColor(value: string);
  1678. /**
  1679. * Creates a new TextBlock object
  1680. * @param name defines the name of the control
  1681. * @param text defines the text to display (emptry string by default)
  1682. */
  1683. constructor(
  1684. /**
  1685. * Defines the name of the control
  1686. */
  1687. name?: string | undefined, text?: string);
  1688. protected _getTypeName(): string;
  1689. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1690. private _drawText;
  1691. /** @hidden */
  1692. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Nullable<Measure>): void;
  1693. protected _applyStates(context: CanvasRenderingContext2D): void;
  1694. protected _breakLines(refWidth: number, context: CanvasRenderingContext2D): object[];
  1695. protected _parseLine(line: string | undefined, context: CanvasRenderingContext2D): object;
  1696. protected _parseLineEllipsis(line: string | undefined, width: number, context: CanvasRenderingContext2D): object;
  1697. protected _parseLineWordWrap(line: string | undefined, width: number, context: CanvasRenderingContext2D): object[];
  1698. protected _renderLines(context: CanvasRenderingContext2D): void;
  1699. /**
  1700. * Given a width constraint applied on the text block, find the expected height
  1701. * @returns expected height
  1702. */
  1703. computeExpectedHeight(): number;
  1704. dispose(): void;
  1705. }
  1706. }
  1707. declare module "babylonjs-gui/2D/controls/image" {
  1708. import { Nullable } from "babylonjs/types";
  1709. import { Observable } from "babylonjs/Misc/observable";
  1710. import { Control } from "babylonjs-gui/2D/controls/control";
  1711. import { Measure } from "babylonjs-gui/2D/measure";
  1712. /**
  1713. * Class used to create 2D images
  1714. */
  1715. export class Image extends Control {
  1716. name?: string | undefined;
  1717. private _workingCanvas;
  1718. private _domImage;
  1719. private _imageWidth;
  1720. private _imageHeight;
  1721. private _loaded;
  1722. private _stretch;
  1723. private _source;
  1724. private _autoScale;
  1725. private _sourceLeft;
  1726. private _sourceTop;
  1727. private _sourceWidth;
  1728. private _sourceHeight;
  1729. private _svgAttributesComputationCompleted;
  1730. private _isSVG;
  1731. private _cellWidth;
  1732. private _cellHeight;
  1733. private _cellId;
  1734. private _populateNinePatchSlicesFromImage;
  1735. private _sliceLeft;
  1736. private _sliceRight;
  1737. private _sliceTop;
  1738. private _sliceBottom;
  1739. private _detectPointerOnOpaqueOnly;
  1740. private _imageDataCache;
  1741. /**
  1742. * Observable notified when the content is loaded
  1743. */
  1744. onImageLoadedObservable: Observable<Image>;
  1745. /**
  1746. * Observable notified when _sourceLeft, _sourceTop, _sourceWidth and _sourceHeight are computed
  1747. */
  1748. onSVGAttributesComputedObservable: Observable<Image>;
  1749. /**
  1750. * Gets a boolean indicating that the content is loaded
  1751. */
  1752. get isLoaded(): boolean;
  1753. /**
  1754. * Gets or sets a boolean indicating if nine patch slices (left, top, right, bottom) should be read from image data
  1755. */
  1756. get populateNinePatchSlicesFromImage(): boolean;
  1757. set populateNinePatchSlicesFromImage(value: boolean);
  1758. /**
  1759. * Gets or sets a boolean indicating if pointers should only be validated on pixels with alpha > 0.
  1760. * Beware using this as this will comsume more memory as the image has to be stored twice
  1761. */
  1762. get detectPointerOnOpaqueOnly(): boolean;
  1763. set detectPointerOnOpaqueOnly(value: boolean);
  1764. /**
  1765. * Gets or sets the left value for slicing (9-patch)
  1766. */
  1767. get sliceLeft(): number;
  1768. set sliceLeft(value: number);
  1769. /**
  1770. * Gets or sets the right value for slicing (9-patch)
  1771. */
  1772. get sliceRight(): number;
  1773. set sliceRight(value: number);
  1774. /**
  1775. * Gets or sets the top value for slicing (9-patch)
  1776. */
  1777. get sliceTop(): number;
  1778. set sliceTop(value: number);
  1779. /**
  1780. * Gets or sets the bottom value for slicing (9-patch)
  1781. */
  1782. get sliceBottom(): number;
  1783. set sliceBottom(value: number);
  1784. /**
  1785. * Gets or sets the left coordinate in the source image
  1786. */
  1787. get sourceLeft(): number;
  1788. set sourceLeft(value: number);
  1789. /**
  1790. * Gets or sets the top coordinate in the source image
  1791. */
  1792. get sourceTop(): number;
  1793. set sourceTop(value: number);
  1794. /**
  1795. * Gets or sets the width to capture in the source image
  1796. */
  1797. get sourceWidth(): number;
  1798. set sourceWidth(value: number);
  1799. /**
  1800. * Gets or sets the height to capture in the source image
  1801. */
  1802. get sourceHeight(): number;
  1803. set sourceHeight(value: number);
  1804. /** Indicates if the format of the image is SVG */
  1805. get isSVG(): boolean;
  1806. /** Gets the status of the SVG attributes computation (sourceLeft, sourceTop, sourceWidth, sourceHeight) */
  1807. get svgAttributesComputationCompleted(): boolean;
  1808. /**
  1809. * Gets or sets a boolean indicating if the image can force its container to adapt its size
  1810. * @see https://doc.babylonjs.com/how_to/gui#image
  1811. */
  1812. get autoScale(): boolean;
  1813. set autoScale(value: boolean);
  1814. /** Gets or sets the streching mode used by the image */
  1815. get stretch(): number;
  1816. set stretch(value: number);
  1817. /** @hidden */
  1818. _rotate90(n: number, preserveProperties?: boolean): Image;
  1819. private _handleRotationForSVGImage;
  1820. private _rotate90SourceProperties;
  1821. /**
  1822. * Gets or sets the internal DOM image used to render the control
  1823. */
  1824. set domImage(value: HTMLImageElement);
  1825. get domImage(): HTMLImageElement;
  1826. private _onImageLoaded;
  1827. private _extractNinePatchSliceDataFromImage;
  1828. /**
  1829. * Gets the image source url
  1830. */
  1831. get source(): Nullable<string>;
  1832. /**
  1833. * Gets or sets image source url
  1834. */
  1835. set source(value: Nullable<string>);
  1836. /**
  1837. * Checks for svg document with icon id present
  1838. */
  1839. private _svgCheck;
  1840. /**
  1841. * Sets sourceLeft, sourceTop, sourceWidth, sourceHeight automatically
  1842. * given external svg file and icon id
  1843. */
  1844. private _getSVGAttribs;
  1845. /**
  1846. * Gets or sets the cell width to use when animation sheet is enabled
  1847. * @see https://doc.babylonjs.com/how_to/gui#image
  1848. */
  1849. get cellWidth(): number;
  1850. set cellWidth(value: number);
  1851. /**
  1852. * Gets or sets the cell height to use when animation sheet is enabled
  1853. * @see https://doc.babylonjs.com/how_to/gui#image
  1854. */
  1855. get cellHeight(): number;
  1856. set cellHeight(value: number);
  1857. /**
  1858. * Gets or sets the cell id to use (this will turn on the animation sheet mode)
  1859. * @see https://doc.babylonjs.com/how_to/gui#image
  1860. */
  1861. get cellId(): number;
  1862. set cellId(value: number);
  1863. /**
  1864. * Creates a new Image
  1865. * @param name defines the control name
  1866. * @param url defines the image url
  1867. */
  1868. constructor(name?: string | undefined, url?: Nullable<string>);
  1869. /**
  1870. * Tests if a given coordinates belong to the current control
  1871. * @param x defines x coordinate to test
  1872. * @param y defines y coordinate to test
  1873. * @returns true if the coordinates are inside the control
  1874. */
  1875. contains(x: number, y: number): boolean;
  1876. protected _getTypeName(): string;
  1877. /** Force the control to synchronize with its content */
  1878. synchronizeSizeWithContent(): void;
  1879. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1880. private _prepareWorkingCanvasForOpaqueDetection;
  1881. private _drawImage;
  1882. _draw(context: CanvasRenderingContext2D): void;
  1883. private _renderCornerPatch;
  1884. private _renderNinePatch;
  1885. dispose(): void;
  1886. /** STRETCH_NONE */
  1887. static readonly STRETCH_NONE: number;
  1888. /** STRETCH_FILL */
  1889. static readonly STRETCH_FILL: number;
  1890. /** STRETCH_UNIFORM */
  1891. static readonly STRETCH_UNIFORM: number;
  1892. /** STRETCH_EXTEND */
  1893. static readonly STRETCH_EXTEND: number;
  1894. /** NINE_PATCH */
  1895. static readonly STRETCH_NINE_PATCH: number;
  1896. }
  1897. }
  1898. declare module "babylonjs-gui/2D/controls/button" {
  1899. import { Nullable } from "babylonjs/types";
  1900. import { Vector2 } from "babylonjs/Maths/math.vector";
  1901. import { Rectangle } from "babylonjs-gui/2D/controls/rectangle";
  1902. import { Control } from "babylonjs-gui/2D/controls/control";
  1903. import { TextBlock } from "babylonjs-gui/2D/controls/textBlock";
  1904. import { Image } from "babylonjs-gui/2D/controls/image";
  1905. import { PointerInfoBase } from 'babylonjs/Events/pointerEvents';
  1906. /**
  1907. * Class used to create 2D buttons
  1908. */
  1909. export class Button extends Rectangle {
  1910. name?: string | undefined;
  1911. /**
  1912. * Function called to generate a pointer enter animation
  1913. */
  1914. pointerEnterAnimation: () => void;
  1915. /**
  1916. * Function called to generate a pointer out animation
  1917. */
  1918. pointerOutAnimation: () => void;
  1919. /**
  1920. * Function called to generate a pointer down animation
  1921. */
  1922. pointerDownAnimation: () => void;
  1923. /**
  1924. * Function called to generate a pointer up animation
  1925. */
  1926. pointerUpAnimation: () => void;
  1927. /**
  1928. * Gets or sets a boolean indicating that the button will let internal controls handle picking instead of doing it directly using its bounding info
  1929. */
  1930. delegatePickingToChildren: boolean;
  1931. private _image;
  1932. /**
  1933. * Returns the image part of the button (if any)
  1934. */
  1935. get image(): Nullable<Image>;
  1936. private _textBlock;
  1937. /**
  1938. * Returns the image part of the button (if any)
  1939. */
  1940. get textBlock(): Nullable<TextBlock>;
  1941. /**
  1942. * Creates a new Button
  1943. * @param name defines the name of the button
  1944. */
  1945. constructor(name?: string | undefined);
  1946. protected _getTypeName(): string;
  1947. /** @hidden */
  1948. _processPicking(x: number, y: number, pi: PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
  1949. /** @hidden */
  1950. _onPointerEnter(target: Control, pi: PointerInfoBase): boolean;
  1951. /** @hidden */
  1952. _onPointerOut(target: Control, pi: PointerInfoBase, force?: boolean): void;
  1953. /** @hidden */
  1954. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, pi: PointerInfoBase): boolean;
  1955. /** @hidden */
  1956. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi: PointerInfoBase): void;
  1957. /**
  1958. * Creates a new button made with an image and a text
  1959. * @param name defines the name of the button
  1960. * @param text defines the text of the button
  1961. * @param imageUrl defines the url of the image
  1962. * @returns a new Button
  1963. */
  1964. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  1965. /**
  1966. * Creates a new button made with an image
  1967. * @param name defines the name of the button
  1968. * @param imageUrl defines the url of the image
  1969. * @returns a new Button
  1970. */
  1971. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  1972. /**
  1973. * Creates a new button made with a text
  1974. * @param name defines the name of the button
  1975. * @param text defines the text of the button
  1976. * @returns a new Button
  1977. */
  1978. static CreateSimpleButton(name: string, text: string): Button;
  1979. /**
  1980. * Creates a new button made with an image and a centered text
  1981. * @param name defines the name of the button
  1982. * @param text defines the text of the button
  1983. * @param imageUrl defines the url of the image
  1984. * @returns a new Button
  1985. */
  1986. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  1987. }
  1988. }
  1989. declare module "babylonjs-gui/2D/controls/stackPanel" {
  1990. import { Container } from "babylonjs-gui/2D/controls/container";
  1991. import { Measure } from "babylonjs-gui/2D/measure";
  1992. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  1993. /**
  1994. * Class used to create a 2D stack panel container
  1995. */
  1996. export class StackPanel extends Container {
  1997. name?: string | undefined;
  1998. private _isVertical;
  1999. private _manualWidth;
  2000. private _manualHeight;
  2001. private _doNotTrackManualChanges;
  2002. /**
  2003. * Gets or sets a boolean indicating that layou warnings should be ignored
  2004. */
  2005. ignoreLayoutWarnings: boolean;
  2006. /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
  2007. get isVertical(): boolean;
  2008. set isVertical(value: boolean);
  2009. /**
  2010. * Gets or sets panel width.
  2011. * This value should not be set when in horizontal mode as it will be computed automatically
  2012. */
  2013. set width(value: string | number);
  2014. get width(): string | number;
  2015. /**
  2016. * Gets or sets panel height.
  2017. * This value should not be set when in vertical mode as it will be computed automatically
  2018. */
  2019. set height(value: string | number);
  2020. get height(): string | number;
  2021. /**
  2022. * Creates a new StackPanel
  2023. * @param name defines control name
  2024. */
  2025. constructor(name?: string | undefined);
  2026. protected _getTypeName(): string;
  2027. /** @hidden */
  2028. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2029. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2030. protected _postMeasure(): void;
  2031. /**
  2032. * Serializes the current control
  2033. * @param serializationObject defined the JSON serialized object
  2034. */
  2035. serialize(serializationObject: any): void;
  2036. /** @hidden */
  2037. _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture): void;
  2038. }
  2039. }
  2040. declare module "babylonjs-gui/2D/controls/checkbox" {
  2041. import { Observable } from "babylonjs/Misc/observable";
  2042. import { Vector2 } from "babylonjs/Maths/math.vector";
  2043. import { Control } from "babylonjs-gui/2D/controls/control";
  2044. import { StackPanel } from "babylonjs-gui/2D/controls/stackPanel";
  2045. import { Nullable } from 'babylonjs/types';
  2046. import { Measure } from "babylonjs-gui/2D/measure";
  2047. import { PointerInfoBase } from 'babylonjs/Events/pointerEvents';
  2048. /**
  2049. * Class used to represent a 2D checkbox
  2050. */
  2051. export class Checkbox extends Control {
  2052. name?: string | undefined;
  2053. private _isChecked;
  2054. private _background;
  2055. private _checkSizeRatio;
  2056. private _thickness;
  2057. /** Gets or sets border thickness */
  2058. get thickness(): number;
  2059. set thickness(value: number);
  2060. /**
  2061. * Observable raised when isChecked property changes
  2062. */
  2063. onIsCheckedChangedObservable: Observable<boolean>;
  2064. /** Gets or sets a value indicating the ratio between overall size and check size */
  2065. get checkSizeRatio(): number;
  2066. set checkSizeRatio(value: number);
  2067. /** Gets or sets background color */
  2068. get background(): string;
  2069. set background(value: string);
  2070. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  2071. get isChecked(): boolean;
  2072. set isChecked(value: boolean);
  2073. /**
  2074. * Creates a new CheckBox
  2075. * @param name defines the control name
  2076. */
  2077. constructor(name?: string | undefined);
  2078. protected _getTypeName(): string;
  2079. /** @hidden */
  2080. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Nullable<Measure>): void;
  2081. /** @hidden */
  2082. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, pi: PointerInfoBase): boolean;
  2083. /**
  2084. * Utility function to easily create a checkbox with a header
  2085. * @param title defines the label to use for the header
  2086. * @param onValueChanged defines the callback to call when value changes
  2087. * @returns a StackPanel containing the checkbox and a textBlock
  2088. */
  2089. static AddCheckBoxWithHeader(title: string, onValueChanged: (value: boolean) => void): StackPanel;
  2090. }
  2091. }
  2092. declare module "babylonjs-gui/2D/controls/virtualKeyboard" {
  2093. import { Nullable } from "babylonjs/types";
  2094. import { Observable } from "babylonjs/Misc/observable";
  2095. import { StackPanel } from "babylonjs-gui/2D/controls/stackPanel";
  2096. import { InputText } from "babylonjs-gui/2D/controls/inputText";
  2097. /**
  2098. * Class used to store key control properties
  2099. */
  2100. export class KeyPropertySet {
  2101. /** Width */
  2102. width?: string;
  2103. /** Height */
  2104. height?: string;
  2105. /** Left padding */
  2106. paddingLeft?: string;
  2107. /** Right padding */
  2108. paddingRight?: string;
  2109. /** Top padding */
  2110. paddingTop?: string;
  2111. /** Bottom padding */
  2112. paddingBottom?: string;
  2113. /** Foreground color */
  2114. color?: string;
  2115. /** Background color */
  2116. background?: string;
  2117. }
  2118. /**
  2119. * Class used to create virtual keyboard
  2120. */
  2121. export class VirtualKeyboard extends StackPanel {
  2122. /** Observable raised when a key is pressed */
  2123. onKeyPressObservable: Observable<string>;
  2124. /** Gets or sets default key button width */
  2125. defaultButtonWidth: string;
  2126. /** Gets or sets default key button height */
  2127. defaultButtonHeight: string;
  2128. /** Gets or sets default key button left padding */
  2129. defaultButtonPaddingLeft: string;
  2130. /** Gets or sets default key button right padding */
  2131. defaultButtonPaddingRight: string;
  2132. /** Gets or sets default key button top padding */
  2133. defaultButtonPaddingTop: string;
  2134. /** Gets or sets default key button bottom padding */
  2135. defaultButtonPaddingBottom: string;
  2136. /** Gets or sets default key button foreground color */
  2137. defaultButtonColor: string;
  2138. /** Gets or sets default key button background color */
  2139. defaultButtonBackground: string;
  2140. /** Gets or sets shift button foreground color */
  2141. shiftButtonColor: string;
  2142. /** Gets or sets shift button thickness*/
  2143. selectedShiftThickness: number;
  2144. /** Gets shift key state */
  2145. shiftState: number;
  2146. protected _getTypeName(): string;
  2147. private _createKey;
  2148. /**
  2149. * Adds a new row of keys
  2150. * @param keys defines the list of keys to add
  2151. * @param propertySets defines the associated property sets
  2152. */
  2153. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  2154. /**
  2155. * Set the shift key to a specific state
  2156. * @param shiftState defines the new shift state
  2157. */
  2158. applyShiftState(shiftState: number): void;
  2159. private _currentlyConnectedInputText;
  2160. private _connectedInputTexts;
  2161. private _onKeyPressObserver;
  2162. /** Gets the input text control currently attached to the keyboard */
  2163. get connectedInputText(): Nullable<InputText>;
  2164. /**
  2165. * Connects the keyboard with an input text control
  2166. *
  2167. * @param input defines the target control
  2168. */
  2169. connect(input: InputText): void;
  2170. /**
  2171. * Disconnects the keyboard from connected InputText controls
  2172. *
  2173. * @param input optionally defines a target control, otherwise all are disconnected
  2174. */
  2175. disconnect(input?: InputText): void;
  2176. private _removeConnectedInputObservables;
  2177. /**
  2178. * Release all resources
  2179. */
  2180. dispose(): void;
  2181. /**
  2182. * Creates a new keyboard using a default layout
  2183. *
  2184. * @param name defines control name
  2185. * @returns a new VirtualKeyboard
  2186. */
  2187. static CreateDefaultLayout(name?: string): VirtualKeyboard;
  2188. }
  2189. }
  2190. declare module "babylonjs-gui/2D/controls/textWrapper" {
  2191. /** @hidden */
  2192. export class TextWrapper {
  2193. private _text;
  2194. private _characters;
  2195. get text(): string;
  2196. set text(txt: string);
  2197. get length(): number;
  2198. removePart(idxStart: number, idxEnd: number, insertTxt?: string): void;
  2199. charAt(idx: number): string;
  2200. substr(from: number, length?: number): string;
  2201. substring(from: number, to?: number): string;
  2202. isWord(index: number): boolean;
  2203. }
  2204. }
  2205. declare module "babylonjs-gui/2D/controls/inputText" {
  2206. import { Nullable } from "babylonjs/types";
  2207. import { Observable } from "babylonjs/Misc/observable";
  2208. import { Vector2 } from "babylonjs/Maths/math.vector";
  2209. import { PointerInfoBase } from 'babylonjs/Events/pointerEvents';
  2210. import { Control } from "babylonjs-gui/2D/controls/control";
  2211. import { IFocusableControl } from "babylonjs-gui/2D/controls/focusableControl";
  2212. import { VirtualKeyboard } from "babylonjs-gui/2D/controls/virtualKeyboard";
  2213. import { Measure } from "babylonjs-gui/2D/measure";
  2214. import { TextWrapper } from "babylonjs-gui/2D/controls/textWrapper";
  2215. import { IKeyboardEvent } from 'babylonjs/Events/deviceInputEvents';
  2216. /**
  2217. * Class used to create input text control
  2218. */
  2219. export class InputText extends Control implements IFocusableControl {
  2220. name?: string | undefined;
  2221. private _textWrapper;
  2222. private _placeholderText;
  2223. private _background;
  2224. private _focusedBackground;
  2225. private _focusedColor;
  2226. private _placeholderColor;
  2227. private _thickness;
  2228. private _margin;
  2229. private _autoStretchWidth;
  2230. private _maxWidth;
  2231. private _isFocused;
  2232. private _blinkTimeout;
  2233. private _blinkIsEven;
  2234. private _cursorOffset;
  2235. private _scrollLeft;
  2236. private _textWidth;
  2237. private _clickedCoordinate;
  2238. private _deadKey;
  2239. private _addKey;
  2240. private _currentKey;
  2241. private _isTextHighlightOn;
  2242. private _textHighlightColor;
  2243. private _highligherOpacity;
  2244. private _highlightedText;
  2245. private _startHighlightIndex;
  2246. private _endHighlightIndex;
  2247. private _cursorIndex;
  2248. private _onFocusSelectAll;
  2249. private _isPointerDown;
  2250. private _onClipboardObserver;
  2251. private _onPointerDblTapObserver;
  2252. /** @hidden */
  2253. _connectedVirtualKeyboard: Nullable<VirtualKeyboard>;
  2254. /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
  2255. promptMessage: string;
  2256. /** Force disable prompt on mobile device */
  2257. disableMobilePrompt: boolean;
  2258. /** Observable raised when the text changes */
  2259. onTextChangedObservable: Observable<InputText>;
  2260. /** Observable raised just before an entered character is to be added */
  2261. onBeforeKeyAddObservable: Observable<InputText>;
  2262. /** Observable raised when the control gets the focus */
  2263. onFocusObservable: Observable<InputText>;
  2264. /** Observable raised when the control loses the focus */
  2265. onBlurObservable: Observable<InputText>;
  2266. /**Observable raised when the text is highlighted */
  2267. onTextHighlightObservable: Observable<InputText>;
  2268. /**Observable raised when copy event is triggered */
  2269. onTextCopyObservable: Observable<InputText>;
  2270. /** Observable raised when cut event is triggered */
  2271. onTextCutObservable: Observable<InputText>;
  2272. /** Observable raised when paste event is triggered */
  2273. onTextPasteObservable: Observable<InputText>;
  2274. /** Observable raised when a key event was processed */
  2275. onKeyboardEventProcessedObservable: Observable<IKeyboardEvent>;
  2276. /** Gets or sets the maximum width allowed by the control */
  2277. get maxWidth(): string | number;
  2278. /** Gets the maximum width allowed by the control in pixels */
  2279. get maxWidthInPixels(): number;
  2280. set maxWidth(value: string | number);
  2281. /** Gets or sets the text highlighter transparency; default: 0.4 */
  2282. get highligherOpacity(): number;
  2283. set highligherOpacity(value: number);
  2284. /** Gets or sets a boolean indicating whether to select complete text by default on input focus */
  2285. get onFocusSelectAll(): boolean;
  2286. set onFocusSelectAll(value: boolean);
  2287. /** Gets or sets the text hightlight color */
  2288. get textHighlightColor(): string;
  2289. set textHighlightColor(value: string);
  2290. /** Gets or sets control margin */
  2291. get margin(): string;
  2292. /** Gets control margin in pixels */
  2293. get marginInPixels(): number;
  2294. set margin(value: string);
  2295. /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
  2296. get autoStretchWidth(): boolean;
  2297. set autoStretchWidth(value: boolean);
  2298. /** Gets or sets border thickness */
  2299. get thickness(): number;
  2300. set thickness(value: number);
  2301. /** Gets or sets the background color when focused */
  2302. get focusedBackground(): string;
  2303. set focusedBackground(value: string);
  2304. /** Gets or sets the background color when focused */
  2305. get focusedColor(): string;
  2306. set focusedColor(value: string);
  2307. /** Gets or sets the background color */
  2308. get background(): string;
  2309. set background(value: string);
  2310. /** Gets or sets the placeholder color */
  2311. get placeholderColor(): string;
  2312. set placeholderColor(value: string);
  2313. /** Gets or sets the text displayed when the control is empty */
  2314. get placeholderText(): string;
  2315. set placeholderText(value: string);
  2316. /** Gets or sets the dead key flag */
  2317. get deadKey(): boolean;
  2318. set deadKey(flag: boolean);
  2319. /** Gets or sets the highlight text */
  2320. get highlightedText(): string;
  2321. set highlightedText(text: string);
  2322. /** Gets or sets if the current key should be added */
  2323. get addKey(): boolean;
  2324. set addKey(flag: boolean);
  2325. /** Gets or sets the value of the current key being entered */
  2326. get currentKey(): string;
  2327. set currentKey(key: string);
  2328. /** Gets or sets the text displayed in the control */
  2329. get text(): string;
  2330. set text(value: string);
  2331. private _textHasChanged;
  2332. /** Gets or sets control width */
  2333. get width(): string | number;
  2334. set width(value: string | number);
  2335. /**
  2336. * Creates a new InputText
  2337. * @param name defines the control name
  2338. * @param text defines the text of the control
  2339. */
  2340. constructor(name?: string | undefined, text?: string);
  2341. /** @hidden */
  2342. onBlur(): void;
  2343. /** @hidden */
  2344. onFocus(): void;
  2345. /**
  2346. * Function to focus an inputText programmatically
  2347. */
  2348. focus(): void;
  2349. /**
  2350. * Function to unfocus an inputText programmatically
  2351. */
  2352. blur(): void;
  2353. protected _getTypeName(): string;
  2354. /**
  2355. * Function called to get the list of controls that should not steal the focus from this control
  2356. * @returns an array of controls
  2357. */
  2358. keepsFocusWith(): Nullable<Control[]>;
  2359. /** @hidden */
  2360. processKey(keyCode: number, key?: string, evt?: IKeyboardEvent): void;
  2361. /** @hidden */
  2362. private _updateValueFromCursorIndex;
  2363. /** @hidden */
  2364. private _processDblClick;
  2365. /** @hidden */
  2366. private _selectAllText;
  2367. /**
  2368. * Handles the keyboard event
  2369. * @param evt Defines the KeyboardEvent
  2370. */
  2371. processKeyboard(evt: IKeyboardEvent): void;
  2372. /** @hidden */
  2373. private _onCopyText;
  2374. /** @hidden */
  2375. private _onCutText;
  2376. /** @hidden */
  2377. private _onPasteText;
  2378. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Nullable<Measure>): void;
  2379. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, pi: PointerInfoBase): boolean;
  2380. _onPointerMove(target: Control, coordinates: Vector2, pointerId: number, pi: PointerInfoBase): void;
  2381. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  2382. protected _beforeRenderText(textWrapper: TextWrapper): TextWrapper;
  2383. dispose(): void;
  2384. }
  2385. }
  2386. declare module "babylonjs-gui/2D/controls/grid" {
  2387. import { Nullable } from "babylonjs/types";
  2388. import { Container } from "babylonjs-gui/2D/controls/container";
  2389. import { ValueAndUnit } from "babylonjs-gui/2D/valueAndUnit";
  2390. import { Control } from "babylonjs-gui/2D/controls/control";
  2391. import { Measure } from "babylonjs-gui/2D/measure";
  2392. /**
  2393. * Class used to create a 2D grid container
  2394. */
  2395. export class Grid extends Container {
  2396. name?: string | undefined;
  2397. private _rowDefinitions;
  2398. private _columnDefinitions;
  2399. private _cells;
  2400. private _childControls;
  2401. /**
  2402. * Gets the number of columns
  2403. */
  2404. get columnCount(): number;
  2405. /**
  2406. * Gets the number of rows
  2407. */
  2408. get rowCount(): number;
  2409. /** Gets the list of children */
  2410. get children(): Control[];
  2411. /** Gets the list of cells (e.g. the containers) */
  2412. get cells(): {
  2413. [key: string]: Container;
  2414. };
  2415. /**
  2416. * Gets the definition of a specific row
  2417. * @param index defines the index of the row
  2418. * @returns the row definition
  2419. */
  2420. getRowDefinition(index: number): Nullable<ValueAndUnit>;
  2421. /**
  2422. * Gets the definition of a specific column
  2423. * @param index defines the index of the column
  2424. * @returns the column definition
  2425. */
  2426. getColumnDefinition(index: number): Nullable<ValueAndUnit>;
  2427. /**
  2428. * Adds a new row to the grid
  2429. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  2430. * @param isPixel defines if the height is expressed in pixel (or in percentage)
  2431. * @returns the current grid
  2432. */
  2433. addRowDefinition(height: number, isPixel?: boolean): Grid;
  2434. /**
  2435. * Adds a new column to the grid
  2436. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  2437. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  2438. * @returns the current grid
  2439. */
  2440. addColumnDefinition(width: number, isPixel?: boolean): Grid;
  2441. /**
  2442. * Update a row definition
  2443. * @param index defines the index of the row to update
  2444. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  2445. * @param isPixel defines if the weight is expressed in pixel (or in percentage)
  2446. * @returns the current grid
  2447. */
  2448. setRowDefinition(index: number, height: number, isPixel?: boolean): Grid;
  2449. /**
  2450. * Update a column definition
  2451. * @param index defines the index of the column to update
  2452. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  2453. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  2454. * @returns the current grid
  2455. */
  2456. setColumnDefinition(index: number, width: number, isPixel?: boolean): Grid;
  2457. /**
  2458. * Gets the list of children stored in a specific cell
  2459. * @param row defines the row to check
  2460. * @param column defines the column to check
  2461. * @returns the list of controls
  2462. */
  2463. getChildrenAt(row: number, column: number): Nullable<Array<Control>>;
  2464. /**
  2465. * Gets a string representing the child cell info (row x column)
  2466. * @param child defines the control to get info from
  2467. * @returns a string containing the child cell info (row x column)
  2468. */
  2469. getChildCellInfo(child: Control): string;
  2470. private _removeCell;
  2471. private _offsetCell;
  2472. /**
  2473. * Remove a column definition at specified index
  2474. * @param index defines the index of the column to remove
  2475. * @returns the current grid
  2476. */
  2477. removeColumnDefinition(index: number): Grid;
  2478. /**
  2479. * Remove a row definition at specified index
  2480. * @param index defines the index of the row to remove
  2481. * @returns the current grid
  2482. */
  2483. removeRowDefinition(index: number): Grid;
  2484. /**
  2485. * Adds a new control to the current grid
  2486. * @param control defines the control to add
  2487. * @param row defines the row where to add the control (0 by default)
  2488. * @param column defines the column where to add the control (0 by default)
  2489. * @returns the current grid
  2490. */
  2491. addControl(control: Control, row?: number, column?: number): Grid;
  2492. /**
  2493. * Removes a control from the current container
  2494. * @param control defines the control to remove
  2495. * @returns the current container
  2496. */
  2497. removeControl(control: Control): Container;
  2498. /**
  2499. * Creates a new Grid
  2500. * @param name defines control name
  2501. */
  2502. constructor(name?: string | undefined);
  2503. protected _getTypeName(): string;
  2504. protected _getGridDefinitions(definitionCallback: (lefts: number[], tops: number[], widths: number[], heights: number[]) => void): void;
  2505. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2506. _flagDescendantsAsMatrixDirty(): void;
  2507. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  2508. /** Releases associated resources */
  2509. dispose(): void;
  2510. }
  2511. }
  2512. declare module "babylonjs-gui/2D/controls/colorpicker" {
  2513. import { Observable } from "babylonjs/Misc/observable";
  2514. import { Vector2 } from "babylonjs/Maths/math.vector";
  2515. import { Control } from "babylonjs-gui/2D/controls/control";
  2516. import { Measure } from "babylonjs-gui/2D/measure";
  2517. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  2518. import { Color3 } from 'babylonjs/Maths/math.color';
  2519. import { PointerInfoBase } from 'babylonjs/Events/pointerEvents';
  2520. /** Class used to create color pickers */
  2521. export class ColorPicker extends Control {
  2522. name?: string | undefined;
  2523. private static _Epsilon;
  2524. private _colorWheelCanvas;
  2525. private _value;
  2526. private _tmpColor;
  2527. private _pointerStartedOnSquare;
  2528. private _pointerStartedOnWheel;
  2529. private _squareLeft;
  2530. private _squareTop;
  2531. private _squareSize;
  2532. private _h;
  2533. private _s;
  2534. private _v;
  2535. private _lastPointerDownID;
  2536. /**
  2537. * Observable raised when the value changes
  2538. */
  2539. onValueChangedObservable: Observable<Color3>;
  2540. /** Gets or sets the color of the color picker */
  2541. get value(): Color3;
  2542. set value(value: Color3);
  2543. /**
  2544. * Gets or sets control width
  2545. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  2546. */
  2547. get width(): string | number;
  2548. set width(value: string | number);
  2549. /**
  2550. * Gets or sets control height
  2551. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  2552. */
  2553. get height(): string | number;
  2554. /** Gets or sets control height */
  2555. set height(value: string | number);
  2556. /** Gets or sets control size */
  2557. get size(): string | number;
  2558. set size(value: string | number);
  2559. /**
  2560. * Creates a new ColorPicker
  2561. * @param name defines the control name
  2562. */
  2563. constructor(name?: string | undefined);
  2564. protected _getTypeName(): string;
  2565. /** @hidden */
  2566. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2567. private _updateSquareProps;
  2568. private _drawGradientSquare;
  2569. private _drawCircle;
  2570. private _createColorWheelCanvas;
  2571. /** @hidden */
  2572. _draw(context: CanvasRenderingContext2D): void;
  2573. private _pointerIsDown;
  2574. private _updateValueFromPointer;
  2575. private _isPointOnSquare;
  2576. private _isPointOnWheel;
  2577. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, pi: PointerInfoBase): boolean;
  2578. _onPointerMove(target: Control, coordinates: Vector2, pointerId: number, pi: PointerInfoBase): void;
  2579. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi: PointerInfoBase): void;
  2580. _onCanvasBlur(): void;
  2581. /**
  2582. * This function expands the color picker by creating a color picker dialog with manual
  2583. * color value input and the ability to save colors into an array to be used later in
  2584. * subsequent launches of the dialogue.
  2585. * @param advancedTexture defines the AdvancedDynamicTexture the dialog is assigned to
  2586. * @param options defines size for dialog and options for saved colors. Also accepts last color picked as hex string and saved colors array as hex strings.
  2587. * @returns picked color as a hex string and the saved colors array as hex strings.
  2588. */
  2589. static ShowPickerDialogAsync(advancedTexture: AdvancedDynamicTexture, options: {
  2590. pickerWidth?: string;
  2591. pickerHeight?: string;
  2592. headerHeight?: string;
  2593. lastColor?: string;
  2594. swatchLimit?: number;
  2595. numSwatchesPerLine?: number;
  2596. savedColors?: Array<string>;
  2597. }): Promise<{
  2598. savedColors?: string[];
  2599. pickedColor: string;
  2600. }>;
  2601. }
  2602. }
  2603. declare module "babylonjs-gui/2D/controls/ellipse" {
  2604. import { Container } from "babylonjs-gui/2D/controls/container";
  2605. import { Measure } from "babylonjs-gui/2D/measure";
  2606. /** Class used to create 2D ellipse containers */
  2607. export class Ellipse extends Container {
  2608. name?: string | undefined;
  2609. private _thickness;
  2610. /** Gets or sets border thickness */
  2611. get thickness(): number;
  2612. set thickness(value: number);
  2613. /**
  2614. * Creates a new Ellipse
  2615. * @param name defines the control name
  2616. */
  2617. constructor(name?: string | undefined);
  2618. protected _getTypeName(): string;
  2619. protected _localDraw(context: CanvasRenderingContext2D): void;
  2620. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2621. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  2622. }
  2623. }
  2624. declare module "babylonjs-gui/2D/controls/focusableButton" {
  2625. import { Nullable } from "babylonjs/types";
  2626. import { Vector2 } from "babylonjs/Maths/math.vector";
  2627. import { Button } from "babylonjs-gui/2D/controls/button";
  2628. import { Control } from "babylonjs-gui/2D/controls/control";
  2629. import { PointerInfoBase } from 'babylonjs/Events/pointerEvents';
  2630. import { IFocusableControl } from "babylonjs-gui/2D/controls/focusableControl";
  2631. import { Observable } from 'babylonjs/Misc/observable';
  2632. import { IKeyboardEvent } from "babylonjs/Events/deviceInputEvents";
  2633. /**
  2634. * Class used to create a focusable button that can easily handle keyboard events
  2635. */
  2636. export class FocusableButton extends Button implements IFocusableControl {
  2637. name?: string | undefined;
  2638. /** Highlight color when button is focused */
  2639. focusedColor: Nullable<string>;
  2640. private _isFocused;
  2641. private _unfocusedColor;
  2642. /** Observable raised when the control gets the focus */
  2643. onFocusObservable: Observable<Button>;
  2644. /** Observable raised when the control loses the focus */
  2645. onBlurObservable: Observable<Button>;
  2646. /** Observable raised when a key event was processed */
  2647. onKeyboardEventProcessedObservable: Observable<IKeyboardEvent>;
  2648. constructor(name?: string | undefined);
  2649. /** @hidden */
  2650. onBlur(): void;
  2651. /** @hidden */
  2652. onFocus(): void;
  2653. /**
  2654. * Function called to get the list of controls that should not steal the focus from this control
  2655. * @returns an array of controls
  2656. */
  2657. keepsFocusWith(): Nullable<Control[]>;
  2658. /**
  2659. * Function to focus a button programmatically
  2660. */
  2661. focus(): void;
  2662. /**
  2663. * Function to unfocus a button programmatically
  2664. */
  2665. blur(): void;
  2666. /**
  2667. * Handles the keyboard event
  2668. * @param evt Defines the KeyboardEvent
  2669. */
  2670. processKeyboard(evt: IKeyboardEvent): void;
  2671. /** @hidden */
  2672. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, pi: PointerInfoBase): boolean;
  2673. /** @hidden */
  2674. displose(): void;
  2675. }
  2676. }
  2677. declare module "babylonjs-gui/2D/controls/inputPassword" {
  2678. import { InputText } from "babylonjs-gui/2D/controls/inputText";
  2679. import { TextWrapper } from "babylonjs-gui/2D/controls/textWrapper";
  2680. /**
  2681. * Class used to create a password control
  2682. */
  2683. export class InputPassword extends InputText {
  2684. protected _beforeRenderText(textWrapper: TextWrapper): TextWrapper;
  2685. }
  2686. }
  2687. declare module "babylonjs-gui/2D/controls/line" {
  2688. import { Vector3 } from "babylonjs/Maths/math.vector";
  2689. import { Scene } from "babylonjs/scene";
  2690. import { Control } from "babylonjs-gui/2D/controls/control";
  2691. import { Measure } from "babylonjs-gui/2D/measure";
  2692. /** Class used to render 2D lines */
  2693. export class Line extends Control {
  2694. name?: string | undefined;
  2695. private _lineWidth;
  2696. private _x1;
  2697. private _y1;
  2698. private _x2;
  2699. private _y2;
  2700. private _dash;
  2701. private _connectedControl;
  2702. private _connectedControlDirtyObserver;
  2703. /** Gets or sets the dash pattern */
  2704. get dash(): Array<number>;
  2705. set dash(value: Array<number>);
  2706. /** Gets or sets the control connected with the line end */
  2707. get connectedControl(): Control;
  2708. set connectedControl(value: Control);
  2709. /** Gets or sets start coordinates on X axis */
  2710. get x1(): string | number;
  2711. set x1(value: string | number);
  2712. /** Gets or sets start coordinates on Y axis */
  2713. get y1(): string | number;
  2714. set y1(value: string | number);
  2715. /** Gets or sets end coordinates on X axis */
  2716. get x2(): string | number;
  2717. set x2(value: string | number);
  2718. /** Gets or sets end coordinates on Y axis */
  2719. get y2(): string | number;
  2720. set y2(value: string | number);
  2721. /** Gets or sets line width */
  2722. get lineWidth(): number;
  2723. set lineWidth(value: number);
  2724. /** Gets or sets horizontal alignment */
  2725. set horizontalAlignment(value: number);
  2726. /** Gets or sets vertical alignment */
  2727. set verticalAlignment(value: number);
  2728. private get _effectiveX2();
  2729. private get _effectiveY2();
  2730. /**
  2731. * Creates a new Line
  2732. * @param name defines the control name
  2733. */
  2734. constructor(name?: string | undefined);
  2735. protected _getTypeName(): string;
  2736. _draw(context: CanvasRenderingContext2D): void;
  2737. _measure(): void;
  2738. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2739. /**
  2740. * Move one end of the line given 3D cartesian coordinates.
  2741. * @param position Targeted world position
  2742. * @param scene Scene
  2743. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  2744. */
  2745. moveToVector3(position: Vector3, scene: Scene, end?: boolean): void;
  2746. /**
  2747. * Move one end of the line to a position in screen absolute space.
  2748. * @param projectedPosition Position in screen absolute space (X, Y)
  2749. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  2750. */
  2751. _moveToProjectedPosition(projectedPosition: Vector3, end?: boolean): void;
  2752. }
  2753. }
  2754. declare module "babylonjs-gui/2D/multiLinePoint" {
  2755. import { Nullable } from "babylonjs/types";
  2756. import { Vector3 } from "babylonjs/Maths/math.vector";
  2757. import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
  2758. import { MultiLine } from "babylonjs-gui/2D/controls/multiLine";
  2759. import { Control } from "babylonjs-gui/2D/controls/control";
  2760. /**
  2761. * Class used to store a point for a MultiLine object.
  2762. * The point can be pure 2D coordinates, a mesh or a control
  2763. */
  2764. export class MultiLinePoint {
  2765. private _multiLine;
  2766. private _x;
  2767. private _y;
  2768. private _control;
  2769. private _mesh;
  2770. private _controlObserver;
  2771. private _meshObserver;
  2772. /** @hidden */
  2773. _point: Vector3;
  2774. /**
  2775. * Creates a new MultiLinePoint
  2776. * @param multiLine defines the source MultiLine object
  2777. */
  2778. constructor(multiLine: MultiLine);
  2779. /** Gets or sets x coordinate */
  2780. get x(): string | number;
  2781. set x(value: string | number);
  2782. /** Gets or sets y coordinate */
  2783. get y(): string | number;
  2784. set y(value: string | number);
  2785. /** Gets or sets the control associated with this point */
  2786. get control(): Nullable<Control>;
  2787. set control(value: Nullable<Control>);
  2788. /** Gets or sets the mesh associated with this point */
  2789. get mesh(): Nullable<AbstractMesh>;
  2790. set mesh(value: Nullable<AbstractMesh>);
  2791. /** Resets links */
  2792. resetLinks(): void;
  2793. /**
  2794. * Gets a translation vector with Z component
  2795. * @returns the translation vector
  2796. */
  2797. translate(): Vector3;
  2798. private _translatePoint;
  2799. /** Release associated resources */
  2800. dispose(): void;
  2801. }
  2802. }
  2803. declare module "babylonjs-gui/2D/controls/multiLine" {
  2804. import { Nullable } from "babylonjs/types";
  2805. import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
  2806. import { Control } from "babylonjs-gui/2D/controls/control";
  2807. import { MultiLinePoint } from "babylonjs-gui/2D/multiLinePoint";
  2808. import { Measure } from "babylonjs-gui/2D/measure";
  2809. /**
  2810. * Class used to create multi line control
  2811. */
  2812. export class MultiLine extends Control {
  2813. name?: string | undefined;
  2814. private _lineWidth;
  2815. private _dash;
  2816. private _points;
  2817. private _minX;
  2818. private _minY;
  2819. private _maxX;
  2820. private _maxY;
  2821. /**
  2822. * Creates a new MultiLine
  2823. * @param name defines the control name
  2824. */
  2825. constructor(name?: string | undefined);
  2826. /** Gets or sets dash pattern */
  2827. get dash(): Array<number>;
  2828. set dash(value: Array<number>);
  2829. /**
  2830. * Gets point stored at specified index
  2831. * @param index defines the index to look for
  2832. * @returns the requested point if found
  2833. */
  2834. getAt(index: number): MultiLinePoint;
  2835. /** Function called when a point is updated */
  2836. onPointUpdate: () => void;
  2837. /**
  2838. * Adds new points to the point collection
  2839. * @param items defines the list of items (mesh, control or 2d coordiantes) to add
  2840. * @returns the list of created MultiLinePoint
  2841. */
  2842. add(...items: (AbstractMesh | Control | {
  2843. x: string | number;
  2844. y: string | number;
  2845. })[]): MultiLinePoint[];
  2846. /**
  2847. * Adds a new point to the point collection
  2848. * @param item defines the item (mesh, control or 2d coordiantes) to add
  2849. * @returns the created MultiLinePoint
  2850. */
  2851. push(item?: (AbstractMesh | Control | {
  2852. x: string | number;
  2853. y: string | number;
  2854. })): MultiLinePoint;
  2855. /**
  2856. * Remove a specific value or point from the active point collection
  2857. * @param value defines the value or point to remove
  2858. */
  2859. remove(value: number | MultiLinePoint): void;
  2860. /**
  2861. * Resets this object to initial state (no point)
  2862. */
  2863. reset(): void;
  2864. /**
  2865. * Resets all links
  2866. */
  2867. resetLinks(): void;
  2868. /** Gets or sets line width */
  2869. get lineWidth(): number;
  2870. set lineWidth(value: number);
  2871. set horizontalAlignment(value: number);
  2872. set verticalAlignment(value: number);
  2873. protected _getTypeName(): string;
  2874. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Nullable<Measure>): void;
  2875. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2876. _measure(): void;
  2877. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2878. dispose(): void;
  2879. }
  2880. }
  2881. declare module "babylonjs-gui/2D/controls/radioButton" {
  2882. import { Observable } from "babylonjs/Misc/observable";
  2883. import { Vector2 } from "babylonjs/Maths/math.vector";
  2884. import { Control } from "babylonjs-gui/2D/controls/control";
  2885. import { StackPanel } from "babylonjs-gui/2D/controls/stackPanel";
  2886. import { PointerInfoBase } from 'babylonjs/Events/pointerEvents';
  2887. /**
  2888. * Class used to create radio button controls
  2889. */
  2890. export class RadioButton extends Control {
  2891. name?: string | undefined;
  2892. private _isChecked;
  2893. private _background;
  2894. private _checkSizeRatio;
  2895. private _thickness;
  2896. /** Gets or sets border thickness */
  2897. get thickness(): number;
  2898. set thickness(value: number);
  2899. /** Gets or sets group name */
  2900. group: string;
  2901. /** Observable raised when isChecked is changed */
  2902. onIsCheckedChangedObservable: Observable<boolean>;
  2903. /** Gets or sets a value indicating the ratio between overall size and check size */
  2904. get checkSizeRatio(): number;
  2905. set checkSizeRatio(value: number);
  2906. /** Gets or sets background color */
  2907. get background(): string;
  2908. set background(value: string);
  2909. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  2910. get isChecked(): boolean;
  2911. set isChecked(value: boolean);
  2912. /**
  2913. * Creates a new RadioButton
  2914. * @param name defines the control name
  2915. */
  2916. constructor(name?: string | undefined);
  2917. protected _getTypeName(): string;
  2918. _draw(context: CanvasRenderingContext2D): void;
  2919. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, pi: PointerInfoBase): boolean;
  2920. /**
  2921. * Utility function to easily create a radio button with a header
  2922. * @param title defines the label to use for the header
  2923. * @param group defines the group to use for the radio button
  2924. * @param isChecked defines the initial state of the radio button
  2925. * @param onValueChanged defines the callback to call when value changes
  2926. * @returns a StackPanel containing the radio button and a textBlock
  2927. */
  2928. static AddRadioButtonWithHeader(title: string, group: string, isChecked: boolean, onValueChanged: (button: RadioButton, value: boolean) => void): StackPanel;
  2929. }
  2930. }
  2931. declare module "babylonjs-gui/2D/controls/sliders/baseSlider" {
  2932. import { Observable } from "babylonjs/Misc/observable";
  2933. import { Vector2 } from "babylonjs/Maths/math.vector";
  2934. import { Control } from "babylonjs-gui/2D/controls/control";
  2935. import { ValueAndUnit } from "babylonjs-gui/2D/valueAndUnit";
  2936. import { PointerInfoBase } from 'babylonjs/Events/pointerEvents';
  2937. /**
  2938. * Class used to create slider controls
  2939. */
  2940. export class BaseSlider extends Control {
  2941. name?: string | undefined;
  2942. protected _thumbWidth: ValueAndUnit;
  2943. private _minimum;
  2944. private _maximum;
  2945. private _value;
  2946. private _isVertical;
  2947. protected _barOffset: ValueAndUnit;
  2948. private _isThumbClamped;
  2949. protected _displayThumb: boolean;
  2950. private _step;
  2951. private _lastPointerDownID;
  2952. protected _effectiveBarOffset: number;
  2953. protected _renderLeft: number;
  2954. protected _renderTop: number;
  2955. protected _renderWidth: number;
  2956. protected _renderHeight: number;
  2957. protected _backgroundBoxLength: number;
  2958. protected _backgroundBoxThickness: number;
  2959. protected _effectiveThumbThickness: number;
  2960. /** Observable raised when the sldier value changes */
  2961. onValueChangedObservable: Observable<number>;
  2962. /** Gets or sets a boolean indicating if the thumb must be rendered */
  2963. get displayThumb(): boolean;
  2964. set displayThumb(value: boolean);
  2965. /** Gets or sets a step to apply to values (0 by default) */
  2966. get step(): number;
  2967. set step(value: number);
  2968. /** Gets or sets main bar offset (ie. the margin applied to the value bar) */
  2969. get barOffset(): string | number;
  2970. /** Gets main bar offset in pixels*/
  2971. get barOffsetInPixels(): number;
  2972. set barOffset(value: string | number);
  2973. /** Gets or sets thumb width */
  2974. get thumbWidth(): string | number;
  2975. /** Gets thumb width in pixels */
  2976. get thumbWidthInPixels(): number;
  2977. set thumbWidth(value: string | number);
  2978. /** Gets or sets minimum value */
  2979. get minimum(): number;
  2980. set minimum(value: number);
  2981. /** Gets or sets maximum value */
  2982. get maximum(): number;
  2983. set maximum(value: number);
  2984. /** Gets or sets current value */
  2985. get value(): number;
  2986. set value(value: number);
  2987. /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */
  2988. get isVertical(): boolean;
  2989. set isVertical(value: boolean);
  2990. /** Gets or sets a value indicating if the thumb can go over main bar extends */
  2991. get isThumbClamped(): boolean;
  2992. set isThumbClamped(value: boolean);
  2993. /**
  2994. * Creates a new BaseSlider
  2995. * @param name defines the control name
  2996. */
  2997. constructor(name?: string | undefined);
  2998. protected _getTypeName(): string;
  2999. protected _getThumbPosition(): number;
  3000. protected _getThumbThickness(type: string): number;
  3001. protected _prepareRenderingData(type: string): void;
  3002. private _pointerIsDown;
  3003. /** @hidden */
  3004. protected _updateValueFromPointer(x: number, y: number): void;
  3005. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, pi: PointerInfoBase): boolean;
  3006. _onPointerMove(target: Control, coordinates: Vector2, pointerId: number, pi: PointerInfoBase): void;
  3007. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  3008. _onCanvasBlur(): void;
  3009. }
  3010. }
  3011. declare module "babylonjs-gui/2D/controls/sliders/slider" {
  3012. import { BaseSlider } from "babylonjs-gui/2D/controls/sliders/baseSlider";
  3013. import { Nullable } from 'babylonjs/types';
  3014. import { Measure } from "babylonjs-gui/2D/measure";
  3015. /**
  3016. * Class used to create slider controls
  3017. */
  3018. export class Slider extends BaseSlider {
  3019. name?: string | undefined;
  3020. private _background;
  3021. private _borderColor;
  3022. private _thumbColor;
  3023. private _isThumbCircle;
  3024. protected _displayValueBar: boolean;
  3025. /** Gets or sets a boolean indicating if the value bar must be rendered */
  3026. get displayValueBar(): boolean;
  3027. set displayValueBar(value: boolean);
  3028. /** Gets or sets border color */
  3029. get borderColor(): string;
  3030. set borderColor(value: string);
  3031. /** Gets or sets background color */
  3032. get background(): string;
  3033. set background(value: string);
  3034. /** Gets or sets thumb's color */
  3035. get thumbColor(): string;
  3036. set thumbColor(value: string);
  3037. /** Gets or sets a boolean indicating if the thumb should be round or square */
  3038. get isThumbCircle(): boolean;
  3039. set isThumbCircle(value: boolean);
  3040. /**
  3041. * Creates a new Slider
  3042. * @param name defines the control name
  3043. */
  3044. constructor(name?: string | undefined);
  3045. protected _getTypeName(): string;
  3046. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Nullable<Measure>): void;
  3047. }
  3048. }
  3049. declare module "babylonjs-gui/2D/controls/selector" {
  3050. import { Rectangle } from "babylonjs-gui/2D/controls/rectangle";
  3051. import { StackPanel } from "babylonjs-gui/2D/controls/stackPanel";
  3052. /** Class used to create a RadioGroup
  3053. * which contains groups of radio buttons
  3054. */
  3055. export class SelectorGroup {
  3056. /** name of SelectorGroup */
  3057. name: string;
  3058. private _groupPanel;
  3059. private _selectors;
  3060. private _groupHeader;
  3061. /**
  3062. * Creates a new SelectorGroup
  3063. * @param name of group, used as a group heading
  3064. */
  3065. constructor(
  3066. /** name of SelectorGroup */
  3067. name: string);
  3068. /** Gets the groupPanel of the SelectorGroup */
  3069. get groupPanel(): StackPanel;
  3070. /** Gets the selectors array */
  3071. get selectors(): StackPanel[];
  3072. /** Gets and sets the group header */
  3073. get header(): string;
  3074. set header(label: string);
  3075. /** @hidden */
  3076. private _addGroupHeader;
  3077. /** @hidden*/
  3078. _getSelector(selectorNb: number): StackPanel | undefined;
  3079. /** Removes the selector at the given position
  3080. * @param selectorNb the position of the selector within the group
  3081. */
  3082. removeSelector(selectorNb: number): void;
  3083. }
  3084. /** Class used to create a CheckboxGroup
  3085. * which contains groups of checkbox buttons
  3086. */
  3087. export class CheckboxGroup extends SelectorGroup {
  3088. /** Adds a checkbox as a control
  3089. * @param text is the label for the selector
  3090. * @param func is the function called when the Selector is checked
  3091. * @param checked is true when Selector is checked
  3092. */
  3093. addCheckbox(text: string, func?: (s: boolean) => void, checked?: boolean): void;
  3094. /** @hidden */
  3095. _setSelectorLabel(selectorNb: number, label: string): void;
  3096. /** @hidden */
  3097. _setSelectorLabelColor(selectorNb: number, color: string): void;
  3098. /** @hidden */
  3099. _setSelectorButtonColor(selectorNb: number, color: string): void;
  3100. /** @hidden */
  3101. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  3102. }
  3103. /** Class used to create a RadioGroup
  3104. * which contains groups of radio buttons
  3105. */
  3106. export class RadioGroup extends SelectorGroup {
  3107. private _selectNb;
  3108. /** Adds a radio button as a control
  3109. * @param label is the label for the selector
  3110. * @param func is the function called when the Selector is checked
  3111. * @param checked is true when Selector is checked
  3112. */
  3113. addRadio(label: string, func?: (n: number) => void, checked?: boolean): void;
  3114. /** @hidden */
  3115. _setSelectorLabel(selectorNb: number, label: string): void;
  3116. /** @hidden */
  3117. _setSelectorLabelColor(selectorNb: number, color: string): void;
  3118. /** @hidden */
  3119. _setSelectorButtonColor(selectorNb: number, color: string): void;
  3120. /** @hidden */
  3121. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  3122. }
  3123. /** Class used to create a SliderGroup
  3124. * which contains groups of slider buttons
  3125. */
  3126. export class SliderGroup extends SelectorGroup {
  3127. /**
  3128. * Adds a slider to the SelectorGroup
  3129. * @param label is the label for the SliderBar
  3130. * @param func is the function called when the Slider moves
  3131. * @param unit is a string describing the units used, eg degrees or metres
  3132. * @param min is the minimum value for the Slider
  3133. * @param max is the maximum value for the Slider
  3134. * @param value is the start value for the Slider between min and max
  3135. * @param onValueChange is the function used to format the value displayed, eg radians to degrees
  3136. */
  3137. addSlider(label: string, func?: (v: number) => void, unit?: string, min?: number, max?: number, value?: number, onValueChange?: (v: number) => number): void;
  3138. /** @hidden */
  3139. _setSelectorLabel(selectorNb: number, label: string): void;
  3140. /** @hidden */
  3141. _setSelectorLabelColor(selectorNb: number, color: string): void;
  3142. /** @hidden */
  3143. _setSelectorButtonColor(selectorNb: number, color: string): void;
  3144. /** @hidden */
  3145. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  3146. }
  3147. /** Class used to hold the controls for the checkboxes, radio buttons and sliders
  3148. * @see https://doc.babylonjs.com/how_to/selector
  3149. */
  3150. export class SelectionPanel extends Rectangle {
  3151. /** name of SelectionPanel */
  3152. name: string;
  3153. /** an array of SelectionGroups */
  3154. groups: SelectorGroup[];
  3155. private _panel;
  3156. private _buttonColor;
  3157. private _buttonBackground;
  3158. private _headerColor;
  3159. private _barColor;
  3160. private _barHeight;
  3161. private _spacerHeight;
  3162. private _labelColor;
  3163. private _groups;
  3164. private _bars;
  3165. /**
  3166. * Creates a new SelectionPanel
  3167. * @param name of SelectionPanel
  3168. * @param groups is an array of SelectionGroups
  3169. */
  3170. constructor(
  3171. /** name of SelectionPanel */
  3172. name: string,
  3173. /** an array of SelectionGroups */
  3174. groups?: SelectorGroup[]);
  3175. protected _getTypeName(): string;
  3176. /** Gets the (stack) panel of the SelectionPanel */
  3177. get panel(): StackPanel;
  3178. /** Gets or sets the headerColor */
  3179. get headerColor(): string;
  3180. set headerColor(color: string);
  3181. private _setHeaderColor;
  3182. /** Gets or sets the button color */
  3183. get buttonColor(): string;
  3184. set buttonColor(color: string);
  3185. private _setbuttonColor;
  3186. /** Gets or sets the label color */
  3187. get labelColor(): string;
  3188. set labelColor(color: string);
  3189. private _setLabelColor;
  3190. /** Gets or sets the button background */
  3191. get buttonBackground(): string;
  3192. set buttonBackground(color: string);
  3193. private _setButtonBackground;
  3194. /** Gets or sets the color of separator bar */
  3195. get barColor(): string;
  3196. set barColor(color: string);
  3197. private _setBarColor;
  3198. /** Gets or sets the height of separator bar */
  3199. get barHeight(): string;
  3200. set barHeight(value: string);
  3201. private _setBarHeight;
  3202. /** Gets or sets the height of spacers*/
  3203. get spacerHeight(): string;
  3204. set spacerHeight(value: string);
  3205. private _setSpacerHeight;
  3206. /** Adds a bar between groups */
  3207. private _addSpacer;
  3208. /** Add a group to the selection panel
  3209. * @param group is the selector group to add
  3210. */
  3211. addGroup(group: SelectorGroup): void;
  3212. /** Remove the group from the given position
  3213. * @param groupNb is the position of the group in the list
  3214. */
  3215. removeGroup(groupNb: number): void;
  3216. /** Change a group header label
  3217. * @param label is the new group header label
  3218. * @param groupNb is the number of the group to relabel
  3219. * */
  3220. setHeaderName(label: string, groupNb: number): void;
  3221. /** Change selector label to the one given
  3222. * @param label is the new selector label
  3223. * @param groupNb is the number of the groupcontaining the selector
  3224. * @param selectorNb is the number of the selector within a group to relabel
  3225. * */
  3226. relabel(label: string, groupNb: number, selectorNb: number): void;
  3227. /** For a given group position remove the selector at the given position
  3228. * @param groupNb is the number of the group to remove the selector from
  3229. * @param selectorNb is the number of the selector within the group
  3230. */
  3231. removeFromGroupSelector(groupNb: number, selectorNb: number): void;
  3232. /** For a given group position of correct type add a checkbox button
  3233. * @param groupNb is the number of the group to remove the selector from
  3234. * @param label is the label for the selector
  3235. * @param func is the function called when the Selector is checked
  3236. * @param checked is true when Selector is checked
  3237. */
  3238. addToGroupCheckbox(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  3239. /** For a given group position of correct type add a radio button
  3240. * @param groupNb is the number of the group to remove the selector from
  3241. * @param label is the label for the selector
  3242. * @param func is the function called when the Selector is checked
  3243. * @param checked is true when Selector is checked
  3244. */
  3245. addToGroupRadio(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  3246. /**
  3247. * For a given slider group add a slider
  3248. * @param groupNb is the number of the group to add the slider to
  3249. * @param label is the label for the Slider
  3250. * @param func is the function called when the Slider moves
  3251. * @param unit is a string describing the units used, eg degrees or metres
  3252. * @param min is the minimum value for the Slider
  3253. * @param max is the maximum value for the Slider
  3254. * @param value is the start value for the Slider between min and max
  3255. * @param onVal is the function used to format the value displayed, eg radians to degrees
  3256. */
  3257. addToGroupSlider(groupNb: number, label: string, func?: () => void, unit?: string, min?: number, max?: number, value?: number, onVal?: (v: number) => number): void;
  3258. }
  3259. }
  3260. declare module "babylonjs-gui/2D/controls/scrollViewers/scrollViewerWindow" {
  3261. import { Measure } from "babylonjs-gui/2D/measure";
  3262. import { Container } from "babylonjs-gui/2D/controls/container";
  3263. /**
  3264. * Class used to hold a the container for ScrollViewer
  3265. * @hidden
  3266. */
  3267. export class _ScrollViewerWindow extends Container {
  3268. parentClientWidth: number;
  3269. parentClientHeight: number;
  3270. private _freezeControls;
  3271. private _parentMeasure;
  3272. private _oldLeft;
  3273. private _oldTop;
  3274. get freezeControls(): boolean;
  3275. set freezeControls(value: boolean);
  3276. private _bucketWidth;
  3277. private _bucketHeight;
  3278. private _buckets;
  3279. private _bucketLen;
  3280. get bucketWidth(): number;
  3281. get bucketHeight(): number;
  3282. setBucketSizes(width: number, height: number): void;
  3283. private _useBuckets;
  3284. private _makeBuckets;
  3285. private _dispatchInBuckets;
  3286. private _updateMeasures;
  3287. private _updateChildrenMeasures;
  3288. private _restoreMeasures;
  3289. /**
  3290. * Creates a new ScrollViewerWindow
  3291. * @param name of ScrollViewerWindow
  3292. */
  3293. constructor(name?: string);
  3294. protected _getTypeName(): string;
  3295. /** @hidden */
  3296. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3297. /** @hidden */
  3298. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  3299. private _scrollChildren;
  3300. private _scrollChildrenWithBuckets;
  3301. /** @hidden */
  3302. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Measure): void;
  3303. protected _postMeasure(): void;
  3304. }
  3305. }
  3306. declare module "babylonjs-gui/2D/controls/sliders/scrollBar" {
  3307. import { Vector2 } from "babylonjs/Maths/math.vector";
  3308. import { BaseSlider } from "babylonjs-gui/2D/controls/sliders/baseSlider";
  3309. import { Control } from "babylonjs-gui/2D/controls/control";
  3310. import { PointerInfoBase } from 'babylonjs/Events/pointerEvents';
  3311. /**
  3312. * Class used to create slider controls
  3313. */
  3314. export class ScrollBar extends BaseSlider {
  3315. name?: string | undefined;
  3316. private _background;
  3317. private _borderColor;
  3318. private _tempMeasure;
  3319. /** Gets or sets border color */
  3320. get borderColor(): string;
  3321. set borderColor(value: string);
  3322. /** Gets or sets background color */
  3323. get background(): string;
  3324. set background(value: string);
  3325. /**
  3326. * Creates a new Slider
  3327. * @param name defines the control name
  3328. */
  3329. constructor(name?: string | undefined);
  3330. protected _getTypeName(): string;
  3331. protected _getThumbThickness(): number;
  3332. _draw(context: CanvasRenderingContext2D): void;
  3333. private _first;
  3334. private _originX;
  3335. private _originY;
  3336. /** @hidden */
  3337. protected _updateValueFromPointer(x: number, y: number): void;
  3338. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, pi: PointerInfoBase): boolean;
  3339. }
  3340. }
  3341. declare module "babylonjs-gui/2D/controls/sliders/imageScrollBar" {
  3342. import { Vector2 } from "babylonjs/Maths/math.vector";
  3343. import { BaseSlider } from "babylonjs-gui/2D/controls/sliders/baseSlider";
  3344. import { Control } from "babylonjs-gui/2D/controls/control";
  3345. import { Image } from "babylonjs-gui/2D/controls/image";
  3346. import { PointerInfoBase } from 'babylonjs/Events/pointerEvents';
  3347. /**
  3348. * Class used to create slider controls
  3349. */
  3350. export class ImageScrollBar extends BaseSlider {
  3351. name?: string | undefined;
  3352. private _backgroundBaseImage;
  3353. private _backgroundImage;
  3354. private _thumbImage;
  3355. private _thumbBaseImage;
  3356. private _thumbLength;
  3357. private _thumbHeight;
  3358. private _barImageHeight;
  3359. private _tempMeasure;
  3360. /** Number of 90° rotation to apply on the images when in vertical mode */
  3361. num90RotationInVerticalMode: number;
  3362. /**
  3363. * Gets or sets the image used to render the background for horizontal bar
  3364. */
  3365. get backgroundImage(): Image;
  3366. set backgroundImage(value: Image);
  3367. /**
  3368. * Gets or sets the image used to render the thumb
  3369. */
  3370. get thumbImage(): Image;
  3371. set thumbImage(value: Image);
  3372. /**
  3373. * Gets or sets the length of the thumb
  3374. */
  3375. get thumbLength(): number;
  3376. set thumbLength(value: number);
  3377. /**
  3378. * Gets or sets the height of the thumb
  3379. */
  3380. get thumbHeight(): number;
  3381. set thumbHeight(value: number);
  3382. /**
  3383. * Gets or sets the height of the bar image
  3384. */
  3385. get barImageHeight(): number;
  3386. set barImageHeight(value: number);
  3387. /**
  3388. * Creates a new ImageScrollBar
  3389. * @param name defines the control name
  3390. */
  3391. constructor(name?: string | undefined);
  3392. protected _getTypeName(): string;
  3393. protected _getThumbThickness(): number;
  3394. _draw(context: CanvasRenderingContext2D): void;
  3395. private _first;
  3396. private _originX;
  3397. private _originY;
  3398. /** @hidden */
  3399. protected _updateValueFromPointer(x: number, y: number): void;
  3400. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, pi: PointerInfoBase): boolean;
  3401. }
  3402. }
  3403. declare module "babylonjs-gui/2D/controls/scrollViewers/scrollViewer" {
  3404. import { Nullable } from "babylonjs/types";
  3405. import { Rectangle } from "babylonjs-gui/2D/controls/rectangle";
  3406. import { Image } from "babylonjs-gui/2D/controls/image";
  3407. import { Control } from "babylonjs-gui/2D/controls/control";
  3408. import { Container } from "babylonjs-gui/2D/controls/container";
  3409. import { Measure } from "babylonjs-gui/2D/measure";
  3410. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  3411. import { ScrollBar } from "babylonjs-gui/2D/controls/sliders/scrollBar";
  3412. import { ImageScrollBar } from "babylonjs-gui/2D/controls/sliders/imageScrollBar";
  3413. /**
  3414. * Class used to hold a viewer window and sliders in a grid
  3415. */
  3416. export class ScrollViewer extends Rectangle {
  3417. private _grid;
  3418. private _horizontalBarSpace;
  3419. private _verticalBarSpace;
  3420. private _dragSpace;
  3421. private _horizontalBar;
  3422. private _verticalBar;
  3423. private _barColor;
  3424. private _barBackground;
  3425. private _barImage;
  3426. private _horizontalBarImage;
  3427. private _verticalBarImage;
  3428. private _barBackgroundImage;
  3429. private _horizontalBarBackgroundImage;
  3430. private _verticalBarBackgroundImage;
  3431. private _barSize;
  3432. private _window;
  3433. private _pointerIsOver;
  3434. private _wheelPrecision;
  3435. private _onWheelObserver;
  3436. private _clientWidth;
  3437. private _clientHeight;
  3438. private _useImageBar;
  3439. private _thumbLength;
  3440. private _thumbHeight;
  3441. private _barImageHeight;
  3442. private _horizontalBarImageHeight;
  3443. private _verticalBarImageHeight;
  3444. private _oldWindowContentsWidth;
  3445. private _oldWindowContentsHeight;
  3446. /**
  3447. * Gets the horizontal scrollbar
  3448. */
  3449. get horizontalBar(): ScrollBar | ImageScrollBar;
  3450. /**
  3451. * Gets the vertical scrollbar
  3452. */
  3453. get verticalBar(): ScrollBar | ImageScrollBar;
  3454. /**
  3455. * Adds a new control to the current container
  3456. * @param control defines the control to add
  3457. * @returns the current container
  3458. */
  3459. addControl(control: Nullable<Control>): Container;
  3460. /**
  3461. * Removes a control from the current container
  3462. * @param control defines the control to remove
  3463. * @returns the current container
  3464. */
  3465. removeControl(control: Control): Container;
  3466. /** Gets the list of children */
  3467. get children(): Control[];
  3468. _flagDescendantsAsMatrixDirty(): void;
  3469. /**
  3470. * Freezes or unfreezes the controls in the window.
  3471. * When controls are frozen, the scroll viewer can render a lot more quickly but updates to positions/sizes of controls
  3472. * are not taken into account. If you want to change positions/sizes, unfreeze, perform the changes then freeze again
  3473. */
  3474. get freezeControls(): boolean;
  3475. set freezeControls(value: boolean);
  3476. /** Gets the bucket width */
  3477. get bucketWidth(): number;
  3478. /** Gets the bucket height */
  3479. get bucketHeight(): number;
  3480. /**
  3481. * Sets the bucket sizes.
  3482. * When freezeControls is true, setting a non-zero bucket size will improve performances by updating only
  3483. * controls that are visible. The bucket sizes is used to subdivide (internally) the window area to smaller areas into which
  3484. * controls are dispatched. So, the size should be roughly equals to the mean size of all the controls of
  3485. * the window. To disable the usage of buckets, sets either width or height (or both) to 0.
  3486. * Please note that using this option will raise the memory usage (the higher the bucket sizes, the less memory
  3487. * used), that's why it is not enabled by default.
  3488. * @param width width of the bucket
  3489. * @param height height of the bucket
  3490. */
  3491. setBucketSizes(width: number, height: number): void;
  3492. private _forceHorizontalBar;
  3493. private _forceVerticalBar;
  3494. /**
  3495. * Forces the horizontal scroll bar to be displayed
  3496. */
  3497. get forceHorizontalBar(): boolean;
  3498. set forceHorizontalBar(value: boolean);
  3499. /**
  3500. * Forces the vertical scroll bar to be displayed
  3501. */
  3502. get forceVerticalBar(): boolean;
  3503. set forceVerticalBar(value: boolean);
  3504. /**
  3505. * Creates a new ScrollViewer
  3506. * @param name of ScrollViewer
  3507. */
  3508. constructor(name?: string, isImageBased?: boolean);
  3509. /** Reset the scroll viewer window to initial size */
  3510. resetWindow(): void;
  3511. protected _getTypeName(): string;
  3512. private _buildClientSizes;
  3513. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3514. protected _postMeasure(): void;
  3515. /**
  3516. * Gets or sets the mouse wheel precision
  3517. * from 0 to 1 with a default value of 0.05
  3518. * */
  3519. get wheelPrecision(): number;
  3520. set wheelPrecision(value: number);
  3521. /** Gets or sets the scroll bar container background color */
  3522. get scrollBackground(): string;
  3523. set scrollBackground(color: string);
  3524. /** Gets or sets the bar color */
  3525. get barColor(): string;
  3526. set barColor(color: string);
  3527. /** Gets or sets the bar image */
  3528. get thumbImage(): Image;
  3529. set thumbImage(value: Image);
  3530. /** Gets or sets the horizontal bar image */
  3531. get horizontalThumbImage(): Image;
  3532. set horizontalThumbImage(value: Image);
  3533. /** Gets or sets the vertical bar image */
  3534. get verticalThumbImage(): Image;
  3535. set verticalThumbImage(value: Image);
  3536. /** Gets or sets the size of the bar */
  3537. get barSize(): number;
  3538. set barSize(value: number);
  3539. /** Gets or sets the length of the thumb */
  3540. get thumbLength(): number;
  3541. set thumbLength(value: number);
  3542. /** Gets or sets the height of the thumb */
  3543. get thumbHeight(): number;
  3544. set thumbHeight(value: number);
  3545. /** Gets or sets the height of the bar image */
  3546. get barImageHeight(): number;
  3547. set barImageHeight(value: number);
  3548. /** Gets or sets the height of the horizontal bar image */
  3549. get horizontalBarImageHeight(): number;
  3550. set horizontalBarImageHeight(value: number);
  3551. /** Gets or sets the height of the vertical bar image */
  3552. get verticalBarImageHeight(): number;
  3553. set verticalBarImageHeight(value: number);
  3554. /** Gets or sets the bar background */
  3555. get barBackground(): string;
  3556. set barBackground(color: string);
  3557. /** Gets or sets the bar background image */
  3558. get barImage(): Image;
  3559. set barImage(value: Image);
  3560. /** Gets or sets the horizontal bar background image */
  3561. get horizontalBarImage(): Image;
  3562. set horizontalBarImage(value: Image);
  3563. /** Gets or sets the vertical bar background image */
  3564. get verticalBarImage(): Image;
  3565. set verticalBarImage(value: Image);
  3566. private _setWindowPosition;
  3567. /** @hidden */
  3568. private _updateScroller;
  3569. _link(host: AdvancedDynamicTexture): void;
  3570. /** @hidden */
  3571. private _addBar;
  3572. /** @hidden */
  3573. private _attachWheel;
  3574. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  3575. /** Releases associated resources */
  3576. dispose(): void;
  3577. }
  3578. }
  3579. declare module "babylonjs-gui/2D/controls/toggleButton" {
  3580. import { Nullable } from "babylonjs/types";
  3581. import { Observable } from "babylonjs/Misc/observable";
  3582. import { Vector2 } from "babylonjs/Maths/math.vector";
  3583. import { Rectangle } from "babylonjs-gui/2D/controls/rectangle";
  3584. import { Control } from "babylonjs-gui/2D/controls/control";
  3585. import { TextBlock } from "babylonjs-gui/2D/controls/textBlock";
  3586. import { Image } from "babylonjs-gui/2D/controls/image";
  3587. import { PointerInfoBase } from "babylonjs/Events/pointerEvents";
  3588. /**
  3589. * Class used to create toggle buttons
  3590. */
  3591. export class ToggleButton extends Rectangle {
  3592. name?: string | undefined;
  3593. /**
  3594. * Function called to generate the toActive animation
  3595. */
  3596. toActiveAnimation: () => void;
  3597. /**
  3598. * Function called to generate the toInactive animation
  3599. */
  3600. toInactiveAnimation: () => void;
  3601. /**
  3602. * Function called to generate a pointer enter animation when the toggle button is active.
  3603. */
  3604. pointerEnterActiveAnimation: () => void;
  3605. /**
  3606. * Function called to generate a pointer out animation when the toggle button is active.
  3607. */
  3608. pointerOutActiveAnimation: () => void;
  3609. /**
  3610. * Function called to generate a pointer down animation when the toggle button is active.
  3611. */
  3612. pointerDownActiveAnimation: () => void;
  3613. /**
  3614. * Function called to generate a pointer up animation when the toggle button is active.
  3615. */
  3616. pointerUpActiveAnimation: () => void;
  3617. /**
  3618. * Function called to generate a pointer enter animation when the toggle button is inactive.
  3619. */
  3620. pointerEnterInactiveAnimation: () => void;
  3621. /**
  3622. * Function called to generate a pointer out animation when the toggle button is inactive.
  3623. */
  3624. pointerOutInactiveAnimation: () => void;
  3625. /**
  3626. * Function called to generate a pointer down animation when the toggle button is inactive.
  3627. */
  3628. pointerDownInactiveAnimation: () => void;
  3629. /**
  3630. * Function called to generate a pointer up animation when the toggle button is inactive.
  3631. */
  3632. pointerUpInactiveAnimation: () => void;
  3633. /** Observable raised when isActive is changed */
  3634. onIsActiveChangedObservable: Observable<boolean>;
  3635. /**
  3636. * Gets or sets a boolean indicating that the toggle button will let internal controls handle picking instead of doing it directly using its bounding info
  3637. */
  3638. delegatePickingToChildren: boolean;
  3639. private _image;
  3640. /**
  3641. * Returns the ToggleButton's image control if it exists
  3642. */
  3643. get image(): Nullable<Image>;
  3644. private _textBlock;
  3645. /**
  3646. * Returns the ToggleButton's child TextBlock control if it exists
  3647. */
  3648. get textBlock(): Nullable<TextBlock>;
  3649. private _group;
  3650. /** Gets or sets group name this toggle button belongs to */
  3651. get group(): string;
  3652. set group(value: string);
  3653. private _isActive;
  3654. /** Gets or sets a boolean indicating if the toogle button is active or not */
  3655. get isActive(): boolean;
  3656. set isActive(value: boolean);
  3657. /**
  3658. * Creates a new ToggleButton
  3659. * @param name defines the control name
  3660. * @param group defines the toggle group this toggle belongs to
  3661. */
  3662. constructor(name?: string | undefined, group?: string);
  3663. protected _getTypeName(): string;
  3664. /** @hidden */
  3665. _processPicking(x: number, y: number, pi: PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
  3666. /** @hidden */
  3667. _onPointerEnter(target: Control, pi: PointerInfoBase): boolean;
  3668. /** @hidden */
  3669. _onPointerOut(target: Control, pi: PointerInfoBase, force?: boolean): void;
  3670. /** @hidden */
  3671. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, pi: PointerInfoBase): boolean;
  3672. /** @hidden */
  3673. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi: PointerInfoBase): void;
  3674. }
  3675. }
  3676. declare module "babylonjs-gui/2D/controls/displayGrid" {
  3677. import { Control } from "babylonjs-gui/2D/controls/control";
  3678. import { Nullable } from 'babylonjs/types';
  3679. import { Measure } from "babylonjs-gui/2D/measure";
  3680. /** Class used to render a grid */
  3681. export class DisplayGrid extends Control {
  3682. name?: string | undefined;
  3683. private _cellWidth;
  3684. private _cellHeight;
  3685. private _minorLineTickness;
  3686. private _minorLineColor;
  3687. private _majorLineTickness;
  3688. private _majorLineColor;
  3689. private _majorLineFrequency;
  3690. private _background;
  3691. private _displayMajorLines;
  3692. private _displayMinorLines;
  3693. /** Gets or sets a boolean indicating if minor lines must be rendered (true by default)) */
  3694. get displayMinorLines(): boolean;
  3695. set displayMinorLines(value: boolean);
  3696. /** Gets or sets a boolean indicating if major lines must be rendered (true by default)) */
  3697. get displayMajorLines(): boolean;
  3698. set displayMajorLines(value: boolean);
  3699. /** Gets or sets background color (Black by default) */
  3700. get background(): string;
  3701. set background(value: string);
  3702. /** Gets or sets the width of each cell (20 by default) */
  3703. get cellWidth(): number;
  3704. set cellWidth(value: number);
  3705. /** Gets or sets the height of each cell (20 by default) */
  3706. get cellHeight(): number;
  3707. set cellHeight(value: number);
  3708. /** Gets or sets the tickness of minor lines (1 by default) */
  3709. get minorLineTickness(): number;
  3710. set minorLineTickness(value: number);
  3711. /** Gets or sets the color of minor lines (DarkGray by default) */
  3712. get minorLineColor(): string;
  3713. set minorLineColor(value: string);
  3714. /** Gets or sets the tickness of major lines (2 by default) */
  3715. get majorLineTickness(): number;
  3716. set majorLineTickness(value: number);
  3717. /** Gets or sets the color of major lines (White by default) */
  3718. get majorLineColor(): string;
  3719. set majorLineColor(value: string);
  3720. /** Gets or sets the frequency of major lines (default is 1 every 5 minor lines)*/
  3721. get majorLineFrequency(): number;
  3722. set majorLineFrequency(value: number);
  3723. /**
  3724. * Creates a new GridDisplayRectangle
  3725. * @param name defines the control name
  3726. */
  3727. constructor(name?: string | undefined);
  3728. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Nullable<Measure>): void;
  3729. protected _getTypeName(): string;
  3730. }
  3731. }
  3732. declare module "babylonjs-gui/2D/controls/sliders/imageBasedSlider" {
  3733. import { BaseSlider } from "babylonjs-gui/2D/controls/sliders/baseSlider";
  3734. import { Measure } from "babylonjs-gui/2D/measure";
  3735. import { Image } from "babylonjs-gui/2D/controls/image";
  3736. import { Nullable } from 'babylonjs/types';
  3737. /**
  3738. * Class used to create slider controls based on images
  3739. */
  3740. export class ImageBasedSlider extends BaseSlider {
  3741. name?: string | undefined;
  3742. private _backgroundImage;
  3743. private _thumbImage;
  3744. private _valueBarImage;
  3745. private _tempMeasure;
  3746. get displayThumb(): boolean;
  3747. set displayThumb(value: boolean);
  3748. /**
  3749. * Gets or sets the image used to render the background
  3750. */
  3751. get backgroundImage(): Image;
  3752. set backgroundImage(value: Image);
  3753. /**
  3754. * Gets or sets the image used to render the value bar
  3755. */
  3756. get valueBarImage(): Image;
  3757. set valueBarImage(value: Image);
  3758. /**
  3759. * Gets or sets the image used to render the thumb
  3760. */
  3761. get thumbImage(): Image;
  3762. set thumbImage(value: Image);
  3763. /**
  3764. * Creates a new ImageBasedSlider
  3765. * @param name defines the control name
  3766. */
  3767. constructor(name?: string | undefined);
  3768. protected _getTypeName(): string;
  3769. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Nullable<Measure>): void;
  3770. }
  3771. }
  3772. declare module "babylonjs-gui/2D/controls/statics" {
  3773. /**
  3774. * Forcing an export so that this code will execute
  3775. * @hidden
  3776. */
  3777. const name = "Statics";
  3778. export { name };
  3779. }
  3780. declare module "babylonjs-gui/2D/controls/index" {
  3781. export * from "babylonjs-gui/2D/controls/button";
  3782. export * from "babylonjs-gui/2D/controls/checkbox";
  3783. export * from "babylonjs-gui/2D/controls/colorpicker";
  3784. export * from "babylonjs-gui/2D/controls/container";
  3785. export * from "babylonjs-gui/2D/controls/control";
  3786. export * from "babylonjs-gui/2D/controls/ellipse";
  3787. export * from "babylonjs-gui/2D/controls/focusableButton";
  3788. export * from "babylonjs-gui/2D/controls/grid";
  3789. export * from "babylonjs-gui/2D/controls/image";
  3790. export * from "babylonjs-gui/2D/controls/inputText";
  3791. export * from "babylonjs-gui/2D/controls/inputPassword";
  3792. export * from "babylonjs-gui/2D/controls/line";
  3793. export * from "babylonjs-gui/2D/controls/multiLine";
  3794. export * from "babylonjs-gui/2D/controls/radioButton";
  3795. export * from "babylonjs-gui/2D/controls/stackPanel";
  3796. export * from "babylonjs-gui/2D/controls/selector";
  3797. export * from "babylonjs-gui/2D/controls/scrollViewers/scrollViewer";
  3798. export * from "babylonjs-gui/2D/controls/textBlock";
  3799. export * from "babylonjs-gui/2D/controls/textWrapper";
  3800. export * from "babylonjs-gui/2D/controls/toggleButton";
  3801. export * from "babylonjs-gui/2D/controls/virtualKeyboard";
  3802. export * from "babylonjs-gui/2D/controls/rectangle";
  3803. export * from "babylonjs-gui/2D/controls/displayGrid";
  3804. export * from "babylonjs-gui/2D/controls/sliders/baseSlider";
  3805. export * from "babylonjs-gui/2D/controls/sliders/slider";
  3806. export * from "babylonjs-gui/2D/controls/sliders/imageBasedSlider";
  3807. export * from "babylonjs-gui/2D/controls/sliders/scrollBar";
  3808. export * from "babylonjs-gui/2D/controls/sliders/imageScrollBar";
  3809. export * from "babylonjs-gui/2D/controls/statics";
  3810. }
  3811. declare module "babylonjs-gui/2D/adtInstrumentation" {
  3812. import { PerfCounter } from "babylonjs/Misc/perfCounter";
  3813. import { IDisposable } from "babylonjs/scene";
  3814. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  3815. /**
  3816. * This class can be used to get instrumentation data from a AdvancedDynamicTexture object
  3817. */
  3818. export class AdvancedDynamicTextureInstrumentation implements IDisposable {
  3819. /**
  3820. * Define the instrumented AdvancedDynamicTexture.
  3821. */
  3822. texture: AdvancedDynamicTexture;
  3823. private _captureRenderTime;
  3824. private _renderTime;
  3825. private _captureLayoutTime;
  3826. private _layoutTime;
  3827. private _onBeginRenderObserver;
  3828. private _onEndRenderObserver;
  3829. private _onBeginLayoutObserver;
  3830. private _onEndLayoutObserver;
  3831. /**
  3832. * Gets the perf counter used to capture render time
  3833. */
  3834. get renderTimeCounter(): PerfCounter;
  3835. /**
  3836. * Gets the perf counter used to capture layout time
  3837. */
  3838. get layoutTimeCounter(): PerfCounter;
  3839. /**
  3840. * Enable or disable the render time capture
  3841. */
  3842. get captureRenderTime(): boolean;
  3843. set captureRenderTime(value: boolean);
  3844. /**
  3845. * Enable or disable the layout time capture
  3846. */
  3847. get captureLayoutTime(): boolean;
  3848. set captureLayoutTime(value: boolean);
  3849. /**
  3850. * Instantiates a new advanced dynamic texture instrumentation.
  3851. * This class can be used to get instrumentation data from an AdvancedDynamicTexture object
  3852. * @param texture Defines the AdvancedDynamicTexture to instrument
  3853. */
  3854. constructor(
  3855. /**
  3856. * Define the instrumented AdvancedDynamicTexture.
  3857. */
  3858. texture: AdvancedDynamicTexture);
  3859. /**
  3860. * Dispose and release associated resources.
  3861. */
  3862. dispose(): void;
  3863. }
  3864. }
  3865. declare module "babylonjs-gui/2D/xmlLoader" {
  3866. /**
  3867. * Class used to load GUI via XML.
  3868. */
  3869. export class XmlLoader {
  3870. private _nodes;
  3871. private _nodeTypes;
  3872. private _isLoaded;
  3873. private _objectAttributes;
  3874. private _parentClass;
  3875. /**
  3876. * Create a new xml loader
  3877. * @param parentClass Sets the class context. Used when the loader is instanced inside a class and not in a global context
  3878. */
  3879. constructor(parentClass?: null);
  3880. private _getChainElement;
  3881. private _getClassAttribute;
  3882. private _createGuiElement;
  3883. private _parseGrid;
  3884. private _parseElement;
  3885. private _prepareSourceElement;
  3886. private _parseElementsFromSource;
  3887. private _parseXml;
  3888. /**
  3889. * Gets if the loading has finished.
  3890. * @returns whether the loading has finished or not
  3891. */
  3892. isLoaded(): boolean;
  3893. /**
  3894. * Gets a loaded node / control by id.
  3895. * @param id the Controls id set in the xml
  3896. * @returns element of type Control
  3897. */
  3898. getNodeById(id: string): any;
  3899. /**
  3900. * Gets all loaded nodes / controls
  3901. * @returns Array of controls
  3902. */
  3903. getNodes(): any;
  3904. /**
  3905. * Initiates the xml layout loading
  3906. * @param xmlFile defines the xml layout to load
  3907. * @param rootNode defines the node / control to use as a parent for the loaded layout controls.
  3908. * @param callback defines the callback called on layout load.
  3909. */
  3910. loadLayout(xmlFile: any, rootNode: any, callback: any): void;
  3911. }
  3912. }
  3913. declare module "babylonjs-gui/2D/index" {
  3914. export * from "babylonjs-gui/2D/controls/index";
  3915. export * from "babylonjs-gui/2D/advancedDynamicTexture";
  3916. export * from "babylonjs-gui/2D/adtInstrumentation";
  3917. export * from "babylonjs-gui/2D/math2D";
  3918. export * from "babylonjs-gui/2D/measure";
  3919. export * from "babylonjs-gui/2D/multiLinePoint";
  3920. export * from "babylonjs-gui/2D/style";
  3921. export * from "babylonjs-gui/2D/valueAndUnit";
  3922. export * from "babylonjs-gui/2D/xmlLoader";
  3923. }
  3924. declare module "babylonjs-gui/3D/controls/container3D" {
  3925. import { Nullable } from "babylonjs/types";
  3926. import { TransformNode } from "babylonjs/Meshes/transformNode";
  3927. import { Scene } from "babylonjs/scene";
  3928. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  3929. /**
  3930. * Class used to create containers for controls
  3931. */
  3932. export class Container3D extends Control3D {
  3933. private _blockLayout;
  3934. /**
  3935. * Gets the list of child controls
  3936. */
  3937. protected _children: Control3D[];
  3938. /**
  3939. * Gets the list of child controls
  3940. */
  3941. get children(): Array<Control3D>;
  3942. /**
  3943. * Gets or sets a boolean indicating if the layout must be blocked (default is false).
  3944. * This is helpful to optimize layout operation when adding multiple children in a row
  3945. */
  3946. get blockLayout(): boolean;
  3947. set blockLayout(value: boolean);
  3948. /**
  3949. * Creates a new container
  3950. * @param name defines the container name
  3951. */
  3952. constructor(name?: string);
  3953. /**
  3954. * Force the container to update the layout. Please note that it will not take blockLayout property in account
  3955. * @returns the current container
  3956. */
  3957. updateLayout(): Container3D;
  3958. /**
  3959. * Gets a boolean indicating if the given control is in the children of this control
  3960. * @param control defines the control to check
  3961. * @returns true if the control is in the child list
  3962. */
  3963. containsControl(control: Control3D): boolean;
  3964. /**
  3965. * Adds a control to the children of this control
  3966. * @param control defines the control to add
  3967. * @returns the current container
  3968. */
  3969. addControl(control: Control3D): Container3D;
  3970. /**
  3971. * This function will be called everytime a new control is added
  3972. */
  3973. protected _arrangeChildren(): void;
  3974. protected _createNode(scene: Scene): Nullable<TransformNode>;
  3975. /**
  3976. * Removes a control from the children of this control
  3977. * @param control defines the control to remove
  3978. * @returns the current container
  3979. */
  3980. removeControl(control: Control3D): Container3D;
  3981. protected _getTypeName(): string;
  3982. /**
  3983. * Releases all associated resources
  3984. */
  3985. dispose(): void;
  3986. /** Control rotation will remain unchanged */
  3987. static readonly UNSET_ORIENTATION: number;
  3988. /** Control will rotate to make it look at sphere central axis */
  3989. static readonly FACEORIGIN_ORIENTATION: number;
  3990. /** Control will rotate to make it look back at sphere central axis */
  3991. static readonly FACEORIGINREVERSED_ORIENTATION: number;
  3992. /** Control will rotate to look at z axis (0, 0, 1) */
  3993. static readonly FACEFORWARD_ORIENTATION: number;
  3994. /** Control will rotate to look at negative z axis (0, 0, -1) */
  3995. static readonly FACEFORWARDREVERSED_ORIENTATION: number;
  3996. }
  3997. }
  3998. declare module "babylonjs-gui/3D/controls/button3D" {
  3999. import { int } from "babylonjs/types";
  4000. import { TransformNode } from "babylonjs/Meshes/transformNode";
  4001. import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
  4002. import { Material } from "babylonjs/Materials/material";
  4003. import { Scene } from "babylonjs/scene";
  4004. import { AbstractButton3D } from "babylonjs-gui/3D/controls/abstractButton3D";
  4005. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  4006. import { Control } from "babylonjs-gui/2D/controls/control";
  4007. /**
  4008. * Class used to create a button in 3D
  4009. */
  4010. export class Button3D extends AbstractButton3D {
  4011. /** @hidden */
  4012. protected _currentMaterial: Material;
  4013. private _facadeTexture;
  4014. private _content;
  4015. private _contentResolution;
  4016. private _contentScaleRatio;
  4017. /**
  4018. * Gets or sets the texture resolution used to render content (512 by default)
  4019. */
  4020. get contentResolution(): int;
  4021. set contentResolution(value: int);
  4022. /**
  4023. * Gets or sets the texture scale ratio used to render content (2 by default)
  4024. */
  4025. get contentScaleRatio(): number;
  4026. set contentScaleRatio(value: number);
  4027. protected _disposeFacadeTexture(): void;
  4028. protected _resetContent(): void;
  4029. /**
  4030. * Creates a new button
  4031. * @param name defines the control name
  4032. */
  4033. constructor(name?: string);
  4034. /**
  4035. * Gets or sets the GUI 2D content used to display the button's facade
  4036. */
  4037. get content(): Control;
  4038. set content(value: Control);
  4039. /**
  4040. * Apply the facade texture (created from the content property).
  4041. * This function can be overloaded by child classes
  4042. * @param facadeTexture defines the AdvancedDynamicTexture to use
  4043. */
  4044. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  4045. protected _getTypeName(): string;
  4046. protected _createNode(scene: Scene): TransformNode;
  4047. protected _affectMaterial(mesh: AbstractMesh): void;
  4048. /**
  4049. * Releases all associated resources
  4050. */
  4051. dispose(): void;
  4052. }
  4053. }
  4054. declare module "babylonjs-gui/3D/controls/touchButton3D" {
  4055. import { Vector3 } from "babylonjs/Maths/math.vector";
  4056. import { Mesh } from "babylonjs/Meshes/mesh";
  4057. import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
  4058. import { TransformNode } from "babylonjs/Meshes/transformNode";
  4059. import { Scene } from "babylonjs/scene";
  4060. import { Button3D } from "babylonjs-gui/3D/controls/button3D";
  4061. /**
  4062. * Class used to create a touchable button in 3D
  4063. */
  4064. export class TouchButton3D extends Button3D {
  4065. private _collisionMesh;
  4066. private _collidableFrontDirection;
  4067. private _lastTouchPoint;
  4068. private _tempButtonForwardRay;
  4069. private _lastKnownCollidableScale;
  4070. private _collidableInitialized;
  4071. private _frontOffset;
  4072. private _backOffset;
  4073. private _hoverOffset;
  4074. private _pushThroughBackOffset;
  4075. private _activeInteractions;
  4076. private _previousHeight;
  4077. /**
  4078. * Creates a new touchable button
  4079. * @param name defines the control name
  4080. * @param collisionMesh mesh to track collisions with
  4081. */
  4082. constructor(name?: string, collisionMesh?: Mesh);
  4083. /**
  4084. * Sets the front-facing direction of the button
  4085. * @param frontDir the forward direction of the button
  4086. */
  4087. set collidableFrontDirection(frontWorldDir: Vector3);
  4088. private _getWorldMatrixData;
  4089. /**
  4090. * Sets the mesh used for testing input collision
  4091. * @param collisionMesh the new collision mesh for the button
  4092. */
  4093. set collisionMesh(collisionMesh: Mesh);
  4094. private _getShortestDistancePointToLine;
  4095. private _isPrimedForInteraction;
  4096. private _getPointOnButton;
  4097. private _updateDistanceOffsets;
  4098. private _getHeightFromButtonCenter;
  4099. private _getDistanceOffPlane;
  4100. private _updateButtonState;
  4101. /** @hidden */
  4102. _collisionCheckForStateChange(mesh: AbstractMesh): void;
  4103. protected _getTypeName(): string;
  4104. protected _createNode(scene: Scene): TransformNode;
  4105. /**
  4106. * Releases all associated resources
  4107. */
  4108. dispose(): void;
  4109. }
  4110. }
  4111. declare module "babylonjs-gui/3D/gui3DManager" {
  4112. import { Nullable } from "babylonjs/types";
  4113. import { Observable } from "babylonjs/Misc/observable";
  4114. import { Vector3 } from "babylonjs/Maths/math.vector";
  4115. import { Material } from "babylonjs/Materials/material";
  4116. import { UtilityLayerRenderer } from "babylonjs/Rendering/utilityLayerRenderer";
  4117. import { IDisposable, Scene } from "babylonjs/scene";
  4118. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  4119. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  4120. /**
  4121. * Class used to manage 3D user interface
  4122. * @see https://doc.babylonjs.com/how_to/gui3d
  4123. */
  4124. export class GUI3DManager implements IDisposable {
  4125. private _scene;
  4126. private _sceneDisposeObserver;
  4127. private _utilityLayer;
  4128. private _rootContainer;
  4129. private _pointerObserver;
  4130. private _pointerOutObserver;
  4131. private _touchableButtons;
  4132. /** @hidden */
  4133. _lastPickedControl: Control3D;
  4134. /** @hidden */
  4135. _lastControlOver: {
  4136. [pointerId: number]: Control3D;
  4137. };
  4138. /** @hidden */
  4139. _lastControlDown: {
  4140. [pointerId: number]: Control3D;
  4141. };
  4142. /**
  4143. * Observable raised when the point picked by the pointer events changed
  4144. */
  4145. onPickedPointChangedObservable: Observable<Nullable<Vector3>>;
  4146. /** @hidden */
  4147. _sharedMaterials: {
  4148. [key: string]: Material;
  4149. };
  4150. /** @hidden */
  4151. _touchSharedMaterials: {
  4152. [key: string]: Material;
  4153. };
  4154. /** Gets the hosting scene */
  4155. get scene(): Scene;
  4156. /** Gets associated utility layer */
  4157. get utilityLayer(): Nullable<UtilityLayerRenderer>;
  4158. /**
  4159. * Creates a new GUI3DManager
  4160. * @param scene
  4161. */
  4162. constructor(scene?: Scene);
  4163. private _handlePointerOut;
  4164. private _doPicking;
  4165. private _processTouchControls;
  4166. /**
  4167. * Gets the root container
  4168. */
  4169. get rootContainer(): Container3D;
  4170. /**
  4171. * Gets a boolean indicating if the given control is in the root child list
  4172. * @param control defines the control to check
  4173. * @returns true if the control is in the root child list
  4174. */
  4175. containsControl(control: Control3D): boolean;
  4176. /**
  4177. * Adds a control to the root child list
  4178. * @param control defines the control to add
  4179. * @returns the current manager
  4180. */
  4181. addControl(control: Control3D): GUI3DManager;
  4182. /**
  4183. * Removes a control from the root child list
  4184. * @param control defines the control to remove
  4185. * @returns the current container
  4186. */
  4187. removeControl(control: Control3D): GUI3DManager;
  4188. /**
  4189. * Releases all associated resources
  4190. */
  4191. dispose(): void;
  4192. }
  4193. }
  4194. declare module "babylonjs-gui/3D/vector3WithInfo" {
  4195. import { Vector3 } from "babylonjs/Maths/math.vector";
  4196. /**
  4197. * Class used to transport Vector3 information for pointer events
  4198. */
  4199. export class Vector3WithInfo extends Vector3 {
  4200. /** defines the current mouse button index */
  4201. buttonIndex: number;
  4202. /**
  4203. * Creates a new Vector3WithInfo
  4204. * @param source defines the vector3 data to transport
  4205. * @param buttonIndex defines the current mouse button index
  4206. */
  4207. constructor(source: Vector3,
  4208. /** defines the current mouse button index */
  4209. buttonIndex?: number);
  4210. }
  4211. }
  4212. declare module "babylonjs-gui/3D/controls/control3D" {
  4213. import { Nullable } from "babylonjs/types";
  4214. import { Observable } from "babylonjs/Misc/observable";
  4215. import { Vector3 } from "babylonjs/Maths/math.vector";
  4216. import { TransformNode } from "babylonjs/Meshes/transformNode";
  4217. import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
  4218. import { IBehaviorAware, Behavior } from "babylonjs/Behaviors/behavior";
  4219. import { IDisposable, Scene } from "babylonjs/scene";
  4220. import { GUI3DManager } from "babylonjs-gui/3D/gui3DManager";
  4221. import { Vector3WithInfo } from "babylonjs-gui/3D/vector3WithInfo";
  4222. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  4223. /**
  4224. * Class used as base class for controls
  4225. */
  4226. export class Control3D implements IDisposable, IBehaviorAware<Control3D> {
  4227. /** Defines the control name */
  4228. name?: string | undefined;
  4229. /** @hidden */
  4230. _host: GUI3DManager;
  4231. private _node;
  4232. private _downCount;
  4233. private _enterCount;
  4234. private _downPointerIds;
  4235. private _isVisible;
  4236. /** Gets or sets the control position in world space */
  4237. get position(): Vector3;
  4238. set position(value: Vector3);
  4239. /** Gets or sets the control scaling in world space */
  4240. get scaling(): Vector3;
  4241. set scaling(value: Vector3);
  4242. /** Callback used to start pointer enter animation */
  4243. pointerEnterAnimation: () => void;
  4244. /** Callback used to start pointer out animation */
  4245. pointerOutAnimation: () => void;
  4246. /** Callback used to start pointer down animation */
  4247. pointerDownAnimation: () => void;
  4248. /** Callback used to start pointer up animation */
  4249. pointerUpAnimation: () => void;
  4250. /**
  4251. * An event triggered when the pointer move over the control
  4252. */
  4253. onPointerMoveObservable: Observable<Vector3>;
  4254. /**
  4255. * An event triggered when the pointer move out of the control
  4256. */
  4257. onPointerOutObservable: Observable<Control3D>;
  4258. /**
  4259. * An event triggered when the pointer taps the control
  4260. */
  4261. onPointerDownObservable: Observable<Vector3WithInfo>;
  4262. /**
  4263. * An event triggered when pointer is up
  4264. */
  4265. onPointerUpObservable: Observable<Vector3WithInfo>;
  4266. /**
  4267. * An event triggered when a control is clicked on (with a mouse)
  4268. */
  4269. onPointerClickObservable: Observable<Vector3WithInfo>;
  4270. /**
  4271. * An event triggered when pointer enters the control
  4272. */
  4273. onPointerEnterObservable: Observable<Control3D>;
  4274. /**
  4275. * Gets or sets the parent container
  4276. */
  4277. parent: Nullable<Container3D>;
  4278. private _behaviors;
  4279. /**
  4280. * Gets the list of attached behaviors
  4281. * @see https://doc.babylonjs.com/features/behaviour
  4282. */
  4283. get behaviors(): Behavior<Control3D>[];
  4284. /**
  4285. * Attach a behavior to the control
  4286. * @see https://doc.babylonjs.com/features/behaviour
  4287. * @param behavior defines the behavior to attach
  4288. * @returns the current control
  4289. */
  4290. addBehavior(behavior: Behavior<Control3D>): Control3D;
  4291. /**
  4292. * Remove an attached behavior
  4293. * @see https://doc.babylonjs.com/features/behaviour
  4294. * @param behavior defines the behavior to attach
  4295. * @returns the current control
  4296. */
  4297. removeBehavior(behavior: Behavior<Control3D>): Control3D;
  4298. /**
  4299. * Gets an attached behavior by name
  4300. * @param name defines the name of the behavior to look for
  4301. * @see https://doc.babylonjs.com/features/behaviour
  4302. * @returns null if behavior was not found else the requested behavior
  4303. */
  4304. getBehaviorByName(name: string): Nullable<Behavior<Control3D>>;
  4305. /** Gets or sets a boolean indicating if the control is visible */
  4306. get isVisible(): boolean;
  4307. set isVisible(value: boolean);
  4308. /**
  4309. * Creates a new control
  4310. * @param name defines the control name
  4311. */
  4312. constructor(
  4313. /** Defines the control name */
  4314. name?: string | undefined);
  4315. /**
  4316. * Gets a string representing the class name
  4317. */
  4318. get typeName(): string;
  4319. /**
  4320. * Get the current class name of the control.
  4321. * @returns current class name
  4322. */
  4323. getClassName(): string;
  4324. protected _getTypeName(): string;
  4325. /**
  4326. * Gets the transform node used by this control
  4327. */
  4328. get node(): Nullable<TransformNode>;
  4329. /**
  4330. * Gets the mesh used to render this control
  4331. */
  4332. get mesh(): Nullable<AbstractMesh>;
  4333. /**
  4334. * Link the control as child of the given node
  4335. * @param node defines the node to link to. Use null to unlink the control
  4336. * @returns the current control
  4337. */
  4338. linkToTransformNode(node: Nullable<TransformNode>): Control3D;
  4339. /** @hidden **/
  4340. _prepareNode(scene: Scene): void;
  4341. protected _injectGUI3DMetadata(node: TransformNode): any;
  4342. /**
  4343. * Node creation.
  4344. * Can be overriden by children
  4345. * @param scene defines the scene where the node must be attached
  4346. * @returns the attached node or null if none. Must return a Mesh or AbstractMesh if there is an atttached visible object
  4347. */
  4348. protected _createNode(scene: Scene): Nullable<TransformNode>;
  4349. /**
  4350. * Affect a material to the given mesh
  4351. * @param mesh defines the mesh which will represent the control
  4352. */
  4353. protected _affectMaterial(mesh: AbstractMesh): void;
  4354. /** @hidden */
  4355. _onPointerMove(target: Control3D, coordinates: Vector3): void;
  4356. /** @hidden */
  4357. _onPointerEnter(target: Control3D): boolean;
  4358. /** @hidden */
  4359. _onPointerOut(target: Control3D): void;
  4360. /** @hidden */
  4361. _onPointerDown(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number): boolean;
  4362. /** @hidden */
  4363. _onPointerUp(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  4364. /** @hidden */
  4365. forcePointerUp(pointerId?: Nullable<number>): void;
  4366. /** @hidden */
  4367. _processObservables(type: number, pickedPoint: Vector3, pointerId: number, buttonIndex: number): boolean;
  4368. /** @hidden */
  4369. _disposeNode(): void;
  4370. /**
  4371. * Releases all associated resources
  4372. */
  4373. dispose(): void;
  4374. }
  4375. }
  4376. declare module "babylonjs-gui/3D/controls/abstractButton3D" {
  4377. import { TransformNode } from "babylonjs/Meshes/transformNode";
  4378. import { Scene } from "babylonjs/scene";
  4379. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  4380. /**
  4381. * Class used as a root to all buttons
  4382. */
  4383. export class AbstractButton3D extends Control3D {
  4384. /**
  4385. * Creates a new button
  4386. * @param name defines the control name
  4387. */
  4388. constructor(name?: string);
  4389. protected _getTypeName(): string;
  4390. protected _createNode(scene: Scene): TransformNode;
  4391. }
  4392. }
  4393. declare module "babylonjs-gui/3D/controls/volumeBasedPanel" {
  4394. import { Vector3 } from "babylonjs/Maths/math.vector";
  4395. import { int } from "babylonjs/types";
  4396. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  4397. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  4398. /**
  4399. * Abstract class used to create a container panel deployed on the surface of a volume
  4400. */
  4401. export abstract class VolumeBasedPanel extends Container3D {
  4402. private _columns;
  4403. private _rows;
  4404. private _rowThenColum;
  4405. private _orientation;
  4406. protected _cellWidth: number;
  4407. protected _cellHeight: number;
  4408. /**
  4409. * Gets or sets the distance between elements
  4410. */
  4411. margin: number;
  4412. /**
  4413. * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)
  4414. * | Value | Type | Description |
  4415. * | ----- | ----------------------------------- | ----------- |
  4416. * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |
  4417. * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |
  4418. * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |
  4419. * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |
  4420. * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |
  4421. */
  4422. get orientation(): number;
  4423. set orientation(value: number);
  4424. /**
  4425. * Gets or sets the number of columns requested (10 by default).
  4426. * The panel will automatically compute the number of rows based on number of child controls.
  4427. */
  4428. get columns(): int;
  4429. set columns(value: int);
  4430. /**
  4431. * Gets or sets a the number of rows requested.
  4432. * The panel will automatically compute the number of columns based on number of child controls.
  4433. */
  4434. get rows(): int;
  4435. set rows(value: int);
  4436. /**
  4437. * Creates new VolumeBasedPanel
  4438. */
  4439. constructor();
  4440. protected _arrangeChildren(): void;
  4441. /** Child classes must implement this function to provide correct control positioning */
  4442. protected abstract _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  4443. /** Child classes can implement this function to provide additional processing */
  4444. protected _finalProcessing(): void;
  4445. }
  4446. }
  4447. declare module "babylonjs-gui/3D/controls/cylinderPanel" {
  4448. import { Vector3 } from "babylonjs/Maths/math.vector";
  4449. import { float } from "babylonjs/types";
  4450. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  4451. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  4452. /**
  4453. * Class used to create a container panel deployed on the surface of a cylinder
  4454. */
  4455. export class CylinderPanel extends VolumeBasedPanel {
  4456. private _radius;
  4457. /**
  4458. * Gets or sets the radius of the cylinder where to project controls (5 by default)
  4459. */
  4460. get radius(): float;
  4461. set radius(value: float);
  4462. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  4463. private _cylindricalMapping;
  4464. }
  4465. }
  4466. declare module "babylonjs-gui/3D/materials/shaders/fluent.vertex" {
  4467. /** @hidden */
  4468. export var fluentVertexShader: {
  4469. name: string;
  4470. shader: string;
  4471. };
  4472. }
  4473. declare module "babylonjs-gui/3D/materials/shaders/fluent.fragment" {
  4474. /** @hidden */
  4475. export var fluentPixelShader: {
  4476. name: string;
  4477. shader: string;
  4478. };
  4479. }
  4480. declare module "babylonjs-gui/3D/materials/fluentMaterial" {
  4481. import { Nullable } from "babylonjs/types";
  4482. import { Vector3, Matrix } from "babylonjs/Maths/math.vector";
  4483. import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture";
  4484. import { MaterialDefines } from "babylonjs/Materials/materialDefines";
  4485. import { PushMaterial } from "babylonjs/Materials/pushMaterial";
  4486. import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
  4487. import { SubMesh } from "babylonjs/Meshes/subMesh";
  4488. import { Mesh } from "babylonjs/Meshes/mesh";
  4489. import { Scene } from "babylonjs/scene";
  4490. import { Color3, Color4 } from 'babylonjs/Maths/math.color';
  4491. import "babylonjs-gui/3D/materials/shaders/fluent.vertex";
  4492. import "babylonjs-gui/3D/materials/shaders/fluent.fragment";
  4493. /** @hidden */
  4494. export class FluentMaterialDefines extends MaterialDefines {
  4495. INNERGLOW: boolean;
  4496. BORDER: boolean;
  4497. HOVERLIGHT: boolean;
  4498. TEXTURE: boolean;
  4499. constructor();
  4500. }
  4501. /**
  4502. * Class used to render controls with fluent desgin
  4503. */
  4504. export class FluentMaterial extends PushMaterial {
  4505. /**
  4506. * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)
  4507. */
  4508. innerGlowColorIntensity: number;
  4509. /**
  4510. * Gets or sets the inner glow color (white by default)
  4511. */
  4512. innerGlowColor: Color3;
  4513. /**
  4514. * Gets or sets the albedo color (Default is Color3(0.3, 0.35, 0.4))
  4515. */
  4516. albedoColor: Color3;
  4517. /**
  4518. * Gets or sets a boolean indicating if borders must be rendered (default is false)
  4519. */
  4520. renderBorders: boolean;
  4521. /**
  4522. * Gets or sets border width (default is 0.5)
  4523. */
  4524. borderWidth: number;
  4525. /**
  4526. * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)
  4527. */
  4528. edgeSmoothingValue: number;
  4529. /**
  4530. * Gets or sets the minimum value that can be applied to border width (default is 0.1)
  4531. */
  4532. borderMinValue: number;
  4533. /**
  4534. * Gets or sets a boolean indicating if hover light must be rendered (default is false)
  4535. */
  4536. renderHoverLight: boolean;
  4537. /**
  4538. * Gets or sets the radius used to render the hover light (default is 1.0)
  4539. */
  4540. hoverRadius: number;
  4541. /**
  4542. * Gets or sets the color used to render the hover light (default is Color4(0.3, 0.3, 0.3, 1.0))
  4543. */
  4544. hoverColor: Color4;
  4545. /**
  4546. * Gets or sets the hover light position in world space (default is Vector3.Zero())
  4547. */
  4548. hoverPosition: Vector3;
  4549. private _albedoTexture;
  4550. /** Gets or sets the texture to use for albedo color */
  4551. albedoTexture: Nullable<BaseTexture>;
  4552. /**
  4553. * Creates a new Fluent material
  4554. * @param name defines the name of the material
  4555. * @param scene defines the hosting scene
  4556. */
  4557. constructor(name: string, scene: Scene);
  4558. needAlphaBlending(): boolean;
  4559. needAlphaTesting(): boolean;
  4560. getAlphaTestTexture(): Nullable<BaseTexture>;
  4561. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  4562. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  4563. getActiveTextures(): BaseTexture[];
  4564. hasTexture(texture: BaseTexture): boolean;
  4565. dispose(forceDisposeEffect?: boolean): void;
  4566. clone(name: string): FluentMaterial;
  4567. serialize(): any;
  4568. getClassName(): string;
  4569. static Parse(source: any, scene: Scene, rootUrl: string): FluentMaterial;
  4570. }
  4571. }
  4572. declare module "babylonjs-gui/3D/controls/holographicButton" {
  4573. import { Button3D } from "babylonjs-gui/3D/controls/button3D";
  4574. import { Nullable } from "babylonjs/types";
  4575. import { StandardMaterial } from "babylonjs/Materials/standardMaterial";
  4576. import { TransformNode } from "babylonjs/Meshes/transformNode";
  4577. import { Mesh } from "babylonjs/Meshes/mesh";
  4578. import { Scene } from "babylonjs/scene";
  4579. import { FluentMaterial } from "babylonjs-gui/3D/materials/fluentMaterial";
  4580. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  4581. /**
  4582. * Class used to create a holographic button in 3D
  4583. */
  4584. export class HolographicButton extends Button3D {
  4585. private _backPlate;
  4586. private _textPlate;
  4587. private _frontPlate;
  4588. private _text;
  4589. private _imageUrl;
  4590. private _shareMaterials;
  4591. private _frontMaterial;
  4592. private _backMaterial;
  4593. private _plateMaterial;
  4594. private _pickedPointObserver;
  4595. private _tooltipFade;
  4596. private _tooltipTextBlock;
  4597. private _tooltipTexture;
  4598. private _tooltipMesh;
  4599. private _tooltipHoverObserver;
  4600. private _tooltipOutObserver;
  4601. private _disposeTooltip;
  4602. /**
  4603. * Rendering ground id of all the mesh in the button
  4604. */
  4605. set renderingGroupId(id: number);
  4606. get renderingGroupId(): number;
  4607. /**
  4608. * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
  4609. */
  4610. set tooltipText(text: Nullable<string>);
  4611. get tooltipText(): Nullable<string>;
  4612. /**
  4613. * Gets or sets text for the button
  4614. */
  4615. get text(): string;
  4616. set text(value: string);
  4617. /**
  4618. * Gets or sets the image url for the button
  4619. */
  4620. get imageUrl(): string;
  4621. set imageUrl(value: string);
  4622. /**
  4623. * Gets the back material used by this button
  4624. */
  4625. get backMaterial(): FluentMaterial;
  4626. /**
  4627. * Gets the front material used by this button
  4628. */
  4629. get frontMaterial(): FluentMaterial;
  4630. /**
  4631. * Gets the plate material used by this button
  4632. */
  4633. get plateMaterial(): StandardMaterial;
  4634. /**
  4635. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  4636. */
  4637. get shareMaterials(): boolean;
  4638. /**
  4639. * Creates a new button
  4640. * @param name defines the control name
  4641. */
  4642. constructor(name?: string, shareMaterials?: boolean);
  4643. protected _getTypeName(): string;
  4644. private _rebuildContent;
  4645. protected _createNode(scene: Scene): TransformNode;
  4646. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  4647. private _createBackMaterial;
  4648. private _createFrontMaterial;
  4649. private _createPlateMaterial;
  4650. protected _affectMaterial(mesh: Mesh): void;
  4651. /**
  4652. * Releases all associated resources
  4653. */
  4654. dispose(): void;
  4655. }
  4656. }
  4657. declare module "babylonjs-gui/3D/controls/meshButton3D" {
  4658. import { TransformNode } from "babylonjs/Meshes/transformNode";
  4659. import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
  4660. import { Mesh } from "babylonjs/Meshes/mesh";
  4661. import { Scene } from "babylonjs/scene";
  4662. import { Button3D } from "babylonjs-gui/3D/controls/button3D";
  4663. /**
  4664. * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene
  4665. */
  4666. export class MeshButton3D extends Button3D {
  4667. /** @hidden */
  4668. protected _currentMesh: Mesh;
  4669. /**
  4670. * Creates a new 3D button based on a mesh
  4671. * @param mesh mesh to become a 3D button
  4672. * @param name defines the control name
  4673. */
  4674. constructor(mesh: Mesh, name?: string);
  4675. protected _getTypeName(): string;
  4676. protected _createNode(scene: Scene): TransformNode;
  4677. protected _affectMaterial(mesh: AbstractMesh): void;
  4678. }
  4679. }
  4680. declare module "babylonjs-gui/3D/controls/planePanel" {
  4681. import { Vector3 } from "babylonjs/Maths/math.vector";
  4682. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  4683. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  4684. /**
  4685. * Class used to create a container panel deployed on the surface of a plane
  4686. */
  4687. export class PlanePanel extends VolumeBasedPanel {
  4688. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  4689. }
  4690. }
  4691. declare module "babylonjs-gui/3D/controls/scatterPanel" {
  4692. import { Vector3 } from "babylonjs/Maths/math.vector";
  4693. import { float } from "babylonjs/types";
  4694. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  4695. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  4696. /**
  4697. * Class used to create a container panel where items get randomized planar mapping
  4698. */
  4699. export class ScatterPanel extends VolumeBasedPanel {
  4700. private _iteration;
  4701. /**
  4702. * Gets or sets the number of iteration to use to scatter the controls (100 by default)
  4703. */
  4704. get iteration(): float;
  4705. set iteration(value: float);
  4706. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  4707. private _scatterMapping;
  4708. protected _finalProcessing(): void;
  4709. }
  4710. }
  4711. declare module "babylonjs-gui/3D/controls/spherePanel" {
  4712. import { Vector3 } from "babylonjs/Maths/math.vector";
  4713. import { float } from "babylonjs/types";
  4714. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  4715. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  4716. /**
  4717. * Class used to create a container panel deployed on the surface of a sphere
  4718. */
  4719. export class SpherePanel extends VolumeBasedPanel {
  4720. private _radius;
  4721. /**
  4722. * Gets or sets the radius of the sphere where to project controls (5 by default)
  4723. */
  4724. get radius(): float;
  4725. set radius(value: float);
  4726. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  4727. private _sphericalMapping;
  4728. }
  4729. }
  4730. declare module "babylonjs-gui/3D/controls/stackPanel3D" {
  4731. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  4732. /**
  4733. * Class used to create a stack panel in 3D on XY plane
  4734. */
  4735. export class StackPanel3D extends Container3D {
  4736. private _isVertical;
  4737. /**
  4738. * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)
  4739. */
  4740. get isVertical(): boolean;
  4741. set isVertical(value: boolean);
  4742. /**
  4743. * Gets or sets the distance between elements
  4744. */
  4745. margin: number;
  4746. /**
  4747. * Creates new StackPanel
  4748. * @param isVertical
  4749. */
  4750. constructor(isVertical?: boolean);
  4751. protected _arrangeChildren(): void;
  4752. }
  4753. }
  4754. declare module "babylonjs-gui/3D/controls/touchMeshButton3D" {
  4755. import { TransformNode } from "babylonjs/Meshes/transformNode";
  4756. import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
  4757. import { Mesh } from "babylonjs/Meshes/mesh";
  4758. import { Scene } from "babylonjs/scene";
  4759. import { TouchButton3D } from "babylonjs-gui/3D/controls/touchButton3D";
  4760. /**
  4761. * Class used to create an interactable object. It's a touchable 3D button using a mesh coming from the current scene
  4762. */
  4763. export class TouchMeshButton3D extends TouchButton3D {
  4764. /** @hidden */
  4765. protected _currentMesh: Mesh;
  4766. /**
  4767. * Creates a new 3D button based on a mesh
  4768. * @param mesh mesh to become a 3D button
  4769. * @param collisionMesh mesh to track collisions with
  4770. * @param name defines the control name
  4771. */
  4772. constructor(mesh: Mesh, options: {
  4773. collisionMesh: Mesh;
  4774. useDynamicMesh?: boolean;
  4775. }, name?: string);
  4776. protected _getTypeName(): string;
  4777. protected _createNode(scene: Scene): TransformNode;
  4778. protected _affectMaterial(mesh: AbstractMesh): void;
  4779. }
  4780. }
  4781. declare module "babylonjs-gui/3D/controls/touchHolographicButton" {
  4782. import { Nullable } from "babylonjs/types";
  4783. import { StandardMaterial } from "babylonjs/Materials/standardMaterial";
  4784. import { TransformNode } from "babylonjs/Meshes/transformNode";
  4785. import { Mesh } from "babylonjs/Meshes/mesh";
  4786. import { Scene } from "babylonjs/scene";
  4787. import { FluentMaterial } from "babylonjs-gui/3D/materials/fluentMaterial";
  4788. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  4789. import { TouchButton3D } from "babylonjs-gui/3D/controls/touchButton3D";
  4790. /**
  4791. * Class used to create a holographic button in 3D
  4792. */
  4793. export class TouchHolographicButton extends TouchButton3D {
  4794. private _backPlate;
  4795. private _textPlate;
  4796. private _frontPlate;
  4797. private _text;
  4798. private _imageUrl;
  4799. private _shareMaterials;
  4800. private _frontMaterial;
  4801. private _backMaterial;
  4802. private _plateMaterial;
  4803. private _pickedPointObserver;
  4804. private _tooltipFade;
  4805. private _tooltipTextBlock;
  4806. private _tooltipTexture;
  4807. private _tooltipMesh;
  4808. private _tooltipHoverObserver;
  4809. private _tooltipOutObserver;
  4810. private _disposeTooltip;
  4811. /**
  4812. * Rendering ground id of all the mesh in the button
  4813. */
  4814. set renderingGroupId(id: number);
  4815. get renderingGroupId(): number;
  4816. /**
  4817. * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
  4818. */
  4819. set tooltipText(text: Nullable<string>);
  4820. get tooltipText(): Nullable<string>;
  4821. /**
  4822. * Gets or sets text for the button
  4823. */
  4824. get text(): string;
  4825. set text(value: string);
  4826. /**
  4827. * Gets or sets the image url for the button
  4828. */
  4829. get imageUrl(): string;
  4830. set imageUrl(value: string);
  4831. /**
  4832. * Gets the back material used by this button
  4833. */
  4834. get backMaterial(): FluentMaterial;
  4835. /**
  4836. * Gets the front material used by this button
  4837. */
  4838. get frontMaterial(): FluentMaterial;
  4839. /**
  4840. * Gets the plate material used by this button
  4841. */
  4842. get plateMaterial(): StandardMaterial;
  4843. /**
  4844. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  4845. */
  4846. get shareMaterials(): boolean;
  4847. /**
  4848. * Creates a new button
  4849. * @param name defines the control name
  4850. */
  4851. constructor(name?: string, shareMaterials?: boolean);
  4852. protected _getTypeName(): string;
  4853. private _rebuildContent;
  4854. protected _createNode(scene: Scene): TransformNode;
  4855. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  4856. private _createBackMaterial;
  4857. private _createFrontMaterial;
  4858. private _createPlateMaterial;
  4859. protected _affectMaterial(mesh: Mesh): void;
  4860. /**
  4861. * Releases all associated resources
  4862. */
  4863. dispose(): void;
  4864. }
  4865. }
  4866. declare module "babylonjs-gui/3D/controls/index" {
  4867. export * from "babylonjs-gui/3D/controls/abstractButton3D";
  4868. export * from "babylonjs-gui/3D/controls/button3D";
  4869. export * from "babylonjs-gui/3D/controls/container3D";
  4870. export * from "babylonjs-gui/3D/controls/control3D";
  4871. export * from "babylonjs-gui/3D/controls/cylinderPanel";
  4872. export * from "babylonjs-gui/3D/controls/holographicButton";
  4873. export * from "babylonjs-gui/3D/controls/meshButton3D";
  4874. export * from "babylonjs-gui/3D/controls/planePanel";
  4875. export * from "babylonjs-gui/3D/controls/scatterPanel";
  4876. export * from "babylonjs-gui/3D/controls/spherePanel";
  4877. export * from "babylonjs-gui/3D/controls/stackPanel3D";
  4878. export * from "babylonjs-gui/3D/controls/touchButton3D";
  4879. export * from "babylonjs-gui/3D/controls/touchMeshButton3D";
  4880. export * from "babylonjs-gui/3D/controls/touchHolographicButton";
  4881. export * from "babylonjs-gui/3D/controls/volumeBasedPanel";
  4882. }
  4883. declare module "babylonjs-gui/3D/materials/index" {
  4884. export * from "babylonjs-gui/3D/materials/fluentMaterial";
  4885. }
  4886. declare module "babylonjs-gui/3D/index" {
  4887. export * from "babylonjs-gui/3D/controls/index";
  4888. export * from "babylonjs-gui/3D/materials/index";
  4889. export * from "babylonjs-gui/3D/gui3DManager";
  4890. export * from "babylonjs-gui/3D/vector3WithInfo";
  4891. }
  4892. declare module "babylonjs-gui/index" {
  4893. export * from "babylonjs-gui/2D/index";
  4894. export * from "babylonjs-gui/3D/index";
  4895. }
  4896. declare module "babylonjs-gui/legacy/legacy" {
  4897. export * from "babylonjs-gui/index";
  4898. }
  4899. declare module "babylonjs-gui" {
  4900. export * from "babylonjs-gui/legacy/legacy";
  4901. }
  4902. declare module BABYLON.GUI {
  4903. /**
  4904. * Interface used to define a control that can receive focus
  4905. */
  4906. export interface IFocusableControl {
  4907. /**
  4908. * Function called when the control receives the focus
  4909. */
  4910. onFocus(): void;
  4911. /**
  4912. * Function called when the control loses the focus
  4913. */
  4914. onBlur(): void;
  4915. /**
  4916. * Function called to let the control handle keyboard events
  4917. * @param evt defines the current keyboard event
  4918. */
  4919. processKeyboard(evt: BABYLON.IKeyboardEvent): void;
  4920. /**
  4921. * Function called to get the list of controls that should not steal the focus from this control
  4922. * @returns an array of controls
  4923. */
  4924. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  4925. /**
  4926. * Function to focus the control programmatically
  4927. */
  4928. focus(): void;
  4929. /**
  4930. * Function to unfocus the control programmatically
  4931. */
  4932. blur(): void;
  4933. }
  4934. }
  4935. declare module BABYLON.GUI {
  4936. /**
  4937. * Class used to specific a value and its associated unit
  4938. */
  4939. export class ValueAndUnit {
  4940. /** defines the unit to store */
  4941. unit: number;
  4942. /** defines a boolean indicating if the value can be negative */
  4943. negativeValueAllowed: boolean;
  4944. private _value;
  4945. private _originalUnit;
  4946. /**
  4947. * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
  4948. * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
  4949. */
  4950. ignoreAdaptiveScaling: boolean;
  4951. /**
  4952. * Creates a new ValueAndUnit
  4953. * @param value defines the value to store
  4954. * @param unit defines the unit to store
  4955. * @param negativeValueAllowed defines a boolean indicating if the value can be negative
  4956. */
  4957. constructor(value: number,
  4958. /** defines the unit to store */
  4959. unit?: number,
  4960. /** defines a boolean indicating if the value can be negative */
  4961. negativeValueAllowed?: boolean);
  4962. /** Gets a boolean indicating if the value is a percentage */
  4963. get isPercentage(): boolean;
  4964. /** Gets a boolean indicating if the value is store as pixel */
  4965. get isPixel(): boolean;
  4966. /** Gets direct internal value */
  4967. get internalValue(): number;
  4968. /**
  4969. * Gets value as pixel
  4970. * @param host defines the root host
  4971. * @param refValue defines the reference value for percentages
  4972. * @returns the value as pixel
  4973. */
  4974. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  4975. /**
  4976. * Update the current value and unit. This should be done cautiously as the GUi won't be marked as dirty with this function.
  4977. * @param value defines the value to store
  4978. * @param unit defines the unit to store
  4979. * @returns the current ValueAndUnit
  4980. */
  4981. updateInPlace(value: number, unit?: number): ValueAndUnit;
  4982. /**
  4983. * Gets the value accordingly to its unit
  4984. * @param host defines the root host
  4985. * @returns the value
  4986. */
  4987. getValue(host: AdvancedDynamicTexture): number;
  4988. /**
  4989. * Gets a string representation of the value
  4990. * @param host defines the root host
  4991. * @param decimals defines an optional number of decimals to display
  4992. * @returns a string
  4993. */
  4994. toString(host: AdvancedDynamicTexture, decimals?: number): string;
  4995. /**
  4996. * Store a value parsed from a string
  4997. * @param source defines the source string
  4998. * @returns true if the value was successfully parsed
  4999. */
  5000. fromString(source: string | number): boolean;
  5001. private static _Regex;
  5002. private static _UNITMODE_PERCENTAGE;
  5003. private static _UNITMODE_PIXEL;
  5004. /** UNITMODE_PERCENTAGE */
  5005. static get UNITMODE_PERCENTAGE(): number;
  5006. /** UNITMODE_PIXEL */
  5007. static get UNITMODE_PIXEL(): number;
  5008. }
  5009. }
  5010. declare module BABYLON.GUI {
  5011. /**
  5012. * Define a style used by control to automatically setup properties based on a template.
  5013. * Only support font related properties so far
  5014. */
  5015. export class Style implements BABYLON.IDisposable {
  5016. private _fontFamily;
  5017. private _fontStyle;
  5018. private _fontWeight;
  5019. /** @hidden */
  5020. _host: AdvancedDynamicTexture;
  5021. /** @hidden */
  5022. _fontSize: ValueAndUnit;
  5023. /**
  5024. * BABYLON.Observable raised when the style values are changed
  5025. */
  5026. onChangedObservable: BABYLON.Observable<Style>;
  5027. /**
  5028. * Creates a new style object
  5029. * @param host defines the AdvancedDynamicTexture which hosts this style
  5030. */
  5031. constructor(host: AdvancedDynamicTexture);
  5032. /**
  5033. * Gets or sets the font size
  5034. */
  5035. get fontSize(): string | number;
  5036. set fontSize(value: string | number);
  5037. /**
  5038. * Gets or sets the font family
  5039. */
  5040. get fontFamily(): string;
  5041. set fontFamily(value: string);
  5042. /**
  5043. * Gets or sets the font style
  5044. */
  5045. get fontStyle(): string;
  5046. set fontStyle(value: string);
  5047. /** Gets or sets font weight */
  5048. get fontWeight(): string;
  5049. set fontWeight(value: string);
  5050. /** Dispose all associated resources */
  5051. dispose(): void;
  5052. }
  5053. }
  5054. declare module BABYLON.GUI {
  5055. /**
  5056. * Class used to transport BABYLON.Vector2 information for pointer events
  5057. */
  5058. export class Vector2WithInfo extends BABYLON.Vector2 {
  5059. /** defines the current mouse button index */
  5060. buttonIndex: number;
  5061. /**
  5062. * Creates a new Vector2WithInfo
  5063. * @param source defines the vector2 data to transport
  5064. * @param buttonIndex defines the current mouse button index
  5065. */
  5066. constructor(source: BABYLON.Vector2,
  5067. /** defines the current mouse button index */
  5068. buttonIndex?: number);
  5069. }
  5070. /** Class used to provide 2D matrix features */
  5071. export class Matrix2D {
  5072. /** Gets the internal array of 6 floats used to store matrix data */
  5073. m: Float32Array;
  5074. /**
  5075. * Creates a new matrix
  5076. * @param m00 defines value for (0, 0)
  5077. * @param m01 defines value for (0, 1)
  5078. * @param m10 defines value for (1, 0)
  5079. * @param m11 defines value for (1, 1)
  5080. * @param m20 defines value for (2, 0)
  5081. * @param m21 defines value for (2, 1)
  5082. */
  5083. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  5084. /**
  5085. * Fills the matrix from direct values
  5086. * @param m00 defines value for (0, 0)
  5087. * @param m01 defines value for (0, 1)
  5088. * @param m10 defines value for (1, 0)
  5089. * @param m11 defines value for (1, 1)
  5090. * @param m20 defines value for (2, 0)
  5091. * @param m21 defines value for (2, 1)
  5092. * @returns the current modified matrix
  5093. */
  5094. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  5095. /**
  5096. * Gets matrix determinant
  5097. * @returns the determinant
  5098. */
  5099. determinant(): number;
  5100. /**
  5101. * Inverses the matrix and stores it in a target matrix
  5102. * @param result defines the target matrix
  5103. * @returns the current matrix
  5104. */
  5105. invertToRef(result: Matrix2D): Matrix2D;
  5106. /**
  5107. * Multiplies the current matrix with another one
  5108. * @param other defines the second operand
  5109. * @param result defines the target matrix
  5110. * @returns the current matrix
  5111. */
  5112. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  5113. /**
  5114. * Applies the current matrix to a set of 2 floats and stores the result in a vector2
  5115. * @param x defines the x coordinate to transform
  5116. * @param y defines the x coordinate to transform
  5117. * @param result defines the target vector2
  5118. * @returns the current matrix
  5119. */
  5120. transformCoordinates(x: number, y: number, result: BABYLON.Vector2): Matrix2D;
  5121. /**
  5122. * Creates an identity matrix
  5123. * @returns a new matrix
  5124. */
  5125. static Identity(): Matrix2D;
  5126. /**
  5127. * Creates a translation matrix and stores it in a target matrix
  5128. * @param x defines the x coordinate of the translation
  5129. * @param y defines the y coordinate of the translation
  5130. * @param result defines the target matrix
  5131. */
  5132. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  5133. /**
  5134. * Creates a scaling matrix and stores it in a target matrix
  5135. * @param x defines the x coordinate of the scaling
  5136. * @param y defines the y coordinate of the scaling
  5137. * @param result defines the target matrix
  5138. */
  5139. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  5140. /**
  5141. * Creates a rotation matrix and stores it in a target matrix
  5142. * @param angle defines the rotation angle
  5143. * @param result defines the target matrix
  5144. */
  5145. static RotationToRef(angle: number, result: Matrix2D): void;
  5146. private static _TempPreTranslationMatrix;
  5147. private static _TempPostTranslationMatrix;
  5148. private static _TempRotationMatrix;
  5149. private static _TempScalingMatrix;
  5150. private static _TempCompose0;
  5151. private static _TempCompose1;
  5152. private static _TempCompose2;
  5153. /**
  5154. * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
  5155. * @param tx defines the x coordinate of the translation
  5156. * @param ty defines the y coordinate of the translation
  5157. * @param angle defines the rotation angle
  5158. * @param scaleX defines the x coordinate of the scaling
  5159. * @param scaleY defines the y coordinate of the scaling
  5160. * @param parentMatrix defines the parent matrix to multiply by (can be null)
  5161. * @param result defines the target matrix
  5162. */
  5163. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: BABYLON.Nullable<Matrix2D>, result: Matrix2D): void;
  5164. }
  5165. }
  5166. declare module BABYLON.GUI {
  5167. /**
  5168. * Class used to store 2D control sizes
  5169. */
  5170. export class Measure {
  5171. /** defines left coordinate */
  5172. left: number;
  5173. /** defines top coordinate */
  5174. top: number;
  5175. /** defines width dimension */
  5176. width: number;
  5177. /** defines height dimension */
  5178. height: number;
  5179. /**
  5180. * Creates a new measure
  5181. * @param left defines left coordinate
  5182. * @param top defines top coordinate
  5183. * @param width defines width dimension
  5184. * @param height defines height dimension
  5185. */
  5186. constructor(
  5187. /** defines left coordinate */
  5188. left: number,
  5189. /** defines top coordinate */
  5190. top: number,
  5191. /** defines width dimension */
  5192. width: number,
  5193. /** defines height dimension */
  5194. height: number);
  5195. /**
  5196. * Copy from another measure
  5197. * @param other defines the other measure to copy from
  5198. */
  5199. copyFrom(other: Measure): void;
  5200. /**
  5201. * Copy from a group of 4 floats
  5202. * @param left defines left coordinate
  5203. * @param top defines top coordinate
  5204. * @param width defines width dimension
  5205. * @param height defines height dimension
  5206. */
  5207. copyFromFloats(left: number, top: number, width: number, height: number): void;
  5208. /**
  5209. * Computes the axis aligned bounding box measure for two given measures
  5210. * @param a Input measure
  5211. * @param b Input measure
  5212. * @param result the resulting bounding measure
  5213. */
  5214. static CombineToRef(a: Measure, b: Measure, result: Measure): void;
  5215. /**
  5216. * Computes the axis aligned bounding box of the measure after it is modified by a given transform
  5217. * @param transform the matrix to transform the measure before computing the AABB
  5218. * @param addX number to add to left
  5219. * @param addY number to add to top
  5220. * @param addWidth number to add to width
  5221. * @param addHeight number to add to height
  5222. * @param result the resulting AABB
  5223. */
  5224. addAndTransformToRef(transform: Matrix2D, addX: number, addY: number, addWidth: number, addHeight: number, result: Measure): void;
  5225. /**
  5226. * Computes the axis aligned bounding box of the measure after it is modified by a given transform
  5227. * @param transform the matrix to transform the measure before computing the AABB
  5228. * @param result the resulting AABB
  5229. */
  5230. transformToRef(transform: Matrix2D, result: Measure): void;
  5231. /**
  5232. * Check equality between this measure and another one
  5233. * @param other defines the other measures
  5234. * @returns true if both measures are equals
  5235. */
  5236. isEqualsTo(other: Measure): boolean;
  5237. /**
  5238. * Creates an empty measure
  5239. * @returns a new measure
  5240. */
  5241. static Empty(): Measure;
  5242. }
  5243. }
  5244. declare module BABYLON.GUI {
  5245. /**
  5246. * Class used to create texture to support 2D GUI elements
  5247. * @see https://doc.babylonjs.com/how_to/gui
  5248. */
  5249. export class AdvancedDynamicTexture extends BABYLON.DynamicTexture {
  5250. /** Define the Uurl to load snippets */
  5251. static SnippetUrl: string;
  5252. /** Snippet ID if the content was created from the snippet server */
  5253. snippetId: string;
  5254. private _isDirty;
  5255. private _renderObserver;
  5256. private _resizeObserver;
  5257. private _preKeyboardObserver;
  5258. private _pointerMoveObserver;
  5259. private _pointerObserver;
  5260. private _canvasPointerOutObserver;
  5261. private _canvasBlurObserver;
  5262. private _background;
  5263. /** @hidden */
  5264. _rootContainer: Container;
  5265. /** @hidden */
  5266. _lastPickedControl: Control;
  5267. /** @hidden */
  5268. _lastControlOver: {
  5269. [pointerId: number]: Control;
  5270. };
  5271. /** @hidden */
  5272. _lastControlDown: {
  5273. [pointerId: number]: Control;
  5274. };
  5275. /** @hidden */
  5276. _capturingControl: {
  5277. [pointerId: number]: Control;
  5278. };
  5279. /** @hidden */
  5280. _shouldBlockPointer: boolean;
  5281. /** @hidden */
  5282. _layerToDispose: BABYLON.Nullable<BABYLON.Layer>;
  5283. /** @hidden */
  5284. _linkedControls: Control[];
  5285. private _isFullscreen;
  5286. private _fullscreenViewport;
  5287. private _idealWidth;
  5288. private _idealHeight;
  5289. private _useSmallestIdeal;
  5290. private _renderAtIdealSize;
  5291. private _focusedControl;
  5292. private _blockNextFocusCheck;
  5293. private _renderScale;
  5294. private _rootElement;
  5295. private _cursorChanged;
  5296. private _defaultMousePointerId;
  5297. /** @hidden */
  5298. _numLayoutCalls: number;
  5299. /** Gets the number of layout calls made the last time the ADT has been rendered */
  5300. get numLayoutCalls(): number;
  5301. /** @hidden */
  5302. _numRenderCalls: number;
  5303. /** Gets the number of render calls made the last time the ADT has been rendered */
  5304. get numRenderCalls(): number;
  5305. /**
  5306. * Define type to string to ensure compatibility across browsers
  5307. * Safari doesn't support DataTransfer constructor
  5308. */
  5309. private _clipboardData;
  5310. /**
  5311. * BABYLON.Observable event triggered each time an clipboard event is received from the rendering canvas
  5312. */
  5313. onClipboardObservable: BABYLON.Observable<BABYLON.ClipboardInfo>;
  5314. /**
  5315. * BABYLON.Observable event triggered each time a pointer down is intercepted by a control
  5316. */
  5317. onControlPickedObservable: BABYLON.Observable<Control>;
  5318. /**
  5319. * BABYLON.Observable event triggered before layout is evaluated
  5320. */
  5321. onBeginLayoutObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  5322. /**
  5323. * BABYLON.Observable event triggered after the layout was evaluated
  5324. */
  5325. onEndLayoutObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  5326. /**
  5327. * BABYLON.Observable event triggered before the texture is rendered
  5328. */
  5329. onBeginRenderObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  5330. /**
  5331. * BABYLON.Observable event triggered after the texture was rendered
  5332. */
  5333. onEndRenderObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  5334. /**
  5335. * Gets or sets a boolean defining if alpha is stored as premultiplied
  5336. */
  5337. premulAlpha: boolean;
  5338. /**
  5339. * Gets or sets a boolean indicating that the canvas must be reverted on Y when updating the texture
  5340. */
  5341. applyYInversionOnUpdate: boolean;
  5342. /**
  5343. * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
  5344. * Useful when you want more antialiasing
  5345. */
  5346. get renderScale(): number;
  5347. set renderScale(value: number);
  5348. /** Gets or sets the background color */
  5349. get background(): string;
  5350. set background(value: string);
  5351. /**
  5352. * Gets or sets the ideal width used to design controls.
  5353. * The GUI will then rescale everything accordingly
  5354. * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
  5355. */
  5356. get idealWidth(): number;
  5357. set idealWidth(value: number);
  5358. /**
  5359. * Gets or sets the ideal height used to design controls.
  5360. * The GUI will then rescale everything accordingly
  5361. * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
  5362. */
  5363. get idealHeight(): number;
  5364. set idealHeight(value: number);
  5365. /**
  5366. * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
  5367. * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
  5368. */
  5369. get useSmallestIdeal(): boolean;
  5370. set useSmallestIdeal(value: boolean);
  5371. /**
  5372. * Gets or sets a boolean indicating if adaptive scaling must be used
  5373. * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
  5374. */
  5375. get renderAtIdealSize(): boolean;
  5376. set renderAtIdealSize(value: boolean);
  5377. /**
  5378. * Gets the ratio used when in "ideal mode"
  5379. * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
  5380. * */
  5381. get idealRatio(): number;
  5382. /**
  5383. * Gets the underlying layer used to render the texture when in fullscreen mode
  5384. */
  5385. get layer(): BABYLON.Nullable<BABYLON.Layer>;
  5386. /**
  5387. * Gets the root container control
  5388. */
  5389. get rootContainer(): Container;
  5390. /**
  5391. * Returns an array containing the root container.
  5392. * This is mostly used to let the Inspector introspects the ADT
  5393. * @returns an array containing the rootContainer
  5394. */
  5395. getChildren(): Array<Container>;
  5396. /**
  5397. * Will return all controls that are inside this texture
  5398. * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
  5399. * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
  5400. * @return all child controls
  5401. */
  5402. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  5403. /**
  5404. * Gets or sets the current focused control
  5405. */
  5406. get focusedControl(): BABYLON.Nullable<IFocusableControl>;
  5407. set focusedControl(control: BABYLON.Nullable<IFocusableControl>);
  5408. /**
  5409. * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
  5410. */
  5411. get isForeground(): boolean;
  5412. set isForeground(value: boolean);
  5413. /**
  5414. * Gets or set information about clipboardData
  5415. */
  5416. get clipboardData(): string;
  5417. set clipboardData(value: string);
  5418. /**
  5419. * Creates a new AdvancedDynamicTexture
  5420. * @param name defines the name of the texture
  5421. * @param width defines the width of the texture
  5422. * @param height defines the height of the texture
  5423. * @param scene defines the hosting scene
  5424. * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
  5425. * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
  5426. * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)
  5427. */
  5428. constructor(name: string, width: number | undefined, height: number | undefined, scene: BABYLON.Nullable<BABYLON.Scene>, generateMipMaps?: boolean, samplingMode?: number, invertY?: boolean);
  5429. /**
  5430. * Get the current class name of the texture useful for serialization or dynamic coding.
  5431. * @returns "AdvancedDynamicTexture"
  5432. */
  5433. getClassName(): string;
  5434. /**
  5435. * Function used to execute a function on all controls
  5436. * @param func defines the function to execute
  5437. * @param container defines the container where controls belong. If null the root container will be used
  5438. */
  5439. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  5440. private _useInvalidateRectOptimization;
  5441. /**
  5442. * Gets or sets a boolean indicating if the InvalidateRect optimization should be turned on
  5443. */
  5444. get useInvalidateRectOptimization(): boolean;
  5445. set useInvalidateRectOptimization(value: boolean);
  5446. private _invalidatedRectangle;
  5447. /**
  5448. * Invalidates a rectangle area on the gui texture
  5449. * @param invalidMinX left most position of the rectangle to invalidate in the texture
  5450. * @param invalidMinY top most position of the rectangle to invalidate in the texture
  5451. * @param invalidMaxX right most position of the rectangle to invalidate in the texture
  5452. * @param invalidMaxY bottom most position of the rectangle to invalidate in the texture
  5453. */
  5454. invalidateRect(invalidMinX: number, invalidMinY: number, invalidMaxX: number, invalidMaxY: number): void;
  5455. /**
  5456. * Marks the texture as dirty forcing a complete update
  5457. */
  5458. markAsDirty(): void;
  5459. /**
  5460. * Helper function used to create a new style
  5461. * @returns a new style
  5462. * @see https://doc.babylonjs.com/how_to/gui#styles
  5463. */
  5464. createStyle(): Style;
  5465. /**
  5466. * Adds a new control to the root container
  5467. * @param control defines the control to add
  5468. * @returns the current texture
  5469. */
  5470. addControl(control: Control): AdvancedDynamicTexture;
  5471. /**
  5472. * Removes a control from the root container
  5473. * @param control defines the control to remove
  5474. * @returns the current texture
  5475. */
  5476. removeControl(control: Control): AdvancedDynamicTexture;
  5477. /**
  5478. * Release all resources
  5479. */
  5480. dispose(): void;
  5481. private _onResize;
  5482. /** @hidden */
  5483. _getGlobalViewport(scene: BABYLON.Scene): BABYLON.Viewport;
  5484. /**
  5485. * Get screen coordinates for a vector3
  5486. * @param position defines the position to project
  5487. * @param worldMatrix defines the world matrix to use
  5488. * @returns the projected position
  5489. */
  5490. getProjectedPosition(position: BABYLON.Vector3, worldMatrix: BABYLON.Matrix): BABYLON.Vector2;
  5491. /**
  5492. * Get screen coordinates for a vector3
  5493. * @param position defines the position to project
  5494. * @param worldMatrix defines the world matrix to use
  5495. * @returns the projected position with Z
  5496. */
  5497. getProjectedPositionWithZ(position: BABYLON.Vector3, worldMatrix: BABYLON.Matrix): BABYLON.Vector3;
  5498. private _checkUpdate;
  5499. private _clearMeasure;
  5500. private _render;
  5501. /** @hidden */
  5502. _changeCursor(cursor: string): void;
  5503. /** @hidden */
  5504. _registerLastControlDown(control: Control, pointerId: number): void;
  5505. private _doPicking;
  5506. /** @hidden */
  5507. _cleanControlAfterRemovalFromList(list: {
  5508. [pointerId: number]: Control;
  5509. }, control: Control): void;
  5510. /** @hidden */
  5511. _cleanControlAfterRemoval(control: Control): void;
  5512. /** Attach to all scene events required to support pointer events */
  5513. attach(): void;
  5514. /** @hidden */
  5515. private onClipboardCopy;
  5516. /** @hidden */
  5517. private onClipboardCut;
  5518. /** @hidden */
  5519. private onClipboardPaste;
  5520. /**
  5521. * Register the clipboard Events onto the canvas
  5522. */
  5523. registerClipboardEvents(): void;
  5524. /**
  5525. * Unregister the clipboard Events from the canvas
  5526. */
  5527. unRegisterClipboardEvents(): void;
  5528. /**
  5529. * Connect the texture to a hosting mesh to enable interactions
  5530. * @param mesh defines the mesh to attach to
  5531. * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
  5532. */
  5533. attachToMesh(mesh: BABYLON.AbstractMesh, supportPointerMove?: boolean): void;
  5534. /**
  5535. * Move the focus to a specific control
  5536. * @param control defines the control which will receive the focus
  5537. */
  5538. moveFocusToControl(control: IFocusableControl): void;
  5539. private _manageFocus;
  5540. private _attachToOnPointerOut;
  5541. private _attachToOnBlur;
  5542. /**
  5543. * Serializes the entire GUI system
  5544. * @returns an object with the JSON serialized data
  5545. */
  5546. serializeContent(): any;
  5547. /**
  5548. * Recreate the content of the ADT from a JSON object
  5549. * @param serializedObject define the JSON serialized object to restore from
  5550. */
  5551. parseContent(serializedObject: any): void;
  5552. /**
  5553. * Recreate the content of the ADT from a snippet saved by the GUI editor
  5554. * @param snippetId defines the snippet to load
  5555. * @returns a promise that will resolve on success
  5556. */
  5557. parseFromSnippetAsync(snippetId: string): Promise<void>;
  5558. /**
  5559. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
  5560. * @param mesh defines the mesh which will receive the texture
  5561. * @param width defines the texture width (1024 by default)
  5562. * @param height defines the texture height (1024 by default)
  5563. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  5564. * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)
  5565. * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)
  5566. * @returns a new AdvancedDynamicTexture
  5567. */
  5568. static CreateForMesh(mesh: BABYLON.AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, onlyAlphaTesting?: boolean, invertY?: boolean): AdvancedDynamicTexture;
  5569. /**
  5570. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh) BUT do not create a new material for the mesh. You will be responsible for connecting the texture
  5571. * @param mesh defines the mesh which will receive the texture
  5572. * @param width defines the texture width (1024 by default)
  5573. * @param height defines the texture height (1024 by default)
  5574. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  5575. * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)
  5576. * @returns a new AdvancedDynamicTexture
  5577. */
  5578. static CreateForMeshTexture(mesh: BABYLON.AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, invertY?: boolean): AdvancedDynamicTexture;
  5579. /**
  5580. * Creates a new AdvancedDynamicTexture in fullscreen mode.
  5581. * In this mode the texture will rely on a layer for its rendering.
  5582. * This allows it to be treated like any other layer.
  5583. * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
  5584. * LayerMask is set through advancedTexture.layer.layerMask
  5585. * @param name defines name for the texture
  5586. * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
  5587. * @param scene defines the hsoting scene
  5588. * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
  5589. * @returns a new AdvancedDynamicTexture
  5590. */
  5591. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: BABYLON.Nullable<BABYLON.Scene>, sampling?: number): AdvancedDynamicTexture;
  5592. }
  5593. }
  5594. declare module BABYLON.GUI {
  5595. /**
  5596. * Root class used for all 2D controls
  5597. * @see https://doc.babylonjs.com/how_to/gui#controls
  5598. */
  5599. export class Control {
  5600. /** defines the name of the control */
  5601. name?: string | undefined;
  5602. /**
  5603. * Gets or sets a boolean indicating if alpha must be an inherited value (false by default)
  5604. */
  5605. static AllowAlphaInheritance: boolean;
  5606. private _alpha;
  5607. private _alphaSet;
  5608. private _zIndex;
  5609. /** @hidden */
  5610. _host: AdvancedDynamicTexture;
  5611. /** Gets or sets the control parent */
  5612. parent: BABYLON.Nullable<Container>;
  5613. /** @hidden */
  5614. _currentMeasure: Measure;
  5615. private _fontFamily;
  5616. private _fontStyle;
  5617. private _fontWeight;
  5618. private _fontSize;
  5619. private _font;
  5620. /** @hidden */
  5621. _width: ValueAndUnit;
  5622. /** @hidden */
  5623. _height: ValueAndUnit;
  5624. /** @hidden */
  5625. protected _fontOffset: {
  5626. ascent: number;
  5627. height: number;
  5628. descent: number;
  5629. };
  5630. private _color;
  5631. private _style;
  5632. private _styleObserver;
  5633. /** @hidden */
  5634. protected _horizontalAlignment: number;
  5635. /** @hidden */
  5636. protected _verticalAlignment: number;
  5637. /** @hidden */
  5638. protected _isDirty: boolean;
  5639. /** @hidden */
  5640. protected _wasDirty: boolean;
  5641. /** @hidden */
  5642. _tempParentMeasure: Measure;
  5643. /** @hidden */
  5644. _prevCurrentMeasureTransformedIntoGlobalSpace: Measure;
  5645. /** @hidden */
  5646. protected _cachedParentMeasure: Measure;
  5647. private _paddingLeft;
  5648. private _paddingRight;
  5649. private _paddingTop;
  5650. private _paddingBottom;
  5651. /** @hidden */
  5652. _left: ValueAndUnit;
  5653. /** @hidden */
  5654. _top: ValueAndUnit;
  5655. private _scaleX;
  5656. private _scaleY;
  5657. private _rotation;
  5658. private _transformCenterX;
  5659. private _transformCenterY;
  5660. /** @hidden */
  5661. _transformMatrix: Matrix2D;
  5662. /** @hidden */
  5663. protected _invertTransformMatrix: Matrix2D;
  5664. /** @hidden */
  5665. protected _transformedPosition: BABYLON.Vector2;
  5666. private _isMatrixDirty;
  5667. private _cachedOffsetX;
  5668. private _cachedOffsetY;
  5669. private _isVisible;
  5670. private _isHighlighted;
  5671. /** @hidden */
  5672. _linkedMesh: BABYLON.Nullable<BABYLON.TransformNode>;
  5673. private _fontSet;
  5674. private _dummyVector2;
  5675. private _downCount;
  5676. private _enterCount;
  5677. private _doNotRender;
  5678. private _downPointerIds;
  5679. protected _isEnabled: boolean;
  5680. protected _disabledColor: string;
  5681. protected _disabledColorItem: string;
  5682. /** @hidden */
  5683. protected _rebuildLayout: boolean;
  5684. /** @hidden */
  5685. _customData: any;
  5686. /** @hidden */
  5687. _isClipped: boolean;
  5688. /** @hidden */
  5689. _automaticSize: boolean;
  5690. /** @hidden */
  5691. _tag: any;
  5692. /**
  5693. * Gets or sets the unique id of the node. Please note that this number will be updated when the control is added to a container
  5694. */
  5695. uniqueId: number;
  5696. /**
  5697. * Gets or sets an object used to store user defined information for the node
  5698. */
  5699. metadata: any;
  5700. /** Gets or sets a boolean indicating if the control can be hit with pointer events */
  5701. isHitTestVisible: boolean;
  5702. /** Gets or sets a boolean indicating if the control can block pointer events */
  5703. isPointerBlocker: boolean;
  5704. /** Gets or sets a boolean indicating if the control can be focusable */
  5705. isFocusInvisible: boolean;
  5706. /**
  5707. * Gets or sets a boolean indicating if the children are clipped to the current control bounds.
  5708. * Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
  5709. */
  5710. clipChildren: boolean;
  5711. /**
  5712. * Gets or sets a boolean indicating that control content must be clipped
  5713. * Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
  5714. */
  5715. clipContent: boolean;
  5716. /**
  5717. * Gets or sets a boolean indicating that the current control should cache its rendering (useful when the control does not change often)
  5718. */
  5719. useBitmapCache: boolean;
  5720. private _cacheData;
  5721. private _shadowOffsetX;
  5722. /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
  5723. get shadowOffsetX(): number;
  5724. set shadowOffsetX(value: number);
  5725. private _shadowOffsetY;
  5726. /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
  5727. get shadowOffsetY(): number;
  5728. set shadowOffsetY(value: number);
  5729. private _shadowBlur;
  5730. /** Gets or sets a value indicating the amount of blur to use to render the shadow */
  5731. get shadowBlur(): number;
  5732. set shadowBlur(value: number);
  5733. private _shadowColor;
  5734. /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
  5735. get shadowColor(): string;
  5736. set shadowColor(value: string);
  5737. /** Gets or sets the cursor to use when the control is hovered */
  5738. hoverCursor: string;
  5739. /** @hidden */
  5740. protected _linkOffsetX: ValueAndUnit;
  5741. /** @hidden */
  5742. protected _linkOffsetY: ValueAndUnit;
  5743. /** Gets the control type name */
  5744. get typeName(): string;
  5745. /**
  5746. * Get the current class name of the control.
  5747. * @returns current class name
  5748. */
  5749. getClassName(): string;
  5750. /**
  5751. * An event triggered when pointer wheel is scrolled
  5752. */
  5753. onWheelObservable: BABYLON.Observable<BABYLON.Vector2>;
  5754. /**
  5755. * An event triggered when the pointer move over the control.
  5756. */
  5757. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector2>;
  5758. /**
  5759. * An event triggered when the pointer move out of the control.
  5760. */
  5761. onPointerOutObservable: BABYLON.Observable<Control>;
  5762. /**
  5763. * An event triggered when the pointer taps the control
  5764. */
  5765. onPointerDownObservable: BABYLON.Observable<Vector2WithInfo>;
  5766. /**
  5767. * An event triggered when pointer up
  5768. */
  5769. onPointerUpObservable: BABYLON.Observable<Vector2WithInfo>;
  5770. /**
  5771. * An event triggered when a control is clicked on
  5772. */
  5773. onPointerClickObservable: BABYLON.Observable<Vector2WithInfo>;
  5774. /**
  5775. * An event triggered when pointer enters the control
  5776. */
  5777. onPointerEnterObservable: BABYLON.Observable<Control>;
  5778. /**
  5779. * An event triggered when the control is marked as dirty
  5780. */
  5781. onDirtyObservable: BABYLON.Observable<Control>;
  5782. /**
  5783. * An event triggered before drawing the control
  5784. */
  5785. onBeforeDrawObservable: BABYLON.Observable<Control>;
  5786. /**
  5787. * An event triggered after the control was drawn
  5788. */
  5789. onAfterDrawObservable: BABYLON.Observable<Control>;
  5790. /**
  5791. * An event triggered when the control has been disposed
  5792. */
  5793. onDisposeObservable: BABYLON.Observable<Control>;
  5794. /**
  5795. * Get the hosting AdvancedDynamicTexture
  5796. */
  5797. get host(): AdvancedDynamicTexture;
  5798. /** Gets or set information about font offsets (used to render and align text) */
  5799. get fontOffset(): {
  5800. ascent: number;
  5801. height: number;
  5802. descent: number;
  5803. };
  5804. set fontOffset(offset: {
  5805. ascent: number;
  5806. height: number;
  5807. descent: number;
  5808. });
  5809. /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
  5810. get alpha(): number;
  5811. set alpha(value: number);
  5812. /**
  5813. * Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)
  5814. */
  5815. get isHighlighted(): boolean;
  5816. set isHighlighted(value: boolean);
  5817. /** Gets or sets a value indicating the scale factor on X axis (1 by default)
  5818. * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  5819. */
  5820. get scaleX(): number;
  5821. set scaleX(value: number);
  5822. /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
  5823. * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  5824. */
  5825. get scaleY(): number;
  5826. set scaleY(value: number);
  5827. /** Gets or sets the rotation angle (0 by default)
  5828. * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  5829. */
  5830. get rotation(): number;
  5831. set rotation(value: number);
  5832. /** Gets or sets the transformation center on Y axis (0 by default)
  5833. * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  5834. */
  5835. get transformCenterY(): number;
  5836. set transformCenterY(value: number);
  5837. /** Gets or sets the transformation center on X axis (0 by default)
  5838. * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  5839. */
  5840. get transformCenterX(): number;
  5841. set transformCenterX(value: number);
  5842. /**
  5843. * Gets or sets the horizontal alignment
  5844. * @see https://doc.babylonjs.com/how_to/gui#alignments
  5845. */
  5846. get horizontalAlignment(): number;
  5847. set horizontalAlignment(value: number);
  5848. /**
  5849. * Gets or sets the vertical alignment
  5850. * @see https://doc.babylonjs.com/how_to/gui#alignments
  5851. */
  5852. get verticalAlignment(): number;
  5853. set verticalAlignment(value: number);
  5854. /**
  5855. * Gets or sets a fixed ratio for this control.
  5856. * When different from 0, the ratio is used to compute the "second" dimension.
  5857. * The first dimension used in the computation is the last one set (by setting width / widthInPixels or height / heightInPixels), and the
  5858. * second dimension is computed as first dimension * fixedRatio
  5859. */
  5860. fixedRatio: number;
  5861. private _fixedRatioMasterIsWidth;
  5862. /**
  5863. * Gets or sets control width
  5864. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  5865. */
  5866. get width(): string | number;
  5867. set width(value: string | number);
  5868. /**
  5869. * Gets or sets the control width in pixel
  5870. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  5871. */
  5872. get widthInPixels(): number;
  5873. set widthInPixels(value: number);
  5874. /**
  5875. * Gets or sets control height
  5876. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  5877. */
  5878. get height(): string | number;
  5879. set height(value: string | number);
  5880. /**
  5881. * Gets or sets control height in pixel
  5882. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  5883. */
  5884. get heightInPixels(): number;
  5885. set heightInPixels(value: number);
  5886. /** Gets or set font family */
  5887. get fontFamily(): string;
  5888. set fontFamily(value: string);
  5889. /** Gets or sets font style */
  5890. get fontStyle(): string;
  5891. set fontStyle(value: string);
  5892. /** Gets or sets font weight */
  5893. get fontWeight(): string;
  5894. set fontWeight(value: string);
  5895. /**
  5896. * Gets or sets style
  5897. * @see https://doc.babylonjs.com/how_to/gui#styles
  5898. */
  5899. get style(): BABYLON.Nullable<Style>;
  5900. set style(value: BABYLON.Nullable<Style>);
  5901. /** @hidden */
  5902. get _isFontSizeInPercentage(): boolean;
  5903. /** Gets or sets font size in pixels */
  5904. get fontSizeInPixels(): number;
  5905. set fontSizeInPixels(value: number);
  5906. /** Gets or sets font size */
  5907. get fontSize(): string | number;
  5908. set fontSize(value: string | number);
  5909. /** Gets or sets foreground color */
  5910. get color(): string;
  5911. set color(value: string);
  5912. /** Gets or sets z index which is used to reorder controls on the z axis */
  5913. get zIndex(): number;
  5914. set zIndex(value: number);
  5915. /** Gets or sets a boolean indicating if the control can be rendered */
  5916. get notRenderable(): boolean;
  5917. set notRenderable(value: boolean);
  5918. /** Gets or sets a boolean indicating if the control is visible */
  5919. get isVisible(): boolean;
  5920. set isVisible(value: boolean);
  5921. /** Gets a boolean indicating that the control needs to update its rendering */
  5922. get isDirty(): boolean;
  5923. /**
  5924. * Gets the current linked mesh (or null if none)
  5925. */
  5926. get linkedMesh(): BABYLON.Nullable<BABYLON.TransformNode>;
  5927. /**
  5928. * Gets or sets a value indicating the padding to use on the left of the control
  5929. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  5930. */
  5931. get paddingLeft(): string | number;
  5932. set paddingLeft(value: string | number);
  5933. /**
  5934. * Gets or sets a value indicating the padding in pixels to use on the left of the control
  5935. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  5936. */
  5937. get paddingLeftInPixels(): number;
  5938. set paddingLeftInPixels(value: number);
  5939. /**
  5940. * Gets or sets a value indicating the padding to use on the right of the control
  5941. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  5942. */
  5943. get paddingRight(): string | number;
  5944. set paddingRight(value: string | number);
  5945. /**
  5946. * Gets or sets a value indicating the padding in pixels to use on the right of the control
  5947. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  5948. */
  5949. get paddingRightInPixels(): number;
  5950. set paddingRightInPixels(value: number);
  5951. /**
  5952. * Gets or sets a value indicating the padding to use on the top of the control
  5953. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  5954. */
  5955. get paddingTop(): string | number;
  5956. set paddingTop(value: string | number);
  5957. /**
  5958. * Gets or sets a value indicating the padding in pixels to use on the top of the control
  5959. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  5960. */
  5961. get paddingTopInPixels(): number;
  5962. set paddingTopInPixels(value: number);
  5963. /**
  5964. * Gets or sets a value indicating the padding to use on the bottom of the control
  5965. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  5966. */
  5967. get paddingBottom(): string | number;
  5968. set paddingBottom(value: string | number);
  5969. /**
  5970. * Gets or sets a value indicating the padding in pixels to use on the bottom of the control
  5971. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  5972. */
  5973. get paddingBottomInPixels(): number;
  5974. set paddingBottomInPixels(value: number);
  5975. /**
  5976. * Gets or sets a value indicating the left coordinate of the control
  5977. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  5978. */
  5979. get left(): string | number;
  5980. set left(value: string | number);
  5981. /**
  5982. * Gets or sets a value indicating the left coordinate in pixels of the control
  5983. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  5984. */
  5985. get leftInPixels(): number;
  5986. set leftInPixels(value: number);
  5987. /**
  5988. * Gets or sets a value indicating the top coordinate of the control
  5989. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  5990. */
  5991. get top(): string | number;
  5992. set top(value: string | number);
  5993. /**
  5994. * Gets or sets a value indicating the top coordinate in pixels of the control
  5995. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  5996. */
  5997. get topInPixels(): number;
  5998. set topInPixels(value: number);
  5999. /**
  6000. * Gets or sets a value indicating the offset on X axis to the linked mesh
  6001. * @see https://doc.babylonjs.com/how_to/gui#tracking-positions
  6002. */
  6003. get linkOffsetX(): string | number;
  6004. set linkOffsetX(value: string | number);
  6005. /**
  6006. * Gets or sets a value indicating the offset in pixels on X axis to the linked mesh
  6007. * @see https://doc.babylonjs.com/how_to/gui#tracking-positions
  6008. */
  6009. get linkOffsetXInPixels(): number;
  6010. set linkOffsetXInPixels(value: number);
  6011. /**
  6012. * Gets or sets a value indicating the offset on Y axis to the linked mesh
  6013. * @see https://doc.babylonjs.com/how_to/gui#tracking-positions
  6014. */
  6015. get linkOffsetY(): string | number;
  6016. set linkOffsetY(value: string | number);
  6017. /**
  6018. * Gets or sets a value indicating the offset in pixels on Y axis to the linked mesh
  6019. * @see https://doc.babylonjs.com/how_to/gui#tracking-positions
  6020. */
  6021. get linkOffsetYInPixels(): number;
  6022. set linkOffsetYInPixels(value: number);
  6023. /** Gets the center coordinate on X axis */
  6024. get centerX(): number;
  6025. /** Gets the center coordinate on Y axis */
  6026. get centerY(): number;
  6027. /** Gets or sets if control is Enabled */
  6028. get isEnabled(): boolean;
  6029. set isEnabled(value: boolean);
  6030. /** Gets or sets background color of control if it's disabled */
  6031. get disabledColor(): string;
  6032. set disabledColor(value: string);
  6033. /** Gets or sets front color of control if it's disabled */
  6034. get disabledColorItem(): string;
  6035. set disabledColorItem(value: string);
  6036. /**
  6037. * Creates a new control
  6038. * @param name defines the name of the control
  6039. */
  6040. constructor(
  6041. /** defines the name of the control */
  6042. name?: string | undefined);
  6043. /** @hidden */
  6044. protected _getTypeName(): string;
  6045. /**
  6046. * Gets the first ascendant in the hierarchy of the given type
  6047. * @param className defines the required type
  6048. * @returns the ascendant or null if not found
  6049. */
  6050. getAscendantOfClass(className: string): BABYLON.Nullable<Control>;
  6051. /** @hidden */
  6052. _resetFontCache(): void;
  6053. /**
  6054. * Determines if a container is an ascendant of the current control
  6055. * @param container defines the container to look for
  6056. * @returns true if the container is one of the ascendant of the control
  6057. */
  6058. isAscendant(container: Control): boolean;
  6059. /**
  6060. * Gets coordinates in local control space
  6061. * @param globalCoordinates defines the coordinates to transform
  6062. * @returns the new coordinates in local space
  6063. */
  6064. getLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  6065. /**
  6066. * Gets coordinates in local control space
  6067. * @param globalCoordinates defines the coordinates to transform
  6068. * @param result defines the target vector2 where to store the result
  6069. * @returns the current control
  6070. */
  6071. getLocalCoordinatesToRef(globalCoordinates: BABYLON.Vector2, result: BABYLON.Vector2): Control;
  6072. /**
  6073. * Gets coordinates in parent local control space
  6074. * @param globalCoordinates defines the coordinates to transform
  6075. * @returns the new coordinates in parent local space
  6076. */
  6077. getParentLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  6078. /**
  6079. * Move the current control to a vector3 position projected onto the screen.
  6080. * @param position defines the target position
  6081. * @param scene defines the hosting scene
  6082. */
  6083. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene): void;
  6084. /**
  6085. * Will store all controls that have this control as ascendant in a given array
  6086. * @param results defines the array where to store the descendants
  6087. * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
  6088. * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
  6089. */
  6090. getDescendantsToRef(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  6091. /**
  6092. * Will return all controls that have this control as ascendant
  6093. * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
  6094. * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
  6095. * @return all child controls
  6096. */
  6097. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  6098. /**
  6099. * Link current control with a target mesh
  6100. * @param mesh defines the mesh to link with
  6101. * @see https://doc.babylonjs.com/how_to/gui#tracking-positions
  6102. */
  6103. linkWithMesh(mesh: BABYLON.Nullable<BABYLON.TransformNode>): void;
  6104. /**
  6105. * Shorthand funtion to set the top, right, bottom, and left padding values on the control.
  6106. * @param { string | number} paddingTop - The value of the top padding.
  6107. * @param { string | number} paddingRight - The value of the right padding. If omitted, top is used.
  6108. * @param { string | number} paddingBottom - The value of the bottom padding. If omitted, top is used.
  6109. * @param { string | number} paddingLeft - The value of the left padding. If omitted, right is used.
  6110. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  6111. */
  6112. setPadding(paddingTop: string | number, paddingRight?: string | number, paddingBottom?: string | number, paddingLeft?: string | number): void;
  6113. /**
  6114. * Shorthand funtion to set the top, right, bottom, and left padding values in pixels on the control.
  6115. * @param { number} paddingTop - The value in pixels of the top padding.
  6116. * @param { number} paddingRight - The value in pixels of the right padding. If omitted, top is used.
  6117. * @param { number} paddingBottom - The value in pixels of the bottom padding. If omitted, top is used.
  6118. * @param { number} paddingLeft - The value in pixels of the left padding. If omitted, right is used.
  6119. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  6120. */
  6121. setPaddingInPixels(paddingTop: number, paddingRight?: number, paddingBottom?: number, paddingLeft?: number): void;
  6122. /** @hidden */
  6123. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3): void;
  6124. /** @hidden */
  6125. _offsetLeft(offset: number): void;
  6126. /** @hidden */
  6127. _offsetTop(offset: number): void;
  6128. /** @hidden */
  6129. _markMatrixAsDirty(): void;
  6130. /** @hidden */
  6131. _flagDescendantsAsMatrixDirty(): void;
  6132. /** @hidden */
  6133. _intersectsRect(rect: Measure): boolean;
  6134. /** @hidden */
  6135. protected invalidateRect(): void;
  6136. /** @hidden */
  6137. _markAsDirty(force?: boolean): void;
  6138. /** @hidden */
  6139. _markAllAsDirty(): void;
  6140. /** @hidden */
  6141. _link(host: AdvancedDynamicTexture): void;
  6142. /** @hidden */
  6143. protected _transform(context?: CanvasRenderingContext2D): void;
  6144. /** @hidden */
  6145. _renderHighlight(context: CanvasRenderingContext2D): void;
  6146. /** @hidden */
  6147. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  6148. /** @hidden */
  6149. protected _applyStates(context: CanvasRenderingContext2D): void;
  6150. /** @hidden */
  6151. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  6152. /** @hidden */
  6153. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6154. protected _evaluateClippingState(parentMeasure: Measure): void;
  6155. /** @hidden */
  6156. _measure(): void;
  6157. /** @hidden */
  6158. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6159. /** @hidden */
  6160. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6161. /** @hidden */
  6162. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6163. /** @hidden */
  6164. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  6165. private static _ClipMeasure;
  6166. private _tmpMeasureA;
  6167. private _clip;
  6168. /** @hidden */
  6169. _render(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): boolean;
  6170. /** @hidden */
  6171. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  6172. /**
  6173. * Tests if a given coordinates belong to the current control
  6174. * @param x defines x coordinate to test
  6175. * @param y defines y coordinate to test
  6176. * @returns true if the coordinates are inside the control
  6177. */
  6178. contains(x: number, y: number): boolean;
  6179. /** @hidden */
  6180. _processPicking(x: number, y: number, pi: BABYLON.PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
  6181. /** @hidden */
  6182. _onPointerMove(target: Control, coordinates: BABYLON.Vector2, pointerId: number, pi: BABYLON.PointerInfoBase): void;
  6183. /** @hidden */
  6184. _onPointerEnter(target: Control, pi: BABYLON.PointerInfoBase): boolean;
  6185. /** @hidden */
  6186. _onPointerOut(target: Control, pi: BABYLON.Nullable<BABYLON.PointerInfoBase>, force?: boolean): void;
  6187. /** @hidden */
  6188. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  6189. /** @hidden */
  6190. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi?: BABYLON.PointerInfoBase): void;
  6191. /** @hidden */
  6192. _forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  6193. /** @hidden */
  6194. _onWheelScroll(deltaX?: number, deltaY?: number): void;
  6195. /** @hidden */
  6196. _onCanvasBlur(): void;
  6197. /** @hidden */
  6198. _processObservables(type: number, x: number, y: number, pi: BABYLON.PointerInfoBase, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
  6199. private _prepareFont;
  6200. /**
  6201. * Serializes the current control
  6202. * @param serializationObject defined the JSON serialized object
  6203. */
  6204. serialize(serializationObject: any): void;
  6205. /** @hidden */
  6206. _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture): void;
  6207. /** Releases associated resources */
  6208. dispose(): void;
  6209. private static _HORIZONTAL_ALIGNMENT_LEFT;
  6210. private static _HORIZONTAL_ALIGNMENT_RIGHT;
  6211. private static _HORIZONTAL_ALIGNMENT_CENTER;
  6212. private static _VERTICAL_ALIGNMENT_TOP;
  6213. private static _VERTICAL_ALIGNMENT_BOTTOM;
  6214. private static _VERTICAL_ALIGNMENT_CENTER;
  6215. /** HORIZONTAL_ALIGNMENT_LEFT */
  6216. static get HORIZONTAL_ALIGNMENT_LEFT(): number;
  6217. /** HORIZONTAL_ALIGNMENT_RIGHT */
  6218. static get HORIZONTAL_ALIGNMENT_RIGHT(): number;
  6219. /** HORIZONTAL_ALIGNMENT_CENTER */
  6220. static get HORIZONTAL_ALIGNMENT_CENTER(): number;
  6221. /** VERTICAL_ALIGNMENT_TOP */
  6222. static get VERTICAL_ALIGNMENT_TOP(): number;
  6223. /** VERTICAL_ALIGNMENT_BOTTOM */
  6224. static get VERTICAL_ALIGNMENT_BOTTOM(): number;
  6225. /** VERTICAL_ALIGNMENT_CENTER */
  6226. static get VERTICAL_ALIGNMENT_CENTER(): number;
  6227. private static _FontHeightSizes;
  6228. /** @hidden */
  6229. static _GetFontOffset(font: string): {
  6230. ascent: number;
  6231. height: number;
  6232. descent: number;
  6233. };
  6234. /**
  6235. * Creates a Control from parsed data
  6236. * @param serializedObject defines parsed data
  6237. * @param host defines the hosting AdvancedDynamicTexture
  6238. * @returns a new Control
  6239. */
  6240. static Parse(serializedObject: any, host: AdvancedDynamicTexture): Control;
  6241. /**
  6242. * Creates a stack panel that can be used to render headers
  6243. * @param control defines the control to associate with the header
  6244. * @param text defines the text of the header
  6245. * @param size defines the size of the header
  6246. * @param options defines options used to configure the header
  6247. * @returns a new StackPanel
  6248. * @ignore
  6249. * @hidden
  6250. */
  6251. static AddHeader: (control: Control, text: string, size: string | number, options: {
  6252. isHorizontal: boolean;
  6253. controlFirst: boolean;
  6254. }) => any;
  6255. /** @hidden */
  6256. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  6257. }
  6258. }
  6259. declare module BABYLON.GUI {
  6260. /**
  6261. * Root class for 2D containers
  6262. * @see https://doc.babylonjs.com/how_to/gui#containers
  6263. */
  6264. export class Container extends Control {
  6265. name?: string | undefined;
  6266. /** @hidden */
  6267. _children: Control[];
  6268. /** @hidden */
  6269. protected _measureForChildren: Measure;
  6270. /** @hidden */
  6271. protected _background: string;
  6272. /** @hidden */
  6273. protected _adaptWidthToChildren: boolean;
  6274. /** @hidden */
  6275. protected _adaptHeightToChildren: boolean;
  6276. /**
  6277. * Gets or sets a boolean indicating that layout cycle errors should be displayed on the console
  6278. */
  6279. logLayoutCycleErrors: boolean;
  6280. /**
  6281. * Gets or sets the number of layout cycles (a change involved by a control while evaluating the layout) allowed
  6282. */
  6283. maxLayoutCycle: number;
  6284. /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
  6285. get adaptHeightToChildren(): boolean;
  6286. set adaptHeightToChildren(value: boolean);
  6287. /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
  6288. get adaptWidthToChildren(): boolean;
  6289. set adaptWidthToChildren(value: boolean);
  6290. /** Gets or sets background color */
  6291. get background(): string;
  6292. set background(value: string);
  6293. /** Gets the list of children */
  6294. get children(): Control[];
  6295. /**
  6296. * Creates a new Container
  6297. * @param name defines the name of the container
  6298. */
  6299. constructor(name?: string | undefined);
  6300. protected _getTypeName(): string;
  6301. _flagDescendantsAsMatrixDirty(): void;
  6302. /**
  6303. * Gets a child using its name
  6304. * @param name defines the child name to look for
  6305. * @returns the child control if found
  6306. */
  6307. getChildByName(name: string): BABYLON.Nullable<Control>;
  6308. /**
  6309. * Gets a child using its type and its name
  6310. * @param name defines the child name to look for
  6311. * @param type defines the child type to look for
  6312. * @returns the child control if found
  6313. */
  6314. getChildByType(name: string, type: string): BABYLON.Nullable<Control>;
  6315. /**
  6316. * Search for a specific control in children
  6317. * @param control defines the control to look for
  6318. * @returns true if the control is in child list
  6319. */
  6320. containsControl(control: Control): boolean;
  6321. /**
  6322. * Adds a new control to the current container
  6323. * @param control defines the control to add
  6324. * @returns the current container
  6325. */
  6326. addControl(control: BABYLON.Nullable<Control>): Container;
  6327. /**
  6328. * Removes all controls from the current container
  6329. * @returns the current container
  6330. */
  6331. clearControls(): Container;
  6332. /**
  6333. * Removes a control from the current container
  6334. * @param control defines the control to remove
  6335. * @returns the current container
  6336. */
  6337. removeControl(control: Control): Container;
  6338. /** @hidden */
  6339. _reOrderControl(control: Control): void;
  6340. /** @hidden */
  6341. _offsetLeft(offset: number): void;
  6342. /** @hidden */
  6343. _offsetTop(offset: number): void;
  6344. /** @hidden */
  6345. _markAllAsDirty(): void;
  6346. /** @hidden */
  6347. protected _localDraw(context: CanvasRenderingContext2D): void;
  6348. /** @hidden */
  6349. _link(host: AdvancedDynamicTexture): void;
  6350. /** @hidden */
  6351. protected _beforeLayout(): void;
  6352. /** @hidden */
  6353. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6354. /** @hidden */
  6355. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  6356. protected _postMeasure(): void;
  6357. /** @hidden */
  6358. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Measure): void;
  6359. getDescendantsToRef(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  6360. /** @hidden */
  6361. _processPicking(x: number, y: number, pi: BABYLON.PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
  6362. /** @hidden */
  6363. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6364. /**
  6365. * Serializes the current control
  6366. * @param serializationObject defined the JSON serialized object
  6367. */
  6368. serialize(serializationObject: any): void;
  6369. /** Releases associated resources */
  6370. dispose(): void;
  6371. /** @hidden */
  6372. _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture): void;
  6373. }
  6374. }
  6375. declare module BABYLON.GUI {
  6376. /** Class used to create rectangle container */
  6377. export class Rectangle extends Container {
  6378. name?: string | undefined;
  6379. private _thickness;
  6380. private _cornerRadius;
  6381. /** Gets or sets border thickness */
  6382. get thickness(): number;
  6383. set thickness(value: number);
  6384. /** Gets or sets the corner radius angle */
  6385. get cornerRadius(): number;
  6386. set cornerRadius(value: number);
  6387. /**
  6388. * Creates a new Rectangle
  6389. * @param name defines the control name
  6390. */
  6391. constructor(name?: string | undefined);
  6392. protected _getTypeName(): string;
  6393. protected _localDraw(context: CanvasRenderingContext2D): void;
  6394. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6395. private _drawRoundedRect;
  6396. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  6397. }
  6398. }
  6399. declare module BABYLON.GUI {
  6400. /**
  6401. * Enum that determines the text-wrapping mode to use.
  6402. */
  6403. export enum TextWrapping {
  6404. /**
  6405. * Clip the text when it's larger than Control.width; this is the default mode.
  6406. */
  6407. Clip = 0,
  6408. /**
  6409. * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.
  6410. */
  6411. WordWrap = 1,
  6412. /**
  6413. * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.
  6414. */
  6415. Ellipsis = 2
  6416. }
  6417. /**
  6418. * Class used to create text block control
  6419. */
  6420. export class TextBlock extends Control {
  6421. /**
  6422. * Defines the name of the control
  6423. */
  6424. name?: string | undefined;
  6425. private _text;
  6426. private _textWrapping;
  6427. private _textHorizontalAlignment;
  6428. private _textVerticalAlignment;
  6429. private _lines;
  6430. private _resizeToFit;
  6431. private _lineSpacing;
  6432. private _outlineWidth;
  6433. private _outlineColor;
  6434. private _underline;
  6435. private _lineThrough;
  6436. /**
  6437. * An event triggered after the text is changed
  6438. */
  6439. onTextChangedObservable: BABYLON.Observable<TextBlock>;
  6440. /**
  6441. * An event triggered after the text was broken up into lines
  6442. */
  6443. onLinesReadyObservable: BABYLON.Observable<TextBlock>;
  6444. /**
  6445. * Function used to split a string into words. By default, a string is split at each space character found
  6446. */
  6447. wordSplittingFunction: BABYLON.Nullable<(line: string) => string[]>;
  6448. /**
  6449. * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
  6450. */
  6451. get lines(): any[];
  6452. /**
  6453. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  6454. */
  6455. get resizeToFit(): boolean;
  6456. /**
  6457. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  6458. */
  6459. set resizeToFit(value: boolean);
  6460. /**
  6461. * Gets or sets a boolean indicating if text must be wrapped
  6462. */
  6463. get textWrapping(): TextWrapping | boolean;
  6464. /**
  6465. * Gets or sets a boolean indicating if text must be wrapped
  6466. */
  6467. set textWrapping(value: TextWrapping | boolean);
  6468. /**
  6469. * Gets or sets text to display
  6470. */
  6471. get text(): string;
  6472. /**
  6473. * Gets or sets text to display
  6474. */
  6475. set text(value: string);
  6476. /**
  6477. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  6478. */
  6479. get textHorizontalAlignment(): number;
  6480. /**
  6481. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  6482. */
  6483. set textHorizontalAlignment(value: number);
  6484. /**
  6485. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  6486. */
  6487. get textVerticalAlignment(): number;
  6488. /**
  6489. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  6490. */
  6491. set textVerticalAlignment(value: number);
  6492. /**
  6493. * Gets or sets line spacing value
  6494. */
  6495. set lineSpacing(value: string | number);
  6496. /**
  6497. * Gets or sets line spacing value
  6498. */
  6499. get lineSpacing(): string | number;
  6500. /**
  6501. * Gets or sets outlineWidth of the text to display
  6502. */
  6503. get outlineWidth(): number;
  6504. /**
  6505. * Gets or sets outlineWidth of the text to display
  6506. */
  6507. set outlineWidth(value: number);
  6508. /**
  6509. * Gets or sets a boolean indicating that text must have underline
  6510. */
  6511. get underline(): boolean;
  6512. /**
  6513. * Gets or sets a boolean indicating that text must have underline
  6514. */
  6515. set underline(value: boolean);
  6516. /**
  6517. * Gets or sets an boolean indicating that text must be crossed out
  6518. */
  6519. get lineThrough(): boolean;
  6520. /**
  6521. * Gets or sets an boolean indicating that text must be crossed out
  6522. */
  6523. set lineThrough(value: boolean);
  6524. /**
  6525. * Gets or sets outlineColor of the text to display
  6526. */
  6527. get outlineColor(): string;
  6528. /**
  6529. * Gets or sets outlineColor of the text to display
  6530. */
  6531. set outlineColor(value: string);
  6532. /**
  6533. * Creates a new TextBlock object
  6534. * @param name defines the name of the control
  6535. * @param text defines the text to display (emptry string by default)
  6536. */
  6537. constructor(
  6538. /**
  6539. * Defines the name of the control
  6540. */
  6541. name?: string | undefined, text?: string);
  6542. protected _getTypeName(): string;
  6543. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6544. private _drawText;
  6545. /** @hidden */
  6546. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  6547. protected _applyStates(context: CanvasRenderingContext2D): void;
  6548. protected _breakLines(refWidth: number, context: CanvasRenderingContext2D): object[];
  6549. protected _parseLine(line: string | undefined, context: CanvasRenderingContext2D): object;
  6550. protected _parseLineEllipsis(line: string | undefined, width: number, context: CanvasRenderingContext2D): object;
  6551. protected _parseLineWordWrap(line: string | undefined, width: number, context: CanvasRenderingContext2D): object[];
  6552. protected _renderLines(context: CanvasRenderingContext2D): void;
  6553. /**
  6554. * Given a width constraint applied on the text block, find the expected height
  6555. * @returns expected height
  6556. */
  6557. computeExpectedHeight(): number;
  6558. dispose(): void;
  6559. }
  6560. }
  6561. declare module BABYLON.GUI {
  6562. /**
  6563. * Class used to create 2D images
  6564. */
  6565. export class Image extends Control {
  6566. name?: string | undefined;
  6567. private _workingCanvas;
  6568. private _domImage;
  6569. private _imageWidth;
  6570. private _imageHeight;
  6571. private _loaded;
  6572. private _stretch;
  6573. private _source;
  6574. private _autoScale;
  6575. private _sourceLeft;
  6576. private _sourceTop;
  6577. private _sourceWidth;
  6578. private _sourceHeight;
  6579. private _svgAttributesComputationCompleted;
  6580. private _isSVG;
  6581. private _cellWidth;
  6582. private _cellHeight;
  6583. private _cellId;
  6584. private _populateNinePatchSlicesFromImage;
  6585. private _sliceLeft;
  6586. private _sliceRight;
  6587. private _sliceTop;
  6588. private _sliceBottom;
  6589. private _detectPointerOnOpaqueOnly;
  6590. private _imageDataCache;
  6591. /**
  6592. * BABYLON.Observable notified when the content is loaded
  6593. */
  6594. onImageLoadedObservable: BABYLON.Observable<Image>;
  6595. /**
  6596. * BABYLON.Observable notified when _sourceLeft, _sourceTop, _sourceWidth and _sourceHeight are computed
  6597. */
  6598. onSVGAttributesComputedObservable: BABYLON.Observable<Image>;
  6599. /**
  6600. * Gets a boolean indicating that the content is loaded
  6601. */
  6602. get isLoaded(): boolean;
  6603. /**
  6604. * Gets or sets a boolean indicating if nine patch slices (left, top, right, bottom) should be read from image data
  6605. */
  6606. get populateNinePatchSlicesFromImage(): boolean;
  6607. set populateNinePatchSlicesFromImage(value: boolean);
  6608. /**
  6609. * Gets or sets a boolean indicating if pointers should only be validated on pixels with alpha > 0.
  6610. * Beware using this as this will comsume more memory as the image has to be stored twice
  6611. */
  6612. get detectPointerOnOpaqueOnly(): boolean;
  6613. set detectPointerOnOpaqueOnly(value: boolean);
  6614. /**
  6615. * Gets or sets the left value for slicing (9-patch)
  6616. */
  6617. get sliceLeft(): number;
  6618. set sliceLeft(value: number);
  6619. /**
  6620. * Gets or sets the right value for slicing (9-patch)
  6621. */
  6622. get sliceRight(): number;
  6623. set sliceRight(value: number);
  6624. /**
  6625. * Gets or sets the top value for slicing (9-patch)
  6626. */
  6627. get sliceTop(): number;
  6628. set sliceTop(value: number);
  6629. /**
  6630. * Gets or sets the bottom value for slicing (9-patch)
  6631. */
  6632. get sliceBottom(): number;
  6633. set sliceBottom(value: number);
  6634. /**
  6635. * Gets or sets the left coordinate in the source image
  6636. */
  6637. get sourceLeft(): number;
  6638. set sourceLeft(value: number);
  6639. /**
  6640. * Gets or sets the top coordinate in the source image
  6641. */
  6642. get sourceTop(): number;
  6643. set sourceTop(value: number);
  6644. /**
  6645. * Gets or sets the width to capture in the source image
  6646. */
  6647. get sourceWidth(): number;
  6648. set sourceWidth(value: number);
  6649. /**
  6650. * Gets or sets the height to capture in the source image
  6651. */
  6652. get sourceHeight(): number;
  6653. set sourceHeight(value: number);
  6654. /** Indicates if the format of the image is SVG */
  6655. get isSVG(): boolean;
  6656. /** Gets the status of the SVG attributes computation (sourceLeft, sourceTop, sourceWidth, sourceHeight) */
  6657. get svgAttributesComputationCompleted(): boolean;
  6658. /**
  6659. * Gets or sets a boolean indicating if the image can force its container to adapt its size
  6660. * @see https://doc.babylonjs.com/how_to/gui#image
  6661. */
  6662. get autoScale(): boolean;
  6663. set autoScale(value: boolean);
  6664. /** Gets or sets the streching mode used by the image */
  6665. get stretch(): number;
  6666. set stretch(value: number);
  6667. /** @hidden */
  6668. _rotate90(n: number, preserveProperties?: boolean): Image;
  6669. private _handleRotationForSVGImage;
  6670. private _rotate90SourceProperties;
  6671. /**
  6672. * Gets or sets the internal DOM image used to render the control
  6673. */
  6674. set domImage(value: HTMLImageElement);
  6675. get domImage(): HTMLImageElement;
  6676. private _onImageLoaded;
  6677. private _extractNinePatchSliceDataFromImage;
  6678. /**
  6679. * Gets the image source url
  6680. */
  6681. get source(): BABYLON.Nullable<string>;
  6682. /**
  6683. * Gets or sets image source url
  6684. */
  6685. set source(value: BABYLON.Nullable<string>);
  6686. /**
  6687. * Checks for svg document with icon id present
  6688. */
  6689. private _svgCheck;
  6690. /**
  6691. * Sets sourceLeft, sourceTop, sourceWidth, sourceHeight automatically
  6692. * given external svg file and icon id
  6693. */
  6694. private _getSVGAttribs;
  6695. /**
  6696. * Gets or sets the cell width to use when animation sheet is enabled
  6697. * @see https://doc.babylonjs.com/how_to/gui#image
  6698. */
  6699. get cellWidth(): number;
  6700. set cellWidth(value: number);
  6701. /**
  6702. * Gets or sets the cell height to use when animation sheet is enabled
  6703. * @see https://doc.babylonjs.com/how_to/gui#image
  6704. */
  6705. get cellHeight(): number;
  6706. set cellHeight(value: number);
  6707. /**
  6708. * Gets or sets the cell id to use (this will turn on the animation sheet mode)
  6709. * @see https://doc.babylonjs.com/how_to/gui#image
  6710. */
  6711. get cellId(): number;
  6712. set cellId(value: number);
  6713. /**
  6714. * Creates a new Image
  6715. * @param name defines the control name
  6716. * @param url defines the image url
  6717. */
  6718. constructor(name?: string | undefined, url?: BABYLON.Nullable<string>);
  6719. /**
  6720. * Tests if a given coordinates belong to the current control
  6721. * @param x defines x coordinate to test
  6722. * @param y defines y coordinate to test
  6723. * @returns true if the coordinates are inside the control
  6724. */
  6725. contains(x: number, y: number): boolean;
  6726. protected _getTypeName(): string;
  6727. /** Force the control to synchronize with its content */
  6728. synchronizeSizeWithContent(): void;
  6729. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6730. private _prepareWorkingCanvasForOpaqueDetection;
  6731. private _drawImage;
  6732. _draw(context: CanvasRenderingContext2D): void;
  6733. private _renderCornerPatch;
  6734. private _renderNinePatch;
  6735. dispose(): void;
  6736. /** STRETCH_NONE */
  6737. static readonly STRETCH_NONE: number;
  6738. /** STRETCH_FILL */
  6739. static readonly STRETCH_FILL: number;
  6740. /** STRETCH_UNIFORM */
  6741. static readonly STRETCH_UNIFORM: number;
  6742. /** STRETCH_EXTEND */
  6743. static readonly STRETCH_EXTEND: number;
  6744. /** NINE_PATCH */
  6745. static readonly STRETCH_NINE_PATCH: number;
  6746. }
  6747. }
  6748. declare module BABYLON.GUI {
  6749. /**
  6750. * Class used to create 2D buttons
  6751. */
  6752. export class Button extends Rectangle {
  6753. name?: string | undefined;
  6754. /**
  6755. * Function called to generate a pointer enter animation
  6756. */
  6757. pointerEnterAnimation: () => void;
  6758. /**
  6759. * Function called to generate a pointer out animation
  6760. */
  6761. pointerOutAnimation: () => void;
  6762. /**
  6763. * Function called to generate a pointer down animation
  6764. */
  6765. pointerDownAnimation: () => void;
  6766. /**
  6767. * Function called to generate a pointer up animation
  6768. */
  6769. pointerUpAnimation: () => void;
  6770. /**
  6771. * Gets or sets a boolean indicating that the button will let internal controls handle picking instead of doing it directly using its bounding info
  6772. */
  6773. delegatePickingToChildren: boolean;
  6774. private _image;
  6775. /**
  6776. * Returns the image part of the button (if any)
  6777. */
  6778. get image(): BABYLON.Nullable<Image>;
  6779. private _textBlock;
  6780. /**
  6781. * Returns the image part of the button (if any)
  6782. */
  6783. get textBlock(): BABYLON.Nullable<TextBlock>;
  6784. /**
  6785. * Creates a new Button
  6786. * @param name defines the name of the button
  6787. */
  6788. constructor(name?: string | undefined);
  6789. protected _getTypeName(): string;
  6790. /** @hidden */
  6791. _processPicking(x: number, y: number, pi: BABYLON.PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
  6792. /** @hidden */
  6793. _onPointerEnter(target: Control, pi: BABYLON.PointerInfoBase): boolean;
  6794. /** @hidden */
  6795. _onPointerOut(target: Control, pi: BABYLON.PointerInfoBase, force?: boolean): void;
  6796. /** @hidden */
  6797. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  6798. /** @hidden */
  6799. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi: BABYLON.PointerInfoBase): void;
  6800. /**
  6801. * Creates a new button made with an image and a text
  6802. * @param name defines the name of the button
  6803. * @param text defines the text of the button
  6804. * @param imageUrl defines the url of the image
  6805. * @returns a new Button
  6806. */
  6807. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  6808. /**
  6809. * Creates a new button made with an image
  6810. * @param name defines the name of the button
  6811. * @param imageUrl defines the url of the image
  6812. * @returns a new Button
  6813. */
  6814. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  6815. /**
  6816. * Creates a new button made with a text
  6817. * @param name defines the name of the button
  6818. * @param text defines the text of the button
  6819. * @returns a new Button
  6820. */
  6821. static CreateSimpleButton(name: string, text: string): Button;
  6822. /**
  6823. * Creates a new button made with an image and a centered text
  6824. * @param name defines the name of the button
  6825. * @param text defines the text of the button
  6826. * @param imageUrl defines the url of the image
  6827. * @returns a new Button
  6828. */
  6829. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  6830. }
  6831. }
  6832. declare module BABYLON.GUI {
  6833. /**
  6834. * Class used to create a 2D stack panel container
  6835. */
  6836. export class StackPanel extends Container {
  6837. name?: string | undefined;
  6838. private _isVertical;
  6839. private _manualWidth;
  6840. private _manualHeight;
  6841. private _doNotTrackManualChanges;
  6842. /**
  6843. * Gets or sets a boolean indicating that layou warnings should be ignored
  6844. */
  6845. ignoreLayoutWarnings: boolean;
  6846. /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
  6847. get isVertical(): boolean;
  6848. set isVertical(value: boolean);
  6849. /**
  6850. * Gets or sets panel width.
  6851. * This value should not be set when in horizontal mode as it will be computed automatically
  6852. */
  6853. set width(value: string | number);
  6854. get width(): string | number;
  6855. /**
  6856. * Gets or sets panel height.
  6857. * This value should not be set when in vertical mode as it will be computed automatically
  6858. */
  6859. set height(value: string | number);
  6860. get height(): string | number;
  6861. /**
  6862. * Creates a new StackPanel
  6863. * @param name defines control name
  6864. */
  6865. constructor(name?: string | undefined);
  6866. protected _getTypeName(): string;
  6867. /** @hidden */
  6868. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6869. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6870. protected _postMeasure(): void;
  6871. /**
  6872. * Serializes the current control
  6873. * @param serializationObject defined the JSON serialized object
  6874. */
  6875. serialize(serializationObject: any): void;
  6876. /** @hidden */
  6877. _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture): void;
  6878. }
  6879. }
  6880. declare module BABYLON.GUI {
  6881. /**
  6882. * Class used to represent a 2D checkbox
  6883. */
  6884. export class Checkbox extends Control {
  6885. name?: string | undefined;
  6886. private _isChecked;
  6887. private _background;
  6888. private _checkSizeRatio;
  6889. private _thickness;
  6890. /** Gets or sets border thickness */
  6891. get thickness(): number;
  6892. set thickness(value: number);
  6893. /**
  6894. * BABYLON.Observable raised when isChecked property changes
  6895. */
  6896. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  6897. /** Gets or sets a value indicating the ratio between overall size and check size */
  6898. get checkSizeRatio(): number;
  6899. set checkSizeRatio(value: number);
  6900. /** Gets or sets background color */
  6901. get background(): string;
  6902. set background(value: string);
  6903. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  6904. get isChecked(): boolean;
  6905. set isChecked(value: boolean);
  6906. /**
  6907. * Creates a new CheckBox
  6908. * @param name defines the control name
  6909. */
  6910. constructor(name?: string | undefined);
  6911. protected _getTypeName(): string;
  6912. /** @hidden */
  6913. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  6914. /** @hidden */
  6915. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  6916. /**
  6917. * Utility function to easily create a checkbox with a header
  6918. * @param title defines the label to use for the header
  6919. * @param onValueChanged defines the callback to call when value changes
  6920. * @returns a StackPanel containing the checkbox and a textBlock
  6921. */
  6922. static AddCheckBoxWithHeader(title: string, onValueChanged: (value: boolean) => void): StackPanel;
  6923. }
  6924. }
  6925. declare module BABYLON.GUI {
  6926. /**
  6927. * Class used to store key control properties
  6928. */
  6929. export class KeyPropertySet {
  6930. /** Width */
  6931. width?: string;
  6932. /** Height */
  6933. height?: string;
  6934. /** Left padding */
  6935. paddingLeft?: string;
  6936. /** Right padding */
  6937. paddingRight?: string;
  6938. /** Top padding */
  6939. paddingTop?: string;
  6940. /** Bottom padding */
  6941. paddingBottom?: string;
  6942. /** Foreground color */
  6943. color?: string;
  6944. /** Background color */
  6945. background?: string;
  6946. }
  6947. /**
  6948. * Class used to create virtual keyboard
  6949. */
  6950. export class VirtualKeyboard extends StackPanel {
  6951. /** BABYLON.Observable raised when a key is pressed */
  6952. onKeyPressObservable: BABYLON.Observable<string>;
  6953. /** Gets or sets default key button width */
  6954. defaultButtonWidth: string;
  6955. /** Gets or sets default key button height */
  6956. defaultButtonHeight: string;
  6957. /** Gets or sets default key button left padding */
  6958. defaultButtonPaddingLeft: string;
  6959. /** Gets or sets default key button right padding */
  6960. defaultButtonPaddingRight: string;
  6961. /** Gets or sets default key button top padding */
  6962. defaultButtonPaddingTop: string;
  6963. /** Gets or sets default key button bottom padding */
  6964. defaultButtonPaddingBottom: string;
  6965. /** Gets or sets default key button foreground color */
  6966. defaultButtonColor: string;
  6967. /** Gets or sets default key button background color */
  6968. defaultButtonBackground: string;
  6969. /** Gets or sets shift button foreground color */
  6970. shiftButtonColor: string;
  6971. /** Gets or sets shift button thickness*/
  6972. selectedShiftThickness: number;
  6973. /** Gets shift key state */
  6974. shiftState: number;
  6975. protected _getTypeName(): string;
  6976. private _createKey;
  6977. /**
  6978. * Adds a new row of keys
  6979. * @param keys defines the list of keys to add
  6980. * @param propertySets defines the associated property sets
  6981. */
  6982. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  6983. /**
  6984. * Set the shift key to a specific state
  6985. * @param shiftState defines the new shift state
  6986. */
  6987. applyShiftState(shiftState: number): void;
  6988. private _currentlyConnectedInputText;
  6989. private _connectedInputTexts;
  6990. private _onKeyPressObserver;
  6991. /** Gets the input text control currently attached to the keyboard */
  6992. get connectedInputText(): BABYLON.Nullable<InputText>;
  6993. /**
  6994. * Connects the keyboard with an input text control
  6995. *
  6996. * @param input defines the target control
  6997. */
  6998. connect(input: InputText): void;
  6999. /**
  7000. * Disconnects the keyboard from connected InputText controls
  7001. *
  7002. * @param input optionally defines a target control, otherwise all are disconnected
  7003. */
  7004. disconnect(input?: InputText): void;
  7005. private _removeConnectedInputObservables;
  7006. /**
  7007. * Release all resources
  7008. */
  7009. dispose(): void;
  7010. /**
  7011. * Creates a new keyboard using a default layout
  7012. *
  7013. * @param name defines control name
  7014. * @returns a new VirtualKeyboard
  7015. */
  7016. static CreateDefaultLayout(name?: string): VirtualKeyboard;
  7017. }
  7018. }
  7019. declare module BABYLON.GUI {
  7020. /** @hidden */
  7021. export class TextWrapper {
  7022. private _text;
  7023. private _characters;
  7024. get text(): string;
  7025. set text(txt: string);
  7026. get length(): number;
  7027. removePart(idxStart: number, idxEnd: number, insertTxt?: string): void;
  7028. charAt(idx: number): string;
  7029. substr(from: number, length?: number): string;
  7030. substring(from: number, to?: number): string;
  7031. isWord(index: number): boolean;
  7032. }
  7033. }
  7034. declare module BABYLON.GUI {
  7035. /**
  7036. * Class used to create input text control
  7037. */
  7038. export class InputText extends Control implements IFocusableControl {
  7039. name?: string | undefined;
  7040. private _textWrapper;
  7041. private _placeholderText;
  7042. private _background;
  7043. private _focusedBackground;
  7044. private _focusedColor;
  7045. private _placeholderColor;
  7046. private _thickness;
  7047. private _margin;
  7048. private _autoStretchWidth;
  7049. private _maxWidth;
  7050. private _isFocused;
  7051. private _blinkTimeout;
  7052. private _blinkIsEven;
  7053. private _cursorOffset;
  7054. private _scrollLeft;
  7055. private _textWidth;
  7056. private _clickedCoordinate;
  7057. private _deadKey;
  7058. private _addKey;
  7059. private _currentKey;
  7060. private _isTextHighlightOn;
  7061. private _textHighlightColor;
  7062. private _highligherOpacity;
  7063. private _highlightedText;
  7064. private _startHighlightIndex;
  7065. private _endHighlightIndex;
  7066. private _cursorIndex;
  7067. private _onFocusSelectAll;
  7068. private _isPointerDown;
  7069. private _onClipboardObserver;
  7070. private _onPointerDblTapObserver;
  7071. /** @hidden */
  7072. _connectedVirtualKeyboard: BABYLON.Nullable<VirtualKeyboard>;
  7073. /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
  7074. promptMessage: string;
  7075. /** Force disable prompt on mobile device */
  7076. disableMobilePrompt: boolean;
  7077. /** BABYLON.Observable raised when the text changes */
  7078. onTextChangedObservable: BABYLON.Observable<InputText>;
  7079. /** BABYLON.Observable raised just before an entered character is to be added */
  7080. onBeforeKeyAddObservable: BABYLON.Observable<InputText>;
  7081. /** BABYLON.Observable raised when the control gets the focus */
  7082. onFocusObservable: BABYLON.Observable<InputText>;
  7083. /** BABYLON.Observable raised when the control loses the focus */
  7084. onBlurObservable: BABYLON.Observable<InputText>;
  7085. /**Observable raised when the text is highlighted */
  7086. onTextHighlightObservable: BABYLON.Observable<InputText>;
  7087. /**Observable raised when copy event is triggered */
  7088. onTextCopyObservable: BABYLON.Observable<InputText>;
  7089. /** BABYLON.Observable raised when cut event is triggered */
  7090. onTextCutObservable: BABYLON.Observable<InputText>;
  7091. /** BABYLON.Observable raised when paste event is triggered */
  7092. onTextPasteObservable: BABYLON.Observable<InputText>;
  7093. /** BABYLON.Observable raised when a key event was processed */
  7094. onKeyboardEventProcessedObservable: BABYLON.Observable<BABYLON.IKeyboardEvent>;
  7095. /** Gets or sets the maximum width allowed by the control */
  7096. get maxWidth(): string | number;
  7097. /** Gets the maximum width allowed by the control in pixels */
  7098. get maxWidthInPixels(): number;
  7099. set maxWidth(value: string | number);
  7100. /** Gets or sets the text highlighter transparency; default: 0.4 */
  7101. get highligherOpacity(): number;
  7102. set highligherOpacity(value: number);
  7103. /** Gets or sets a boolean indicating whether to select complete text by default on input focus */
  7104. get onFocusSelectAll(): boolean;
  7105. set onFocusSelectAll(value: boolean);
  7106. /** Gets or sets the text hightlight color */
  7107. get textHighlightColor(): string;
  7108. set textHighlightColor(value: string);
  7109. /** Gets or sets control margin */
  7110. get margin(): string;
  7111. /** Gets control margin in pixels */
  7112. get marginInPixels(): number;
  7113. set margin(value: string);
  7114. /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
  7115. get autoStretchWidth(): boolean;
  7116. set autoStretchWidth(value: boolean);
  7117. /** Gets or sets border thickness */
  7118. get thickness(): number;
  7119. set thickness(value: number);
  7120. /** Gets or sets the background color when focused */
  7121. get focusedBackground(): string;
  7122. set focusedBackground(value: string);
  7123. /** Gets or sets the background color when focused */
  7124. get focusedColor(): string;
  7125. set focusedColor(value: string);
  7126. /** Gets or sets the background color */
  7127. get background(): string;
  7128. set background(value: string);
  7129. /** Gets or sets the placeholder color */
  7130. get placeholderColor(): string;
  7131. set placeholderColor(value: string);
  7132. /** Gets or sets the text displayed when the control is empty */
  7133. get placeholderText(): string;
  7134. set placeholderText(value: string);
  7135. /** Gets or sets the dead key flag */
  7136. get deadKey(): boolean;
  7137. set deadKey(flag: boolean);
  7138. /** Gets or sets the highlight text */
  7139. get highlightedText(): string;
  7140. set highlightedText(text: string);
  7141. /** Gets or sets if the current key should be added */
  7142. get addKey(): boolean;
  7143. set addKey(flag: boolean);
  7144. /** Gets or sets the value of the current key being entered */
  7145. get currentKey(): string;
  7146. set currentKey(key: string);
  7147. /** Gets or sets the text displayed in the control */
  7148. get text(): string;
  7149. set text(value: string);
  7150. private _textHasChanged;
  7151. /** Gets or sets control width */
  7152. get width(): string | number;
  7153. set width(value: string | number);
  7154. /**
  7155. * Creates a new InputText
  7156. * @param name defines the control name
  7157. * @param text defines the text of the control
  7158. */
  7159. constructor(name?: string | undefined, text?: string);
  7160. /** @hidden */
  7161. onBlur(): void;
  7162. /** @hidden */
  7163. onFocus(): void;
  7164. /**
  7165. * Function to focus an inputText programmatically
  7166. */
  7167. focus(): void;
  7168. /**
  7169. * Function to unfocus an inputText programmatically
  7170. */
  7171. blur(): void;
  7172. protected _getTypeName(): string;
  7173. /**
  7174. * Function called to get the list of controls that should not steal the focus from this control
  7175. * @returns an array of controls
  7176. */
  7177. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  7178. /** @hidden */
  7179. processKey(keyCode: number, key?: string, evt?: BABYLON.IKeyboardEvent): void;
  7180. /** @hidden */
  7181. private _updateValueFromCursorIndex;
  7182. /** @hidden */
  7183. private _processDblClick;
  7184. /** @hidden */
  7185. private _selectAllText;
  7186. /**
  7187. * Handles the keyboard event
  7188. * @param evt Defines the KeyboardEvent
  7189. */
  7190. processKeyboard(evt: BABYLON.IKeyboardEvent): void;
  7191. /** @hidden */
  7192. private _onCopyText;
  7193. /** @hidden */
  7194. private _onCutText;
  7195. /** @hidden */
  7196. private _onPasteText;
  7197. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  7198. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  7199. _onPointerMove(target: Control, coordinates: BABYLON.Vector2, pointerId: number, pi: BABYLON.PointerInfoBase): void;
  7200. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  7201. protected _beforeRenderText(textWrapper: TextWrapper): TextWrapper;
  7202. dispose(): void;
  7203. }
  7204. }
  7205. declare module BABYLON.GUI {
  7206. /**
  7207. * Class used to create a 2D grid container
  7208. */
  7209. export class Grid extends Container {
  7210. name?: string | undefined;
  7211. private _rowDefinitions;
  7212. private _columnDefinitions;
  7213. private _cells;
  7214. private _childControls;
  7215. /**
  7216. * Gets the number of columns
  7217. */
  7218. get columnCount(): number;
  7219. /**
  7220. * Gets the number of rows
  7221. */
  7222. get rowCount(): number;
  7223. /** Gets the list of children */
  7224. get children(): Control[];
  7225. /** Gets the list of cells (e.g. the containers) */
  7226. get cells(): {
  7227. [key: string]: Container;
  7228. };
  7229. /**
  7230. * Gets the definition of a specific row
  7231. * @param index defines the index of the row
  7232. * @returns the row definition
  7233. */
  7234. getRowDefinition(index: number): BABYLON.Nullable<ValueAndUnit>;
  7235. /**
  7236. * Gets the definition of a specific column
  7237. * @param index defines the index of the column
  7238. * @returns the column definition
  7239. */
  7240. getColumnDefinition(index: number): BABYLON.Nullable<ValueAndUnit>;
  7241. /**
  7242. * Adds a new row to the grid
  7243. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  7244. * @param isPixel defines if the height is expressed in pixel (or in percentage)
  7245. * @returns the current grid
  7246. */
  7247. addRowDefinition(height: number, isPixel?: boolean): Grid;
  7248. /**
  7249. * Adds a new column to the grid
  7250. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  7251. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  7252. * @returns the current grid
  7253. */
  7254. addColumnDefinition(width: number, isPixel?: boolean): Grid;
  7255. /**
  7256. * Update a row definition
  7257. * @param index defines the index of the row to update
  7258. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  7259. * @param isPixel defines if the weight is expressed in pixel (or in percentage)
  7260. * @returns the current grid
  7261. */
  7262. setRowDefinition(index: number, height: number, isPixel?: boolean): Grid;
  7263. /**
  7264. * Update a column definition
  7265. * @param index defines the index of the column to update
  7266. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  7267. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  7268. * @returns the current grid
  7269. */
  7270. setColumnDefinition(index: number, width: number, isPixel?: boolean): Grid;
  7271. /**
  7272. * Gets the list of children stored in a specific cell
  7273. * @param row defines the row to check
  7274. * @param column defines the column to check
  7275. * @returns the list of controls
  7276. */
  7277. getChildrenAt(row: number, column: number): BABYLON.Nullable<Array<Control>>;
  7278. /**
  7279. * Gets a string representing the child cell info (row x column)
  7280. * @param child defines the control to get info from
  7281. * @returns a string containing the child cell info (row x column)
  7282. */
  7283. getChildCellInfo(child: Control): string;
  7284. private _removeCell;
  7285. private _offsetCell;
  7286. /**
  7287. * Remove a column definition at specified index
  7288. * @param index defines the index of the column to remove
  7289. * @returns the current grid
  7290. */
  7291. removeColumnDefinition(index: number): Grid;
  7292. /**
  7293. * Remove a row definition at specified index
  7294. * @param index defines the index of the row to remove
  7295. * @returns the current grid
  7296. */
  7297. removeRowDefinition(index: number): Grid;
  7298. /**
  7299. * Adds a new control to the current grid
  7300. * @param control defines the control to add
  7301. * @param row defines the row where to add the control (0 by default)
  7302. * @param column defines the column where to add the control (0 by default)
  7303. * @returns the current grid
  7304. */
  7305. addControl(control: Control, row?: number, column?: number): Grid;
  7306. /**
  7307. * Removes a control from the current container
  7308. * @param control defines the control to remove
  7309. * @returns the current container
  7310. */
  7311. removeControl(control: Control): Container;
  7312. /**
  7313. * Creates a new Grid
  7314. * @param name defines control name
  7315. */
  7316. constructor(name?: string | undefined);
  7317. protected _getTypeName(): string;
  7318. protected _getGridDefinitions(definitionCallback: (lefts: number[], tops: number[], widths: number[], heights: number[]) => void): void;
  7319. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  7320. _flagDescendantsAsMatrixDirty(): void;
  7321. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  7322. /** Releases associated resources */
  7323. dispose(): void;
  7324. }
  7325. }
  7326. declare module BABYLON.GUI {
  7327. /** Class used to create color pickers */
  7328. export class ColorPicker extends Control {
  7329. name?: string | undefined;
  7330. private static _Epsilon;
  7331. private _colorWheelCanvas;
  7332. private _value;
  7333. private _tmpColor;
  7334. private _pointerStartedOnSquare;
  7335. private _pointerStartedOnWheel;
  7336. private _squareLeft;
  7337. private _squareTop;
  7338. private _squareSize;
  7339. private _h;
  7340. private _s;
  7341. private _v;
  7342. private _lastPointerDownID;
  7343. /**
  7344. * BABYLON.Observable raised when the value changes
  7345. */
  7346. onValueChangedObservable: BABYLON.Observable<BABYLON.Color3>;
  7347. /** Gets or sets the color of the color picker */
  7348. get value(): BABYLON.Color3;
  7349. set value(value: BABYLON.Color3);
  7350. /**
  7351. * Gets or sets control width
  7352. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  7353. */
  7354. get width(): string | number;
  7355. set width(value: string | number);
  7356. /**
  7357. * Gets or sets control height
  7358. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  7359. */
  7360. get height(): string | number;
  7361. /** Gets or sets control height */
  7362. set height(value: string | number);
  7363. /** Gets or sets control size */
  7364. get size(): string | number;
  7365. set size(value: string | number);
  7366. /**
  7367. * Creates a new ColorPicker
  7368. * @param name defines the control name
  7369. */
  7370. constructor(name?: string | undefined);
  7371. protected _getTypeName(): string;
  7372. /** @hidden */
  7373. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  7374. private _updateSquareProps;
  7375. private _drawGradientSquare;
  7376. private _drawCircle;
  7377. private _createColorWheelCanvas;
  7378. /** @hidden */
  7379. _draw(context: CanvasRenderingContext2D): void;
  7380. private _pointerIsDown;
  7381. private _updateValueFromPointer;
  7382. private _isPointOnSquare;
  7383. private _isPointOnWheel;
  7384. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  7385. _onPointerMove(target: Control, coordinates: BABYLON.Vector2, pointerId: number, pi: BABYLON.PointerInfoBase): void;
  7386. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi: BABYLON.PointerInfoBase): void;
  7387. _onCanvasBlur(): void;
  7388. /**
  7389. * This function expands the color picker by creating a color picker dialog with manual
  7390. * color value input and the ability to save colors into an array to be used later in
  7391. * subsequent launches of the dialogue.
  7392. * @param advancedTexture defines the AdvancedDynamicTexture the dialog is assigned to
  7393. * @param options defines size for dialog and options for saved colors. Also accepts last color picked as hex string and saved colors array as hex strings.
  7394. * @returns picked color as a hex string and the saved colors array as hex strings.
  7395. */
  7396. static ShowPickerDialogAsync(advancedTexture: AdvancedDynamicTexture, options: {
  7397. pickerWidth?: string;
  7398. pickerHeight?: string;
  7399. headerHeight?: string;
  7400. lastColor?: string;
  7401. swatchLimit?: number;
  7402. numSwatchesPerLine?: number;
  7403. savedColors?: Array<string>;
  7404. }): Promise<{
  7405. savedColors?: string[];
  7406. pickedColor: string;
  7407. }>;
  7408. }
  7409. }
  7410. declare module BABYLON.GUI {
  7411. /** Class used to create 2D ellipse containers */
  7412. export class Ellipse extends Container {
  7413. name?: string | undefined;
  7414. private _thickness;
  7415. /** Gets or sets border thickness */
  7416. get thickness(): number;
  7417. set thickness(value: number);
  7418. /**
  7419. * Creates a new Ellipse
  7420. * @param name defines the control name
  7421. */
  7422. constructor(name?: string | undefined);
  7423. protected _getTypeName(): string;
  7424. protected _localDraw(context: CanvasRenderingContext2D): void;
  7425. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  7426. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  7427. }
  7428. }
  7429. declare module BABYLON.GUI {
  7430. /**
  7431. * Class used to create a focusable button that can easily handle keyboard events
  7432. */
  7433. export class FocusableButton extends Button implements IFocusableControl {
  7434. name?: string | undefined;
  7435. /** Highlight color when button is focused */
  7436. focusedColor: BABYLON.Nullable<string>;
  7437. private _isFocused;
  7438. private _unfocusedColor;
  7439. /** BABYLON.Observable raised when the control gets the focus */
  7440. onFocusObservable: BABYLON.Observable<Button>;
  7441. /** BABYLON.Observable raised when the control loses the focus */
  7442. onBlurObservable: BABYLON.Observable<Button>;
  7443. /** BABYLON.Observable raised when a key event was processed */
  7444. onKeyboardEventProcessedObservable: BABYLON.Observable<BABYLON.IKeyboardEvent>;
  7445. constructor(name?: string | undefined);
  7446. /** @hidden */
  7447. onBlur(): void;
  7448. /** @hidden */
  7449. onFocus(): void;
  7450. /**
  7451. * Function called to get the list of controls that should not steal the focus from this control
  7452. * @returns an array of controls
  7453. */
  7454. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  7455. /**
  7456. * Function to focus a button programmatically
  7457. */
  7458. focus(): void;
  7459. /**
  7460. * Function to unfocus a button programmatically
  7461. */
  7462. blur(): void;
  7463. /**
  7464. * Handles the keyboard event
  7465. * @param evt Defines the KeyboardEvent
  7466. */
  7467. processKeyboard(evt: BABYLON.IKeyboardEvent): void;
  7468. /** @hidden */
  7469. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  7470. /** @hidden */
  7471. displose(): void;
  7472. }
  7473. }
  7474. declare module BABYLON.GUI {
  7475. /**
  7476. * Class used to create a password control
  7477. */
  7478. export class InputPassword extends InputText {
  7479. protected _beforeRenderText(textWrapper: TextWrapper): TextWrapper;
  7480. }
  7481. }
  7482. declare module BABYLON.GUI {
  7483. /** Class used to render 2D lines */
  7484. export class Line extends Control {
  7485. name?: string | undefined;
  7486. private _lineWidth;
  7487. private _x1;
  7488. private _y1;
  7489. private _x2;
  7490. private _y2;
  7491. private _dash;
  7492. private _connectedControl;
  7493. private _connectedControlDirtyObserver;
  7494. /** Gets or sets the dash pattern */
  7495. get dash(): Array<number>;
  7496. set dash(value: Array<number>);
  7497. /** Gets or sets the control connected with the line end */
  7498. get connectedControl(): Control;
  7499. set connectedControl(value: Control);
  7500. /** Gets or sets start coordinates on X axis */
  7501. get x1(): string | number;
  7502. set x1(value: string | number);
  7503. /** Gets or sets start coordinates on Y axis */
  7504. get y1(): string | number;
  7505. set y1(value: string | number);
  7506. /** Gets or sets end coordinates on X axis */
  7507. get x2(): string | number;
  7508. set x2(value: string | number);
  7509. /** Gets or sets end coordinates on Y axis */
  7510. get y2(): string | number;
  7511. set y2(value: string | number);
  7512. /** Gets or sets line width */
  7513. get lineWidth(): number;
  7514. set lineWidth(value: number);
  7515. /** Gets or sets horizontal alignment */
  7516. set horizontalAlignment(value: number);
  7517. /** Gets or sets vertical alignment */
  7518. set verticalAlignment(value: number);
  7519. private get _effectiveX2();
  7520. private get _effectiveY2();
  7521. /**
  7522. * Creates a new Line
  7523. * @param name defines the control name
  7524. */
  7525. constructor(name?: string | undefined);
  7526. protected _getTypeName(): string;
  7527. _draw(context: CanvasRenderingContext2D): void;
  7528. _measure(): void;
  7529. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  7530. /**
  7531. * Move one end of the line given 3D cartesian coordinates.
  7532. * @param position Targeted world position
  7533. * @param scene BABYLON.Scene
  7534. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  7535. */
  7536. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene, end?: boolean): void;
  7537. /**
  7538. * Move one end of the line to a position in screen absolute space.
  7539. * @param projectedPosition Position in screen absolute space (X, Y)
  7540. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  7541. */
  7542. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3, end?: boolean): void;
  7543. }
  7544. }
  7545. declare module BABYLON.GUI {
  7546. /**
  7547. * Class used to store a point for a MultiLine object.
  7548. * The point can be pure 2D coordinates, a mesh or a control
  7549. */
  7550. export class MultiLinePoint {
  7551. private _multiLine;
  7552. private _x;
  7553. private _y;
  7554. private _control;
  7555. private _mesh;
  7556. private _controlObserver;
  7557. private _meshObserver;
  7558. /** @hidden */
  7559. _point: BABYLON.Vector3;
  7560. /**
  7561. * Creates a new MultiLinePoint
  7562. * @param multiLine defines the source MultiLine object
  7563. */
  7564. constructor(multiLine: MultiLine);
  7565. /** Gets or sets x coordinate */
  7566. get x(): string | number;
  7567. set x(value: string | number);
  7568. /** Gets or sets y coordinate */
  7569. get y(): string | number;
  7570. set y(value: string | number);
  7571. /** Gets or sets the control associated with this point */
  7572. get control(): BABYLON.Nullable<Control>;
  7573. set control(value: BABYLON.Nullable<Control>);
  7574. /** Gets or sets the mesh associated with this point */
  7575. get mesh(): BABYLON.Nullable<BABYLON.AbstractMesh>;
  7576. set mesh(value: BABYLON.Nullable<BABYLON.AbstractMesh>);
  7577. /** Resets links */
  7578. resetLinks(): void;
  7579. /**
  7580. * Gets a translation vector with Z component
  7581. * @returns the translation vector
  7582. */
  7583. translate(): BABYLON.Vector3;
  7584. private _translatePoint;
  7585. /** Release associated resources */
  7586. dispose(): void;
  7587. }
  7588. }
  7589. declare module BABYLON.GUI {
  7590. /**
  7591. * Class used to create multi line control
  7592. */
  7593. export class MultiLine extends Control {
  7594. name?: string | undefined;
  7595. private _lineWidth;
  7596. private _dash;
  7597. private _points;
  7598. private _minX;
  7599. private _minY;
  7600. private _maxX;
  7601. private _maxY;
  7602. /**
  7603. * Creates a new MultiLine
  7604. * @param name defines the control name
  7605. */
  7606. constructor(name?: string | undefined);
  7607. /** Gets or sets dash pattern */
  7608. get dash(): Array<number>;
  7609. set dash(value: Array<number>);
  7610. /**
  7611. * Gets point stored at specified index
  7612. * @param index defines the index to look for
  7613. * @returns the requested point if found
  7614. */
  7615. getAt(index: number): MultiLinePoint;
  7616. /** Function called when a point is updated */
  7617. onPointUpdate: () => void;
  7618. /**
  7619. * Adds new points to the point collection
  7620. * @param items defines the list of items (mesh, control or 2d coordiantes) to add
  7621. * @returns the list of created MultiLinePoint
  7622. */
  7623. add(...items: (AbstractMesh | Control | {
  7624. x: string | number;
  7625. y: string | number;
  7626. })[]): MultiLinePoint[];
  7627. /**
  7628. * Adds a new point to the point collection
  7629. * @param item defines the item (mesh, control or 2d coordiantes) to add
  7630. * @returns the created MultiLinePoint
  7631. */
  7632. push(item?: (AbstractMesh | Control | {
  7633. x: string | number;
  7634. y: string | number;
  7635. })): MultiLinePoint;
  7636. /**
  7637. * Remove a specific value or point from the active point collection
  7638. * @param value defines the value or point to remove
  7639. */
  7640. remove(value: number | MultiLinePoint): void;
  7641. /**
  7642. * Resets this object to initial state (no point)
  7643. */
  7644. reset(): void;
  7645. /**
  7646. * Resets all links
  7647. */
  7648. resetLinks(): void;
  7649. /** Gets or sets line width */
  7650. get lineWidth(): number;
  7651. set lineWidth(value: number);
  7652. set horizontalAlignment(value: number);
  7653. set verticalAlignment(value: number);
  7654. protected _getTypeName(): string;
  7655. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  7656. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  7657. _measure(): void;
  7658. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  7659. dispose(): void;
  7660. }
  7661. }
  7662. declare module BABYLON.GUI {
  7663. /**
  7664. * Class used to create radio button controls
  7665. */
  7666. export class RadioButton extends Control {
  7667. name?: string | undefined;
  7668. private _isChecked;
  7669. private _background;
  7670. private _checkSizeRatio;
  7671. private _thickness;
  7672. /** Gets or sets border thickness */
  7673. get thickness(): number;
  7674. set thickness(value: number);
  7675. /** Gets or sets group name */
  7676. group: string;
  7677. /** BABYLON.Observable raised when isChecked is changed */
  7678. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  7679. /** Gets or sets a value indicating the ratio between overall size and check size */
  7680. get checkSizeRatio(): number;
  7681. set checkSizeRatio(value: number);
  7682. /** Gets or sets background color */
  7683. get background(): string;
  7684. set background(value: string);
  7685. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  7686. get isChecked(): boolean;
  7687. set isChecked(value: boolean);
  7688. /**
  7689. * Creates a new RadioButton
  7690. * @param name defines the control name
  7691. */
  7692. constructor(name?: string | undefined);
  7693. protected _getTypeName(): string;
  7694. _draw(context: CanvasRenderingContext2D): void;
  7695. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  7696. /**
  7697. * Utility function to easily create a radio button with a header
  7698. * @param title defines the label to use for the header
  7699. * @param group defines the group to use for the radio button
  7700. * @param isChecked defines the initial state of the radio button
  7701. * @param onValueChanged defines the callback to call when value changes
  7702. * @returns a StackPanel containing the radio button and a textBlock
  7703. */
  7704. static AddRadioButtonWithHeader(title: string, group: string, isChecked: boolean, onValueChanged: (button: RadioButton, value: boolean) => void): StackPanel;
  7705. }
  7706. }
  7707. declare module BABYLON.GUI {
  7708. /**
  7709. * Class used to create slider controls
  7710. */
  7711. export class BaseSlider extends Control {
  7712. name?: string | undefined;
  7713. protected _thumbWidth: ValueAndUnit;
  7714. private _minimum;
  7715. private _maximum;
  7716. private _value;
  7717. private _isVertical;
  7718. protected _barOffset: ValueAndUnit;
  7719. private _isThumbClamped;
  7720. protected _displayThumb: boolean;
  7721. private _step;
  7722. private _lastPointerDownID;
  7723. protected _effectiveBarOffset: number;
  7724. protected _renderLeft: number;
  7725. protected _renderTop: number;
  7726. protected _renderWidth: number;
  7727. protected _renderHeight: number;
  7728. protected _backgroundBoxLength: number;
  7729. protected _backgroundBoxThickness: number;
  7730. protected _effectiveThumbThickness: number;
  7731. /** BABYLON.Observable raised when the sldier value changes */
  7732. onValueChangedObservable: BABYLON.Observable<number>;
  7733. /** Gets or sets a boolean indicating if the thumb must be rendered */
  7734. get displayThumb(): boolean;
  7735. set displayThumb(value: boolean);
  7736. /** Gets or sets a step to apply to values (0 by default) */
  7737. get step(): number;
  7738. set step(value: number);
  7739. /** Gets or sets main bar offset (ie. the margin applied to the value bar) */
  7740. get barOffset(): string | number;
  7741. /** Gets main bar offset in pixels*/
  7742. get barOffsetInPixels(): number;
  7743. set barOffset(value: string | number);
  7744. /** Gets or sets thumb width */
  7745. get thumbWidth(): string | number;
  7746. /** Gets thumb width in pixels */
  7747. get thumbWidthInPixels(): number;
  7748. set thumbWidth(value: string | number);
  7749. /** Gets or sets minimum value */
  7750. get minimum(): number;
  7751. set minimum(value: number);
  7752. /** Gets or sets maximum value */
  7753. get maximum(): number;
  7754. set maximum(value: number);
  7755. /** Gets or sets current value */
  7756. get value(): number;
  7757. set value(value: number);
  7758. /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */
  7759. get isVertical(): boolean;
  7760. set isVertical(value: boolean);
  7761. /** Gets or sets a value indicating if the thumb can go over main bar extends */
  7762. get isThumbClamped(): boolean;
  7763. set isThumbClamped(value: boolean);
  7764. /**
  7765. * Creates a new BaseSlider
  7766. * @param name defines the control name
  7767. */
  7768. constructor(name?: string | undefined);
  7769. protected _getTypeName(): string;
  7770. protected _getThumbPosition(): number;
  7771. protected _getThumbThickness(type: string): number;
  7772. protected _prepareRenderingData(type: string): void;
  7773. private _pointerIsDown;
  7774. /** @hidden */
  7775. protected _updateValueFromPointer(x: number, y: number): void;
  7776. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  7777. _onPointerMove(target: Control, coordinates: BABYLON.Vector2, pointerId: number, pi: BABYLON.PointerInfoBase): void;
  7778. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  7779. _onCanvasBlur(): void;
  7780. }
  7781. }
  7782. declare module BABYLON.GUI {
  7783. /**
  7784. * Class used to create slider controls
  7785. */
  7786. export class Slider extends BaseSlider {
  7787. name?: string | undefined;
  7788. private _background;
  7789. private _borderColor;
  7790. private _thumbColor;
  7791. private _isThumbCircle;
  7792. protected _displayValueBar: boolean;
  7793. /** Gets or sets a boolean indicating if the value bar must be rendered */
  7794. get displayValueBar(): boolean;
  7795. set displayValueBar(value: boolean);
  7796. /** Gets or sets border color */
  7797. get borderColor(): string;
  7798. set borderColor(value: string);
  7799. /** Gets or sets background color */
  7800. get background(): string;
  7801. set background(value: string);
  7802. /** Gets or sets thumb's color */
  7803. get thumbColor(): string;
  7804. set thumbColor(value: string);
  7805. /** Gets or sets a boolean indicating if the thumb should be round or square */
  7806. get isThumbCircle(): boolean;
  7807. set isThumbCircle(value: boolean);
  7808. /**
  7809. * Creates a new Slider
  7810. * @param name defines the control name
  7811. */
  7812. constructor(name?: string | undefined);
  7813. protected _getTypeName(): string;
  7814. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  7815. }
  7816. }
  7817. declare module BABYLON.GUI {
  7818. /** Class used to create a RadioGroup
  7819. * which contains groups of radio buttons
  7820. */
  7821. export class SelectorGroup {
  7822. /** name of SelectorGroup */
  7823. name: string;
  7824. private _groupPanel;
  7825. private _selectors;
  7826. private _groupHeader;
  7827. /**
  7828. * Creates a new SelectorGroup
  7829. * @param name of group, used as a group heading
  7830. */
  7831. constructor(
  7832. /** name of SelectorGroup */
  7833. name: string);
  7834. /** Gets the groupPanel of the SelectorGroup */
  7835. get groupPanel(): StackPanel;
  7836. /** Gets the selectors array */
  7837. get selectors(): StackPanel[];
  7838. /** Gets and sets the group header */
  7839. get header(): string;
  7840. set header(label: string);
  7841. /** @hidden */
  7842. private _addGroupHeader;
  7843. /** @hidden*/
  7844. _getSelector(selectorNb: number): StackPanel | undefined;
  7845. /** Removes the selector at the given position
  7846. * @param selectorNb the position of the selector within the group
  7847. */
  7848. removeSelector(selectorNb: number): void;
  7849. }
  7850. /** Class used to create a CheckboxGroup
  7851. * which contains groups of checkbox buttons
  7852. */
  7853. export class CheckboxGroup extends SelectorGroup {
  7854. /** Adds a checkbox as a control
  7855. * @param text is the label for the selector
  7856. * @param func is the function called when the Selector is checked
  7857. * @param checked is true when Selector is checked
  7858. */
  7859. addCheckbox(text: string, func?: (s: boolean) => void, checked?: boolean): void;
  7860. /** @hidden */
  7861. _setSelectorLabel(selectorNb: number, label: string): void;
  7862. /** @hidden */
  7863. _setSelectorLabelColor(selectorNb: number, color: string): void;
  7864. /** @hidden */
  7865. _setSelectorButtonColor(selectorNb: number, color: string): void;
  7866. /** @hidden */
  7867. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  7868. }
  7869. /** Class used to create a RadioGroup
  7870. * which contains groups of radio buttons
  7871. */
  7872. export class RadioGroup extends SelectorGroup {
  7873. private _selectNb;
  7874. /** Adds a radio button as a control
  7875. * @param label is the label for the selector
  7876. * @param func is the function called when the Selector is checked
  7877. * @param checked is true when Selector is checked
  7878. */
  7879. addRadio(label: string, func?: (n: number) => void, checked?: boolean): void;
  7880. /** @hidden */
  7881. _setSelectorLabel(selectorNb: number, label: string): void;
  7882. /** @hidden */
  7883. _setSelectorLabelColor(selectorNb: number, color: string): void;
  7884. /** @hidden */
  7885. _setSelectorButtonColor(selectorNb: number, color: string): void;
  7886. /** @hidden */
  7887. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  7888. }
  7889. /** Class used to create a SliderGroup
  7890. * which contains groups of slider buttons
  7891. */
  7892. export class SliderGroup extends SelectorGroup {
  7893. /**
  7894. * Adds a slider to the SelectorGroup
  7895. * @param label is the label for the SliderBar
  7896. * @param func is the function called when the Slider moves
  7897. * @param unit is a string describing the units used, eg degrees or metres
  7898. * @param min is the minimum value for the Slider
  7899. * @param max is the maximum value for the Slider
  7900. * @param value is the start value for the Slider between min and max
  7901. * @param onValueChange is the function used to format the value displayed, eg radians to degrees
  7902. */
  7903. addSlider(label: string, func?: (v: number) => void, unit?: string, min?: number, max?: number, value?: number, onValueChange?: (v: number) => number): void;
  7904. /** @hidden */
  7905. _setSelectorLabel(selectorNb: number, label: string): void;
  7906. /** @hidden */
  7907. _setSelectorLabelColor(selectorNb: number, color: string): void;
  7908. /** @hidden */
  7909. _setSelectorButtonColor(selectorNb: number, color: string): void;
  7910. /** @hidden */
  7911. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  7912. }
  7913. /** Class used to hold the controls for the checkboxes, radio buttons and sliders
  7914. * @see https://doc.babylonjs.com/how_to/selector
  7915. */
  7916. export class SelectionPanel extends Rectangle {
  7917. /** name of SelectionPanel */
  7918. name: string;
  7919. /** an array of SelectionGroups */
  7920. groups: SelectorGroup[];
  7921. private _panel;
  7922. private _buttonColor;
  7923. private _buttonBackground;
  7924. private _headerColor;
  7925. private _barColor;
  7926. private _barHeight;
  7927. private _spacerHeight;
  7928. private _labelColor;
  7929. private _groups;
  7930. private _bars;
  7931. /**
  7932. * Creates a new SelectionPanel
  7933. * @param name of SelectionPanel
  7934. * @param groups is an array of SelectionGroups
  7935. */
  7936. constructor(
  7937. /** name of SelectionPanel */
  7938. name: string,
  7939. /** an array of SelectionGroups */
  7940. groups?: SelectorGroup[]);
  7941. protected _getTypeName(): string;
  7942. /** Gets the (stack) panel of the SelectionPanel */
  7943. get panel(): StackPanel;
  7944. /** Gets or sets the headerColor */
  7945. get headerColor(): string;
  7946. set headerColor(color: string);
  7947. private _setHeaderColor;
  7948. /** Gets or sets the button color */
  7949. get buttonColor(): string;
  7950. set buttonColor(color: string);
  7951. private _setbuttonColor;
  7952. /** Gets or sets the label color */
  7953. get labelColor(): string;
  7954. set labelColor(color: string);
  7955. private _setLabelColor;
  7956. /** Gets or sets the button background */
  7957. get buttonBackground(): string;
  7958. set buttonBackground(color: string);
  7959. private _setButtonBackground;
  7960. /** Gets or sets the color of separator bar */
  7961. get barColor(): string;
  7962. set barColor(color: string);
  7963. private _setBarColor;
  7964. /** Gets or sets the height of separator bar */
  7965. get barHeight(): string;
  7966. set barHeight(value: string);
  7967. private _setBarHeight;
  7968. /** Gets or sets the height of spacers*/
  7969. get spacerHeight(): string;
  7970. set spacerHeight(value: string);
  7971. private _setSpacerHeight;
  7972. /** Adds a bar between groups */
  7973. private _addSpacer;
  7974. /** Add a group to the selection panel
  7975. * @param group is the selector group to add
  7976. */
  7977. addGroup(group: SelectorGroup): void;
  7978. /** Remove the group from the given position
  7979. * @param groupNb is the position of the group in the list
  7980. */
  7981. removeGroup(groupNb: number): void;
  7982. /** Change a group header label
  7983. * @param label is the new group header label
  7984. * @param groupNb is the number of the group to relabel
  7985. * */
  7986. setHeaderName(label: string, groupNb: number): void;
  7987. /** Change selector label to the one given
  7988. * @param label is the new selector label
  7989. * @param groupNb is the number of the groupcontaining the selector
  7990. * @param selectorNb is the number of the selector within a group to relabel
  7991. * */
  7992. relabel(label: string, groupNb: number, selectorNb: number): void;
  7993. /** For a given group position remove the selector at the given position
  7994. * @param groupNb is the number of the group to remove the selector from
  7995. * @param selectorNb is the number of the selector within the group
  7996. */
  7997. removeFromGroupSelector(groupNb: number, selectorNb: number): void;
  7998. /** For a given group position of correct type add a checkbox button
  7999. * @param groupNb is the number of the group to remove the selector from
  8000. * @param label is the label for the selector
  8001. * @param func is the function called when the Selector is checked
  8002. * @param checked is true when Selector is checked
  8003. */
  8004. addToGroupCheckbox(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  8005. /** For a given group position of correct type add a radio button
  8006. * @param groupNb is the number of the group to remove the selector from
  8007. * @param label is the label for the selector
  8008. * @param func is the function called when the Selector is checked
  8009. * @param checked is true when Selector is checked
  8010. */
  8011. addToGroupRadio(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  8012. /**
  8013. * For a given slider group add a slider
  8014. * @param groupNb is the number of the group to add the slider to
  8015. * @param label is the label for the Slider
  8016. * @param func is the function called when the Slider moves
  8017. * @param unit is a string describing the units used, eg degrees or metres
  8018. * @param min is the minimum value for the Slider
  8019. * @param max is the maximum value for the Slider
  8020. * @param value is the start value for the Slider between min and max
  8021. * @param onVal is the function used to format the value displayed, eg radians to degrees
  8022. */
  8023. addToGroupSlider(groupNb: number, label: string, func?: () => void, unit?: string, min?: number, max?: number, value?: number, onVal?: (v: number) => number): void;
  8024. }
  8025. }
  8026. declare module BABYLON.GUI {
  8027. /**
  8028. * Class used to hold a the container for ScrollViewer
  8029. * @hidden
  8030. */
  8031. export class _ScrollViewerWindow extends Container {
  8032. parentClientWidth: number;
  8033. parentClientHeight: number;
  8034. private _freezeControls;
  8035. private _parentMeasure;
  8036. private _oldLeft;
  8037. private _oldTop;
  8038. get freezeControls(): boolean;
  8039. set freezeControls(value: boolean);
  8040. private _bucketWidth;
  8041. private _bucketHeight;
  8042. private _buckets;
  8043. private _bucketLen;
  8044. get bucketWidth(): number;
  8045. get bucketHeight(): number;
  8046. setBucketSizes(width: number, height: number): void;
  8047. private _useBuckets;
  8048. private _makeBuckets;
  8049. private _dispatchInBuckets;
  8050. private _updateMeasures;
  8051. private _updateChildrenMeasures;
  8052. private _restoreMeasures;
  8053. /**
  8054. * Creates a new ScrollViewerWindow
  8055. * @param name of ScrollViewerWindow
  8056. */
  8057. constructor(name?: string);
  8058. protected _getTypeName(): string;
  8059. /** @hidden */
  8060. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  8061. /** @hidden */
  8062. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  8063. private _scrollChildren;
  8064. private _scrollChildrenWithBuckets;
  8065. /** @hidden */
  8066. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Measure): void;
  8067. protected _postMeasure(): void;
  8068. }
  8069. }
  8070. declare module BABYLON.GUI {
  8071. /**
  8072. * Class used to create slider controls
  8073. */
  8074. export class ScrollBar extends BaseSlider {
  8075. name?: string | undefined;
  8076. private _background;
  8077. private _borderColor;
  8078. private _tempMeasure;
  8079. /** Gets or sets border color */
  8080. get borderColor(): string;
  8081. set borderColor(value: string);
  8082. /** Gets or sets background color */
  8083. get background(): string;
  8084. set background(value: string);
  8085. /**
  8086. * Creates a new Slider
  8087. * @param name defines the control name
  8088. */
  8089. constructor(name?: string | undefined);
  8090. protected _getTypeName(): string;
  8091. protected _getThumbThickness(): number;
  8092. _draw(context: CanvasRenderingContext2D): void;
  8093. private _first;
  8094. private _originX;
  8095. private _originY;
  8096. /** @hidden */
  8097. protected _updateValueFromPointer(x: number, y: number): void;
  8098. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  8099. }
  8100. }
  8101. declare module BABYLON.GUI {
  8102. /**
  8103. * Class used to create slider controls
  8104. */
  8105. export class ImageScrollBar extends BaseSlider {
  8106. name?: string | undefined;
  8107. private _backgroundBaseImage;
  8108. private _backgroundImage;
  8109. private _thumbImage;
  8110. private _thumbBaseImage;
  8111. private _thumbLength;
  8112. private _thumbHeight;
  8113. private _barImageHeight;
  8114. private _tempMeasure;
  8115. /** Number of 90° rotation to apply on the images when in vertical mode */
  8116. num90RotationInVerticalMode: number;
  8117. /**
  8118. * Gets or sets the image used to render the background for horizontal bar
  8119. */
  8120. get backgroundImage(): Image;
  8121. set backgroundImage(value: Image);
  8122. /**
  8123. * Gets or sets the image used to render the thumb
  8124. */
  8125. get thumbImage(): Image;
  8126. set thumbImage(value: Image);
  8127. /**
  8128. * Gets or sets the length of the thumb
  8129. */
  8130. get thumbLength(): number;
  8131. set thumbLength(value: number);
  8132. /**
  8133. * Gets or sets the height of the thumb
  8134. */
  8135. get thumbHeight(): number;
  8136. set thumbHeight(value: number);
  8137. /**
  8138. * Gets or sets the height of the bar image
  8139. */
  8140. get barImageHeight(): number;
  8141. set barImageHeight(value: number);
  8142. /**
  8143. * Creates a new ImageScrollBar
  8144. * @param name defines the control name
  8145. */
  8146. constructor(name?: string | undefined);
  8147. protected _getTypeName(): string;
  8148. protected _getThumbThickness(): number;
  8149. _draw(context: CanvasRenderingContext2D): void;
  8150. private _first;
  8151. private _originX;
  8152. private _originY;
  8153. /** @hidden */
  8154. protected _updateValueFromPointer(x: number, y: number): void;
  8155. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  8156. }
  8157. }
  8158. declare module BABYLON.GUI {
  8159. /**
  8160. * Class used to hold a viewer window and sliders in a grid
  8161. */
  8162. export class ScrollViewer extends Rectangle {
  8163. private _grid;
  8164. private _horizontalBarSpace;
  8165. private _verticalBarSpace;
  8166. private _dragSpace;
  8167. private _horizontalBar;
  8168. private _verticalBar;
  8169. private _barColor;
  8170. private _barBackground;
  8171. private _barImage;
  8172. private _horizontalBarImage;
  8173. private _verticalBarImage;
  8174. private _barBackgroundImage;
  8175. private _horizontalBarBackgroundImage;
  8176. private _verticalBarBackgroundImage;
  8177. private _barSize;
  8178. private _window;
  8179. private _pointerIsOver;
  8180. private _wheelPrecision;
  8181. private _onWheelObserver;
  8182. private _clientWidth;
  8183. private _clientHeight;
  8184. private _useImageBar;
  8185. private _thumbLength;
  8186. private _thumbHeight;
  8187. private _barImageHeight;
  8188. private _horizontalBarImageHeight;
  8189. private _verticalBarImageHeight;
  8190. private _oldWindowContentsWidth;
  8191. private _oldWindowContentsHeight;
  8192. /**
  8193. * Gets the horizontal scrollbar
  8194. */
  8195. get horizontalBar(): ScrollBar | ImageScrollBar;
  8196. /**
  8197. * Gets the vertical scrollbar
  8198. */
  8199. get verticalBar(): ScrollBar | ImageScrollBar;
  8200. /**
  8201. * Adds a new control to the current container
  8202. * @param control defines the control to add
  8203. * @returns the current container
  8204. */
  8205. addControl(control: BABYLON.Nullable<Control>): Container;
  8206. /**
  8207. * Removes a control from the current container
  8208. * @param control defines the control to remove
  8209. * @returns the current container
  8210. */
  8211. removeControl(control: Control): Container;
  8212. /** Gets the list of children */
  8213. get children(): Control[];
  8214. _flagDescendantsAsMatrixDirty(): void;
  8215. /**
  8216. * Freezes or unfreezes the controls in the window.
  8217. * When controls are frozen, the scroll viewer can render a lot more quickly but updates to positions/sizes of controls
  8218. * are not taken into account. If you want to change positions/sizes, unfreeze, perform the changes then freeze again
  8219. */
  8220. get freezeControls(): boolean;
  8221. set freezeControls(value: boolean);
  8222. /** Gets the bucket width */
  8223. get bucketWidth(): number;
  8224. /** Gets the bucket height */
  8225. get bucketHeight(): number;
  8226. /**
  8227. * Sets the bucket sizes.
  8228. * When freezeControls is true, setting a non-zero bucket size will improve performances by updating only
  8229. * controls that are visible. The bucket sizes is used to subdivide (internally) the window area to smaller areas into which
  8230. * controls are dispatched. So, the size should be roughly equals to the mean size of all the controls of
  8231. * the window. To disable the usage of buckets, sets either width or height (or both) to 0.
  8232. * Please note that using this option will raise the memory usage (the higher the bucket sizes, the less memory
  8233. * used), that's why it is not enabled by default.
  8234. * @param width width of the bucket
  8235. * @param height height of the bucket
  8236. */
  8237. setBucketSizes(width: number, height: number): void;
  8238. private _forceHorizontalBar;
  8239. private _forceVerticalBar;
  8240. /**
  8241. * Forces the horizontal scroll bar to be displayed
  8242. */
  8243. get forceHorizontalBar(): boolean;
  8244. set forceHorizontalBar(value: boolean);
  8245. /**
  8246. * Forces the vertical scroll bar to be displayed
  8247. */
  8248. get forceVerticalBar(): boolean;
  8249. set forceVerticalBar(value: boolean);
  8250. /**
  8251. * Creates a new ScrollViewer
  8252. * @param name of ScrollViewer
  8253. */
  8254. constructor(name?: string, isImageBased?: boolean);
  8255. /** Reset the scroll viewer window to initial size */
  8256. resetWindow(): void;
  8257. protected _getTypeName(): string;
  8258. private _buildClientSizes;
  8259. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  8260. protected _postMeasure(): void;
  8261. /**
  8262. * Gets or sets the mouse wheel precision
  8263. * from 0 to 1 with a default value of 0.05
  8264. * */
  8265. get wheelPrecision(): number;
  8266. set wheelPrecision(value: number);
  8267. /** Gets or sets the scroll bar container background color */
  8268. get scrollBackground(): string;
  8269. set scrollBackground(color: string);
  8270. /** Gets or sets the bar color */
  8271. get barColor(): string;
  8272. set barColor(color: string);
  8273. /** Gets or sets the bar image */
  8274. get thumbImage(): Image;
  8275. set thumbImage(value: Image);
  8276. /** Gets or sets the horizontal bar image */
  8277. get horizontalThumbImage(): Image;
  8278. set horizontalThumbImage(value: Image);
  8279. /** Gets or sets the vertical bar image */
  8280. get verticalThumbImage(): Image;
  8281. set verticalThumbImage(value: Image);
  8282. /** Gets or sets the size of the bar */
  8283. get barSize(): number;
  8284. set barSize(value: number);
  8285. /** Gets or sets the length of the thumb */
  8286. get thumbLength(): number;
  8287. set thumbLength(value: number);
  8288. /** Gets or sets the height of the thumb */
  8289. get thumbHeight(): number;
  8290. set thumbHeight(value: number);
  8291. /** Gets or sets the height of the bar image */
  8292. get barImageHeight(): number;
  8293. set barImageHeight(value: number);
  8294. /** Gets or sets the height of the horizontal bar image */
  8295. get horizontalBarImageHeight(): number;
  8296. set horizontalBarImageHeight(value: number);
  8297. /** Gets or sets the height of the vertical bar image */
  8298. get verticalBarImageHeight(): number;
  8299. set verticalBarImageHeight(value: number);
  8300. /** Gets or sets the bar background */
  8301. get barBackground(): string;
  8302. set barBackground(color: string);
  8303. /** Gets or sets the bar background image */
  8304. get barImage(): Image;
  8305. set barImage(value: Image);
  8306. /** Gets or sets the horizontal bar background image */
  8307. get horizontalBarImage(): Image;
  8308. set horizontalBarImage(value: Image);
  8309. /** Gets or sets the vertical bar background image */
  8310. get verticalBarImage(): Image;
  8311. set verticalBarImage(value: Image);
  8312. private _setWindowPosition;
  8313. /** @hidden */
  8314. private _updateScroller;
  8315. _link(host: AdvancedDynamicTexture): void;
  8316. /** @hidden */
  8317. private _addBar;
  8318. /** @hidden */
  8319. private _attachWheel;
  8320. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  8321. /** Releases associated resources */
  8322. dispose(): void;
  8323. }
  8324. }
  8325. declare module BABYLON.GUI {
  8326. /**
  8327. * Class used to create toggle buttons
  8328. */
  8329. export class ToggleButton extends Rectangle {
  8330. name?: string | undefined;
  8331. /**
  8332. * Function called to generate the toActive animation
  8333. */
  8334. toActiveAnimation: () => void;
  8335. /**
  8336. * Function called to generate the toInactive animation
  8337. */
  8338. toInactiveAnimation: () => void;
  8339. /**
  8340. * Function called to generate a pointer enter animation when the toggle button is active.
  8341. */
  8342. pointerEnterActiveAnimation: () => void;
  8343. /**
  8344. * Function called to generate a pointer out animation when the toggle button is active.
  8345. */
  8346. pointerOutActiveAnimation: () => void;
  8347. /**
  8348. * Function called to generate a pointer down animation when the toggle button is active.
  8349. */
  8350. pointerDownActiveAnimation: () => void;
  8351. /**
  8352. * Function called to generate a pointer up animation when the toggle button is active.
  8353. */
  8354. pointerUpActiveAnimation: () => void;
  8355. /**
  8356. * Function called to generate a pointer enter animation when the toggle button is inactive.
  8357. */
  8358. pointerEnterInactiveAnimation: () => void;
  8359. /**
  8360. * Function called to generate a pointer out animation when the toggle button is inactive.
  8361. */
  8362. pointerOutInactiveAnimation: () => void;
  8363. /**
  8364. * Function called to generate a pointer down animation when the toggle button is inactive.
  8365. */
  8366. pointerDownInactiveAnimation: () => void;
  8367. /**
  8368. * Function called to generate a pointer up animation when the toggle button is inactive.
  8369. */
  8370. pointerUpInactiveAnimation: () => void;
  8371. /** BABYLON.Observable raised when isActive is changed */
  8372. onIsActiveChangedObservable: BABYLON.Observable<boolean>;
  8373. /**
  8374. * Gets or sets a boolean indicating that the toggle button will let internal controls handle picking instead of doing it directly using its bounding info
  8375. */
  8376. delegatePickingToChildren: boolean;
  8377. private _image;
  8378. /**
  8379. * Returns the ToggleButton's image control if it exists
  8380. */
  8381. get image(): BABYLON.Nullable<Image>;
  8382. private _textBlock;
  8383. /**
  8384. * Returns the ToggleButton's child TextBlock control if it exists
  8385. */
  8386. get textBlock(): BABYLON.Nullable<TextBlock>;
  8387. private _group;
  8388. /** Gets or sets group name this toggle button belongs to */
  8389. get group(): string;
  8390. set group(value: string);
  8391. private _isActive;
  8392. /** Gets or sets a boolean indicating if the toogle button is active or not */
  8393. get isActive(): boolean;
  8394. set isActive(value: boolean);
  8395. /**
  8396. * Creates a new ToggleButton
  8397. * @param name defines the control name
  8398. * @param group defines the toggle group this toggle belongs to
  8399. */
  8400. constructor(name?: string | undefined, group?: string);
  8401. protected _getTypeName(): string;
  8402. /** @hidden */
  8403. _processPicking(x: number, y: number, pi: BABYLON.PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
  8404. /** @hidden */
  8405. _onPointerEnter(target: Control, pi: BABYLON.PointerInfoBase): boolean;
  8406. /** @hidden */
  8407. _onPointerOut(target: Control, pi: BABYLON.PointerInfoBase, force?: boolean): void;
  8408. /** @hidden */
  8409. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  8410. /** @hidden */
  8411. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi: BABYLON.PointerInfoBase): void;
  8412. }
  8413. }
  8414. declare module BABYLON.GUI {
  8415. /** Class used to render a grid */
  8416. export class DisplayGrid extends Control {
  8417. name?: string | undefined;
  8418. private _cellWidth;
  8419. private _cellHeight;
  8420. private _minorLineTickness;
  8421. private _minorLineColor;
  8422. private _majorLineTickness;
  8423. private _majorLineColor;
  8424. private _majorLineFrequency;
  8425. private _background;
  8426. private _displayMajorLines;
  8427. private _displayMinorLines;
  8428. /** Gets or sets a boolean indicating if minor lines must be rendered (true by default)) */
  8429. get displayMinorLines(): boolean;
  8430. set displayMinorLines(value: boolean);
  8431. /** Gets or sets a boolean indicating if major lines must be rendered (true by default)) */
  8432. get displayMajorLines(): boolean;
  8433. set displayMajorLines(value: boolean);
  8434. /** Gets or sets background color (Black by default) */
  8435. get background(): string;
  8436. set background(value: string);
  8437. /** Gets or sets the width of each cell (20 by default) */
  8438. get cellWidth(): number;
  8439. set cellWidth(value: number);
  8440. /** Gets or sets the height of each cell (20 by default) */
  8441. get cellHeight(): number;
  8442. set cellHeight(value: number);
  8443. /** Gets or sets the tickness of minor lines (1 by default) */
  8444. get minorLineTickness(): number;
  8445. set minorLineTickness(value: number);
  8446. /** Gets or sets the color of minor lines (DarkGray by default) */
  8447. get minorLineColor(): string;
  8448. set minorLineColor(value: string);
  8449. /** Gets or sets the tickness of major lines (2 by default) */
  8450. get majorLineTickness(): number;
  8451. set majorLineTickness(value: number);
  8452. /** Gets or sets the color of major lines (White by default) */
  8453. get majorLineColor(): string;
  8454. set majorLineColor(value: string);
  8455. /** Gets or sets the frequency of major lines (default is 1 every 5 minor lines)*/
  8456. get majorLineFrequency(): number;
  8457. set majorLineFrequency(value: number);
  8458. /**
  8459. * Creates a new GridDisplayRectangle
  8460. * @param name defines the control name
  8461. */
  8462. constructor(name?: string | undefined);
  8463. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  8464. protected _getTypeName(): string;
  8465. }
  8466. }
  8467. declare module BABYLON.GUI {
  8468. /**
  8469. * Class used to create slider controls based on images
  8470. */
  8471. export class ImageBasedSlider extends BaseSlider {
  8472. name?: string | undefined;
  8473. private _backgroundImage;
  8474. private _thumbImage;
  8475. private _valueBarImage;
  8476. private _tempMeasure;
  8477. get displayThumb(): boolean;
  8478. set displayThumb(value: boolean);
  8479. /**
  8480. * Gets or sets the image used to render the background
  8481. */
  8482. get backgroundImage(): Image;
  8483. set backgroundImage(value: Image);
  8484. /**
  8485. * Gets or sets the image used to render the value bar
  8486. */
  8487. get valueBarImage(): Image;
  8488. set valueBarImage(value: Image);
  8489. /**
  8490. * Gets or sets the image used to render the thumb
  8491. */
  8492. get thumbImage(): Image;
  8493. set thumbImage(value: Image);
  8494. /**
  8495. * Creates a new ImageBasedSlider
  8496. * @param name defines the control name
  8497. */
  8498. constructor(name?: string | undefined);
  8499. protected _getTypeName(): string;
  8500. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  8501. }
  8502. }
  8503. declare module BABYLON.GUI {
  8504. /**
  8505. * Forcing an export so that this code will execute
  8506. * @hidden
  8507. */
  8508. const name = "Statics";
  8509. }
  8510. declare module BABYLON.GUI {
  8511. /**
  8512. * This class can be used to get instrumentation data from a AdvancedDynamicTexture object
  8513. */
  8514. export class AdvancedDynamicTextureInstrumentation implements BABYLON.IDisposable {
  8515. /**
  8516. * Define the instrumented AdvancedDynamicTexture.
  8517. */
  8518. texture: AdvancedDynamicTexture;
  8519. private _captureRenderTime;
  8520. private _renderTime;
  8521. private _captureLayoutTime;
  8522. private _layoutTime;
  8523. private _onBeginRenderObserver;
  8524. private _onEndRenderObserver;
  8525. private _onBeginLayoutObserver;
  8526. private _onEndLayoutObserver;
  8527. /**
  8528. * Gets the perf counter used to capture render time
  8529. */
  8530. get renderTimeCounter(): BABYLON.PerfCounter;
  8531. /**
  8532. * Gets the perf counter used to capture layout time
  8533. */
  8534. get layoutTimeCounter(): BABYLON.PerfCounter;
  8535. /**
  8536. * Enable or disable the render time capture
  8537. */
  8538. get captureRenderTime(): boolean;
  8539. set captureRenderTime(value: boolean);
  8540. /**
  8541. * Enable or disable the layout time capture
  8542. */
  8543. get captureLayoutTime(): boolean;
  8544. set captureLayoutTime(value: boolean);
  8545. /**
  8546. * Instantiates a new advanced dynamic texture instrumentation.
  8547. * This class can be used to get instrumentation data from an AdvancedDynamicTexture object
  8548. * @param texture Defines the AdvancedDynamicTexture to instrument
  8549. */
  8550. constructor(
  8551. /**
  8552. * Define the instrumented AdvancedDynamicTexture.
  8553. */
  8554. texture: AdvancedDynamicTexture);
  8555. /**
  8556. * Dispose and release associated resources.
  8557. */
  8558. dispose(): void;
  8559. }
  8560. }
  8561. declare module BABYLON.GUI {
  8562. /**
  8563. * Class used to load GUI via XML.
  8564. */
  8565. export class XmlLoader {
  8566. private _nodes;
  8567. private _nodeTypes;
  8568. private _isLoaded;
  8569. private _objectAttributes;
  8570. private _parentClass;
  8571. /**
  8572. * Create a new xml loader
  8573. * @param parentClass Sets the class context. Used when the loader is instanced inside a class and not in a global context
  8574. */
  8575. constructor(parentClass?: null);
  8576. private _getChainElement;
  8577. private _getClassAttribute;
  8578. private _createGuiElement;
  8579. private _parseGrid;
  8580. private _parseElement;
  8581. private _prepareSourceElement;
  8582. private _parseElementsFromSource;
  8583. private _parseXml;
  8584. /**
  8585. * Gets if the loading has finished.
  8586. * @returns whether the loading has finished or not
  8587. */
  8588. isLoaded(): boolean;
  8589. /**
  8590. * Gets a loaded node / control by id.
  8591. * @param id the Controls id set in the xml
  8592. * @returns element of type Control
  8593. */
  8594. getNodeById(id: string): any;
  8595. /**
  8596. * Gets all loaded nodes / controls
  8597. * @returns Array of controls
  8598. */
  8599. getNodes(): any;
  8600. /**
  8601. * Initiates the xml layout loading
  8602. * @param xmlFile defines the xml layout to load
  8603. * @param rootNode defines the node / control to use as a parent for the loaded layout controls.
  8604. * @param callback defines the callback called on layout load.
  8605. */
  8606. loadLayout(xmlFile: any, rootNode: any, callback: any): void;
  8607. }
  8608. }
  8609. declare module BABYLON.GUI {
  8610. /**
  8611. * Class used to create containers for controls
  8612. */
  8613. export class Container3D extends Control3D {
  8614. private _blockLayout;
  8615. /**
  8616. * Gets the list of child controls
  8617. */
  8618. protected _children: Control3D[];
  8619. /**
  8620. * Gets the list of child controls
  8621. */
  8622. get children(): Array<Control3D>;
  8623. /**
  8624. * Gets or sets a boolean indicating if the layout must be blocked (default is false).
  8625. * This is helpful to optimize layout operation when adding multiple children in a row
  8626. */
  8627. get blockLayout(): boolean;
  8628. set blockLayout(value: boolean);
  8629. /**
  8630. * Creates a new container
  8631. * @param name defines the container name
  8632. */
  8633. constructor(name?: string);
  8634. /**
  8635. * Force the container to update the layout. Please note that it will not take blockLayout property in account
  8636. * @returns the current container
  8637. */
  8638. updateLayout(): Container3D;
  8639. /**
  8640. * Gets a boolean indicating if the given control is in the children of this control
  8641. * @param control defines the control to check
  8642. * @returns true if the control is in the child list
  8643. */
  8644. containsControl(control: Control3D): boolean;
  8645. /**
  8646. * Adds a control to the children of this control
  8647. * @param control defines the control to add
  8648. * @returns the current container
  8649. */
  8650. addControl(control: Control3D): Container3D;
  8651. /**
  8652. * This function will be called everytime a new control is added
  8653. */
  8654. protected _arrangeChildren(): void;
  8655. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  8656. /**
  8657. * Removes a control from the children of this control
  8658. * @param control defines the control to remove
  8659. * @returns the current container
  8660. */
  8661. removeControl(control: Control3D): Container3D;
  8662. protected _getTypeName(): string;
  8663. /**
  8664. * Releases all associated resources
  8665. */
  8666. dispose(): void;
  8667. /** Control rotation will remain unchanged */
  8668. static readonly UNSET_ORIENTATION: number;
  8669. /** Control will rotate to make it look at sphere central axis */
  8670. static readonly FACEORIGIN_ORIENTATION: number;
  8671. /** Control will rotate to make it look back at sphere central axis */
  8672. static readonly FACEORIGINREVERSED_ORIENTATION: number;
  8673. /** Control will rotate to look at z axis (0, 0, 1) */
  8674. static readonly FACEFORWARD_ORIENTATION: number;
  8675. /** Control will rotate to look at negative z axis (0, 0, -1) */
  8676. static readonly FACEFORWARDREVERSED_ORIENTATION: number;
  8677. }
  8678. }
  8679. declare module BABYLON.GUI {
  8680. /**
  8681. * Class used to create a button in 3D
  8682. */
  8683. export class Button3D extends AbstractButton3D {
  8684. /** @hidden */
  8685. protected _currentMaterial: BABYLON.Material;
  8686. private _facadeTexture;
  8687. private _content;
  8688. private _contentResolution;
  8689. private _contentScaleRatio;
  8690. /**
  8691. * Gets or sets the texture resolution used to render content (512 by default)
  8692. */
  8693. get contentResolution(): BABYLON.int;
  8694. set contentResolution(value: BABYLON.int);
  8695. /**
  8696. * Gets or sets the texture scale ratio used to render content (2 by default)
  8697. */
  8698. get contentScaleRatio(): number;
  8699. set contentScaleRatio(value: number);
  8700. protected _disposeFacadeTexture(): void;
  8701. protected _resetContent(): void;
  8702. /**
  8703. * Creates a new button
  8704. * @param name defines the control name
  8705. */
  8706. constructor(name?: string);
  8707. /**
  8708. * Gets or sets the GUI 2D content used to display the button's facade
  8709. */
  8710. get content(): Control;
  8711. set content(value: Control);
  8712. /**
  8713. * Apply the facade texture (created from the content property).
  8714. * This function can be overloaded by child classes
  8715. * @param facadeTexture defines the AdvancedDynamicTexture to use
  8716. */
  8717. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  8718. protected _getTypeName(): string;
  8719. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  8720. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  8721. /**
  8722. * Releases all associated resources
  8723. */
  8724. dispose(): void;
  8725. }
  8726. }
  8727. declare module BABYLON.GUI {
  8728. /**
  8729. * Class used to create a touchable button in 3D
  8730. */
  8731. export class TouchButton3D extends Button3D {
  8732. private _collisionMesh;
  8733. private _collidableFrontDirection;
  8734. private _lastTouchPoint;
  8735. private _tempButtonForwardRay;
  8736. private _lastKnownCollidableScale;
  8737. private _collidableInitialized;
  8738. private _frontOffset;
  8739. private _backOffset;
  8740. private _hoverOffset;
  8741. private _pushThroughBackOffset;
  8742. private _activeInteractions;
  8743. private _previousHeight;
  8744. /**
  8745. * Creates a new touchable button
  8746. * @param name defines the control name
  8747. * @param collisionMesh mesh to track collisions with
  8748. */
  8749. constructor(name?: string, collisionMesh?: BABYLON.Mesh);
  8750. /**
  8751. * Sets the front-facing direction of the button
  8752. * @param frontDir the forward direction of the button
  8753. */
  8754. set collidableFrontDirection(frontWorldDir: BABYLON.Vector3);
  8755. private _getWorldMatrixData;
  8756. /**
  8757. * Sets the mesh used for testing input collision
  8758. * @param collisionMesh the new collision mesh for the button
  8759. */
  8760. set collisionMesh(collisionMesh: BABYLON.Mesh);
  8761. private _getShortestDistancePointToLine;
  8762. private _isPrimedForInteraction;
  8763. private _getPointOnButton;
  8764. private _updateDistanceOffsets;
  8765. private _getHeightFromButtonCenter;
  8766. private _getDistanceOffPlane;
  8767. private _updateButtonState;
  8768. /** @hidden */
  8769. _collisionCheckForStateChange(mesh: BABYLON.AbstractMesh): void;
  8770. protected _getTypeName(): string;
  8771. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  8772. /**
  8773. * Releases all associated resources
  8774. */
  8775. dispose(): void;
  8776. }
  8777. }
  8778. declare module BABYLON.GUI {
  8779. /**
  8780. * Class used to manage 3D user interface
  8781. * @see https://doc.babylonjs.com/how_to/gui3d
  8782. */
  8783. export class GUI3DManager implements BABYLON.IDisposable {
  8784. private _scene;
  8785. private _sceneDisposeObserver;
  8786. private _utilityLayer;
  8787. private _rootContainer;
  8788. private _pointerObserver;
  8789. private _pointerOutObserver;
  8790. private _touchableButtons;
  8791. /** @hidden */
  8792. _lastPickedControl: Control3D;
  8793. /** @hidden */
  8794. _lastControlOver: {
  8795. [pointerId: number]: Control3D;
  8796. };
  8797. /** @hidden */
  8798. _lastControlDown: {
  8799. [pointerId: number]: Control3D;
  8800. };
  8801. /**
  8802. * BABYLON.Observable raised when the point picked by the pointer events changed
  8803. */
  8804. onPickedPointChangedObservable: BABYLON.Observable<BABYLON.Nullable<BABYLON.Vector3>>;
  8805. /** @hidden */
  8806. _sharedMaterials: {
  8807. [key: string]: BABYLON.Material;
  8808. };
  8809. /** @hidden */
  8810. _touchSharedMaterials: {
  8811. [key: string]: BABYLON.Material;
  8812. };
  8813. /** Gets the hosting scene */
  8814. get scene(): BABYLON.Scene;
  8815. /** Gets associated utility layer */
  8816. get utilityLayer(): BABYLON.Nullable<BABYLON.UtilityLayerRenderer>;
  8817. /**
  8818. * Creates a new GUI3DManager
  8819. * @param scene
  8820. */
  8821. constructor(scene?: BABYLON.Scene);
  8822. private _handlePointerOut;
  8823. private _doPicking;
  8824. private _processTouchControls;
  8825. /**
  8826. * Gets the root container
  8827. */
  8828. get rootContainer(): Container3D;
  8829. /**
  8830. * Gets a boolean indicating if the given control is in the root child list
  8831. * @param control defines the control to check
  8832. * @returns true if the control is in the root child list
  8833. */
  8834. containsControl(control: Control3D): boolean;
  8835. /**
  8836. * Adds a control to the root child list
  8837. * @param control defines the control to add
  8838. * @returns the current manager
  8839. */
  8840. addControl(control: Control3D): GUI3DManager;
  8841. /**
  8842. * Removes a control from the root child list
  8843. * @param control defines the control to remove
  8844. * @returns the current container
  8845. */
  8846. removeControl(control: Control3D): GUI3DManager;
  8847. /**
  8848. * Releases all associated resources
  8849. */
  8850. dispose(): void;
  8851. }
  8852. }
  8853. declare module BABYLON.GUI {
  8854. /**
  8855. * Class used to transport BABYLON.Vector3 information for pointer events
  8856. */
  8857. export class Vector3WithInfo extends BABYLON.Vector3 {
  8858. /** defines the current mouse button index */
  8859. buttonIndex: number;
  8860. /**
  8861. * Creates a new Vector3WithInfo
  8862. * @param source defines the vector3 data to transport
  8863. * @param buttonIndex defines the current mouse button index
  8864. */
  8865. constructor(source: BABYLON.Vector3,
  8866. /** defines the current mouse button index */
  8867. buttonIndex?: number);
  8868. }
  8869. }
  8870. declare module BABYLON.GUI {
  8871. /**
  8872. * Class used as base class for controls
  8873. */
  8874. export class Control3D implements BABYLON.IDisposable, BABYLON.IBehaviorAware<Control3D> {
  8875. /** Defines the control name */
  8876. name?: string | undefined;
  8877. /** @hidden */
  8878. _host: GUI3DManager;
  8879. private _node;
  8880. private _downCount;
  8881. private _enterCount;
  8882. private _downPointerIds;
  8883. private _isVisible;
  8884. /** Gets or sets the control position in world space */
  8885. get position(): BABYLON.Vector3;
  8886. set position(value: BABYLON.Vector3);
  8887. /** Gets or sets the control scaling in world space */
  8888. get scaling(): BABYLON.Vector3;
  8889. set scaling(value: BABYLON.Vector3);
  8890. /** Callback used to start pointer enter animation */
  8891. pointerEnterAnimation: () => void;
  8892. /** Callback used to start pointer out animation */
  8893. pointerOutAnimation: () => void;
  8894. /** Callback used to start pointer down animation */
  8895. pointerDownAnimation: () => void;
  8896. /** Callback used to start pointer up animation */
  8897. pointerUpAnimation: () => void;
  8898. /**
  8899. * An event triggered when the pointer move over the control
  8900. */
  8901. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector3>;
  8902. /**
  8903. * An event triggered when the pointer move out of the control
  8904. */
  8905. onPointerOutObservable: BABYLON.Observable<Control3D>;
  8906. /**
  8907. * An event triggered when the pointer taps the control
  8908. */
  8909. onPointerDownObservable: BABYLON.Observable<Vector3WithInfo>;
  8910. /**
  8911. * An event triggered when pointer is up
  8912. */
  8913. onPointerUpObservable: BABYLON.Observable<Vector3WithInfo>;
  8914. /**
  8915. * An event triggered when a control is clicked on (with a mouse)
  8916. */
  8917. onPointerClickObservable: BABYLON.Observable<Vector3WithInfo>;
  8918. /**
  8919. * An event triggered when pointer enters the control
  8920. */
  8921. onPointerEnterObservable: BABYLON.Observable<Control3D>;
  8922. /**
  8923. * Gets or sets the parent container
  8924. */
  8925. parent: BABYLON.Nullable<Container3D>;
  8926. private _behaviors;
  8927. /**
  8928. * Gets the list of attached behaviors
  8929. * @see https://doc.babylonjs.com/features/behaviour
  8930. */
  8931. get behaviors(): BABYLON.Behavior<Control3D>[];
  8932. /**
  8933. * Attach a behavior to the control
  8934. * @see https://doc.babylonjs.com/features/behaviour
  8935. * @param behavior defines the behavior to attach
  8936. * @returns the current control
  8937. */
  8938. addBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  8939. /**
  8940. * Remove an attached behavior
  8941. * @see https://doc.babylonjs.com/features/behaviour
  8942. * @param behavior defines the behavior to attach
  8943. * @returns the current control
  8944. */
  8945. removeBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  8946. /**
  8947. * Gets an attached behavior by name
  8948. * @param name defines the name of the behavior to look for
  8949. * @see https://doc.babylonjs.com/features/behaviour
  8950. * @returns null if behavior was not found else the requested behavior
  8951. */
  8952. getBehaviorByName(name: string): BABYLON.Nullable<BABYLON.Behavior<Control3D>>;
  8953. /** Gets or sets a boolean indicating if the control is visible */
  8954. get isVisible(): boolean;
  8955. set isVisible(value: boolean);
  8956. /**
  8957. * Creates a new control
  8958. * @param name defines the control name
  8959. */
  8960. constructor(
  8961. /** Defines the control name */
  8962. name?: string | undefined);
  8963. /**
  8964. * Gets a string representing the class name
  8965. */
  8966. get typeName(): string;
  8967. /**
  8968. * Get the current class name of the control.
  8969. * @returns current class name
  8970. */
  8971. getClassName(): string;
  8972. protected _getTypeName(): string;
  8973. /**
  8974. * Gets the transform node used by this control
  8975. */
  8976. get node(): BABYLON.Nullable<BABYLON.TransformNode>;
  8977. /**
  8978. * Gets the mesh used to render this control
  8979. */
  8980. get mesh(): BABYLON.Nullable<BABYLON.AbstractMesh>;
  8981. /**
  8982. * Link the control as child of the given node
  8983. * @param node defines the node to link to. Use null to unlink the control
  8984. * @returns the current control
  8985. */
  8986. linkToTransformNode(node: BABYLON.Nullable<BABYLON.TransformNode>): Control3D;
  8987. /** @hidden **/
  8988. _prepareNode(scene: BABYLON.Scene): void;
  8989. protected _injectGUI3DMetadata(node: BABYLON.TransformNode): any;
  8990. /**
  8991. * Node creation.
  8992. * Can be overriden by children
  8993. * @param scene defines the scene where the node must be attached
  8994. * @returns the attached node or null if none. Must return a BABYLON.Mesh or BABYLON.AbstractMesh if there is an atttached visible object
  8995. */
  8996. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  8997. /**
  8998. * Affect a material to the given mesh
  8999. * @param mesh defines the mesh which will represent the control
  9000. */
  9001. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  9002. /** @hidden */
  9003. _onPointerMove(target: Control3D, coordinates: BABYLON.Vector3): void;
  9004. /** @hidden */
  9005. _onPointerEnter(target: Control3D): boolean;
  9006. /** @hidden */
  9007. _onPointerOut(target: Control3D): void;
  9008. /** @hidden */
  9009. _onPointerDown(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  9010. /** @hidden */
  9011. _onPointerUp(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  9012. /** @hidden */
  9013. forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  9014. /** @hidden */
  9015. _processObservables(type: number, pickedPoint: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  9016. /** @hidden */
  9017. _disposeNode(): void;
  9018. /**
  9019. * Releases all associated resources
  9020. */
  9021. dispose(): void;
  9022. }
  9023. }
  9024. declare module BABYLON.GUI {
  9025. /**
  9026. * Class used as a root to all buttons
  9027. */
  9028. export class AbstractButton3D extends Control3D {
  9029. /**
  9030. * Creates a new button
  9031. * @param name defines the control name
  9032. */
  9033. constructor(name?: string);
  9034. protected _getTypeName(): string;
  9035. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  9036. }
  9037. }
  9038. declare module BABYLON.GUI {
  9039. /**
  9040. * Abstract class used to create a container panel deployed on the surface of a volume
  9041. */
  9042. export abstract class VolumeBasedPanel extends Container3D {
  9043. private _columns;
  9044. private _rows;
  9045. private _rowThenColum;
  9046. private _orientation;
  9047. protected _cellWidth: number;
  9048. protected _cellHeight: number;
  9049. /**
  9050. * Gets or sets the distance between elements
  9051. */
  9052. margin: number;
  9053. /**
  9054. * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)
  9055. * | Value | Type | Description |
  9056. * | ----- | ----------------------------------- | ----------- |
  9057. * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |
  9058. * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |
  9059. * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |
  9060. * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |
  9061. * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |
  9062. */
  9063. get orientation(): number;
  9064. set orientation(value: number);
  9065. /**
  9066. * Gets or sets the number of columns requested (10 by default).
  9067. * The panel will automatically compute the number of rows based on number of child controls.
  9068. */
  9069. get columns(): BABYLON.int;
  9070. set columns(value: BABYLON.int);
  9071. /**
  9072. * Gets or sets a the number of rows requested.
  9073. * The panel will automatically compute the number of columns based on number of child controls.
  9074. */
  9075. get rows(): BABYLON.int;
  9076. set rows(value: BABYLON.int);
  9077. /**
  9078. * Creates new VolumeBasedPanel
  9079. */
  9080. constructor();
  9081. protected _arrangeChildren(): void;
  9082. /** Child classes must implement this function to provide correct control positioning */
  9083. protected abstract _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  9084. /** Child classes can implement this function to provide additional processing */
  9085. protected _finalProcessing(): void;
  9086. }
  9087. }
  9088. declare module BABYLON.GUI {
  9089. /**
  9090. * Class used to create a container panel deployed on the surface of a cylinder
  9091. */
  9092. export class CylinderPanel extends VolumeBasedPanel {
  9093. private _radius;
  9094. /**
  9095. * Gets or sets the radius of the cylinder where to project controls (5 by default)
  9096. */
  9097. get radius(): BABYLON.float;
  9098. set radius(value: BABYLON.float);
  9099. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  9100. private _cylindricalMapping;
  9101. }
  9102. }
  9103. declare module BABYLON.GUI {
  9104. /** @hidden */
  9105. export var fluentVertexShader: {
  9106. name: string;
  9107. shader: string;
  9108. };
  9109. }
  9110. declare module BABYLON.GUI {
  9111. /** @hidden */
  9112. export var fluentPixelShader: {
  9113. name: string;
  9114. shader: string;
  9115. };
  9116. }
  9117. declare module BABYLON.GUI {
  9118. /** @hidden */
  9119. export class FluentMaterialDefines extends BABYLON.MaterialDefines {
  9120. INNERGLOW: boolean;
  9121. BORDER: boolean;
  9122. HOVERLIGHT: boolean;
  9123. TEXTURE: boolean;
  9124. constructor();
  9125. }
  9126. /**
  9127. * Class used to render controls with fluent desgin
  9128. */
  9129. export class FluentMaterial extends BABYLON.PushMaterial {
  9130. /**
  9131. * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)
  9132. */
  9133. innerGlowColorIntensity: number;
  9134. /**
  9135. * Gets or sets the inner glow color (white by default)
  9136. */
  9137. innerGlowColor: BABYLON.Color3;
  9138. /**
  9139. * Gets or sets the albedo color (Default is BABYLON.Color3(0.3, 0.35, 0.4))
  9140. */
  9141. albedoColor: BABYLON.Color3;
  9142. /**
  9143. * Gets or sets a boolean indicating if borders must be rendered (default is false)
  9144. */
  9145. renderBorders: boolean;
  9146. /**
  9147. * Gets or sets border width (default is 0.5)
  9148. */
  9149. borderWidth: number;
  9150. /**
  9151. * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)
  9152. */
  9153. edgeSmoothingValue: number;
  9154. /**
  9155. * Gets or sets the minimum value that can be applied to border width (default is 0.1)
  9156. */
  9157. borderMinValue: number;
  9158. /**
  9159. * Gets or sets a boolean indicating if hover light must be rendered (default is false)
  9160. */
  9161. renderHoverLight: boolean;
  9162. /**
  9163. * Gets or sets the radius used to render the hover light (default is 1.0)
  9164. */
  9165. hoverRadius: number;
  9166. /**
  9167. * Gets or sets the color used to render the hover light (default is BABYLON.Color4(0.3, 0.3, 0.3, 1.0))
  9168. */
  9169. hoverColor: BABYLON.Color4;
  9170. /**
  9171. * Gets or sets the hover light position in world space (default is BABYLON.Vector3.Zero())
  9172. */
  9173. hoverPosition: BABYLON.Vector3;
  9174. private _albedoTexture;
  9175. /** Gets or sets the texture to use for albedo color */
  9176. albedoTexture: BABYLON.Nullable<BABYLON.BaseTexture>;
  9177. /**
  9178. * Creates a new Fluent material
  9179. * @param name defines the name of the material
  9180. * @param scene defines the hosting scene
  9181. */
  9182. constructor(name: string, scene: BABYLON.Scene);
  9183. needAlphaBlending(): boolean;
  9184. needAlphaTesting(): boolean;
  9185. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  9186. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  9187. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  9188. getActiveTextures(): BABYLON.BaseTexture[];
  9189. hasTexture(texture: BABYLON.BaseTexture): boolean;
  9190. dispose(forceDisposeEffect?: boolean): void;
  9191. clone(name: string): FluentMaterial;
  9192. serialize(): any;
  9193. getClassName(): string;
  9194. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): FluentMaterial;
  9195. }
  9196. }
  9197. declare module BABYLON.GUI {
  9198. /**
  9199. * Class used to create a holographic button in 3D
  9200. */
  9201. export class HolographicButton extends Button3D {
  9202. private _backPlate;
  9203. private _textPlate;
  9204. private _frontPlate;
  9205. private _text;
  9206. private _imageUrl;
  9207. private _shareMaterials;
  9208. private _frontMaterial;
  9209. private _backMaterial;
  9210. private _plateMaterial;
  9211. private _pickedPointObserver;
  9212. private _tooltipFade;
  9213. private _tooltipTextBlock;
  9214. private _tooltipTexture;
  9215. private _tooltipMesh;
  9216. private _tooltipHoverObserver;
  9217. private _tooltipOutObserver;
  9218. private _disposeTooltip;
  9219. /**
  9220. * Rendering ground id of all the mesh in the button
  9221. */
  9222. set renderingGroupId(id: number);
  9223. get renderingGroupId(): number;
  9224. /**
  9225. * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
  9226. */
  9227. set tooltipText(text: BABYLON.Nullable<string>);
  9228. get tooltipText(): BABYLON.Nullable<string>;
  9229. /**
  9230. * Gets or sets text for the button
  9231. */
  9232. get text(): string;
  9233. set text(value: string);
  9234. /**
  9235. * Gets or sets the image url for the button
  9236. */
  9237. get imageUrl(): string;
  9238. set imageUrl(value: string);
  9239. /**
  9240. * Gets the back material used by this button
  9241. */
  9242. get backMaterial(): FluentMaterial;
  9243. /**
  9244. * Gets the front material used by this button
  9245. */
  9246. get frontMaterial(): FluentMaterial;
  9247. /**
  9248. * Gets the plate material used by this button
  9249. */
  9250. get plateMaterial(): BABYLON.StandardMaterial;
  9251. /**
  9252. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  9253. */
  9254. get shareMaterials(): boolean;
  9255. /**
  9256. * Creates a new button
  9257. * @param name defines the control name
  9258. */
  9259. constructor(name?: string, shareMaterials?: boolean);
  9260. protected _getTypeName(): string;
  9261. private _rebuildContent;
  9262. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  9263. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  9264. private _createBackMaterial;
  9265. private _createFrontMaterial;
  9266. private _createPlateMaterial;
  9267. protected _affectMaterial(mesh: BABYLON.Mesh): void;
  9268. /**
  9269. * Releases all associated resources
  9270. */
  9271. dispose(): void;
  9272. }
  9273. }
  9274. declare module BABYLON.GUI {
  9275. /**
  9276. * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene
  9277. */
  9278. export class MeshButton3D extends Button3D {
  9279. /** @hidden */
  9280. protected _currentMesh: BABYLON.Mesh;
  9281. /**
  9282. * Creates a new 3D button based on a mesh
  9283. * @param mesh mesh to become a 3D button
  9284. * @param name defines the control name
  9285. */
  9286. constructor(mesh: BABYLON.Mesh, name?: string);
  9287. protected _getTypeName(): string;
  9288. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  9289. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  9290. }
  9291. }
  9292. declare module BABYLON.GUI {
  9293. /**
  9294. * Class used to create a container panel deployed on the surface of a plane
  9295. */
  9296. export class PlanePanel extends VolumeBasedPanel {
  9297. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  9298. }
  9299. }
  9300. declare module BABYLON.GUI {
  9301. /**
  9302. * Class used to create a container panel where items get randomized planar mapping
  9303. */
  9304. export class ScatterPanel extends VolumeBasedPanel {
  9305. private _iteration;
  9306. /**
  9307. * Gets or sets the number of iteration to use to scatter the controls (100 by default)
  9308. */
  9309. get iteration(): BABYLON.float;
  9310. set iteration(value: BABYLON.float);
  9311. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  9312. private _scatterMapping;
  9313. protected _finalProcessing(): void;
  9314. }
  9315. }
  9316. declare module BABYLON.GUI {
  9317. /**
  9318. * Class used to create a container panel deployed on the surface of a sphere
  9319. */
  9320. export class SpherePanel extends VolumeBasedPanel {
  9321. private _radius;
  9322. /**
  9323. * Gets or sets the radius of the sphere where to project controls (5 by default)
  9324. */
  9325. get radius(): BABYLON.float;
  9326. set radius(value: BABYLON.float);
  9327. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  9328. private _sphericalMapping;
  9329. }
  9330. }
  9331. declare module BABYLON.GUI {
  9332. /**
  9333. * Class used to create a stack panel in 3D on XY plane
  9334. */
  9335. export class StackPanel3D extends Container3D {
  9336. private _isVertical;
  9337. /**
  9338. * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)
  9339. */
  9340. get isVertical(): boolean;
  9341. set isVertical(value: boolean);
  9342. /**
  9343. * Gets or sets the distance between elements
  9344. */
  9345. margin: number;
  9346. /**
  9347. * Creates new StackPanel
  9348. * @param isVertical
  9349. */
  9350. constructor(isVertical?: boolean);
  9351. protected _arrangeChildren(): void;
  9352. }
  9353. }
  9354. declare module BABYLON.GUI {
  9355. /**
  9356. * Class used to create an interactable object. It's a touchable 3D button using a mesh coming from the current scene
  9357. */
  9358. export class TouchMeshButton3D extends TouchButton3D {
  9359. /** @hidden */
  9360. protected _currentMesh: BABYLON.Mesh;
  9361. /**
  9362. * Creates a new 3D button based on a mesh
  9363. * @param mesh mesh to become a 3D button
  9364. * @param collisionMesh mesh to track collisions with
  9365. * @param name defines the control name
  9366. */
  9367. constructor(mesh: BABYLON.Mesh, options: {
  9368. collisionMesh: BABYLON.Mesh;
  9369. useDynamicMesh?: boolean;
  9370. }, name?: string);
  9371. protected _getTypeName(): string;
  9372. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  9373. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  9374. }
  9375. }
  9376. declare module BABYLON.GUI {
  9377. /**
  9378. * Class used to create a holographic button in 3D
  9379. */
  9380. export class TouchHolographicButton extends TouchButton3D {
  9381. private _backPlate;
  9382. private _textPlate;
  9383. private _frontPlate;
  9384. private _text;
  9385. private _imageUrl;
  9386. private _shareMaterials;
  9387. private _frontMaterial;
  9388. private _backMaterial;
  9389. private _plateMaterial;
  9390. private _pickedPointObserver;
  9391. private _tooltipFade;
  9392. private _tooltipTextBlock;
  9393. private _tooltipTexture;
  9394. private _tooltipMesh;
  9395. private _tooltipHoverObserver;
  9396. private _tooltipOutObserver;
  9397. private _disposeTooltip;
  9398. /**
  9399. * Rendering ground id of all the mesh in the button
  9400. */
  9401. set renderingGroupId(id: number);
  9402. get renderingGroupId(): number;
  9403. /**
  9404. * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
  9405. */
  9406. set tooltipText(text: BABYLON.Nullable<string>);
  9407. get tooltipText(): BABYLON.Nullable<string>;
  9408. /**
  9409. * Gets or sets text for the button
  9410. */
  9411. get text(): string;
  9412. set text(value: string);
  9413. /**
  9414. * Gets or sets the image url for the button
  9415. */
  9416. get imageUrl(): string;
  9417. set imageUrl(value: string);
  9418. /**
  9419. * Gets the back material used by this button
  9420. */
  9421. get backMaterial(): FluentMaterial;
  9422. /**
  9423. * Gets the front material used by this button
  9424. */
  9425. get frontMaterial(): FluentMaterial;
  9426. /**
  9427. * Gets the plate material used by this button
  9428. */
  9429. get plateMaterial(): BABYLON.StandardMaterial;
  9430. /**
  9431. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  9432. */
  9433. get shareMaterials(): boolean;
  9434. /**
  9435. * Creates a new button
  9436. * @param name defines the control name
  9437. */
  9438. constructor(name?: string, shareMaterials?: boolean);
  9439. protected _getTypeName(): string;
  9440. private _rebuildContent;
  9441. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  9442. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  9443. private _createBackMaterial;
  9444. private _createFrontMaterial;
  9445. private _createPlateMaterial;
  9446. protected _affectMaterial(mesh: BABYLON.Mesh): void;
  9447. /**
  9448. * Releases all associated resources
  9449. */
  9450. dispose(): void;
  9451. }
  9452. }