babylon.gui.module.d.ts 302 KB

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