babylon.gui.module.d.ts 291 KB

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