babylon.gui.module.d.ts 268 KB

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