babylon.gui.module.d.ts 372 KB

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