babylon.gui.module.d.ts 348 KB

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