babylon.gui.module.d.ts 269 KB

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