babylon.gui.module.d.ts 223 KB

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