babylon.gui.module.d.ts 380 KB

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