babylon.gui.module.d.ts 246 KB

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