babylon.gui.module.d.ts 242 KB

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