babylon.gui.module.d.ts 300 KB

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