babylon.gui.module.d.ts 346 KB

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