babylon.gui.module.d.ts 261 KB

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