babylon.gui.module.d.ts 299 KB

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