babylon.gui.module.d.ts 275 KB

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