babylon.gui.module.d.ts 245 KB

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