babylon.gui.module.d.ts 300 KB

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