babylon.gui.module.d.ts 353 KB

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