babylon.gui.module.d.ts 279 KB

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