babylon.gui.module.d.ts 289 KB

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