babylon.gui.module.d.ts 288 KB

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