babylon.gui.module.d.ts 342 KB

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