babylon.gui.module.d.ts 303 KB

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