babylon.gui.module.d.ts 300 KB

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