babylon.gui.module.d.ts 248 KB

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