babylon.gui.module.d.ts 264 KB

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