babylon.gui.module.d.ts 268 KB

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