babylon.gui.module.d.ts 298 KB

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