babylon.gui.module.d.ts 246 KB

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