babylon.gui.module.d.ts 242 KB

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