babylon.gui.module.d.ts 359 KB

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