babylon.gui.module.d.ts 347 KB

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