babylon.gui.module.d.ts 285 KB

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