babylon.gui.module.d.ts 355 KB

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