babylon.gui.module.d.ts 247 KB

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