babylon.gui.module.d.ts 347 KB

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