babylon.gui.module.d.ts 243 KB

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