babylon.gui.module.d.ts 301 KB

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