babylon.gui.module.d.ts 216 KB

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