babylon.gui.module.d.ts 299 KB

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