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 let the current focused control keeps the focus
  70. * @param pointerId defines the unique id of the current pointer
  71. * @returns a boolean indicating if the control wants to keep the focus
  72. */
  73. keepFocus(pointerId: number): boolean;
  74. }
  75. /**
  76. * Class used to create texture to support 2D GUI elements
  77. * @see http://doc.babylonjs.com/how_to/gui
  78. */
  79. export class AdvancedDynamicTexture extends DynamicTexture {
  80. /** @hidden */
  81. _rootContainer: Container;
  82. /** @hidden */
  83. _lastPickedControl: Control;
  84. /** @hidden */
  85. _lastControlOver: {
  86. [pointerId: number]: Control;
  87. };
  88. /** @hidden */
  89. _lastControlDown: {
  90. [pointerId: number]: Control;
  91. };
  92. /** @hidden */
  93. _capturingControl: {
  94. [pointerId: number]: Control;
  95. };
  96. /** @hidden */
  97. _shouldBlockPointer: boolean;
  98. /** @hidden */
  99. _layerToDispose: Nullable<Layer>;
  100. /** @hidden */
  101. _linkedControls: Control[];
  102. /**
  103. * Gets or sets a boolean defining if alpha is stored as premultiplied
  104. */
  105. premulAlpha: boolean;
  106. /**
  107. * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
  108. * Useful when you want more antialiasing
  109. */
  110. renderScale: number;
  111. /** Gets or sets the background color */
  112. background: string;
  113. /**
  114. * Gets or sets the ideal width used to design controls.
  115. * The GUI will then rescale everything accordingly
  116. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  117. */
  118. idealWidth: number;
  119. /**
  120. * Gets or sets the ideal height used to design controls.
  121. * The GUI will then rescale everything accordingly
  122. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  123. */
  124. idealHeight: number;
  125. /**
  126. * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
  127. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  128. */
  129. useSmallestIdeal: boolean;
  130. /**
  131. * Gets or sets a boolean indicating if adaptive scaling must be used
  132. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  133. */
  134. renderAtIdealSize: boolean;
  135. /**
  136. * Gets the underlying layer used to render the texture when in fullscreen mode
  137. */
  138. readonly layer: Nullable<Layer>;
  139. /**
  140. * Gets the root container control
  141. */
  142. readonly rootContainer: Container;
  143. /**
  144. * Gets or sets the current focused control
  145. */
  146. focusedControl: Nullable<IFocusableControl>;
  147. /**
  148. * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
  149. */
  150. isForeground: boolean;
  151. /**
  152. * Creates a new AdvancedDynamicTexture
  153. * @param name defines the name of the texture
  154. * @param width defines the width of the texture
  155. * @param height defines the height of the texture
  156. * @param scene defines the hosting scene
  157. * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
  158. * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
  159. */
  160. constructor(name: string, width: number | undefined, height: number | undefined, scene: Nullable<Scene>, generateMipMaps?: boolean, samplingMode?: number);
  161. /**
  162. * Function used to execute a function on all controls
  163. * @param func defines the function to execute
  164. * @param container defines the container where controls belong. If null the root container will be used
  165. */
  166. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  167. /**
  168. * Marks the texture as dirty forcing a complete update
  169. */
  170. markAsDirty(): void;
  171. /**
  172. * Helper function used to create a new style
  173. * @returns a new style
  174. * @see http://doc.babylonjs.com/how_to/gui#styles
  175. */
  176. createStyle(): Style;
  177. /**
  178. * Adds a new control to the root container
  179. * @param control defines the control to add
  180. * @returns the current texture
  181. */
  182. addControl(control: Control): AdvancedDynamicTexture;
  183. /**
  184. * Removes a control from the root container
  185. * @param control defines the control to remove
  186. * @returns the current texture
  187. */
  188. removeControl(control: Control): AdvancedDynamicTexture;
  189. /**
  190. * Release all resources
  191. */
  192. dispose(): void;
  193. /** @hidden */
  194. _getGlobalViewport(scene: Scene): Viewport;
  195. /**
  196. * Get screen coordinates for a vector3
  197. * @param position defines the position to project
  198. * @param worldMatrix defines the world matrix to use
  199. * @returns the projected position
  200. */
  201. getProjectedPosition(position: Vector3, worldMatrix: Matrix): Vector2;
  202. /** @hidden */
  203. _changeCursor(cursor: string): void;
  204. /** @hidden */
  205. _cleanControlAfterRemovalFromList(list: {
  206. [pointerId: number]: Control;
  207. }, control: Control): void;
  208. /** @hidden */
  209. _cleanControlAfterRemoval(control: Control): void;
  210. /** Attach to all scene events required to support pointer events */
  211. attach(): void;
  212. /**
  213. * Connect the texture to a hosting mesh to enable interactions
  214. * @param mesh defines the mesh to attach to
  215. * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
  216. */
  217. attachToMesh(mesh: AbstractMesh, supportPointerMove?: boolean): void;
  218. /**
  219. * Move the focus to a specific control
  220. * @param control defines the control which will receive the focus
  221. */
  222. moveFocusToControl(control: IFocusableControl): void;
  223. /**
  224. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
  225. * @param mesh defines the mesh which will receive the texture
  226. * @param width defines the texture width (1024 by default)
  227. * @param height defines the texture height (1024 by default)
  228. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  229. * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)
  230. * @returns a new AdvancedDynamicTexture
  231. */
  232. static CreateForMesh(mesh: AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, onlyAlphaTesting?: boolean): AdvancedDynamicTexture;
  233. /**
  234. * Creates a new AdvancedDynamicTexture in fullscreen mode.
  235. * In this mode the texture will rely on a layer for its rendering.
  236. * This allows it to be treated like any other layer.
  237. * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
  238. * LayerMask is set through advancedTexture.layer.layerMask
  239. * @param name defines name for the texture
  240. * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
  241. * @param scene defines the hsoting scene
  242. * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
  243. * @returns a new AdvancedDynamicTexture
  244. */
  245. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>, sampling?: number): AdvancedDynamicTexture;
  246. }
  247. }
  248. declare module 'babylonjs-gui/2D/math2D' {
  249. import { Vector2, Nullable } from "babylonjs";
  250. /**
  251. * Class used to transport Vector2 information for pointer events
  252. */
  253. export class Vector2WithInfo extends Vector2 {
  254. /** defines the current mouse button index */
  255. buttonIndex: number;
  256. /**
  257. * Creates a new Vector2WithInfo
  258. * @param source defines the vector2 data to transport
  259. * @param buttonIndex defines the current mouse button index
  260. */
  261. constructor(source: Vector2,
  262. /** defines the current mouse button index */
  263. buttonIndex?: number);
  264. }
  265. /** Class used to provide 2D matrix features */
  266. export class Matrix2D {
  267. /** Gets the internal array of 6 floats used to store matrix data */
  268. m: Float32Array;
  269. /**
  270. * Creates a new matrix
  271. * @param m00 defines value for (0, 0)
  272. * @param m01 defines value for (0, 1)
  273. * @param m10 defines value for (1, 0)
  274. * @param m11 defines value for (1, 1)
  275. * @param m20 defines value for (2, 0)
  276. * @param m21 defines value for (2, 1)
  277. */
  278. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  279. /**
  280. * Fills the matrix from direct values
  281. * @param m00 defines value for (0, 0)
  282. * @param m01 defines value for (0, 1)
  283. * @param m10 defines value for (1, 0)
  284. * @param m11 defines value for (1, 1)
  285. * @param m20 defines value for (2, 0)
  286. * @param m21 defines value for (2, 1)
  287. * @returns the current modified matrix
  288. */
  289. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  290. /**
  291. * Gets matrix determinant
  292. * @returns the determinant
  293. */
  294. determinant(): number;
  295. /**
  296. * Inverses the matrix and stores it in a target matrix
  297. * @param result defines the target matrix
  298. * @returns the current matrix
  299. */
  300. invertToRef(result: Matrix2D): Matrix2D;
  301. /**
  302. * Multiplies the current matrix with another one
  303. * @param other defines the second operand
  304. * @param result defines the target matrix
  305. * @returns the current matrix
  306. */
  307. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  308. /**
  309. * Applies the current matrix to a set of 2 floats and stores the result in a vector2
  310. * @param x defines the x coordinate to transform
  311. * @param y defines the x coordinate to transform
  312. * @param result defines the target vector2
  313. * @returns the current matrix
  314. */
  315. transformCoordinates(x: number, y: number, result: Vector2): Matrix2D;
  316. /**
  317. * Creates an identity matrix
  318. * @returns a new matrix
  319. */
  320. static Identity(): Matrix2D;
  321. /**
  322. * Creates a translation matrix and stores it in a target matrix
  323. * @param x defines the x coordinate of the translation
  324. * @param y defines the y coordinate of the translation
  325. * @param result defines the target matrix
  326. */
  327. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  328. /**
  329. * Creates a scaling matrix and stores it in a target matrix
  330. * @param x defines the x coordinate of the scaling
  331. * @param y defines the y coordinate of the scaling
  332. * @param result defines the target matrix
  333. */
  334. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  335. /**
  336. * Creates a rotation matrix and stores it in a target matrix
  337. * @param angle defines the rotation angle
  338. * @param result defines the target matrix
  339. */
  340. static RotationToRef(angle: number, result: Matrix2D): void;
  341. /**
  342. * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
  343. * @param tx defines the x coordinate of the translation
  344. * @param ty defines the y coordinate of the translation
  345. * @param angle defines the rotation angle
  346. * @param scaleX defines the x coordinate of the scaling
  347. * @param scaleY defines the y coordinate of the scaling
  348. * @param parentMatrix defines the parent matrix to multiply by (can be null)
  349. * @param result defines the target matrix
  350. */
  351. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: Nullable<Matrix2D>, result: Matrix2D): void;
  352. }
  353. }
  354. declare module 'babylonjs-gui/2D/measure' {
  355. /**
  356. * Class used to store 2D control sizes
  357. */
  358. export class Measure {
  359. /** defines left coordinate */
  360. left: number;
  361. /** defines top coordinate */
  362. top: number;
  363. /** defines width dimension */
  364. width: number;
  365. /** defines height dimension */
  366. height: number;
  367. /**
  368. * Creates a new measure
  369. * @param left defines left coordinate
  370. * @param top defines top coordinate
  371. * @param width defines width dimension
  372. * @param height defines height dimension
  373. */
  374. constructor(
  375. /** defines left coordinate */
  376. left: number,
  377. /** defines top coordinate */
  378. top: number,
  379. /** defines width dimension */
  380. width: number,
  381. /** defines height dimension */
  382. height: number);
  383. /**
  384. * Copy from another measure
  385. * @param other defines the other measure to copy from
  386. */
  387. copyFrom(other: Measure): void;
  388. /**
  389. * Check equality between this measure and another one
  390. * @param other defines the other measures
  391. * @returns true if both measures are equals
  392. */
  393. isEqualsTo(other: Measure): boolean;
  394. /**
  395. * Creates an empty measure
  396. * @returns a new measure
  397. */
  398. static Empty(): Measure;
  399. }
  400. }
  401. declare module 'babylonjs-gui/2D/multiLinePoint' {
  402. import { MultiLine } from "babylonjs-gui/2D/controls/multiLine";
  403. import { Control } from "babylonjs-gui/2D/controls/control";
  404. import { AbstractMesh, Nullable, Vector2 } from "babylonjs";
  405. /**
  406. * Class used to store a point for a MultiLine object.
  407. * The point can be pure 2D coordinates, a mesh or a control
  408. */
  409. export class MultiLinePoint {
  410. /** @hidden */
  411. _point: Vector2;
  412. /**
  413. * Creates a new MultiLinePoint
  414. * @param multiLine defines the source MultiLine object
  415. */
  416. constructor(multiLine: MultiLine);
  417. /** Gets or sets x coordinate */
  418. x: string | number;
  419. /** Gets or sets y coordinate */
  420. y: string | number;
  421. /** Gets or sets the control associated with this point */
  422. control: Nullable<Control>;
  423. /** Gets or sets the mesh associated with this point */
  424. mesh: Nullable<AbstractMesh>;
  425. /**
  426. * Gets a translation vector
  427. * @returns the translation vector
  428. */
  429. translate(): Vector2;
  430. /** Release associated resources */
  431. dispose(): void;
  432. }
  433. }
  434. declare module 'babylonjs-gui/2D/style' {
  435. import { IDisposable, Observable } from "babylonjs";
  436. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  437. import { ValueAndUnit } from "babylonjs-gui/2D/valueAndUnit";
  438. /**
  439. * Define a style used by control to automatically setup properties based on a template.
  440. * Only support font related properties so far
  441. */
  442. export class Style implements IDisposable {
  443. /** @hidden */
  444. _host: AdvancedDynamicTexture;
  445. /** @hidden */
  446. _fontSize: ValueAndUnit;
  447. /**
  448. * Observable raised when the style values are changed
  449. */
  450. onChangedObservable: Observable<Style>;
  451. /**
  452. * Creates a new style object
  453. * @param host defines the AdvancedDynamicTexture which hosts this style
  454. */
  455. constructor(host: AdvancedDynamicTexture);
  456. /**
  457. * Gets or sets the font size
  458. */
  459. fontSize: string | number;
  460. /**
  461. * Gets or sets the font family
  462. */
  463. fontFamily: string;
  464. /**
  465. * Gets or sets the font style
  466. */
  467. fontStyle: string;
  468. /** Gets or sets font weight */
  469. fontWeight: string;
  470. /** Dispose all associated resources */
  471. dispose(): void;
  472. }
  473. }
  474. declare module 'babylonjs-gui/2D/valueAndUnit' {
  475. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  476. /**
  477. * Class used to specific a value and its associated unit
  478. */
  479. export class ValueAndUnit {
  480. /** defines the unit to store */
  481. unit: number;
  482. /** defines a boolean indicating if the value can be negative */
  483. negativeValueAllowed: boolean;
  484. /**
  485. * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
  486. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  487. */
  488. ignoreAdaptiveScaling: boolean;
  489. /**
  490. * Creates a new ValueAndUnit
  491. * @param value defines the value to store
  492. * @param unit defines the unit to store
  493. * @param negativeValueAllowed defines a boolean indicating if the value can be negative
  494. */
  495. constructor(value: number,
  496. /** defines the unit to store */
  497. unit?: number,
  498. /** defines a boolean indicating if the value can be negative */
  499. negativeValueAllowed?: boolean);
  500. /** Gets a boolean indicating if the value is a percentage */
  501. readonly isPercentage: boolean;
  502. /** Gets a boolean indicating if the value is store as pixel */
  503. readonly isPixel: boolean;
  504. /** Gets direct internal value */
  505. readonly internalValue: number;
  506. /**
  507. * Gets value as pixel
  508. * @param host defines the root host
  509. * @param refValue defines the reference value for percentages
  510. * @returns the value as pixel
  511. */
  512. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  513. /**
  514. * Gets the value accordingly to its unit
  515. * @param host defines the root host
  516. * @returns the value
  517. */
  518. getValue(host: AdvancedDynamicTexture): number;
  519. /**
  520. * Gets a string representation of the value
  521. * @param host defines the root host
  522. * @returns a string
  523. */
  524. toString(host: AdvancedDynamicTexture): string;
  525. /**
  526. * Store a value parsed from a string
  527. * @param source defines the source string
  528. * @returns true if the value was successfully parsed
  529. */
  530. fromString(source: string | number): boolean;
  531. /** UNITMODE_PERCENTAGE */
  532. static readonly UNITMODE_PERCENTAGE: number;
  533. /** UNITMODE_PIXEL */
  534. static readonly UNITMODE_PIXEL: number;
  535. }
  536. }
  537. declare module 'babylonjs-gui/3D/controls' {
  538. export * from "babylonjs-gui/3D/controls/abstractButton3D";
  539. export * from "babylonjs-gui/3D/controls/button3D";
  540. export * from "babylonjs-gui/3D/controls/container3D";
  541. export * from "babylonjs-gui/3D/controls/control3D";
  542. export * from "babylonjs-gui/3D/controls/cylinderPanel";
  543. export * from "babylonjs-gui/3D/controls/holographicButton";
  544. export * from "babylonjs-gui/3D/controls/meshButton3D";
  545. export * from "babylonjs-gui/3D/controls/planePanel";
  546. export * from "babylonjs-gui/3D/controls/scatterPanel";
  547. export * from "babylonjs-gui/3D/controls/spherePanel";
  548. export * from "babylonjs-gui/3D/controls/stackPanel3D";
  549. export * from "babylonjs-gui/3D/controls/volumeBasedPanel";
  550. }
  551. declare module 'babylonjs-gui/3D/materials' {
  552. export * from "babylonjs-gui/3D/materials/fluentMaterial";
  553. }
  554. declare module 'babylonjs-gui/3D/gui3DManager' {
  555. import { IDisposable, Scene, Nullable, UtilityLayerRenderer, Observable, Vector3, Material } from "babylonjs";
  556. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  557. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  558. /**
  559. * Class used to manage 3D user interface
  560. * @see http://doc.babylonjs.com/how_to/gui3d
  561. */
  562. export class GUI3DManager implements IDisposable {
  563. /** @hidden */
  564. _lastPickedControl: Control3D;
  565. /** @hidden */
  566. _lastControlOver: {
  567. [pointerId: number]: Control3D;
  568. };
  569. /** @hidden */
  570. _lastControlDown: {
  571. [pointerId: number]: Control3D;
  572. };
  573. /**
  574. * Observable raised when the point picked by the pointer events changed
  575. */
  576. onPickedPointChangedObservable: Observable<Nullable<Vector3>>;
  577. /** @hidden */
  578. _sharedMaterials: {
  579. [key: string]: Material;
  580. };
  581. /** Gets the hosting scene */
  582. readonly scene: Scene;
  583. /** Gets associated utility layer */
  584. readonly utilityLayer: Nullable<UtilityLayerRenderer>;
  585. /**
  586. * Creates a new GUI3DManager
  587. * @param scene
  588. */
  589. constructor(scene?: Scene);
  590. /**
  591. * Gets the root container
  592. */
  593. readonly rootContainer: Container3D;
  594. /**
  595. * Gets a boolean indicating if the given control is in the root child list
  596. * @param control defines the control to check
  597. * @returns true if the control is in the root child list
  598. */
  599. containsControl(control: Control3D): boolean;
  600. /**
  601. * Adds a control to the root child list
  602. * @param control defines the control to add
  603. * @returns the current manager
  604. */
  605. addControl(control: Control3D): GUI3DManager;
  606. /**
  607. * Removes a control from the root child list
  608. * @param control defines the control to remove
  609. * @returns the current container
  610. */
  611. removeControl(control: Control3D): GUI3DManager;
  612. /**
  613. * Releases all associated resources
  614. */
  615. dispose(): void;
  616. }
  617. }
  618. declare module 'babylonjs-gui/3D/vector3WithInfo' {
  619. import { Vector3 } from "babylonjs";
  620. /**
  621. * Class used to transport Vector3 information for pointer events
  622. */
  623. export class Vector3WithInfo extends Vector3 {
  624. /** defines the current mouse button index */
  625. buttonIndex: number;
  626. /**
  627. * Creates a new Vector3WithInfo
  628. * @param source defines the vector3 data to transport
  629. * @param buttonIndex defines the current mouse button index
  630. */
  631. constructor(source: Vector3,
  632. /** defines the current mouse button index */
  633. buttonIndex?: number);
  634. }
  635. }
  636. declare module 'babylonjs-gui/2D/controls/button' {
  637. import { Rectangle } from "babylonjs-gui/2D/controls/rectangle";
  638. import { Control } from "babylonjs-gui/2D/controls/control";
  639. import { Vector2 } from "babylonjs";
  640. /**
  641. * Class used to create 2D buttons
  642. */
  643. export class Button extends Rectangle {
  644. name?: string | undefined;
  645. /**
  646. * Function called to generate a pointer enter animation
  647. */
  648. pointerEnterAnimation: () => void;
  649. /**
  650. * Function called to generate a pointer out animation
  651. */
  652. pointerOutAnimation: () => void;
  653. /**
  654. * Function called to generate a pointer down animation
  655. */
  656. pointerDownAnimation: () => void;
  657. /**
  658. * Function called to generate a pointer up animation
  659. */
  660. pointerUpAnimation: () => void;
  661. /**
  662. * Creates a new Button
  663. * @param name defines the name of the button
  664. */
  665. constructor(name?: string | undefined);
  666. protected _getTypeName(): string;
  667. /** @hidden */
  668. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  669. /** @hidden */
  670. _onPointerEnter(target: Control): boolean;
  671. /** @hidden */
  672. _onPointerOut(target: Control): void;
  673. /** @hidden */
  674. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  675. /** @hidden */
  676. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  677. /**
  678. * Creates a new button made with an image and a text
  679. * @param name defines the name of the button
  680. * @param text defines the text of the button
  681. * @param imageUrl defines the url of the image
  682. * @returns a new Button
  683. */
  684. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  685. /**
  686. * Creates a new button made with an image
  687. * @param name defines the name of the button
  688. * @param imageUrl defines the url of the image
  689. * @returns a new Button
  690. */
  691. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  692. /**
  693. * Creates a new button made with a text
  694. * @param name defines the name of the button
  695. * @param text defines the text of the button
  696. * @returns a new Button
  697. */
  698. static CreateSimpleButton(name: string, text: string): Button;
  699. /**
  700. * Creates a new button made with an image and a centered text
  701. * @param name defines the name of the button
  702. * @param text defines the text of the button
  703. * @param imageUrl defines the url of the image
  704. * @returns a new Button
  705. */
  706. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  707. }
  708. }
  709. declare module 'babylonjs-gui/2D/controls/checkbox' {
  710. import { Control } from "babylonjs-gui/2D/controls/control";
  711. import { Measure } from "babylonjs-gui/2D/measure";
  712. import { Observable, Vector2 } from "babylonjs";
  713. import { StackPanel } from "babylonjs-gui/2D/controls/stackPanel";
  714. /**
  715. * Class used to represent a 2D checkbox
  716. */
  717. export class Checkbox extends Control {
  718. name?: string | undefined;
  719. /** Gets or sets border thickness */
  720. thickness: number;
  721. /**
  722. * Observable raised when isChecked property changes
  723. */
  724. onIsCheckedChangedObservable: Observable<boolean>;
  725. /** Gets or sets a value indicating the ratio between overall size and check size */
  726. checkSizeRatio: number;
  727. /** Gets or sets background color */
  728. background: string;
  729. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  730. isChecked: boolean;
  731. /**
  732. * Creates a new CheckBox
  733. * @param name defines the control name
  734. */
  735. constructor(name?: string | undefined);
  736. protected _getTypeName(): string;
  737. /** @hidden */
  738. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  739. /** @hidden */
  740. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  741. /**
  742. * Utility function to easily create a checkbox with a header
  743. * @param title defines the label to use for the header
  744. * @param onValueChanged defines the callback to call when value changes
  745. * @returns a StackPanel containing the checkbox and a textBlock
  746. */
  747. static AddCheckBoxWithHeader(title: string, onValueChanged: (value: boolean) => void): StackPanel;
  748. }
  749. }
  750. declare module 'babylonjs-gui/2D/controls/colorpicker' {
  751. import { Control } from "babylonjs-gui/2D/controls/control";
  752. import { Color3, Observable, Vector2 } from "babylonjs";
  753. import { Measure } from "babylonjs-gui/2D/measure";
  754. /** Class used to create color pickers */
  755. export class ColorPicker extends Control {
  756. name?: string | undefined;
  757. /**
  758. * Observable raised when the value changes
  759. */
  760. onValueChangedObservable: Observable<Color3>;
  761. /** Gets or sets the color of the color picker */
  762. value: Color3;
  763. /** Gets or sets control width */
  764. width: string | number;
  765. /** Gets or sets control height */
  766. height: string | number;
  767. /** Gets or sets control size */
  768. size: string | number;
  769. /**
  770. * Creates a new ColorPicker
  771. * @param name defines the control name
  772. */
  773. constructor(name?: string | undefined);
  774. protected _getTypeName(): string;
  775. /** @hidden */
  776. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  777. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  778. _onPointerMove(target: Control, coordinates: Vector2): void;
  779. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  780. }
  781. }
  782. declare module 'babylonjs-gui/2D/controls/container' {
  783. import { Control } from "babylonjs-gui/2D/controls/control";
  784. import { Measure } from "babylonjs-gui/2D/measure";
  785. import { Nullable } from "babylonjs";
  786. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  787. /**
  788. * Root class for 2D containers
  789. * @see http://doc.babylonjs.com/how_to/gui#containers
  790. */
  791. export class Container extends Control {
  792. name?: string | undefined;
  793. /** @hidden */
  794. protected _children: Control[];
  795. /** @hidden */
  796. protected _measureForChildren: Measure;
  797. /** @hidden */
  798. protected _background: string;
  799. /** @hidden */
  800. protected _adaptWidthToChildren: boolean;
  801. /** @hidden */
  802. protected _adaptHeightToChildren: boolean;
  803. /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
  804. adaptHeightToChildren: boolean;
  805. /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
  806. adaptWidthToChildren: boolean;
  807. /** Gets or sets background color */
  808. background: string;
  809. /** Gets the list of children */
  810. readonly children: Control[];
  811. /**
  812. * Creates a new Container
  813. * @param name defines the name of the container
  814. */
  815. constructor(name?: string | undefined);
  816. protected _getTypeName(): string;
  817. /**
  818. * Gets a child using its name
  819. * @param name defines the child name to look for
  820. * @returns the child control if found
  821. */
  822. getChildByName(name: string): Nullable<Control>;
  823. /**
  824. * Gets a child using its type and its name
  825. * @param name defines the child name to look for
  826. * @param type defines the child type to look for
  827. * @returns the child control if found
  828. */
  829. getChildByType(name: string, type: string): Nullable<Control>;
  830. /**
  831. * Search for a specific control in children
  832. * @param control defines the control to look for
  833. * @returns true if the control is in child list
  834. */
  835. containsControl(control: Control): boolean;
  836. /**
  837. * Adds a new control to the current container
  838. * @param control defines the control to add
  839. * @returns the current container
  840. */
  841. addControl(control: Nullable<Control>): Container;
  842. /**
  843. * Removes all controls from the current container
  844. * @returns the current container
  845. */
  846. clearControls(): Container;
  847. /**
  848. * Removes a control from the current container
  849. * @param control defines the control to remove
  850. * @returns the current container
  851. */
  852. removeControl(control: Control): Container;
  853. /** @hidden */
  854. _reOrderControl(control: Control): void;
  855. /** @hidden */
  856. _markMatrixAsDirty(): void;
  857. /** @hidden */
  858. _markAllAsDirty(): void;
  859. /** @hidden */
  860. protected _localDraw(context: CanvasRenderingContext2D): void;
  861. /** @hidden */
  862. _link(root: Nullable<Container>, host: AdvancedDynamicTexture): void;
  863. /** @hidden */
  864. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  865. /** @hidden */
  866. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  867. /** @hidden */
  868. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  869. /** @hidden */
  870. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  871. /** Releases associated resources */
  872. dispose(): void;
  873. }
  874. }
  875. declare module 'babylonjs-gui/2D/controls/control' {
  876. import { Container } from "babylonjs-gui/2D/controls/container";
  877. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  878. import { ValueAndUnit } from "babylonjs-gui/2D/valueAndUnit";
  879. import { Nullable, Vector2, AbstractMesh, Observable, Vector3, Scene } from "babylonjs";
  880. import { Measure } from "babylonjs-gui/2D/measure";
  881. import { Style } from "babylonjs-gui/2D/style";
  882. import { Matrix2D, Vector2WithInfo } from "babylonjs-gui/2D/math2D";
  883. /**
  884. * Root class used for all 2D controls
  885. * @see http://doc.babylonjs.com/how_to/gui#controls
  886. */
  887. export class Control {
  888. /** defines the name of the control */
  889. name?: string | undefined;
  890. /** @hidden */
  891. _root: Nullable<Container>;
  892. /** @hidden */
  893. _host: AdvancedDynamicTexture;
  894. /** Gets or sets the control parent */
  895. parent: Nullable<Container>;
  896. /** @hidden */
  897. _currentMeasure: Measure;
  898. /** @hidden */
  899. _width: ValueAndUnit;
  900. /** @hidden */
  901. _height: ValueAndUnit;
  902. /** @hidden */
  903. protected _fontOffset: {
  904. ascent: number;
  905. height: number;
  906. descent: number;
  907. };
  908. /** @hidden */
  909. protected _horizontalAlignment: number;
  910. /** @hidden */
  911. protected _verticalAlignment: number;
  912. /** @hidden */
  913. _tempParentMeasure: Measure;
  914. /** @hidden */
  915. protected _cachedParentMeasure: Measure;
  916. /** @hidden */
  917. _left: ValueAndUnit;
  918. /** @hidden */
  919. _top: ValueAndUnit;
  920. /** @hidden */
  921. protected _invertTransformMatrix: Matrix2D;
  922. /** @hidden */
  923. protected _transformedPosition: Vector2;
  924. /** @hidden */
  925. _linkedMesh: Nullable<AbstractMesh>;
  926. protected _isEnabled: boolean;
  927. protected _disabledColor: string;
  928. /** @hidden */
  929. _tag: any;
  930. /** Gets or sets a boolean indicating if the control can be hit with pointer events */
  931. isHitTestVisible: boolean;
  932. /** Gets or sets a boolean indicating if the control can block pointer events */
  933. isPointerBlocker: boolean;
  934. /** Gets or sets a boolean indicating if the control can be focusable */
  935. isFocusInvisible: boolean;
  936. /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
  937. shadowOffsetX: number;
  938. /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
  939. shadowOffsetY: number;
  940. /** Gets or sets a value indicating the amount of blur to use to render the shadow */
  941. shadowBlur: number;
  942. /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
  943. shadowColor: string;
  944. /** Gets or sets the cursor to use when the control is hovered */
  945. hoverCursor: string;
  946. /** @hidden */
  947. protected _linkOffsetX: ValueAndUnit;
  948. /** @hidden */
  949. protected _linkOffsetY: ValueAndUnit;
  950. /** Gets the control type name */
  951. readonly typeName: string;
  952. /**
  953. * An event triggered when the pointer move over the control.
  954. */
  955. onPointerMoveObservable: Observable<Vector2>;
  956. /**
  957. * An event triggered when the pointer move out of the control.
  958. */
  959. onPointerOutObservable: Observable<Control>;
  960. /**
  961. * An event triggered when the pointer taps the control
  962. */
  963. onPointerDownObservable: Observable<Vector2WithInfo>;
  964. /**
  965. * An event triggered when pointer up
  966. */
  967. onPointerUpObservable: Observable<Vector2WithInfo>;
  968. /**
  969. * An event triggered when a control is clicked on
  970. */
  971. onPointerClickObservable: Observable<Vector2WithInfo>;
  972. /**
  973. * An event triggered when pointer enters the control
  974. */
  975. onPointerEnterObservable: Observable<Control>;
  976. /**
  977. * An event triggered when the control is marked as dirty
  978. */
  979. onDirtyObservable: Observable<Control>;
  980. /**
  981. * An event triggered after the control is drawn
  982. */
  983. onAfterDrawObservable: Observable<Control>;
  984. /** Gets or set information about font offsets (used to render and align text) */
  985. fontOffset: {
  986. ascent: number;
  987. height: number;
  988. descent: number;
  989. };
  990. /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
  991. alpha: number;
  992. /** Gets or sets a value indicating the scale factor on X axis (1 by default)
  993. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  994. */
  995. scaleX: number;
  996. /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
  997. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  998. */
  999. scaleY: number;
  1000. /** Gets or sets the rotation angle (0 by default)
  1001. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1002. */
  1003. rotation: number;
  1004. /** Gets or sets the transformation center on Y axis (0 by default)
  1005. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1006. */
  1007. transformCenterY: number;
  1008. /** Gets or sets the transformation center on X axis (0 by default)
  1009. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1010. */
  1011. transformCenterX: number;
  1012. /**
  1013. * Gets or sets the horizontal alignment
  1014. * @see http://doc.babylonjs.com/how_to/gui#alignments
  1015. */
  1016. horizontalAlignment: number;
  1017. /**
  1018. * Gets or sets the vertical alignment
  1019. * @see http://doc.babylonjs.com/how_to/gui#alignments
  1020. */
  1021. verticalAlignment: number;
  1022. /**
  1023. * Gets or sets control width
  1024. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1025. */
  1026. width: string | number;
  1027. /**
  1028. * Gets control width in pixel
  1029. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1030. */
  1031. readonly widthInPixels: number;
  1032. /**
  1033. * Gets or sets control height
  1034. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1035. */
  1036. height: string | number;
  1037. /**
  1038. * Gets control height in pixel
  1039. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1040. */
  1041. readonly heightInPixels: number;
  1042. /** Gets or set font family */
  1043. fontFamily: string;
  1044. /** Gets or sets font style */
  1045. fontStyle: string;
  1046. /** Gets or sets font weight */
  1047. fontWeight: string;
  1048. /**
  1049. * Gets or sets style
  1050. * @see http://doc.babylonjs.com/how_to/gui#styles
  1051. */
  1052. style: Nullable<Style>;
  1053. /** @hidden */
  1054. readonly _isFontSizeInPercentage: boolean;
  1055. /** Gets font size in pixels */
  1056. readonly fontSizeInPixels: number;
  1057. /** Gets or sets font size */
  1058. fontSize: string | number;
  1059. /** Gets or sets foreground color */
  1060. color: string;
  1061. /** Gets or sets z index which is used to reorder controls on the z axis */
  1062. zIndex: number;
  1063. /** Gets or sets a boolean indicating if the control can be rendered */
  1064. notRenderable: boolean;
  1065. /** Gets or sets a boolean indicating if the control is visible */
  1066. isVisible: boolean;
  1067. /** Gets a boolean indicating that the control needs to update its rendering */
  1068. readonly isDirty: boolean;
  1069. /**
  1070. * Gets or sets a value indicating the padding to use on the left of the control
  1071. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1072. */
  1073. paddingLeft: string | number;
  1074. /**
  1075. * Gets a value indicating the padding in pixels to use on the left of the control
  1076. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1077. */
  1078. readonly paddingLeftInPixels: number;
  1079. /**
  1080. * Gets or sets a value indicating the padding to use on the right of the control
  1081. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1082. */
  1083. paddingRight: string | number;
  1084. /**
  1085. * Gets a value indicating the padding in pixels to use on the right of the control
  1086. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1087. */
  1088. readonly paddingRightInPixels: number;
  1089. /**
  1090. * Gets or sets a value indicating the padding to use on the top of the control
  1091. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1092. */
  1093. paddingTop: string | number;
  1094. /**
  1095. * Gets a value indicating the padding in pixels to use on the top of the control
  1096. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1097. */
  1098. readonly paddingTopInPixels: number;
  1099. /**
  1100. * Gets or sets a value indicating the padding to use on the bottom of the control
  1101. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1102. */
  1103. paddingBottom: string | number;
  1104. /**
  1105. * Gets a value indicating the padding in pixels to use on the bottom of the control
  1106. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1107. */
  1108. readonly paddingBottomInPixels: number;
  1109. /**
  1110. * Gets or sets a value indicating the left coordinate of the control
  1111. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1112. */
  1113. left: string | number;
  1114. /**
  1115. * Gets a value indicating the left coordinate in pixels of the control
  1116. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1117. */
  1118. readonly leftInPixels: number;
  1119. /**
  1120. * Gets or sets a value indicating the top coordinate of the control
  1121. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1122. */
  1123. top: string | number;
  1124. /**
  1125. * Gets a value indicating the top coordinate in pixels of the control
  1126. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1127. */
  1128. readonly topInPixels: number;
  1129. /**
  1130. * Gets or sets a value indicating the offset on X axis to the linked mesh
  1131. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1132. */
  1133. linkOffsetX: string | number;
  1134. /**
  1135. * Gets a value indicating the offset in pixels on X axis to the linked mesh
  1136. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1137. */
  1138. readonly linkOffsetXInPixels: number;
  1139. /**
  1140. * Gets or sets a value indicating the offset on Y axis to the linked mesh
  1141. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1142. */
  1143. linkOffsetY: string | number;
  1144. /**
  1145. * Gets a value indicating the offset in pixels on Y axis to the linked mesh
  1146. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1147. */
  1148. readonly linkOffsetYInPixels: number;
  1149. /** Gets the center coordinate on X axis */
  1150. readonly centerX: number;
  1151. /** Gets the center coordinate on Y axis */
  1152. readonly centerY: number;
  1153. /** Gets or sets if control is Enabled*/
  1154. isEnabled: boolean;
  1155. /** Gets or sets background color of control if it's disabled*/
  1156. disabledColor: string;
  1157. /**
  1158. * Creates a new control
  1159. * @param name defines the name of the control
  1160. */
  1161. constructor(
  1162. /** defines the name of the control */
  1163. name?: string | undefined);
  1164. /** @hidden */
  1165. protected _getTypeName(): string;
  1166. /** @hidden */
  1167. _resetFontCache(): void;
  1168. /**
  1169. * Determines if a container is an ascendant of the current control
  1170. * @param container defines the container to look for
  1171. * @returns true if the container is one of the ascendant of the control
  1172. */
  1173. IsAscendant(container: Container): boolean;
  1174. /**
  1175. * Gets coordinates in local control space
  1176. * @param globalCoordinates defines the coordinates to transform
  1177. * @returns the new coordinates in local space
  1178. */
  1179. getLocalCoordinates(globalCoordinates: Vector2): Vector2;
  1180. /**
  1181. * Gets coordinates in local control space
  1182. * @param globalCoordinates defines the coordinates to transform
  1183. * @param result defines the target vector2 where to store the result
  1184. * @returns the current control
  1185. */
  1186. getLocalCoordinatesToRef(globalCoordinates: Vector2, result: Vector2): Control;
  1187. /**
  1188. * Gets coordinates in parent local control space
  1189. * @param globalCoordinates defines the coordinates to transform
  1190. * @returns the new coordinates in parent local space
  1191. */
  1192. getParentLocalCoordinates(globalCoordinates: Vector2): Vector2;
  1193. /**
  1194. * Move the current control to a vector3 position projected onto the screen.
  1195. * @param position defines the target position
  1196. * @param scene defines the hosting scene
  1197. */
  1198. moveToVector3(position: Vector3, scene: Scene): void;
  1199. /**
  1200. * Link current control with a target mesh
  1201. * @param mesh defines the mesh to link with
  1202. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1203. */
  1204. linkWithMesh(mesh: Nullable<AbstractMesh>): void;
  1205. /** @hidden */
  1206. _moveToProjectedPosition(projectedPosition: Vector3): void;
  1207. /** @hidden */
  1208. _markMatrixAsDirty(): void;
  1209. /** @hidden */
  1210. _markAsDirty(): void;
  1211. /** @hidden */
  1212. _markAllAsDirty(): void;
  1213. /** @hidden */
  1214. _link(root: Nullable<Container>, host: AdvancedDynamicTexture): void;
  1215. /** @hidden */
  1216. protected _transform(context: CanvasRenderingContext2D): void;
  1217. /** @hidden */
  1218. protected _applyStates(context: CanvasRenderingContext2D): void;
  1219. /** @hidden */
  1220. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  1221. /** @hidden */
  1222. protected _clip(context: CanvasRenderingContext2D): void;
  1223. /** @hidden */
  1224. _measure(): void;
  1225. /** @hidden */
  1226. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1227. /** @hidden */
  1228. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1229. /** @hidden */
  1230. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1231. /** @hidden */
  1232. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1233. /**
  1234. * Tests if a given coordinates belong to the current control
  1235. * @param x defines x coordinate to test
  1236. * @param y defines y coordinate to test
  1237. * @returns true if the coordinates are inside the control
  1238. */
  1239. contains(x: number, y: number): boolean;
  1240. /** @hidden */
  1241. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  1242. /** @hidden */
  1243. _onPointerMove(target: Control, coordinates: Vector2): void;
  1244. /** @hidden */
  1245. _onPointerEnter(target: Control): boolean;
  1246. /** @hidden */
  1247. _onPointerOut(target: Control): void;
  1248. /** @hidden */
  1249. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  1250. /** @hidden */
  1251. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  1252. /** @hidden */
  1253. _forcePointerUp(pointerId?: Nullable<number>): void;
  1254. /** @hidden */
  1255. _processObservables(type: number, x: number, y: number, pointerId: number, buttonIndex: number): boolean;
  1256. /** Releases associated resources */
  1257. dispose(): void;
  1258. /** HORIZONTAL_ALIGNMENT_LEFT */
  1259. static readonly HORIZONTAL_ALIGNMENT_LEFT: number;
  1260. /** HORIZONTAL_ALIGNMENT_RIGHT */
  1261. static readonly HORIZONTAL_ALIGNMENT_RIGHT: number;
  1262. /** HORIZONTAL_ALIGNMENT_CENTER */
  1263. static readonly HORIZONTAL_ALIGNMENT_CENTER: number;
  1264. /** VERTICAL_ALIGNMENT_TOP */
  1265. static readonly VERTICAL_ALIGNMENT_TOP: number;
  1266. /** VERTICAL_ALIGNMENT_BOTTOM */
  1267. static readonly VERTICAL_ALIGNMENT_BOTTOM: number;
  1268. /** VERTICAL_ALIGNMENT_CENTER */
  1269. static readonly VERTICAL_ALIGNMENT_CENTER: number;
  1270. /** @hidden */
  1271. static _GetFontOffset(font: string): {
  1272. ascent: number;
  1273. height: number;
  1274. descent: number;
  1275. };
  1276. /**
  1277. * Creates a stack panel that can be used to render headers
  1278. * @param control defines the control to associate with the header
  1279. * @param text defines the text of the header
  1280. * @param size defines the size of the header
  1281. * @param options defines options used to configure the header
  1282. * @returns a new StackPanel
  1283. * @ignore
  1284. * @hidden
  1285. */
  1286. static AddHeader: (control: Control, text: string, size: string | number, options: {
  1287. isHorizontal: boolean;
  1288. controlFirst: boolean;
  1289. }) => any;
  1290. /** @hidden */
  1291. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  1292. }
  1293. }
  1294. declare module 'babylonjs-gui/2D/controls/ellipse' {
  1295. import { Container } from "babylonjs-gui/2D/controls/container";
  1296. import { Measure } from "babylonjs-gui/2D/measure";
  1297. /** Class used to create 2D ellipse containers */
  1298. export class Ellipse extends Container {
  1299. name?: string | undefined;
  1300. /** Gets or sets border thickness */
  1301. thickness: number;
  1302. /**
  1303. * Creates a new Ellipse
  1304. * @param name defines the control name
  1305. */
  1306. constructor(name?: string | undefined);
  1307. protected _getTypeName(): string;
  1308. protected _localDraw(context: CanvasRenderingContext2D): void;
  1309. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1310. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  1311. }
  1312. }
  1313. declare module 'babylonjs-gui/2D/controls/grid' {
  1314. import { Container } from "babylonjs-gui/2D/controls/container";
  1315. import { Control } from "babylonjs-gui/2D/controls/control";
  1316. import { Measure } from "babylonjs-gui/2D/measure";
  1317. /**
  1318. * Class used to create a 2D grid container
  1319. */
  1320. export class Grid extends Container {
  1321. name?: string | undefined;
  1322. /** Gets the list of children */
  1323. readonly children: Control[];
  1324. /**
  1325. * Adds a new row to the grid
  1326. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  1327. * @param isPixel defines if the height is expressed in pixel (or in percentage)
  1328. * @returns the current grid
  1329. */
  1330. addRowDefinition(height: number, isPixel?: boolean): Grid;
  1331. /**
  1332. * Adds a new column to the grid
  1333. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  1334. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  1335. * @returns the current grid
  1336. */
  1337. addColumnDefinition(width: number, isPixel?: boolean): Grid;
  1338. /**
  1339. * Update a row definition
  1340. * @param index defines the index of the row to update
  1341. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  1342. * @param isPixel defines if the weight is expressed in pixel (or in percentage)
  1343. * @returns the current grid
  1344. */
  1345. setRowDefinition(index: number, height: number, isPixel?: boolean): Grid;
  1346. /**
  1347. * Update a column definition
  1348. * @param index defines the index of the column to update
  1349. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  1350. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  1351. * @returns the current grid
  1352. */
  1353. setColumnDefinition(index: number, width: number, isPixel?: boolean): Grid;
  1354. /**
  1355. * Remove a column definition at specified index
  1356. * @param index defines the index of the column to remove
  1357. * @returns the current grid
  1358. */
  1359. removeColumnDefinition(index: number): Grid;
  1360. /**
  1361. * Remove a row definition at specified index
  1362. * @param index defines the index of the row to remove
  1363. * @returns the current grid
  1364. */
  1365. removeRowDefinition(index: number): Grid;
  1366. /**
  1367. * Adds a new control to the current grid
  1368. * @param control defines the control to add
  1369. * @param row defines the row where to add the control (0 by default)
  1370. * @param column defines the column where to add the control (0 by default)
  1371. * @returns the current grid
  1372. */
  1373. addControl(control: Control, row?: number, column?: number): Grid;
  1374. /**
  1375. * Removes a control from the current container
  1376. * @param control defines the control to remove
  1377. * @returns the current container
  1378. */
  1379. removeControl(control: Control): Container;
  1380. /**
  1381. * Creates a new Grid
  1382. * @param name defines control name
  1383. */
  1384. constructor(name?: string | undefined);
  1385. protected _getTypeName(): string;
  1386. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1387. /** Releases associated resources */
  1388. dispose(): void;
  1389. }
  1390. }
  1391. declare module 'babylonjs-gui/2D/controls/image' {
  1392. import { Control } from "babylonjs-gui/2D/controls/control";
  1393. import { Nullable } from "babylonjs";
  1394. import { Measure } from "babylonjs-gui/2D/measure";
  1395. /**
  1396. * Class used to create 2D images
  1397. */
  1398. export class Image extends Control {
  1399. name?: string | undefined;
  1400. /**
  1401. * Gets or sets the left coordinate in the source image
  1402. */
  1403. sourceLeft: number;
  1404. /**
  1405. * Gets or sets the top coordinate in the source image
  1406. */
  1407. sourceTop: number;
  1408. /**
  1409. * Gets or sets the width to capture in the source image
  1410. */
  1411. sourceWidth: number;
  1412. /**
  1413. * Gets or sets the height to capture in the source image
  1414. */
  1415. sourceHeight: number;
  1416. /**
  1417. * Gets or sets a boolean indicating if the image can force its container to adapt its size
  1418. * @see http://doc.babylonjs.com/how_to/gui#image
  1419. */
  1420. autoScale: boolean;
  1421. /** Gets or sets the streching mode used by the image */
  1422. stretch: number;
  1423. /**
  1424. * Gets or sets the internal DOM image used to render the control
  1425. */
  1426. domImage: HTMLImageElement;
  1427. /**
  1428. * Gets or sets image source url
  1429. */
  1430. source: Nullable<string>;
  1431. /**
  1432. * Gets or sets the cell width to use when animation sheet is enabled
  1433. * @see http://doc.babylonjs.com/how_to/gui#image
  1434. */
  1435. cellWidth: number;
  1436. /**
  1437. * Gets or sets the cell height to use when animation sheet is enabled
  1438. * @see http://doc.babylonjs.com/how_to/gui#image
  1439. */
  1440. cellHeight: number;
  1441. /**
  1442. * Gets or sets the cell id to use (this will turn on the animation sheet mode)
  1443. * @see http://doc.babylonjs.com/how_to/gui#image
  1444. */
  1445. cellId: number;
  1446. /**
  1447. * Creates a new Image
  1448. * @param name defines the control name
  1449. * @param url defines the image url
  1450. */
  1451. constructor(name?: string | undefined, url?: Nullable<string>);
  1452. protected _getTypeName(): string;
  1453. /** Force the control to synchronize with its content */
  1454. synchronizeSizeWithContent(): void;
  1455. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1456. /** STRETCH_NONE */
  1457. static readonly STRETCH_NONE: number;
  1458. /** STRETCH_FILL */
  1459. static readonly STRETCH_FILL: number;
  1460. /** STRETCH_UNIFORM */
  1461. static readonly STRETCH_UNIFORM: number;
  1462. /** STRETCH_EXTEND */
  1463. static readonly STRETCH_EXTEND: number;
  1464. }
  1465. }
  1466. declare module 'babylonjs-gui/2D/controls/inputText' {
  1467. import { Control } from "babylonjs-gui/2D/controls/control";
  1468. import { IFocusableControl } from "babylonjs-gui/2D/advancedDynamicTexture";
  1469. import { Nullable, Observable, Vector2 } from "babylonjs";
  1470. import { Measure } from "babylonjs-gui/2D/measure";
  1471. import { VirtualKeyboard } from "babylonjs-gui/2D/controls/virtualKeyboard";
  1472. /**
  1473. * Class used to create input text control
  1474. */
  1475. export class InputText extends Control implements IFocusableControl {
  1476. name?: string | undefined;
  1477. /** @hidden */
  1478. _connectedVirtualKeyboard: Nullable<VirtualKeyboard>;
  1479. /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
  1480. promptMessage: string;
  1481. /** Observable raised when the text changes */
  1482. onTextChangedObservable: Observable<InputText>;
  1483. /** Observable raised just before an entered character is to be added */
  1484. onBeforeKeyAddObservable: Observable<InputText>;
  1485. /** Observable raised when the control gets the focus */
  1486. onFocusObservable: Observable<InputText>;
  1487. /** Observable raised when the control loses the focus */
  1488. onBlurObservable: Observable<InputText>;
  1489. /** Gets or sets the maximum width allowed by the control */
  1490. maxWidth: string | number;
  1491. /** Gets the maximum width allowed by the control in pixels */
  1492. readonly maxWidthInPixels: number;
  1493. /** Gets or sets control margin */
  1494. margin: string;
  1495. /** Gets control margin in pixels */
  1496. readonly marginInPixels: number;
  1497. /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
  1498. autoStretchWidth: boolean;
  1499. /** Gets or sets border thickness */
  1500. thickness: number;
  1501. /** Gets or sets the background color when focused */
  1502. focusedBackground: string;
  1503. /** Gets or sets the background color */
  1504. background: string;
  1505. /** Gets or sets the placeholder color */
  1506. placeholderColor: string;
  1507. /** Gets or sets the text displayed when the control is empty */
  1508. placeholderText: string;
  1509. /** Gets or sets the dead key flag */
  1510. deadKey: boolean;
  1511. /** Gets or sets if the current key should be added */
  1512. addKey: boolean;
  1513. /** Gets or sets the value of the current key being entered */
  1514. currentKey: string;
  1515. /** Gets or sets the text displayed in the control */
  1516. text: string;
  1517. /** Gets or sets control width */
  1518. width: string | number;
  1519. /**
  1520. * Creates a new InputText
  1521. * @param name defines the control name
  1522. * @param text defines the text of the control
  1523. */
  1524. constructor(name?: string | undefined, text?: string);
  1525. /** @hidden */
  1526. onBlur(): void;
  1527. /** @hidden */
  1528. onFocus(): void;
  1529. protected _getTypeName(): string;
  1530. /**
  1531. * Function called to let the current focused control keeps the focus
  1532. * @param pointerId defines the unique id of the current pointer
  1533. * @returns a boolean indicating if the control wants to keep the focus
  1534. */
  1535. keepFocus(pointerId: number): boolean;
  1536. /** @hidden */
  1537. processKey(keyCode: number, key?: string): void;
  1538. /** @hidden */
  1539. processKeyboard(evt: KeyboardEvent): void;
  1540. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1541. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  1542. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  1543. protected _beforeRenderText(text: string): string;
  1544. dispose(): void;
  1545. }
  1546. }
  1547. declare module 'babylonjs-gui/2D/controls/inputPassword' {
  1548. import { InputText } from "babylonjs-gui/2D/controls/inputText";
  1549. /**
  1550. * Class used to create a password control
  1551. */
  1552. export class InputPassword extends InputText {
  1553. protected _beforeRenderText(text: string): string;
  1554. }
  1555. }
  1556. declare module 'babylonjs-gui/2D/controls/line' {
  1557. import { Control } from "babylonjs-gui/2D/controls/control";
  1558. import { Vector3, Scene } from "babylonjs";
  1559. import { Measure } from "babylonjs-gui/2D/measure";
  1560. /** Class used to render 2D lines */
  1561. export class Line extends Control {
  1562. name?: string | undefined;
  1563. /** Gets or sets the dash pattern */
  1564. dash: Array<number>;
  1565. /** Gets or sets the control connected with the line end */
  1566. connectedControl: Control;
  1567. /** Gets or sets start coordinates on X axis */
  1568. x1: string | number;
  1569. /** Gets or sets start coordinates on Y axis */
  1570. y1: string | number;
  1571. /** Gets or sets end coordinates on X axis */
  1572. x2: string | number;
  1573. /** Gets or sets end coordinates on Y axis */
  1574. y2: string | number;
  1575. /** Gets or sets line width */
  1576. lineWidth: number;
  1577. /** Gets or sets horizontal alignment */
  1578. horizontalAlignment: number;
  1579. /** Gets or sets vertical alignment */
  1580. verticalAlignment: number;
  1581. /**
  1582. * Creates a new Line
  1583. * @param name defines the control name
  1584. */
  1585. constructor(name?: string | undefined);
  1586. protected _getTypeName(): string;
  1587. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1588. _measure(): void;
  1589. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1590. /**
  1591. * Move one end of the line given 3D cartesian coordinates.
  1592. * @param position Targeted world position
  1593. * @param scene Scene
  1594. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  1595. */
  1596. moveToVector3(position: Vector3, scene: Scene, end?: boolean): void;
  1597. /**
  1598. * Move one end of the line to a position in screen absolute space.
  1599. * @param projectedPosition Position in screen absolute space (X, Y)
  1600. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  1601. */
  1602. _moveToProjectedPosition(projectedPosition: Vector3, end?: boolean): void;
  1603. }
  1604. }
  1605. declare module 'babylonjs-gui/2D/controls/multiLine' {
  1606. import { Control } from "babylonjs-gui/2D/controls/control";
  1607. import { MultiLinePoint } from "babylonjs-gui/2D/multiLinePoint";
  1608. import { AbstractMesh } from "babylonjs";
  1609. import { Measure } from "babylonjs-gui/2D/measure";
  1610. /**
  1611. * Class used to create multi line control
  1612. */
  1613. export class MultiLine extends Control {
  1614. name?: string | undefined;
  1615. /**
  1616. * Creates a new MultiLine
  1617. * @param name defines the control name
  1618. */
  1619. constructor(name?: string | undefined);
  1620. /** Gets or sets dash pattern */
  1621. dash: Array<number>;
  1622. /**
  1623. * Gets point stored at specified index
  1624. * @param index defines the index to look for
  1625. * @returns the requested point if found
  1626. */
  1627. getAt(index: number): MultiLinePoint;
  1628. /** Function called when a point is updated */
  1629. onPointUpdate: () => void;
  1630. /**
  1631. * Adds new points to the point collection
  1632. * @param items defines the list of items (mesh, control or 2d coordiantes) to add
  1633. * @returns the list of created MultiLinePoint
  1634. */
  1635. add(...items: (AbstractMesh | Control | {
  1636. x: string | number;
  1637. y: string | number;
  1638. })[]): MultiLinePoint[];
  1639. /**
  1640. * Adds a new point to the point collection
  1641. * @param item defines the item (mesh, control or 2d coordiantes) to add
  1642. * @returns the created MultiLinePoint
  1643. */
  1644. push(item?: (AbstractMesh | Control | {
  1645. x: string | number;
  1646. y: string | number;
  1647. })): MultiLinePoint;
  1648. /**
  1649. * Remove a specific value or point from the active point collection
  1650. * @param value defines the value or point to remove
  1651. */
  1652. remove(value: number | MultiLinePoint): void;
  1653. /** Gets or sets line width */
  1654. lineWidth: number;
  1655. horizontalAlignment: number;
  1656. verticalAlignment: number;
  1657. protected _getTypeName(): string;
  1658. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1659. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1660. _measure(): void;
  1661. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1662. dispose(): void;
  1663. }
  1664. }
  1665. declare module 'babylonjs-gui/2D/controls/radioButton' {
  1666. import { Control } from "babylonjs-gui/2D/controls/control";
  1667. import { Observable, Vector2 } from "babylonjs";
  1668. import { Measure } from "babylonjs-gui/2D/measure";
  1669. import { StackPanel } from "babylonjs-gui/2D/controls";
  1670. /**
  1671. * Class used to create radio button controls
  1672. */
  1673. export class RadioButton extends Control {
  1674. name?: string | undefined;
  1675. /** Gets or sets border thickness */
  1676. thickness: number;
  1677. /** Gets or sets group name */
  1678. group: string;
  1679. /** Observable raised when isChecked is changed */
  1680. onIsCheckedChangedObservable: Observable<boolean>;
  1681. /** Gets or sets a value indicating the ratio between overall size and check size */
  1682. checkSizeRatio: number;
  1683. /** Gets or sets background color */
  1684. background: string;
  1685. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  1686. isChecked: boolean;
  1687. /**
  1688. * Creates a new RadioButton
  1689. * @param name defines the control name
  1690. */
  1691. constructor(name?: string | undefined);
  1692. protected _getTypeName(): string;
  1693. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1694. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  1695. /**
  1696. * Utility function to easily create a radio button with a header
  1697. * @param title defines the label to use for the header
  1698. * @param group defines the group to use for the radio button
  1699. * @param isChecked defines the initial state of the radio button
  1700. * @param onValueChanged defines the callback to call when value changes
  1701. * @returns a StackPanel containing the radio button and a textBlock
  1702. */
  1703. static AddRadioButtonWithHeader(title: string, group: string, isChecked: boolean, onValueChanged: (button: RadioButton, value: boolean) => void): StackPanel;
  1704. }
  1705. }
  1706. declare module 'babylonjs-gui/2D/controls/stackPanel' {
  1707. import { Container } from "babylonjs-gui/2D/controls/container";
  1708. import { Measure } from "babylonjs-gui/2D/measure";
  1709. /**
  1710. * Class used to create a 2D stack panel container
  1711. */
  1712. export class StackPanel extends Container {
  1713. name?: string | undefined;
  1714. /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
  1715. isVertical: boolean;
  1716. /** Gets or sets panel width */
  1717. width: string | number;
  1718. /** Gets or sets panel height */
  1719. height: string | number;
  1720. /**
  1721. * Creates a new StackPanel
  1722. * @param name defines control name
  1723. */
  1724. constructor(name?: string | undefined);
  1725. protected _getTypeName(): string;
  1726. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1727. }
  1728. }
  1729. declare module 'babylonjs-gui/2D/controls/selector' {
  1730. import { Rectangle } from "babylonjs-gui/2D/controls/rectangle";
  1731. import { StackPanel } from "babylonjs-gui/2D/controls/stackPanel";
  1732. /** Class used to create a RadioGroup
  1733. * which contains groups of radio buttons
  1734. */
  1735. export class SelectorGroup {
  1736. /** name of SelectorGroup */
  1737. name: string;
  1738. /**
  1739. * Creates a new SelectorGroup
  1740. * @param name of group, used as a group heading
  1741. */
  1742. constructor(
  1743. /** name of SelectorGroup */
  1744. name: string);
  1745. /** Gets the groupPanel of the SelectorGroup */
  1746. readonly groupPanel: StackPanel;
  1747. /** Gets the selectors array */
  1748. readonly selectors: StackPanel[];
  1749. /** Gets and sets the group header */
  1750. header: string;
  1751. /** @hidden*/
  1752. _getSelector(selectorNb: number): StackPanel | undefined;
  1753. /** Removes the selector at the given position
  1754. * @param selectorNb the position of the selector within the group
  1755. */
  1756. removeSelector(selectorNb: number): void;
  1757. }
  1758. /** Class used to create a CheckboxGroup
  1759. * which contains groups of checkbox buttons
  1760. */
  1761. export class CheckboxGroup extends SelectorGroup {
  1762. /** Adds a checkbox as a control
  1763. * @param text is the label for the selector
  1764. * @param func is the function called when the Selector is checked
  1765. * @param checked is true when Selector is checked
  1766. */
  1767. addCheckbox(text: string, func?: (s: boolean) => void, checked?: boolean): void;
  1768. /** @hidden */
  1769. _setSelectorLabel(selectorNb: number, label: string): void;
  1770. /** @hidden */
  1771. _setSelectorLabelColor(selectorNb: number, color: string): void;
  1772. /** @hidden */
  1773. _setSelectorButtonColor(selectorNb: number, color: string): void;
  1774. /** @hidden */
  1775. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  1776. }
  1777. /** Class used to create a RadioGroup
  1778. * which contains groups of radio buttons
  1779. */
  1780. export class RadioGroup extends SelectorGroup {
  1781. /** Adds a radio button as a control
  1782. * @param label is the label for the selector
  1783. * @param func is the function called when the Selector is checked
  1784. * @param checked is true when Selector is checked
  1785. */
  1786. addRadio(label: string, func?: (n: number) => void, checked?: boolean): void;
  1787. /** @hidden */
  1788. _setSelectorLabel(selectorNb: number, label: string): void;
  1789. /** @hidden */
  1790. _setSelectorLabelColor(selectorNb: number, color: string): void;
  1791. /** @hidden */
  1792. _setSelectorButtonColor(selectorNb: number, color: string): void;
  1793. /** @hidden */
  1794. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  1795. }
  1796. /** Class used to create a SliderGroup
  1797. * which contains groups of slider buttons
  1798. */
  1799. export class SliderGroup extends SelectorGroup {
  1800. /**
  1801. * Adds a slider to the SelectorGroup
  1802. * @param label is the label for the SliderBar
  1803. * @param func is the function called when the Slider moves
  1804. * @param unit is a string describing the units used, eg degrees or metres
  1805. * @param min is the minimum value for the Slider
  1806. * @param max is the maximum value for the Slider
  1807. * @param value is the start value for the Slider between min and max
  1808. * @param onValueChange is the function used to format the value displayed, eg radians to degrees
  1809. */
  1810. addSlider(label: string, func?: (v: number) => void, unit?: string, min?: number, max?: number, value?: number, onValueChange?: (v: number) => number): void;
  1811. /** @hidden */
  1812. _setSelectorLabel(selectorNb: number, label: string): void;
  1813. /** @hidden */
  1814. _setSelectorLabelColor(selectorNb: number, color: string): void;
  1815. /** @hidden */
  1816. _setSelectorButtonColor(selectorNb: number, color: string): void;
  1817. /** @hidden */
  1818. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  1819. }
  1820. /** Class used to hold the controls for the checkboxes, radio buttons and sliders */
  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 let the current focused control keeps the focus
  2790. * @param pointerId defines the unique id of the current pointer
  2791. * @returns a boolean indicating if the control wants to keep the focus
  2792. */
  2793. keepFocus(pointerId: number): boolean;
  2794. }
  2795. /**
  2796. * Class used to create texture to support 2D GUI elements
  2797. * @see http://doc.babylonjs.com/how_to/gui
  2798. */
  2799. export class AdvancedDynamicTexture extends BABYLON.DynamicTexture {
  2800. /** @hidden */
  2801. _rootContainer: Container;
  2802. /** @hidden */
  2803. _lastPickedControl: Control;
  2804. /** @hidden */
  2805. _lastControlOver: {
  2806. [pointerId: number]: Control;
  2807. };
  2808. /** @hidden */
  2809. _lastControlDown: {
  2810. [pointerId: number]: Control;
  2811. };
  2812. /** @hidden */
  2813. _capturingControl: {
  2814. [pointerId: number]: Control;
  2815. };
  2816. /** @hidden */
  2817. _shouldBlockPointer: boolean;
  2818. /** @hidden */
  2819. _layerToDispose: BABYLON.Nullable<BABYLON.Layer>;
  2820. /** @hidden */
  2821. _linkedControls: Control[];
  2822. /**
  2823. * Gets or sets a boolean defining if alpha is stored as premultiplied
  2824. */
  2825. premulAlpha: boolean;
  2826. /**
  2827. * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
  2828. * Useful when you want more antialiasing
  2829. */
  2830. renderScale: number;
  2831. /** Gets or sets the background color */
  2832. background: string;
  2833. /**
  2834. * Gets or sets the ideal width used to design controls.
  2835. * The GUI will then rescale everything accordingly
  2836. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  2837. */
  2838. idealWidth: number;
  2839. /**
  2840. * Gets or sets the ideal height used to design controls.
  2841. * The GUI will then rescale everything accordingly
  2842. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  2843. */
  2844. idealHeight: number;
  2845. /**
  2846. * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
  2847. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  2848. */
  2849. useSmallestIdeal: boolean;
  2850. /**
  2851. * Gets or sets a boolean indicating if adaptive scaling must be used
  2852. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  2853. */
  2854. renderAtIdealSize: boolean;
  2855. /**
  2856. * Gets the underlying layer used to render the texture when in fullscreen mode
  2857. */
  2858. readonly layer: BABYLON.Nullable<BABYLON.Layer>;
  2859. /**
  2860. * Gets the root container control
  2861. */
  2862. readonly rootContainer: Container;
  2863. /**
  2864. * Gets or sets the current focused control
  2865. */
  2866. focusedControl: BABYLON.Nullable<IFocusableControl>;
  2867. /**
  2868. * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
  2869. */
  2870. isForeground: boolean;
  2871. /**
  2872. * Creates a new AdvancedDynamicTexture
  2873. * @param name defines the name of the texture
  2874. * @param width defines the width of the texture
  2875. * @param height defines the height of the texture
  2876. * @param scene defines the hosting scene
  2877. * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
  2878. * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
  2879. */
  2880. constructor(name: string, width: number | undefined, height: number | undefined, scene: BABYLON.Nullable<BABYLON.Scene>, generateMipMaps?: boolean, samplingMode?: number);
  2881. /**
  2882. * Function used to execute a function on all controls
  2883. * @param func defines the function to execute
  2884. * @param container defines the container where controls belong. If null the root container will be used
  2885. */
  2886. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  2887. /**
  2888. * Marks the texture as dirty forcing a complete update
  2889. */
  2890. markAsDirty(): void;
  2891. /**
  2892. * Helper function used to create a new style
  2893. * @returns a new style
  2894. * @see http://doc.babylonjs.com/how_to/gui#styles
  2895. */
  2896. createStyle(): Style;
  2897. /**
  2898. * Adds a new control to the root container
  2899. * @param control defines the control to add
  2900. * @returns the current texture
  2901. */
  2902. addControl(control: Control): AdvancedDynamicTexture;
  2903. /**
  2904. * Removes a control from the root container
  2905. * @param control defines the control to remove
  2906. * @returns the current texture
  2907. */
  2908. removeControl(control: Control): AdvancedDynamicTexture;
  2909. /**
  2910. * Release all resources
  2911. */
  2912. dispose(): void;
  2913. /** @hidden */
  2914. _getGlobalViewport(scene: BABYLON.Scene): BABYLON.Viewport;
  2915. /**
  2916. * Get screen coordinates for a vector3
  2917. * @param position defines the position to project
  2918. * @param worldMatrix defines the world matrix to use
  2919. * @returns the projected position
  2920. */
  2921. getProjectedPosition(position: BABYLON.Vector3, worldMatrix: BABYLON.Matrix): BABYLON.Vector2;
  2922. /** @hidden */
  2923. _changeCursor(cursor: string): void;
  2924. /** @hidden */
  2925. _cleanControlAfterRemovalFromList(list: {
  2926. [pointerId: number]: Control;
  2927. }, control: Control): void;
  2928. /** @hidden */
  2929. _cleanControlAfterRemoval(control: Control): void;
  2930. /** Attach to all scene events required to support pointer events */
  2931. attach(): void;
  2932. /**
  2933. * Connect the texture to a hosting mesh to enable interactions
  2934. * @param mesh defines the mesh to attach to
  2935. * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
  2936. */
  2937. attachToMesh(mesh: BABYLON.AbstractMesh, supportPointerMove?: boolean): void;
  2938. /**
  2939. * Move the focus to a specific control
  2940. * @param control defines the control which will receive the focus
  2941. */
  2942. moveFocusToControl(control: IFocusableControl): void;
  2943. /**
  2944. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
  2945. * @param mesh defines the mesh which will receive the texture
  2946. * @param width defines the texture width (1024 by default)
  2947. * @param height defines the texture height (1024 by default)
  2948. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  2949. * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)
  2950. * @returns a new AdvancedDynamicTexture
  2951. */
  2952. static CreateForMesh(mesh: BABYLON.AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, onlyAlphaTesting?: boolean): AdvancedDynamicTexture;
  2953. /**
  2954. * Creates a new AdvancedDynamicTexture in fullscreen mode.
  2955. * In this mode the texture will rely on a layer for its rendering.
  2956. * This allows it to be treated like any other layer.
  2957. * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
  2958. * LayerMask is set through advancedTexture.layer.layerMask
  2959. * @param name defines name for the texture
  2960. * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
  2961. * @param scene defines the hsoting scene
  2962. * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
  2963. * @returns a new AdvancedDynamicTexture
  2964. */
  2965. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: BABYLON.Nullable<BABYLON.Scene>, sampling?: number): AdvancedDynamicTexture;
  2966. }
  2967. }
  2968. declare module BABYLON.GUI {
  2969. /**
  2970. * Class used to transport BABYLON.Vector2 information for pointer events
  2971. */
  2972. export class Vector2WithInfo extends BABYLON.Vector2 {
  2973. /** defines the current mouse button index */
  2974. buttonIndex: number;
  2975. /**
  2976. * Creates a new Vector2WithInfo
  2977. * @param source defines the vector2 data to transport
  2978. * @param buttonIndex defines the current mouse button index
  2979. */
  2980. constructor(source: BABYLON.Vector2,
  2981. /** defines the current mouse button index */
  2982. buttonIndex?: number);
  2983. }
  2984. /** Class used to provide 2D matrix features */
  2985. export class Matrix2D {
  2986. /** Gets the internal array of 6 floats used to store matrix data */
  2987. m: Float32Array;
  2988. /**
  2989. * Creates a new matrix
  2990. * @param m00 defines value for (0, 0)
  2991. * @param m01 defines value for (0, 1)
  2992. * @param m10 defines value for (1, 0)
  2993. * @param m11 defines value for (1, 1)
  2994. * @param m20 defines value for (2, 0)
  2995. * @param m21 defines value for (2, 1)
  2996. */
  2997. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  2998. /**
  2999. * Fills the matrix from direct values
  3000. * @param m00 defines value for (0, 0)
  3001. * @param m01 defines value for (0, 1)
  3002. * @param m10 defines value for (1, 0)
  3003. * @param m11 defines value for (1, 1)
  3004. * @param m20 defines value for (2, 0)
  3005. * @param m21 defines value for (2, 1)
  3006. * @returns the current modified matrix
  3007. */
  3008. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  3009. /**
  3010. * Gets matrix determinant
  3011. * @returns the determinant
  3012. */
  3013. determinant(): number;
  3014. /**
  3015. * Inverses the matrix and stores it in a target matrix
  3016. * @param result defines the target matrix
  3017. * @returns the current matrix
  3018. */
  3019. invertToRef(result: Matrix2D): Matrix2D;
  3020. /**
  3021. * Multiplies the current matrix with another one
  3022. * @param other defines the second operand
  3023. * @param result defines the target matrix
  3024. * @returns the current matrix
  3025. */
  3026. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  3027. /**
  3028. * Applies the current matrix to a set of 2 floats and stores the result in a vector2
  3029. * @param x defines the x coordinate to transform
  3030. * @param y defines the x coordinate to transform
  3031. * @param result defines the target vector2
  3032. * @returns the current matrix
  3033. */
  3034. transformCoordinates(x: number, y: number, result: BABYLON.Vector2): Matrix2D;
  3035. /**
  3036. * Creates an identity matrix
  3037. * @returns a new matrix
  3038. */
  3039. static Identity(): Matrix2D;
  3040. /**
  3041. * Creates a translation matrix and stores it in a target matrix
  3042. * @param x defines the x coordinate of the translation
  3043. * @param y defines the y coordinate of the translation
  3044. * @param result defines the target matrix
  3045. */
  3046. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  3047. /**
  3048. * Creates a scaling matrix and stores it in a target matrix
  3049. * @param x defines the x coordinate of the scaling
  3050. * @param y defines the y coordinate of the scaling
  3051. * @param result defines the target matrix
  3052. */
  3053. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  3054. /**
  3055. * Creates a rotation matrix and stores it in a target matrix
  3056. * @param angle defines the rotation angle
  3057. * @param result defines the target matrix
  3058. */
  3059. static RotationToRef(angle: number, result: Matrix2D): void;
  3060. /**
  3061. * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
  3062. * @param tx defines the x coordinate of the translation
  3063. * @param ty defines the y coordinate of the translation
  3064. * @param angle defines the rotation angle
  3065. * @param scaleX defines the x coordinate of the scaling
  3066. * @param scaleY defines the y coordinate of the scaling
  3067. * @param parentMatrix defines the parent matrix to multiply by (can be null)
  3068. * @param result defines the target matrix
  3069. */
  3070. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: BABYLON.Nullable<Matrix2D>, result: Matrix2D): void;
  3071. }
  3072. }
  3073. declare module BABYLON.GUI {
  3074. /**
  3075. * Class used to store 2D control sizes
  3076. */
  3077. export class Measure {
  3078. /** defines left coordinate */
  3079. left: number;
  3080. /** defines top coordinate */
  3081. top: number;
  3082. /** defines width dimension */
  3083. width: number;
  3084. /** defines height dimension */
  3085. height: number;
  3086. /**
  3087. * Creates a new measure
  3088. * @param left defines left coordinate
  3089. * @param top defines top coordinate
  3090. * @param width defines width dimension
  3091. * @param height defines height dimension
  3092. */
  3093. constructor(
  3094. /** defines left coordinate */
  3095. left: number,
  3096. /** defines top coordinate */
  3097. top: number,
  3098. /** defines width dimension */
  3099. width: number,
  3100. /** defines height dimension */
  3101. height: number);
  3102. /**
  3103. * Copy from another measure
  3104. * @param other defines the other measure to copy from
  3105. */
  3106. copyFrom(other: Measure): void;
  3107. /**
  3108. * Check equality between this measure and another one
  3109. * @param other defines the other measures
  3110. * @returns true if both measures are equals
  3111. */
  3112. isEqualsTo(other: Measure): boolean;
  3113. /**
  3114. * Creates an empty measure
  3115. * @returns a new measure
  3116. */
  3117. static Empty(): Measure;
  3118. }
  3119. }
  3120. declare module BABYLON.GUI {
  3121. /**
  3122. * Class used to store a point for a MultiLine object.
  3123. * The point can be pure 2D coordinates, a mesh or a control
  3124. */
  3125. export class MultiLinePoint {
  3126. /** @hidden */
  3127. _point: BABYLON.Vector2;
  3128. /**
  3129. * Creates a new MultiLinePoint
  3130. * @param multiLine defines the source MultiLine object
  3131. */
  3132. constructor(multiLine: MultiLine);
  3133. /** Gets or sets x coordinate */
  3134. x: string | number;
  3135. /** Gets or sets y coordinate */
  3136. y: string | number;
  3137. /** Gets or sets the control associated with this point */
  3138. control: BABYLON.Nullable<Control>;
  3139. /** Gets or sets the mesh associated with this point */
  3140. mesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  3141. /**
  3142. * Gets a translation vector
  3143. * @returns the translation vector
  3144. */
  3145. translate(): BABYLON.Vector2;
  3146. /** Release associated resources */
  3147. dispose(): void;
  3148. }
  3149. }
  3150. declare module BABYLON.GUI {
  3151. /**
  3152. * Define a style used by control to automatically setup properties based on a template.
  3153. * Only support font related properties so far
  3154. */
  3155. export class Style implements BABYLON.IDisposable {
  3156. /** @hidden */
  3157. _host: AdvancedDynamicTexture;
  3158. /** @hidden */
  3159. _fontSize: ValueAndUnit;
  3160. /**
  3161. * BABYLON.Observable raised when the style values are changed
  3162. */
  3163. onChangedObservable: BABYLON.Observable<Style>;
  3164. /**
  3165. * Creates a new style object
  3166. * @param host defines the AdvancedDynamicTexture which hosts this style
  3167. */
  3168. constructor(host: AdvancedDynamicTexture);
  3169. /**
  3170. * Gets or sets the font size
  3171. */
  3172. fontSize: string | number;
  3173. /**
  3174. * Gets or sets the font family
  3175. */
  3176. fontFamily: string;
  3177. /**
  3178. * Gets or sets the font style
  3179. */
  3180. fontStyle: string;
  3181. /** Gets or sets font weight */
  3182. fontWeight: string;
  3183. /** Dispose all associated resources */
  3184. dispose(): void;
  3185. }
  3186. }
  3187. declare module BABYLON.GUI {
  3188. /**
  3189. * Class used to specific a value and its associated unit
  3190. */
  3191. export class ValueAndUnit {
  3192. /** defines the unit to store */
  3193. unit: number;
  3194. /** defines a boolean indicating if the value can be negative */
  3195. negativeValueAllowed: boolean;
  3196. /**
  3197. * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
  3198. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  3199. */
  3200. ignoreAdaptiveScaling: boolean;
  3201. /**
  3202. * Creates a new ValueAndUnit
  3203. * @param value defines the value to store
  3204. * @param unit defines the unit to store
  3205. * @param negativeValueAllowed defines a boolean indicating if the value can be negative
  3206. */
  3207. constructor(value: number,
  3208. /** defines the unit to store */
  3209. unit?: number,
  3210. /** defines a boolean indicating if the value can be negative */
  3211. negativeValueAllowed?: boolean);
  3212. /** Gets a boolean indicating if the value is a percentage */
  3213. readonly isPercentage: boolean;
  3214. /** Gets a boolean indicating if the value is store as pixel */
  3215. readonly isPixel: boolean;
  3216. /** Gets direct internal value */
  3217. readonly internalValue: number;
  3218. /**
  3219. * Gets value as pixel
  3220. * @param host defines the root host
  3221. * @param refValue defines the reference value for percentages
  3222. * @returns the value as pixel
  3223. */
  3224. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  3225. /**
  3226. * Gets the value accordingly to its unit
  3227. * @param host defines the root host
  3228. * @returns the value
  3229. */
  3230. getValue(host: AdvancedDynamicTexture): number;
  3231. /**
  3232. * Gets a string representation of the value
  3233. * @param host defines the root host
  3234. * @returns a string
  3235. */
  3236. toString(host: AdvancedDynamicTexture): string;
  3237. /**
  3238. * Store a value parsed from a string
  3239. * @param source defines the source string
  3240. * @returns true if the value was successfully parsed
  3241. */
  3242. fromString(source: string | number): boolean;
  3243. /** UNITMODE_PERCENTAGE */
  3244. static readonly UNITMODE_PERCENTAGE: number;
  3245. /** UNITMODE_PIXEL */
  3246. static readonly UNITMODE_PIXEL: number;
  3247. }
  3248. }
  3249. declare module BABYLON.GUI {
  3250. }
  3251. declare module BABYLON.GUI {
  3252. }
  3253. declare module BABYLON.GUI {
  3254. /**
  3255. * Class used to manage 3D user interface
  3256. * @see http://doc.babylonjs.com/how_to/gui3d
  3257. */
  3258. export class GUI3DManager implements BABYLON.IDisposable {
  3259. /** @hidden */
  3260. _lastPickedControl: Control3D;
  3261. /** @hidden */
  3262. _lastControlOver: {
  3263. [pointerId: number]: Control3D;
  3264. };
  3265. /** @hidden */
  3266. _lastControlDown: {
  3267. [pointerId: number]: Control3D;
  3268. };
  3269. /**
  3270. * BABYLON.Observable raised when the point picked by the pointer events changed
  3271. */
  3272. onPickedPointChangedObservable: BABYLON.Observable<BABYLON.Nullable<BABYLON.Vector3>>;
  3273. /** @hidden */
  3274. _sharedMaterials: {
  3275. [key: string]: BABYLON.Material;
  3276. };
  3277. /** Gets the hosting scene */
  3278. readonly scene: BABYLON.Scene;
  3279. /** Gets associated utility layer */
  3280. readonly utilityLayer: BABYLON.Nullable<BABYLON.UtilityLayerRenderer>;
  3281. /**
  3282. * Creates a new GUI3DManager
  3283. * @param scene
  3284. */
  3285. constructor(scene?: BABYLON.Scene);
  3286. /**
  3287. * Gets the root container
  3288. */
  3289. readonly rootContainer: Container3D;
  3290. /**
  3291. * Gets a boolean indicating if the given control is in the root child list
  3292. * @param control defines the control to check
  3293. * @returns true if the control is in the root child list
  3294. */
  3295. containsControl(control: Control3D): boolean;
  3296. /**
  3297. * Adds a control to the root child list
  3298. * @param control defines the control to add
  3299. * @returns the current manager
  3300. */
  3301. addControl(control: Control3D): GUI3DManager;
  3302. /**
  3303. * Removes a control from the root child list
  3304. * @param control defines the control to remove
  3305. * @returns the current container
  3306. */
  3307. removeControl(control: Control3D): GUI3DManager;
  3308. /**
  3309. * Releases all associated resources
  3310. */
  3311. dispose(): void;
  3312. }
  3313. }
  3314. declare module BABYLON.GUI {
  3315. /**
  3316. * Class used to transport BABYLON.Vector3 information for pointer events
  3317. */
  3318. export class Vector3WithInfo extends BABYLON.Vector3 {
  3319. /** defines the current mouse button index */
  3320. buttonIndex: number;
  3321. /**
  3322. * Creates a new Vector3WithInfo
  3323. * @param source defines the vector3 data to transport
  3324. * @param buttonIndex defines the current mouse button index
  3325. */
  3326. constructor(source: BABYLON.Vector3,
  3327. /** defines the current mouse button index */
  3328. buttonIndex?: number);
  3329. }
  3330. }
  3331. declare module BABYLON.GUI {
  3332. /**
  3333. * Class used to create 2D buttons
  3334. */
  3335. export class Button extends Rectangle {
  3336. name?: string | undefined;
  3337. /**
  3338. * Function called to generate a pointer enter animation
  3339. */
  3340. pointerEnterAnimation: () => void;
  3341. /**
  3342. * Function called to generate a pointer out animation
  3343. */
  3344. pointerOutAnimation: () => void;
  3345. /**
  3346. * Function called to generate a pointer down animation
  3347. */
  3348. pointerDownAnimation: () => void;
  3349. /**
  3350. * Function called to generate a pointer up animation
  3351. */
  3352. pointerUpAnimation: () => void;
  3353. /**
  3354. * Creates a new Button
  3355. * @param name defines the name of the button
  3356. */
  3357. constructor(name?: string | undefined);
  3358. protected _getTypeName(): string;
  3359. /** @hidden */
  3360. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  3361. /** @hidden */
  3362. _onPointerEnter(target: Control): boolean;
  3363. /** @hidden */
  3364. _onPointerOut(target: Control): void;
  3365. /** @hidden */
  3366. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3367. /** @hidden */
  3368. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  3369. /**
  3370. * Creates a new button made with an image and a text
  3371. * @param name defines the name of the button
  3372. * @param text defines the text of the button
  3373. * @param imageUrl defines the url of the image
  3374. * @returns a new Button
  3375. */
  3376. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  3377. /**
  3378. * Creates a new button made with an image
  3379. * @param name defines the name of the button
  3380. * @param imageUrl defines the url of the image
  3381. * @returns a new Button
  3382. */
  3383. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  3384. /**
  3385. * Creates a new button made with a text
  3386. * @param name defines the name of the button
  3387. * @param text defines the text of the button
  3388. * @returns a new Button
  3389. */
  3390. static CreateSimpleButton(name: string, text: string): Button;
  3391. /**
  3392. * Creates a new button made with an image and a centered text
  3393. * @param name defines the name of the button
  3394. * @param text defines the text of the button
  3395. * @param imageUrl defines the url of the image
  3396. * @returns a new Button
  3397. */
  3398. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  3399. }
  3400. }
  3401. declare module BABYLON.GUI {
  3402. /**
  3403. * Class used to represent a 2D checkbox
  3404. */
  3405. export class Checkbox extends Control {
  3406. name?: string | undefined;
  3407. /** Gets or sets border thickness */
  3408. thickness: number;
  3409. /**
  3410. * BABYLON.Observable raised when isChecked property changes
  3411. */
  3412. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  3413. /** Gets or sets a value indicating the ratio between overall size and check size */
  3414. checkSizeRatio: number;
  3415. /** Gets or sets background color */
  3416. background: string;
  3417. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  3418. isChecked: boolean;
  3419. /**
  3420. * Creates a new CheckBox
  3421. * @param name defines the control name
  3422. */
  3423. constructor(name?: string | undefined);
  3424. protected _getTypeName(): string;
  3425. /** @hidden */
  3426. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3427. /** @hidden */
  3428. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3429. /**
  3430. * Utility function to easily create a checkbox with a header
  3431. * @param title defines the label to use for the header
  3432. * @param onValueChanged defines the callback to call when value changes
  3433. * @returns a StackPanel containing the checkbox and a textBlock
  3434. */
  3435. static AddCheckBoxWithHeader(title: string, onValueChanged: (value: boolean) => void): StackPanel;
  3436. }
  3437. }
  3438. declare module BABYLON.GUI {
  3439. /** Class used to create color pickers */
  3440. export class ColorPicker extends Control {
  3441. name?: string | undefined;
  3442. /**
  3443. * BABYLON.Observable raised when the value changes
  3444. */
  3445. onValueChangedObservable: BABYLON.Observable<BABYLON.Color3>;
  3446. /** Gets or sets the color of the color picker */
  3447. value: BABYLON.Color3;
  3448. /** Gets or sets control width */
  3449. width: string | number;
  3450. /** Gets or sets control height */
  3451. height: string | number;
  3452. /** Gets or sets control size */
  3453. size: string | number;
  3454. /**
  3455. * Creates a new ColorPicker
  3456. * @param name defines the control name
  3457. */
  3458. constructor(name?: string | undefined);
  3459. protected _getTypeName(): string;
  3460. /** @hidden */
  3461. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3462. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3463. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  3464. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  3465. }
  3466. }
  3467. declare module BABYLON.GUI {
  3468. /**
  3469. * Root class for 2D containers
  3470. * @see http://doc.babylonjs.com/how_to/gui#containers
  3471. */
  3472. export class Container extends Control {
  3473. name?: string | undefined;
  3474. /** @hidden */
  3475. protected _children: Control[];
  3476. /** @hidden */
  3477. protected _measureForChildren: Measure;
  3478. /** @hidden */
  3479. protected _background: string;
  3480. /** @hidden */
  3481. protected _adaptWidthToChildren: boolean;
  3482. /** @hidden */
  3483. protected _adaptHeightToChildren: boolean;
  3484. /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
  3485. adaptHeightToChildren: boolean;
  3486. /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
  3487. adaptWidthToChildren: boolean;
  3488. /** Gets or sets background color */
  3489. background: string;
  3490. /** Gets the list of children */
  3491. readonly children: Control[];
  3492. /**
  3493. * Creates a new Container
  3494. * @param name defines the name of the container
  3495. */
  3496. constructor(name?: string | undefined);
  3497. protected _getTypeName(): string;
  3498. /**
  3499. * Gets a child using its name
  3500. * @param name defines the child name to look for
  3501. * @returns the child control if found
  3502. */
  3503. getChildByName(name: string): BABYLON.Nullable<Control>;
  3504. /**
  3505. * Gets a child using its type and its name
  3506. * @param name defines the child name to look for
  3507. * @param type defines the child type to look for
  3508. * @returns the child control if found
  3509. */
  3510. getChildByType(name: string, type: string): BABYLON.Nullable<Control>;
  3511. /**
  3512. * Search for a specific control in children
  3513. * @param control defines the control to look for
  3514. * @returns true if the control is in child list
  3515. */
  3516. containsControl(control: Control): boolean;
  3517. /**
  3518. * Adds a new control to the current container
  3519. * @param control defines the control to add
  3520. * @returns the current container
  3521. */
  3522. addControl(control: BABYLON.Nullable<Control>): Container;
  3523. /**
  3524. * Removes all controls from the current container
  3525. * @returns the current container
  3526. */
  3527. clearControls(): Container;
  3528. /**
  3529. * Removes a control from the current container
  3530. * @param control defines the control to remove
  3531. * @returns the current container
  3532. */
  3533. removeControl(control: Control): Container;
  3534. /** @hidden */
  3535. _reOrderControl(control: Control): void;
  3536. /** @hidden */
  3537. _markMatrixAsDirty(): void;
  3538. /** @hidden */
  3539. _markAllAsDirty(): void;
  3540. /** @hidden */
  3541. protected _localDraw(context: CanvasRenderingContext2D): void;
  3542. /** @hidden */
  3543. _link(root: BABYLON.Nullable<Container>, host: AdvancedDynamicTexture): void;
  3544. /** @hidden */
  3545. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3546. /** @hidden */
  3547. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  3548. /** @hidden */
  3549. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  3550. /** @hidden */
  3551. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3552. /** Releases associated resources */
  3553. dispose(): void;
  3554. }
  3555. }
  3556. declare module BABYLON.GUI {
  3557. /**
  3558. * Root class used for all 2D controls
  3559. * @see http://doc.babylonjs.com/how_to/gui#controls
  3560. */
  3561. export class Control {
  3562. /** defines the name of the control */
  3563. name?: string | undefined;
  3564. /** @hidden */
  3565. _root: BABYLON.Nullable<Container>;
  3566. /** @hidden */
  3567. _host: AdvancedDynamicTexture;
  3568. /** Gets or sets the control parent */
  3569. parent: BABYLON.Nullable<Container>;
  3570. /** @hidden */
  3571. _currentMeasure: Measure;
  3572. /** @hidden */
  3573. _width: ValueAndUnit;
  3574. /** @hidden */
  3575. _height: ValueAndUnit;
  3576. /** @hidden */
  3577. protected _fontOffset: {
  3578. ascent: number;
  3579. height: number;
  3580. descent: number;
  3581. };
  3582. /** @hidden */
  3583. protected _horizontalAlignment: number;
  3584. /** @hidden */
  3585. protected _verticalAlignment: number;
  3586. /** @hidden */
  3587. _tempParentMeasure: Measure;
  3588. /** @hidden */
  3589. protected _cachedParentMeasure: Measure;
  3590. /** @hidden */
  3591. _left: ValueAndUnit;
  3592. /** @hidden */
  3593. _top: ValueAndUnit;
  3594. /** @hidden */
  3595. protected _invertTransformMatrix: Matrix2D;
  3596. /** @hidden */
  3597. protected _transformedPosition: BABYLON.Vector2;
  3598. /** @hidden */
  3599. _linkedMesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  3600. protected _isEnabled: boolean;
  3601. protected _disabledColor: string;
  3602. /** @hidden */
  3603. _tag: any;
  3604. /** Gets or sets a boolean indicating if the control can be hit with pointer events */
  3605. isHitTestVisible: boolean;
  3606. /** Gets or sets a boolean indicating if the control can block pointer events */
  3607. isPointerBlocker: boolean;
  3608. /** Gets or sets a boolean indicating if the control can be focusable */
  3609. isFocusInvisible: boolean;
  3610. /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
  3611. shadowOffsetX: number;
  3612. /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
  3613. shadowOffsetY: number;
  3614. /** Gets or sets a value indicating the amount of blur to use to render the shadow */
  3615. shadowBlur: number;
  3616. /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
  3617. shadowColor: string;
  3618. /** Gets or sets the cursor to use when the control is hovered */
  3619. hoverCursor: string;
  3620. /** @hidden */
  3621. protected _linkOffsetX: ValueAndUnit;
  3622. /** @hidden */
  3623. protected _linkOffsetY: ValueAndUnit;
  3624. /** Gets the control type name */
  3625. readonly typeName: string;
  3626. /**
  3627. * An event triggered when the pointer move over the control.
  3628. */
  3629. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector2>;
  3630. /**
  3631. * An event triggered when the pointer move out of the control.
  3632. */
  3633. onPointerOutObservable: BABYLON.Observable<Control>;
  3634. /**
  3635. * An event triggered when the pointer taps the control
  3636. */
  3637. onPointerDownObservable: BABYLON.Observable<Vector2WithInfo>;
  3638. /**
  3639. * An event triggered when pointer up
  3640. */
  3641. onPointerUpObservable: BABYLON.Observable<Vector2WithInfo>;
  3642. /**
  3643. * An event triggered when a control is clicked on
  3644. */
  3645. onPointerClickObservable: BABYLON.Observable<Vector2WithInfo>;
  3646. /**
  3647. * An event triggered when pointer enters the control
  3648. */
  3649. onPointerEnterObservable: BABYLON.Observable<Control>;
  3650. /**
  3651. * An event triggered when the control is marked as dirty
  3652. */
  3653. onDirtyObservable: BABYLON.Observable<Control>;
  3654. /**
  3655. * An event triggered after the control is drawn
  3656. */
  3657. onAfterDrawObservable: BABYLON.Observable<Control>;
  3658. /** Gets or set information about font offsets (used to render and align text) */
  3659. fontOffset: {
  3660. ascent: number;
  3661. height: number;
  3662. descent: number;
  3663. };
  3664. /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
  3665. alpha: number;
  3666. /** Gets or sets a value indicating the scale factor on X axis (1 by default)
  3667. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3668. */
  3669. scaleX: number;
  3670. /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
  3671. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3672. */
  3673. scaleY: number;
  3674. /** Gets or sets the rotation angle (0 by default)
  3675. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3676. */
  3677. rotation: number;
  3678. /** Gets or sets the transformation center on Y axis (0 by default)
  3679. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3680. */
  3681. transformCenterY: number;
  3682. /** Gets or sets the transformation center on X axis (0 by default)
  3683. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3684. */
  3685. transformCenterX: number;
  3686. /**
  3687. * Gets or sets the horizontal alignment
  3688. * @see http://doc.babylonjs.com/how_to/gui#alignments
  3689. */
  3690. horizontalAlignment: number;
  3691. /**
  3692. * Gets or sets the vertical alignment
  3693. * @see http://doc.babylonjs.com/how_to/gui#alignments
  3694. */
  3695. verticalAlignment: number;
  3696. /**
  3697. * Gets or sets control width
  3698. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3699. */
  3700. width: string | number;
  3701. /**
  3702. * Gets control width in pixel
  3703. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3704. */
  3705. readonly widthInPixels: number;
  3706. /**
  3707. * Gets or sets control height
  3708. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3709. */
  3710. height: string | number;
  3711. /**
  3712. * Gets control height in pixel
  3713. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3714. */
  3715. readonly heightInPixels: number;
  3716. /** Gets or set font family */
  3717. fontFamily: string;
  3718. /** Gets or sets font style */
  3719. fontStyle: string;
  3720. /** Gets or sets font weight */
  3721. fontWeight: string;
  3722. /**
  3723. * Gets or sets style
  3724. * @see http://doc.babylonjs.com/how_to/gui#styles
  3725. */
  3726. style: BABYLON.Nullable<Style>;
  3727. /** @hidden */
  3728. readonly _isFontSizeInPercentage: boolean;
  3729. /** Gets font size in pixels */
  3730. readonly fontSizeInPixels: number;
  3731. /** Gets or sets font size */
  3732. fontSize: string | number;
  3733. /** Gets or sets foreground color */
  3734. color: string;
  3735. /** Gets or sets z index which is used to reorder controls on the z axis */
  3736. zIndex: number;
  3737. /** Gets or sets a boolean indicating if the control can be rendered */
  3738. notRenderable: boolean;
  3739. /** Gets or sets a boolean indicating if the control is visible */
  3740. isVisible: boolean;
  3741. /** Gets a boolean indicating that the control needs to update its rendering */
  3742. readonly isDirty: boolean;
  3743. /**
  3744. * Gets or sets a value indicating the padding to use on the left of the control
  3745. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3746. */
  3747. paddingLeft: string | number;
  3748. /**
  3749. * Gets a value indicating the padding in pixels to use on the left of the control
  3750. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3751. */
  3752. readonly paddingLeftInPixels: number;
  3753. /**
  3754. * Gets or sets a value indicating the padding to use on the right of the control
  3755. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3756. */
  3757. paddingRight: string | number;
  3758. /**
  3759. * Gets a value indicating the padding in pixels to use on the right of the control
  3760. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3761. */
  3762. readonly paddingRightInPixels: number;
  3763. /**
  3764. * Gets or sets a value indicating the padding to use on the top of the control
  3765. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3766. */
  3767. paddingTop: string | number;
  3768. /**
  3769. * Gets a value indicating the padding in pixels to use on the top of the control
  3770. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3771. */
  3772. readonly paddingTopInPixels: number;
  3773. /**
  3774. * Gets or sets a value indicating the padding to use on the bottom of the control
  3775. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3776. */
  3777. paddingBottom: string | number;
  3778. /**
  3779. * Gets a value indicating the padding in pixels to use on the bottom of the control
  3780. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3781. */
  3782. readonly paddingBottomInPixels: number;
  3783. /**
  3784. * Gets or sets a value indicating the left coordinate of the control
  3785. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3786. */
  3787. left: string | number;
  3788. /**
  3789. * Gets a value indicating the left coordinate in pixels of the control
  3790. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3791. */
  3792. readonly leftInPixels: number;
  3793. /**
  3794. * Gets or sets a value indicating the top coordinate of the control
  3795. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3796. */
  3797. top: string | number;
  3798. /**
  3799. * Gets a value indicating the top coordinate in pixels of the control
  3800. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3801. */
  3802. readonly topInPixels: number;
  3803. /**
  3804. * Gets or sets a value indicating the offset on X axis to the linked mesh
  3805. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  3806. */
  3807. linkOffsetX: string | number;
  3808. /**
  3809. * Gets a value indicating the offset in pixels on X axis to the linked mesh
  3810. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  3811. */
  3812. readonly linkOffsetXInPixels: number;
  3813. /**
  3814. * Gets or sets a value indicating the offset on Y axis to the linked mesh
  3815. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  3816. */
  3817. linkOffsetY: string | number;
  3818. /**
  3819. * Gets a value indicating the offset in pixels on Y axis to the linked mesh
  3820. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  3821. */
  3822. readonly linkOffsetYInPixels: number;
  3823. /** Gets the center coordinate on X axis */
  3824. readonly centerX: number;
  3825. /** Gets the center coordinate on Y axis */
  3826. readonly centerY: number;
  3827. /** Gets or sets if control is Enabled*/
  3828. isEnabled: boolean;
  3829. /** Gets or sets background color of control if it's disabled*/
  3830. disabledColor: string;
  3831. /**
  3832. * Creates a new control
  3833. * @param name defines the name of the control
  3834. */
  3835. constructor(
  3836. /** defines the name of the control */
  3837. name?: string | undefined);
  3838. /** @hidden */
  3839. protected _getTypeName(): string;
  3840. /** @hidden */
  3841. _resetFontCache(): void;
  3842. /**
  3843. * Determines if a container is an ascendant of the current control
  3844. * @param container defines the container to look for
  3845. * @returns true if the container is one of the ascendant of the control
  3846. */
  3847. IsAscendant(container: Container): boolean;
  3848. /**
  3849. * Gets coordinates in local control space
  3850. * @param globalCoordinates defines the coordinates to transform
  3851. * @returns the new coordinates in local space
  3852. */
  3853. getLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  3854. /**
  3855. * Gets coordinates in local control space
  3856. * @param globalCoordinates defines the coordinates to transform
  3857. * @param result defines the target vector2 where to store the result
  3858. * @returns the current control
  3859. */
  3860. getLocalCoordinatesToRef(globalCoordinates: BABYLON.Vector2, result: BABYLON.Vector2): Control;
  3861. /**
  3862. * Gets coordinates in parent local control space
  3863. * @param globalCoordinates defines the coordinates to transform
  3864. * @returns the new coordinates in parent local space
  3865. */
  3866. getParentLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  3867. /**
  3868. * Move the current control to a vector3 position projected onto the screen.
  3869. * @param position defines the target position
  3870. * @param scene defines the hosting scene
  3871. */
  3872. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene): void;
  3873. /**
  3874. * Link current control with a target mesh
  3875. * @param mesh defines the mesh to link with
  3876. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  3877. */
  3878. linkWithMesh(mesh: BABYLON.Nullable<BABYLON.AbstractMesh>): void;
  3879. /** @hidden */
  3880. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3): void;
  3881. /** @hidden */
  3882. _markMatrixAsDirty(): void;
  3883. /** @hidden */
  3884. _markAsDirty(): void;
  3885. /** @hidden */
  3886. _markAllAsDirty(): void;
  3887. /** @hidden */
  3888. _link(root: BABYLON.Nullable<Container>, host: AdvancedDynamicTexture): void;
  3889. /** @hidden */
  3890. protected _transform(context: CanvasRenderingContext2D): void;
  3891. /** @hidden */
  3892. protected _applyStates(context: CanvasRenderingContext2D): void;
  3893. /** @hidden */
  3894. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  3895. /** @hidden */
  3896. protected _clip(context: CanvasRenderingContext2D): void;
  3897. /** @hidden */
  3898. _measure(): void;
  3899. /** @hidden */
  3900. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3901. /** @hidden */
  3902. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3903. /** @hidden */
  3904. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3905. /** @hidden */
  3906. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3907. /**
  3908. * Tests if a given coordinates belong to the current control
  3909. * @param x defines x coordinate to test
  3910. * @param y defines y coordinate to test
  3911. * @returns true if the coordinates are inside the control
  3912. */
  3913. contains(x: number, y: number): boolean;
  3914. /** @hidden */
  3915. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  3916. /** @hidden */
  3917. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  3918. /** @hidden */
  3919. _onPointerEnter(target: Control): boolean;
  3920. /** @hidden */
  3921. _onPointerOut(target: Control): void;
  3922. /** @hidden */
  3923. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3924. /** @hidden */
  3925. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  3926. /** @hidden */
  3927. _forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  3928. /** @hidden */
  3929. _processObservables(type: number, x: number, y: number, pointerId: number, buttonIndex: number): boolean;
  3930. /** Releases associated resources */
  3931. dispose(): void;
  3932. /** HORIZONTAL_ALIGNMENT_LEFT */
  3933. static readonly HORIZONTAL_ALIGNMENT_LEFT: number;
  3934. /** HORIZONTAL_ALIGNMENT_RIGHT */
  3935. static readonly HORIZONTAL_ALIGNMENT_RIGHT: number;
  3936. /** HORIZONTAL_ALIGNMENT_CENTER */
  3937. static readonly HORIZONTAL_ALIGNMENT_CENTER: number;
  3938. /** VERTICAL_ALIGNMENT_TOP */
  3939. static readonly VERTICAL_ALIGNMENT_TOP: number;
  3940. /** VERTICAL_ALIGNMENT_BOTTOM */
  3941. static readonly VERTICAL_ALIGNMENT_BOTTOM: number;
  3942. /** VERTICAL_ALIGNMENT_CENTER */
  3943. static readonly VERTICAL_ALIGNMENT_CENTER: number;
  3944. /** @hidden */
  3945. static _GetFontOffset(font: string): {
  3946. ascent: number;
  3947. height: number;
  3948. descent: number;
  3949. };
  3950. /**
  3951. * Creates a stack panel that can be used to render headers
  3952. * @param control defines the control to associate with the header
  3953. * @param text defines the text of the header
  3954. * @param size defines the size of the header
  3955. * @param options defines options used to configure the header
  3956. * @returns a new StackPanel
  3957. * @ignore
  3958. * @hidden
  3959. */
  3960. static AddHeader: (control: Control, text: string, size: string | number, options: {
  3961. isHorizontal: boolean;
  3962. controlFirst: boolean;
  3963. }) => any;
  3964. /** @hidden */
  3965. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  3966. }
  3967. }
  3968. declare module BABYLON.GUI {
  3969. /** Class used to create 2D ellipse containers */
  3970. export class Ellipse extends Container {
  3971. name?: string | undefined;
  3972. /** Gets or sets border thickness */
  3973. thickness: number;
  3974. /**
  3975. * Creates a new Ellipse
  3976. * @param name defines the control name
  3977. */
  3978. constructor(name?: string | undefined);
  3979. protected _getTypeName(): string;
  3980. protected _localDraw(context: CanvasRenderingContext2D): void;
  3981. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3982. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  3983. }
  3984. }
  3985. declare module BABYLON.GUI {
  3986. /**
  3987. * Class used to create a 2D grid container
  3988. */
  3989. export class Grid extends Container {
  3990. name?: string | undefined;
  3991. /** Gets the list of children */
  3992. readonly children: Control[];
  3993. /**
  3994. * Adds a new row to the grid
  3995. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  3996. * @param isPixel defines if the height is expressed in pixel (or in percentage)
  3997. * @returns the current grid
  3998. */
  3999. addRowDefinition(height: number, isPixel?: boolean): Grid;
  4000. /**
  4001. * Adds a new column to the grid
  4002. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  4003. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  4004. * @returns the current grid
  4005. */
  4006. addColumnDefinition(width: number, isPixel?: boolean): Grid;
  4007. /**
  4008. * Update a row definition
  4009. * @param index defines the index of the row to update
  4010. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  4011. * @param isPixel defines if the weight is expressed in pixel (or in percentage)
  4012. * @returns the current grid
  4013. */
  4014. setRowDefinition(index: number, height: number, isPixel?: boolean): Grid;
  4015. /**
  4016. * Update a column definition
  4017. * @param index defines the index of the column to update
  4018. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  4019. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  4020. * @returns the current grid
  4021. */
  4022. setColumnDefinition(index: number, width: number, isPixel?: boolean): Grid;
  4023. /**
  4024. * Remove a column definition at specified index
  4025. * @param index defines the index of the column to remove
  4026. * @returns the current grid
  4027. */
  4028. removeColumnDefinition(index: number): Grid;
  4029. /**
  4030. * Remove a row definition at specified index
  4031. * @param index defines the index of the row to remove
  4032. * @returns the current grid
  4033. */
  4034. removeRowDefinition(index: number): Grid;
  4035. /**
  4036. * Adds a new control to the current grid
  4037. * @param control defines the control to add
  4038. * @param row defines the row where to add the control (0 by default)
  4039. * @param column defines the column where to add the control (0 by default)
  4040. * @returns the current grid
  4041. */
  4042. addControl(control: Control, row?: number, column?: number): Grid;
  4043. /**
  4044. * Removes a control from the current container
  4045. * @param control defines the control to remove
  4046. * @returns the current container
  4047. */
  4048. removeControl(control: Control): Container;
  4049. /**
  4050. * Creates a new Grid
  4051. * @param name defines control name
  4052. */
  4053. constructor(name?: string | undefined);
  4054. protected _getTypeName(): string;
  4055. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4056. /** Releases associated resources */
  4057. dispose(): void;
  4058. }
  4059. }
  4060. declare module BABYLON.GUI {
  4061. /**
  4062. * Class used to create 2D images
  4063. */
  4064. export class Image extends Control {
  4065. name?: string | undefined;
  4066. /**
  4067. * Gets or sets the left coordinate in the source image
  4068. */
  4069. sourceLeft: number;
  4070. /**
  4071. * Gets or sets the top coordinate in the source image
  4072. */
  4073. sourceTop: number;
  4074. /**
  4075. * Gets or sets the width to capture in the source image
  4076. */
  4077. sourceWidth: number;
  4078. /**
  4079. * Gets or sets the height to capture in the source image
  4080. */
  4081. sourceHeight: number;
  4082. /**
  4083. * Gets or sets a boolean indicating if the image can force its container to adapt its size
  4084. * @see http://doc.babylonjs.com/how_to/gui#image
  4085. */
  4086. autoScale: boolean;
  4087. /** Gets or sets the streching mode used by the image */
  4088. stretch: number;
  4089. /**
  4090. * Gets or sets the internal DOM image used to render the control
  4091. */
  4092. domImage: HTMLImageElement;
  4093. /**
  4094. * Gets or sets image source url
  4095. */
  4096. source: BABYLON.Nullable<string>;
  4097. /**
  4098. * Gets or sets the cell width to use when animation sheet is enabled
  4099. * @see http://doc.babylonjs.com/how_to/gui#image
  4100. */
  4101. cellWidth: number;
  4102. /**
  4103. * Gets or sets the cell height to use when animation sheet is enabled
  4104. * @see http://doc.babylonjs.com/how_to/gui#image
  4105. */
  4106. cellHeight: number;
  4107. /**
  4108. * Gets or sets the cell id to use (this will turn on the animation sheet mode)
  4109. * @see http://doc.babylonjs.com/how_to/gui#image
  4110. */
  4111. cellId: number;
  4112. /**
  4113. * Creates a new Image
  4114. * @param name defines the control name
  4115. * @param url defines the image url
  4116. */
  4117. constructor(name?: string | undefined, url?: BABYLON.Nullable<string>);
  4118. protected _getTypeName(): string;
  4119. /** Force the control to synchronize with its content */
  4120. synchronizeSizeWithContent(): void;
  4121. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4122. /** STRETCH_NONE */
  4123. static readonly STRETCH_NONE: number;
  4124. /** STRETCH_FILL */
  4125. static readonly STRETCH_FILL: number;
  4126. /** STRETCH_UNIFORM */
  4127. static readonly STRETCH_UNIFORM: number;
  4128. /** STRETCH_EXTEND */
  4129. static readonly STRETCH_EXTEND: number;
  4130. }
  4131. }
  4132. declare module BABYLON.GUI {
  4133. /**
  4134. * Class used to create input text control
  4135. */
  4136. export class InputText extends Control implements IFocusableControl {
  4137. name?: string | undefined;
  4138. /** @hidden */
  4139. _connectedVirtualKeyboard: BABYLON.Nullable<VirtualKeyboard>;
  4140. /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
  4141. promptMessage: string;
  4142. /** BABYLON.Observable raised when the text changes */
  4143. onTextChangedObservable: BABYLON.Observable<InputText>;
  4144. /** BABYLON.Observable raised just before an entered character is to be added */
  4145. onBeforeKeyAddObservable: BABYLON.Observable<InputText>;
  4146. /** BABYLON.Observable raised when the control gets the focus */
  4147. onFocusObservable: BABYLON.Observable<InputText>;
  4148. /** BABYLON.Observable raised when the control loses the focus */
  4149. onBlurObservable: BABYLON.Observable<InputText>;
  4150. /** Gets or sets the maximum width allowed by the control */
  4151. maxWidth: string | number;
  4152. /** Gets the maximum width allowed by the control in pixels */
  4153. readonly maxWidthInPixels: number;
  4154. /** Gets or sets control margin */
  4155. margin: string;
  4156. /** Gets control margin in pixels */
  4157. readonly marginInPixels: number;
  4158. /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
  4159. autoStretchWidth: boolean;
  4160. /** Gets or sets border thickness */
  4161. thickness: number;
  4162. /** Gets or sets the background color when focused */
  4163. focusedBackground: string;
  4164. /** Gets or sets the background color */
  4165. background: string;
  4166. /** Gets or sets the placeholder color */
  4167. placeholderColor: string;
  4168. /** Gets or sets the text displayed when the control is empty */
  4169. placeholderText: string;
  4170. /** Gets or sets the dead key flag */
  4171. deadKey: boolean;
  4172. /** Gets or sets if the current key should be added */
  4173. addKey: boolean;
  4174. /** Gets or sets the value of the current key being entered */
  4175. currentKey: string;
  4176. /** Gets or sets the text displayed in the control */
  4177. text: string;
  4178. /** Gets or sets control width */
  4179. width: string | number;
  4180. /**
  4181. * Creates a new InputText
  4182. * @param name defines the control name
  4183. * @param text defines the text of the control
  4184. */
  4185. constructor(name?: string | undefined, text?: string);
  4186. /** @hidden */
  4187. onBlur(): void;
  4188. /** @hidden */
  4189. onFocus(): void;
  4190. protected _getTypeName(): string;
  4191. /**
  4192. * Function called to let the current focused control keeps the focus
  4193. * @param pointerId defines the unique id of the current pointer
  4194. * @returns a boolean indicating if the control wants to keep the focus
  4195. */
  4196. keepFocus(pointerId: number): boolean;
  4197. /** @hidden */
  4198. processKey(keyCode: number, key?: string): void;
  4199. /** @hidden */
  4200. processKeyboard(evt: KeyboardEvent): void;
  4201. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4202. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  4203. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  4204. protected _beforeRenderText(text: string): string;
  4205. dispose(): void;
  4206. }
  4207. }
  4208. declare module BABYLON.GUI {
  4209. /**
  4210. * Class used to create a password control
  4211. */
  4212. export class InputPassword extends InputText {
  4213. protected _beforeRenderText(text: string): string;
  4214. }
  4215. }
  4216. declare module BABYLON.GUI {
  4217. /** Class used to render 2D lines */
  4218. export class Line extends Control {
  4219. name?: string | undefined;
  4220. /** Gets or sets the dash pattern */
  4221. dash: Array<number>;
  4222. /** Gets or sets the control connected with the line end */
  4223. connectedControl: Control;
  4224. /** Gets or sets start coordinates on X axis */
  4225. x1: string | number;
  4226. /** Gets or sets start coordinates on Y axis */
  4227. y1: string | number;
  4228. /** Gets or sets end coordinates on X axis */
  4229. x2: string | number;
  4230. /** Gets or sets end coordinates on Y axis */
  4231. y2: string | number;
  4232. /** Gets or sets line width */
  4233. lineWidth: number;
  4234. /** Gets or sets horizontal alignment */
  4235. horizontalAlignment: number;
  4236. /** Gets or sets vertical alignment */
  4237. verticalAlignment: number;
  4238. /**
  4239. * Creates a new Line
  4240. * @param name defines the control name
  4241. */
  4242. constructor(name?: string | undefined);
  4243. protected _getTypeName(): string;
  4244. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4245. _measure(): void;
  4246. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4247. /**
  4248. * Move one end of the line given 3D cartesian coordinates.
  4249. * @param position Targeted world position
  4250. * @param scene BABYLON.Scene
  4251. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  4252. */
  4253. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene, end?: boolean): void;
  4254. /**
  4255. * Move one end of the line to a position in screen absolute space.
  4256. * @param projectedPosition Position in screen absolute space (X, Y)
  4257. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  4258. */
  4259. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3, end?: boolean): void;
  4260. }
  4261. }
  4262. declare module BABYLON.GUI {
  4263. /**
  4264. * Class used to create multi line control
  4265. */
  4266. export class MultiLine extends Control {
  4267. name?: string | undefined;
  4268. /**
  4269. * Creates a new MultiLine
  4270. * @param name defines the control name
  4271. */
  4272. constructor(name?: string | undefined);
  4273. /** Gets or sets dash pattern */
  4274. dash: Array<number>;
  4275. /**
  4276. * Gets point stored at specified index
  4277. * @param index defines the index to look for
  4278. * @returns the requested point if found
  4279. */
  4280. getAt(index: number): MultiLinePoint;
  4281. /** Function called when a point is updated */
  4282. onPointUpdate: () => void;
  4283. /**
  4284. * Adds new points to the point collection
  4285. * @param items defines the list of items (mesh, control or 2d coordiantes) to add
  4286. * @returns the list of created MultiLinePoint
  4287. */
  4288. add(...items: (AbstractMesh | Control | {
  4289. x: string | number;
  4290. y: string | number;
  4291. })[]): MultiLinePoint[];
  4292. /**
  4293. * Adds a new point to the point collection
  4294. * @param item defines the item (mesh, control or 2d coordiantes) to add
  4295. * @returns the created MultiLinePoint
  4296. */
  4297. push(item?: (AbstractMesh | Control | {
  4298. x: string | number;
  4299. y: string | number;
  4300. })): MultiLinePoint;
  4301. /**
  4302. * Remove a specific value or point from the active point collection
  4303. * @param value defines the value or point to remove
  4304. */
  4305. remove(value: number | MultiLinePoint): void;
  4306. /** Gets or sets line width */
  4307. lineWidth: number;
  4308. horizontalAlignment: number;
  4309. verticalAlignment: number;
  4310. protected _getTypeName(): string;
  4311. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4312. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4313. _measure(): void;
  4314. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4315. dispose(): void;
  4316. }
  4317. }
  4318. declare module BABYLON.GUI {
  4319. /**
  4320. * Class used to create radio button controls
  4321. */
  4322. export class RadioButton extends Control {
  4323. name?: string | undefined;
  4324. /** Gets or sets border thickness */
  4325. thickness: number;
  4326. /** Gets or sets group name */
  4327. group: string;
  4328. /** BABYLON.Observable raised when isChecked is changed */
  4329. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  4330. /** Gets or sets a value indicating the ratio between overall size and check size */
  4331. checkSizeRatio: number;
  4332. /** Gets or sets background color */
  4333. background: string;
  4334. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  4335. isChecked: boolean;
  4336. /**
  4337. * Creates a new RadioButton
  4338. * @param name defines the control name
  4339. */
  4340. constructor(name?: string | undefined);
  4341. protected _getTypeName(): string;
  4342. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4343. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  4344. /**
  4345. * Utility function to easily create a radio button with a header
  4346. * @param title defines the label to use for the header
  4347. * @param group defines the group to use for the radio button
  4348. * @param isChecked defines the initial state of the radio button
  4349. * @param onValueChanged defines the callback to call when value changes
  4350. * @returns a StackPanel containing the radio button and a textBlock
  4351. */
  4352. static AddRadioButtonWithHeader(title: string, group: string, isChecked: boolean, onValueChanged: (button: RadioButton, value: boolean) => void): StackPanel;
  4353. }
  4354. }
  4355. declare module BABYLON.GUI {
  4356. /**
  4357. * Class used to create a 2D stack panel container
  4358. */
  4359. export class StackPanel extends Container {
  4360. name?: string | undefined;
  4361. /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
  4362. isVertical: boolean;
  4363. /** Gets or sets panel width */
  4364. width: string | number;
  4365. /** Gets or sets panel height */
  4366. height: string | number;
  4367. /**
  4368. * Creates a new StackPanel
  4369. * @param name defines control name
  4370. */
  4371. constructor(name?: string | undefined);
  4372. protected _getTypeName(): string;
  4373. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4374. }
  4375. }
  4376. declare module BABYLON.GUI {
  4377. /** Class used to create a RadioGroup
  4378. * which contains groups of radio buttons
  4379. */
  4380. export class SelectorGroup {
  4381. /** name of SelectorGroup */
  4382. name: string;
  4383. /**
  4384. * Creates a new SelectorGroup
  4385. * @param name of group, used as a group heading
  4386. */
  4387. constructor(
  4388. /** name of SelectorGroup */
  4389. name: string);
  4390. /** Gets the groupPanel of the SelectorGroup */
  4391. readonly groupPanel: StackPanel;
  4392. /** Gets the selectors array */
  4393. readonly selectors: StackPanel[];
  4394. /** Gets and sets the group header */
  4395. header: string;
  4396. /** @hidden*/
  4397. _getSelector(selectorNb: number): StackPanel | undefined;
  4398. /** Removes the selector at the given position
  4399. * @param selectorNb the position of the selector within the group
  4400. */
  4401. removeSelector(selectorNb: number): void;
  4402. }
  4403. /** Class used to create a CheckboxGroup
  4404. * which contains groups of checkbox buttons
  4405. */
  4406. export class CheckboxGroup extends SelectorGroup {
  4407. /** Adds a checkbox as a control
  4408. * @param text is the label for the selector
  4409. * @param func is the function called when the Selector is checked
  4410. * @param checked is true when Selector is checked
  4411. */
  4412. addCheckbox(text: string, func?: (s: boolean) => void, checked?: boolean): void;
  4413. /** @hidden */
  4414. _setSelectorLabel(selectorNb: number, label: string): void;
  4415. /** @hidden */
  4416. _setSelectorLabelColor(selectorNb: number, color: string): void;
  4417. /** @hidden */
  4418. _setSelectorButtonColor(selectorNb: number, color: string): void;
  4419. /** @hidden */
  4420. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  4421. }
  4422. /** Class used to create a RadioGroup
  4423. * which contains groups of radio buttons
  4424. */
  4425. export class RadioGroup extends SelectorGroup {
  4426. /** Adds a radio button as a control
  4427. * @param label is the label for the selector
  4428. * @param func is the function called when the Selector is checked
  4429. * @param checked is true when Selector is checked
  4430. */
  4431. addRadio(label: string, func?: (n: number) => void, checked?: boolean): void;
  4432. /** @hidden */
  4433. _setSelectorLabel(selectorNb: number, label: string): void;
  4434. /** @hidden */
  4435. _setSelectorLabelColor(selectorNb: number, color: string): void;
  4436. /** @hidden */
  4437. _setSelectorButtonColor(selectorNb: number, color: string): void;
  4438. /** @hidden */
  4439. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  4440. }
  4441. /** Class used to create a SliderGroup
  4442. * which contains groups of slider buttons
  4443. */
  4444. export class SliderGroup extends SelectorGroup {
  4445. /**
  4446. * Adds a slider to the SelectorGroup
  4447. * @param label is the label for the SliderBar
  4448. * @param func is the function called when the Slider moves
  4449. * @param unit is a string describing the units used, eg degrees or metres
  4450. * @param min is the minimum value for the Slider
  4451. * @param max is the maximum value for the Slider
  4452. * @param value is the start value for the Slider between min and max
  4453. * @param onValueChange is the function used to format the value displayed, eg radians to degrees
  4454. */
  4455. addSlider(label: string, func?: (v: number) => void, unit?: string, min?: number, max?: number, value?: number, onValueChange?: (v: number) => number): void;
  4456. /** @hidden */
  4457. _setSelectorLabel(selectorNb: number, label: string): void;
  4458. /** @hidden */
  4459. _setSelectorLabelColor(selectorNb: number, color: string): void;
  4460. /** @hidden */
  4461. _setSelectorButtonColor(selectorNb: number, color: string): void;
  4462. /** @hidden */
  4463. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  4464. }
  4465. /** Class used to hold the controls for the checkboxes, radio buttons and sliders */
  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. }