babylon.gui.module.d.ts 336 KB

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