babylon.gui.module.d.ts 260 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750
  1. /*BabylonJS GUI*/
  2. // Dependencies for this module:
  3. // ../../../../Tools/Gulp/babylonjs
  4. declare module 'babylonjs-gui' {
  5. export * from "babylonjs-gui/2D";
  6. export * from "babylonjs-gui/3D";
  7. }
  8. declare module 'babylonjs-gui/2D' {
  9. export * from "babylonjs-gui/2D/controls";
  10. export * from "babylonjs-gui/2D/advancedDynamicTexture";
  11. export * from "babylonjs-gui/2D/math2D";
  12. export * from "babylonjs-gui/2D/measure";
  13. export * from "babylonjs-gui/2D/multiLinePoint";
  14. export * from "babylonjs-gui/2D/style";
  15. export * from "babylonjs-gui/2D/valueAndUnit";
  16. }
  17. declare module 'babylonjs-gui/3D' {
  18. export * from "babylonjs-gui/3D/controls";
  19. export * from "babylonjs-gui/3D/materials";
  20. export * from "babylonjs-gui/3D/gui3DManager";
  21. export * from "babylonjs-gui/3D/vector3WithInfo";
  22. }
  23. declare module 'babylonjs-gui/2D/controls' {
  24. export * from "babylonjs-gui/2D/controls/button";
  25. export * from "babylonjs-gui/2D/controls/checkbox";
  26. export * from "babylonjs-gui/2D/controls/colorpicker";
  27. export * from "babylonjs-gui/2D/controls/container";
  28. export * from "babylonjs-gui/2D/controls/control";
  29. export * from "babylonjs-gui/2D/controls/ellipse";
  30. export * from "babylonjs-gui/2D/controls/grid";
  31. export * from "babylonjs-gui/2D/controls/image";
  32. export * from "babylonjs-gui/2D/controls/inputText";
  33. export * from "babylonjs-gui/2D/controls/inputPassword";
  34. export * from "babylonjs-gui/2D/controls/line";
  35. export * from "babylonjs-gui/2D/controls/multiLine";
  36. export * from "babylonjs-gui/2D/controls/radioButton";
  37. export * from "babylonjs-gui/2D/controls/stackPanel";
  38. export * from "babylonjs-gui/2D/controls/selector";
  39. export * from "babylonjs-gui/2D/controls/textBlock";
  40. export * from "babylonjs-gui/2D/controls/virtualKeyboard";
  41. export * from "babylonjs-gui/2D/controls/rectangle";
  42. export * from "babylonjs-gui/2D/controls/displayGrid";
  43. export * from "babylonjs-gui/2D/controls/baseSlider";
  44. export * from "babylonjs-gui/2D/controls/slider";
  45. export * from "babylonjs-gui/2D/controls/imageBasedSlider";
  46. export * from "babylonjs-gui/2D/controls/statics";
  47. }
  48. declare module 'babylonjs-gui/2D/advancedDynamicTexture' {
  49. import { DynamicTexture, Nullable, Layer, Viewport, Scene, Vector3, Matrix, Vector2, AbstractMesh, Observable, ClipboardInfo } from 'babylonjs';
  50. import { Container } from "babylonjs-gui/2D/controls/container";
  51. import { Control } from "babylonjs-gui/2D/controls/control";
  52. import { Style } from "babylonjs-gui/2D/style";
  53. /**
  54. * Interface used to define a control that can receive focus
  55. */
  56. export interface IFocusableControl {
  57. /**
  58. * Function called when the control receives the focus
  59. */
  60. onFocus(): void;
  61. /**
  62. * Function called when the control loses the focus
  63. */
  64. onBlur(): void;
  65. /**
  66. * Function called to let the control handle keyboard events
  67. * @param evt defines the current keyboard event
  68. */
  69. processKeyboard(evt: KeyboardEvent): void;
  70. /**
  71. * Function called to get the list of controls that should not steal the focus from this control
  72. * @returns an array of controls
  73. */
  74. keepsFocusWith(): Nullable<Control[]>;
  75. }
  76. /**
  77. * Class used to create texture to support 2D GUI elements
  78. * @see http://doc.babylonjs.com/how_to/gui
  79. */
  80. export class AdvancedDynamicTexture extends DynamicTexture {
  81. /** @hidden */
  82. _rootContainer: Container;
  83. /** @hidden */
  84. _lastPickedControl: Control;
  85. /** @hidden */
  86. _lastControlOver: {
  87. [pointerId: number]: Control;
  88. };
  89. /** @hidden */
  90. _lastControlDown: {
  91. [pointerId: number]: Control;
  92. };
  93. /** @hidden */
  94. _capturingControl: {
  95. [pointerId: number]: Control;
  96. };
  97. /** @hidden */
  98. _shouldBlockPointer: boolean;
  99. /** @hidden */
  100. _layerToDispose: Nullable<Layer>;
  101. /** @hidden */
  102. _linkedControls: Control[];
  103. /**
  104. * Observable event triggered each time an clipboard event is received from the rendering canvas
  105. */
  106. onClipboardObservable: Observable<ClipboardInfo>;
  107. /**
  108. * Gets or sets a boolean defining if alpha is stored as premultiplied
  109. */
  110. premulAlpha: boolean;
  111. /**
  112. * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
  113. * Useful when you want more antialiasing
  114. */
  115. renderScale: number;
  116. /** Gets or sets the background color */
  117. background: string;
  118. /**
  119. * Gets or sets the ideal width used to design controls.
  120. * The GUI will then rescale everything accordingly
  121. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  122. */
  123. idealWidth: number;
  124. /**
  125. * Gets or sets the ideal height used to design controls.
  126. * The GUI will then rescale everything accordingly
  127. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  128. */
  129. idealHeight: number;
  130. /**
  131. * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
  132. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  133. */
  134. useSmallestIdeal: boolean;
  135. /**
  136. * Gets or sets a boolean indicating if adaptive scaling must be used
  137. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  138. */
  139. renderAtIdealSize: boolean;
  140. /**
  141. * Gets the underlying layer used to render the texture when in fullscreen mode
  142. */
  143. readonly layer: Nullable<Layer>;
  144. /**
  145. * Gets the root container control
  146. */
  147. readonly rootContainer: Container;
  148. /**
  149. * Gets or sets the current focused control
  150. */
  151. focusedControl: Nullable<IFocusableControl>;
  152. /**
  153. * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
  154. */
  155. isForeground: boolean;
  156. /**
  157. * Gets or set information about clipboardData
  158. */
  159. clipboardData: string;
  160. /**
  161. * Creates a new AdvancedDynamicTexture
  162. * @param name defines the name of the texture
  163. * @param width defines the width of the texture
  164. * @param height defines the height of the texture
  165. * @param scene defines the hosting scene
  166. * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
  167. * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
  168. */
  169. constructor(name: string, width: number | undefined, height: number | undefined, scene: Nullable<Scene>, generateMipMaps?: boolean, samplingMode?: number);
  170. /**
  171. * Function used to execute a function on all controls
  172. * @param func defines the function to execute
  173. * @param container defines the container where controls belong. If null the root container will be used
  174. */
  175. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  176. /**
  177. * Marks the texture as dirty forcing a complete update
  178. */
  179. markAsDirty(): void;
  180. /**
  181. * Helper function used to create a new style
  182. * @returns a new style
  183. * @see http://doc.babylonjs.com/how_to/gui#styles
  184. */
  185. createStyle(): Style;
  186. /**
  187. * Adds a new control to the root container
  188. * @param control defines the control to add
  189. * @returns the current texture
  190. */
  191. addControl(control: Control): AdvancedDynamicTexture;
  192. /**
  193. * Removes a control from the root container
  194. * @param control defines the control to remove
  195. * @returns the current texture
  196. */
  197. removeControl(control: Control): AdvancedDynamicTexture;
  198. /**
  199. * Release all resources
  200. */
  201. dispose(): void;
  202. /** @hidden */
  203. _getGlobalViewport(scene: Scene): Viewport;
  204. /**
  205. * Get screen coordinates for a vector3
  206. * @param position defines the position to project
  207. * @param worldMatrix defines the world matrix to use
  208. * @returns the projected position
  209. */
  210. getProjectedPosition(position: Vector3, worldMatrix: Matrix): Vector2;
  211. /** @hidden */
  212. _changeCursor(cursor: string): void;
  213. /** @hidden */
  214. _cleanControlAfterRemovalFromList(list: {
  215. [pointerId: number]: Control;
  216. }, control: Control): void;
  217. /** @hidden */
  218. _cleanControlAfterRemoval(control: Control): void;
  219. /** Attach to all scene events required to support pointer events */
  220. attach(): void;
  221. /**
  222. * Register the clipboard Events onto the canvas
  223. */
  224. registerClipboardEvents(): void;
  225. /**
  226. * Unregister the clipboard Events from the canvas
  227. */
  228. unRegisterClipboardEvents(): void;
  229. /**
  230. * Connect the texture to a hosting mesh to enable interactions
  231. * @param mesh defines the mesh to attach to
  232. * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
  233. */
  234. attachToMesh(mesh: AbstractMesh, supportPointerMove?: boolean): void;
  235. /**
  236. * Move the focus to a specific control
  237. * @param control defines the control which will receive the focus
  238. */
  239. moveFocusToControl(control: IFocusableControl): void;
  240. /**
  241. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
  242. * @param mesh defines the mesh which will receive the texture
  243. * @param width defines the texture width (1024 by default)
  244. * @param height defines the texture height (1024 by default)
  245. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  246. * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)
  247. * @returns a new AdvancedDynamicTexture
  248. */
  249. static CreateForMesh(mesh: AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, onlyAlphaTesting?: boolean): AdvancedDynamicTexture;
  250. /**
  251. * Creates a new AdvancedDynamicTexture in fullscreen mode.
  252. * In this mode the texture will rely on a layer for its rendering.
  253. * This allows it to be treated like any other layer.
  254. * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
  255. * LayerMask is set through advancedTexture.layer.layerMask
  256. * @param name defines name for the texture
  257. * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
  258. * @param scene defines the hsoting scene
  259. * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
  260. * @returns a new AdvancedDynamicTexture
  261. */
  262. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>, sampling?: number): AdvancedDynamicTexture;
  263. }
  264. }
  265. declare module 'babylonjs-gui/2D/math2D' {
  266. import { Vector2, Nullable } from "babylonjs";
  267. /**
  268. * Class used to transport Vector2 information for pointer events
  269. */
  270. export class Vector2WithInfo extends Vector2 {
  271. /** defines the current mouse button index */
  272. buttonIndex: number;
  273. /**
  274. * Creates a new Vector2WithInfo
  275. * @param source defines the vector2 data to transport
  276. * @param buttonIndex defines the current mouse button index
  277. */
  278. constructor(source: Vector2,
  279. /** defines the current mouse button index */
  280. buttonIndex?: number);
  281. }
  282. /** Class used to provide 2D matrix features */
  283. export class Matrix2D {
  284. /** Gets the internal array of 6 floats used to store matrix data */
  285. m: Float32Array;
  286. /**
  287. * Creates a new matrix
  288. * @param m00 defines value for (0, 0)
  289. * @param m01 defines value for (0, 1)
  290. * @param m10 defines value for (1, 0)
  291. * @param m11 defines value for (1, 1)
  292. * @param m20 defines value for (2, 0)
  293. * @param m21 defines value for (2, 1)
  294. */
  295. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  296. /**
  297. * Fills the matrix from direct values
  298. * @param m00 defines value for (0, 0)
  299. * @param m01 defines value for (0, 1)
  300. * @param m10 defines value for (1, 0)
  301. * @param m11 defines value for (1, 1)
  302. * @param m20 defines value for (2, 0)
  303. * @param m21 defines value for (2, 1)
  304. * @returns the current modified matrix
  305. */
  306. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  307. /**
  308. * Gets matrix determinant
  309. * @returns the determinant
  310. */
  311. determinant(): number;
  312. /**
  313. * Inverses the matrix and stores it in a target matrix
  314. * @param result defines the target matrix
  315. * @returns the current matrix
  316. */
  317. invertToRef(result: Matrix2D): Matrix2D;
  318. /**
  319. * Multiplies the current matrix with another one
  320. * @param other defines the second operand
  321. * @param result defines the target matrix
  322. * @returns the current matrix
  323. */
  324. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  325. /**
  326. * Applies the current matrix to a set of 2 floats and stores the result in a vector2
  327. * @param x defines the x coordinate to transform
  328. * @param y defines the x coordinate to transform
  329. * @param result defines the target vector2
  330. * @returns the current matrix
  331. */
  332. transformCoordinates(x: number, y: number, result: Vector2): Matrix2D;
  333. /**
  334. * Creates an identity matrix
  335. * @returns a new matrix
  336. */
  337. static Identity(): Matrix2D;
  338. /**
  339. * Creates a translation matrix and stores it in a target matrix
  340. * @param x defines the x coordinate of the translation
  341. * @param y defines the y coordinate of the translation
  342. * @param result defines the target matrix
  343. */
  344. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  345. /**
  346. * Creates a scaling matrix and stores it in a target matrix
  347. * @param x defines the x coordinate of the scaling
  348. * @param y defines the y coordinate of the scaling
  349. * @param result defines the target matrix
  350. */
  351. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  352. /**
  353. * Creates a rotation matrix and stores it in a target matrix
  354. * @param angle defines the rotation angle
  355. * @param result defines the target matrix
  356. */
  357. static RotationToRef(angle: number, result: Matrix2D): void;
  358. /**
  359. * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
  360. * @param tx defines the x coordinate of the translation
  361. * @param ty defines the y coordinate of the translation
  362. * @param angle defines the rotation angle
  363. * @param scaleX defines the x coordinate of the scaling
  364. * @param scaleY defines the y coordinate of the scaling
  365. * @param parentMatrix defines the parent matrix to multiply by (can be null)
  366. * @param result defines the target matrix
  367. */
  368. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: Nullable<Matrix2D>, result: Matrix2D): void;
  369. }
  370. }
  371. declare module 'babylonjs-gui/2D/measure' {
  372. /**
  373. * Class used to store 2D control sizes
  374. */
  375. export class Measure {
  376. /** defines left coordinate */
  377. left: number;
  378. /** defines top coordinate */
  379. top: number;
  380. /** defines width dimension */
  381. width: number;
  382. /** defines height dimension */
  383. height: number;
  384. /**
  385. * Creates a new measure
  386. * @param left defines left coordinate
  387. * @param top defines top coordinate
  388. * @param width defines width dimension
  389. * @param height defines height dimension
  390. */
  391. constructor(
  392. /** defines left coordinate */
  393. left: number,
  394. /** defines top coordinate */
  395. top: number,
  396. /** defines width dimension */
  397. width: number,
  398. /** defines height dimension */
  399. height: number);
  400. /**
  401. * Copy from another measure
  402. * @param other defines the other measure to copy from
  403. */
  404. copyFrom(other: Measure): void;
  405. /**
  406. * Copy from a group of 4 floats
  407. * @param left defines left coordinate
  408. * @param top defines top coordinate
  409. * @param width defines width dimension
  410. * @param height defines height dimension
  411. */
  412. copyFromFloats(left: number, top: number, width: number, height: number): void;
  413. /**
  414. * Check equality between this measure and another one
  415. * @param other defines the other measures
  416. * @returns true if both measures are equals
  417. */
  418. isEqualsTo(other: Measure): boolean;
  419. /**
  420. * Creates an empty measure
  421. * @returns a new measure
  422. */
  423. static Empty(): Measure;
  424. }
  425. }
  426. declare module 'babylonjs-gui/2D/multiLinePoint' {
  427. import { MultiLine } from "babylonjs-gui/2D/controls/multiLine";
  428. import { Control } from "babylonjs-gui/2D/controls/control";
  429. import { AbstractMesh, Nullable, Vector2 } from "babylonjs";
  430. /**
  431. * Class used to store a point for a MultiLine object.
  432. * The point can be pure 2D coordinates, a mesh or a control
  433. */
  434. export class MultiLinePoint {
  435. /** @hidden */
  436. _point: Vector2;
  437. /**
  438. * Creates a new MultiLinePoint
  439. * @param multiLine defines the source MultiLine object
  440. */
  441. constructor(multiLine: MultiLine);
  442. /** Gets or sets x coordinate */
  443. x: string | number;
  444. /** Gets or sets y coordinate */
  445. y: string | number;
  446. /** Gets or sets the control associated with this point */
  447. control: Nullable<Control>;
  448. /** Gets or sets the mesh associated with this point */
  449. mesh: Nullable<AbstractMesh>;
  450. /** Resets links */
  451. resetLinks(): void;
  452. /**
  453. * Gets a translation vector
  454. * @returns the translation vector
  455. */
  456. translate(): Vector2;
  457. /** Release associated resources */
  458. dispose(): void;
  459. }
  460. }
  461. declare module 'babylonjs-gui/2D/style' {
  462. import { IDisposable, Observable } from "babylonjs";
  463. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  464. import { ValueAndUnit } from "babylonjs-gui/2D/valueAndUnit";
  465. /**
  466. * Define a style used by control to automatically setup properties based on a template.
  467. * Only support font related properties so far
  468. */
  469. export class Style implements IDisposable {
  470. /** @hidden */
  471. _host: AdvancedDynamicTexture;
  472. /** @hidden */
  473. _fontSize: ValueAndUnit;
  474. /**
  475. * Observable raised when the style values are changed
  476. */
  477. onChangedObservable: Observable<Style>;
  478. /**
  479. * Creates a new style object
  480. * @param host defines the AdvancedDynamicTexture which hosts this style
  481. */
  482. constructor(host: AdvancedDynamicTexture);
  483. /**
  484. * Gets or sets the font size
  485. */
  486. fontSize: string | number;
  487. /**
  488. * Gets or sets the font family
  489. */
  490. fontFamily: string;
  491. /**
  492. * Gets or sets the font style
  493. */
  494. fontStyle: string;
  495. /** Gets or sets font weight */
  496. fontWeight: string;
  497. /** Dispose all associated resources */
  498. dispose(): void;
  499. }
  500. }
  501. declare module 'babylonjs-gui/2D/valueAndUnit' {
  502. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  503. /**
  504. * Class used to specific a value and its associated unit
  505. */
  506. export class ValueAndUnit {
  507. /** defines the unit to store */
  508. unit: number;
  509. /** defines a boolean indicating if the value can be negative */
  510. negativeValueAllowed: boolean;
  511. /**
  512. * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
  513. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  514. */
  515. ignoreAdaptiveScaling: boolean;
  516. /**
  517. * Creates a new ValueAndUnit
  518. * @param value defines the value to store
  519. * @param unit defines the unit to store
  520. * @param negativeValueAllowed defines a boolean indicating if the value can be negative
  521. */
  522. constructor(value: number,
  523. /** defines the unit to store */
  524. unit?: number,
  525. /** defines a boolean indicating if the value can be negative */
  526. negativeValueAllowed?: boolean);
  527. /** Gets a boolean indicating if the value is a percentage */
  528. readonly isPercentage: boolean;
  529. /** Gets a boolean indicating if the value is store as pixel */
  530. readonly isPixel: boolean;
  531. /** Gets direct internal value */
  532. readonly internalValue: number;
  533. /**
  534. * Gets value as pixel
  535. * @param host defines the root host
  536. * @param refValue defines the reference value for percentages
  537. * @returns the value as pixel
  538. */
  539. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  540. /**
  541. * Gets the value accordingly to its unit
  542. * @param host defines the root host
  543. * @returns the value
  544. */
  545. getValue(host: AdvancedDynamicTexture): number;
  546. /**
  547. * Gets a string representation of the value
  548. * @param host defines the root host
  549. * @returns a string
  550. */
  551. toString(host: AdvancedDynamicTexture): string;
  552. /**
  553. * Store a value parsed from a string
  554. * @param source defines the source string
  555. * @returns true if the value was successfully parsed
  556. */
  557. fromString(source: string | number): boolean;
  558. /** UNITMODE_PERCENTAGE */
  559. static readonly UNITMODE_PERCENTAGE: number;
  560. /** UNITMODE_PIXEL */
  561. static readonly UNITMODE_PIXEL: number;
  562. }
  563. }
  564. declare module 'babylonjs-gui/3D/controls' {
  565. export * from "babylonjs-gui/3D/controls/abstractButton3D";
  566. export * from "babylonjs-gui/3D/controls/button3D";
  567. export * from "babylonjs-gui/3D/controls/container3D";
  568. export * from "babylonjs-gui/3D/controls/control3D";
  569. export * from "babylonjs-gui/3D/controls/cylinderPanel";
  570. export * from "babylonjs-gui/3D/controls/holographicButton";
  571. export * from "babylonjs-gui/3D/controls/meshButton3D";
  572. export * from "babylonjs-gui/3D/controls/planePanel";
  573. export * from "babylonjs-gui/3D/controls/scatterPanel";
  574. export * from "babylonjs-gui/3D/controls/spherePanel";
  575. export * from "babylonjs-gui/3D/controls/stackPanel3D";
  576. export * from "babylonjs-gui/3D/controls/volumeBasedPanel";
  577. }
  578. declare module 'babylonjs-gui/3D/materials' {
  579. export * from "babylonjs-gui/3D/materials/fluentMaterial";
  580. }
  581. declare module 'babylonjs-gui/3D/gui3DManager' {
  582. import { IDisposable, Scene, Nullable, UtilityLayerRenderer, Observable, Vector3, Material } from "babylonjs";
  583. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  584. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  585. /**
  586. * Class used to manage 3D user interface
  587. * @see http://doc.babylonjs.com/how_to/gui3d
  588. */
  589. export class GUI3DManager implements IDisposable {
  590. /** @hidden */
  591. _lastPickedControl: Control3D;
  592. /** @hidden */
  593. _lastControlOver: {
  594. [pointerId: number]: Control3D;
  595. };
  596. /** @hidden */
  597. _lastControlDown: {
  598. [pointerId: number]: Control3D;
  599. };
  600. /**
  601. * Observable raised when the point picked by the pointer events changed
  602. */
  603. onPickedPointChangedObservable: Observable<Nullable<Vector3>>;
  604. /** @hidden */
  605. _sharedMaterials: {
  606. [key: string]: Material;
  607. };
  608. /** Gets the hosting scene */
  609. readonly scene: Scene;
  610. /** Gets associated utility layer */
  611. readonly utilityLayer: Nullable<UtilityLayerRenderer>;
  612. /**
  613. * Creates a new GUI3DManager
  614. * @param scene
  615. */
  616. constructor(scene?: Scene);
  617. /**
  618. * Gets the root container
  619. */
  620. readonly rootContainer: Container3D;
  621. /**
  622. * Gets a boolean indicating if the given control is in the root child list
  623. * @param control defines the control to check
  624. * @returns true if the control is in the root child list
  625. */
  626. containsControl(control: Control3D): boolean;
  627. /**
  628. * Adds a control to the root child list
  629. * @param control defines the control to add
  630. * @returns the current manager
  631. */
  632. addControl(control: Control3D): GUI3DManager;
  633. /**
  634. * Removes a control from the root child list
  635. * @param control defines the control to remove
  636. * @returns the current container
  637. */
  638. removeControl(control: Control3D): GUI3DManager;
  639. /**
  640. * Releases all associated resources
  641. */
  642. dispose(): void;
  643. }
  644. }
  645. declare module 'babylonjs-gui/3D/vector3WithInfo' {
  646. import { Vector3 } from "babylonjs";
  647. /**
  648. * Class used to transport Vector3 information for pointer events
  649. */
  650. export class Vector3WithInfo extends Vector3 {
  651. /** defines the current mouse button index */
  652. buttonIndex: number;
  653. /**
  654. * Creates a new Vector3WithInfo
  655. * @param source defines the vector3 data to transport
  656. * @param buttonIndex defines the current mouse button index
  657. */
  658. constructor(source: Vector3,
  659. /** defines the current mouse button index */
  660. buttonIndex?: number);
  661. }
  662. }
  663. declare module 'babylonjs-gui/2D/controls/button' {
  664. import { Rectangle } from "babylonjs-gui/2D/controls/rectangle";
  665. import { Control } from "babylonjs-gui/2D/controls/control";
  666. import { TextBlock } from "babylonjs-gui/2D/controls/textBlock";
  667. import { Image } from "babylonjs-gui/2D/controls/image";
  668. import { Vector2, Nullable } from "babylonjs";
  669. /**
  670. * Class used to create 2D buttons
  671. */
  672. export class Button extends Rectangle {
  673. name?: string | undefined;
  674. /**
  675. * Function called to generate a pointer enter animation
  676. */
  677. pointerEnterAnimation: () => void;
  678. /**
  679. * Function called to generate a pointer out animation
  680. */
  681. pointerOutAnimation: () => void;
  682. /**
  683. * Function called to generate a pointer down animation
  684. */
  685. pointerDownAnimation: () => void;
  686. /**
  687. * Function called to generate a pointer up animation
  688. */
  689. pointerUpAnimation: () => void;
  690. /**
  691. * Returns the image part of the button (if any)
  692. */
  693. readonly image: Nullable<Image>;
  694. /**
  695. * Returns the image part of the button (if any)
  696. */
  697. readonly textBlock: Nullable<TextBlock>;
  698. /**
  699. * Creates a new Button
  700. * @param name defines the name of the button
  701. */
  702. constructor(name?: string | undefined);
  703. protected _getTypeName(): string;
  704. /** @hidden */
  705. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  706. /** @hidden */
  707. _onPointerEnter(target: Control): boolean;
  708. /** @hidden */
  709. _onPointerOut(target: Control): void;
  710. /** @hidden */
  711. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  712. /** @hidden */
  713. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  714. /**
  715. * Creates a new button made with an image and a text
  716. * @param name defines the name of the button
  717. * @param text defines the text of the button
  718. * @param imageUrl defines the url of the image
  719. * @returns a new Button
  720. */
  721. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  722. /**
  723. * Creates a new button made with an image
  724. * @param name defines the name of the button
  725. * @param imageUrl defines the url of the image
  726. * @returns a new Button
  727. */
  728. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  729. /**
  730. * Creates a new button made with a text
  731. * @param name defines the name of the button
  732. * @param text defines the text of the button
  733. * @returns a new Button
  734. */
  735. static CreateSimpleButton(name: string, text: string): Button;
  736. /**
  737. * Creates a new button made with an image and a centered text
  738. * @param name defines the name of the button
  739. * @param text defines the text of the button
  740. * @param imageUrl defines the url of the image
  741. * @returns a new Button
  742. */
  743. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  744. }
  745. }
  746. declare module 'babylonjs-gui/2D/controls/checkbox' {
  747. import { Control } from "babylonjs-gui/2D/controls/control";
  748. import { Measure } from "babylonjs-gui/2D/measure";
  749. import { Observable, Vector2 } from "babylonjs";
  750. import { StackPanel } from "babylonjs-gui/2D/controls/stackPanel";
  751. /**
  752. * Class used to represent a 2D checkbox
  753. */
  754. export class Checkbox extends Control {
  755. name?: string | undefined;
  756. /** Gets or sets border thickness */
  757. thickness: number;
  758. /**
  759. * Observable raised when isChecked property changes
  760. */
  761. onIsCheckedChangedObservable: Observable<boolean>;
  762. /** Gets or sets a value indicating the ratio between overall size and check size */
  763. checkSizeRatio: number;
  764. /** Gets or sets background color */
  765. background: string;
  766. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  767. isChecked: boolean;
  768. /**
  769. * Creates a new CheckBox
  770. * @param name defines the control name
  771. */
  772. constructor(name?: string | undefined);
  773. protected _getTypeName(): string;
  774. /** @hidden */
  775. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  776. /** @hidden */
  777. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  778. /**
  779. * Utility function to easily create a checkbox with a header
  780. * @param title defines the label to use for the header
  781. * @param onValueChanged defines the callback to call when value changes
  782. * @returns a StackPanel containing the checkbox and a textBlock
  783. */
  784. static AddCheckBoxWithHeader(title: string, onValueChanged: (value: boolean) => void): StackPanel;
  785. }
  786. }
  787. declare module 'babylonjs-gui/2D/controls/colorpicker' {
  788. import { Control } from "babylonjs-gui/2D/controls/control";
  789. import { Color3, Observable, Vector2 } from "babylonjs";
  790. import { Measure } from "babylonjs-gui/2D/measure";
  791. /** Class used to create color pickers */
  792. export class ColorPicker extends Control {
  793. name?: string | undefined;
  794. /**
  795. * Observable raised when the value changes
  796. */
  797. onValueChangedObservable: Observable<Color3>;
  798. /** Gets or sets the color of the color picker */
  799. value: Color3;
  800. /** Gets or sets control width */
  801. width: string | number;
  802. /** Gets or sets control height */
  803. height: string | number;
  804. /** Gets or sets control size */
  805. size: string | number;
  806. /**
  807. * Creates a new ColorPicker
  808. * @param name defines the control name
  809. */
  810. constructor(name?: string | undefined);
  811. protected _getTypeName(): string;
  812. /** @hidden */
  813. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  814. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  815. _onPointerMove(target: Control, coordinates: Vector2): void;
  816. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  817. }
  818. }
  819. declare module 'babylonjs-gui/2D/controls/container' {
  820. import { Control } from "babylonjs-gui/2D/controls/control";
  821. import { Measure } from "babylonjs-gui/2D/measure";
  822. import { Nullable } from "babylonjs";
  823. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  824. /**
  825. * Root class for 2D containers
  826. * @see http://doc.babylonjs.com/how_to/gui#containers
  827. */
  828. export class Container extends Control {
  829. name?: string | undefined;
  830. /** @hidden */
  831. protected _children: Control[];
  832. /** @hidden */
  833. protected _measureForChildren: Measure;
  834. /** @hidden */
  835. protected _background: string;
  836. /** @hidden */
  837. protected _adaptWidthToChildren: boolean;
  838. /** @hidden */
  839. protected _adaptHeightToChildren: boolean;
  840. /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
  841. adaptHeightToChildren: boolean;
  842. /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
  843. adaptWidthToChildren: boolean;
  844. /** Gets or sets background color */
  845. background: string;
  846. /** Gets the list of children */
  847. readonly children: Control[];
  848. /**
  849. * Creates a new Container
  850. * @param name defines the name of the container
  851. */
  852. constructor(name?: string | undefined);
  853. protected _getTypeName(): string;
  854. _flagDescendantsAsMatrixDirty(): void;
  855. /**
  856. * Gets a child using its name
  857. * @param name defines the child name to look for
  858. * @returns the child control if found
  859. */
  860. getChildByName(name: string): Nullable<Control>;
  861. /**
  862. * Gets a child using its type and its name
  863. * @param name defines the child name to look for
  864. * @param type defines the child type to look for
  865. * @returns the child control if found
  866. */
  867. getChildByType(name: string, type: string): Nullable<Control>;
  868. /**
  869. * Search for a specific control in children
  870. * @param control defines the control to look for
  871. * @returns true if the control is in child list
  872. */
  873. containsControl(control: Control): boolean;
  874. /**
  875. * Adds a new control to the current container
  876. * @param control defines the control to add
  877. * @returns the current container
  878. */
  879. addControl(control: Nullable<Control>): Container;
  880. /**
  881. * Removes all controls from the current container
  882. * @returns the current container
  883. */
  884. clearControls(): Container;
  885. /**
  886. * Removes a control from the current container
  887. * @param control defines the control to remove
  888. * @returns the current container
  889. */
  890. removeControl(control: Control): Container;
  891. /** @hidden */
  892. _reOrderControl(control: Control): void;
  893. /** @hidden */
  894. _markAllAsDirty(): void;
  895. /** @hidden */
  896. protected _localDraw(context: CanvasRenderingContext2D): void;
  897. /** @hidden */
  898. _link(root: Nullable<Container>, host: AdvancedDynamicTexture): void;
  899. /** @hidden */
  900. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  901. /** @hidden */
  902. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  903. /** @hidden */
  904. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  905. /** @hidden */
  906. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  907. /** Releases associated resources */
  908. dispose(): void;
  909. }
  910. }
  911. declare module 'babylonjs-gui/2D/controls/control' {
  912. import { Container } from "babylonjs-gui/2D/controls/container";
  913. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  914. import { ValueAndUnit } from "babylonjs-gui/2D/valueAndUnit";
  915. import { Nullable, Vector2, AbstractMesh, Observable, Vector3, Scene } from "babylonjs";
  916. import { Measure } from "babylonjs-gui/2D/measure";
  917. import { Style } from "babylonjs-gui/2D/style";
  918. import { Matrix2D, Vector2WithInfo } from "babylonjs-gui/2D/math2D";
  919. /**
  920. * Root class used for all 2D controls
  921. * @see http://doc.babylonjs.com/how_to/gui#controls
  922. */
  923. export class Control {
  924. /** defines the name of the control */
  925. name?: string | undefined;
  926. /**
  927. * Gets or sets a boolean indicating if alpha must be an inherited value (false by default)
  928. */
  929. static AllowAlphaInheritance: boolean;
  930. /** @hidden */
  931. _root: Nullable<Container>;
  932. /** @hidden */
  933. _host: AdvancedDynamicTexture;
  934. /** Gets or sets the control parent */
  935. parent: Nullable<Container>;
  936. /** @hidden */
  937. _currentMeasure: Measure;
  938. /** @hidden */
  939. _width: ValueAndUnit;
  940. /** @hidden */
  941. _height: ValueAndUnit;
  942. /** @hidden */
  943. protected _fontOffset: {
  944. ascent: number;
  945. height: number;
  946. descent: number;
  947. };
  948. /** @hidden */
  949. protected _horizontalAlignment: number;
  950. /** @hidden */
  951. protected _verticalAlignment: number;
  952. /** @hidden */
  953. _tempParentMeasure: Measure;
  954. /** @hidden */
  955. protected _cachedParentMeasure: Measure;
  956. /** @hidden */
  957. _left: ValueAndUnit;
  958. /** @hidden */
  959. _top: ValueAndUnit;
  960. /** @hidden */
  961. protected _invertTransformMatrix: Matrix2D;
  962. /** @hidden */
  963. protected _transformedPosition: Vector2;
  964. /** @hidden */
  965. _linkedMesh: Nullable<AbstractMesh>;
  966. protected _isEnabled: boolean;
  967. protected _disabledColor: string;
  968. /** @hidden */
  969. _tag: any;
  970. /** Gets or sets a boolean indicating if the control can be hit with pointer events */
  971. isHitTestVisible: boolean;
  972. /** Gets or sets a boolean indicating if the control can block pointer events */
  973. isPointerBlocker: boolean;
  974. /** Gets or sets a boolean indicating if the control can be focusable */
  975. isFocusInvisible: boolean;
  976. /** Gets or sets a boolean indicating if the children are clipped to the current control bounds */
  977. clipChildren: boolean;
  978. /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
  979. shadowOffsetX: number;
  980. /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
  981. shadowOffsetY: number;
  982. /** Gets or sets a value indicating the amount of blur to use to render the shadow */
  983. shadowBlur: number;
  984. /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
  985. shadowColor: string;
  986. /** Gets or sets the cursor to use when the control is hovered */
  987. hoverCursor: string;
  988. /** @hidden */
  989. protected _linkOffsetX: ValueAndUnit;
  990. /** @hidden */
  991. protected _linkOffsetY: ValueAndUnit;
  992. /** Gets the control type name */
  993. readonly typeName: string;
  994. /**
  995. * An event triggered when the pointer move over the control.
  996. */
  997. onPointerMoveObservable: Observable<Vector2>;
  998. /**
  999. * An event triggered when the pointer move out of the control.
  1000. */
  1001. onPointerOutObservable: Observable<Control>;
  1002. /**
  1003. * An event triggered when the pointer taps the control
  1004. */
  1005. onPointerDownObservable: Observable<Vector2WithInfo>;
  1006. /**
  1007. * An event triggered when pointer up
  1008. */
  1009. onPointerUpObservable: Observable<Vector2WithInfo>;
  1010. /**
  1011. * An event triggered when a control is clicked on
  1012. */
  1013. onPointerClickObservable: Observable<Vector2WithInfo>;
  1014. /**
  1015. * An event triggered when pointer enters the control
  1016. */
  1017. onPointerEnterObservable: Observable<Control>;
  1018. /**
  1019. * An event triggered when the control is marked as dirty
  1020. */
  1021. onDirtyObservable: Observable<Control>;
  1022. /**
  1023. * An event triggered before drawing the control
  1024. */
  1025. onBeforeDrawObservable: Observable<Control>;
  1026. /**
  1027. * An event triggered after the control was drawn
  1028. */
  1029. onAfterDrawObservable: Observable<Control>;
  1030. /** Gets or set information about font offsets (used to render and align text) */
  1031. fontOffset: {
  1032. ascent: number;
  1033. height: number;
  1034. descent: number;
  1035. };
  1036. /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
  1037. alpha: number;
  1038. /** Gets or sets a value indicating the scale factor on X axis (1 by default)
  1039. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1040. */
  1041. scaleX: number;
  1042. /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
  1043. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1044. */
  1045. scaleY: number;
  1046. /** Gets or sets the rotation angle (0 by default)
  1047. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1048. */
  1049. rotation: number;
  1050. /** Gets or sets the transformation center on Y axis (0 by default)
  1051. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1052. */
  1053. transformCenterY: number;
  1054. /** Gets or sets the transformation center on X axis (0 by default)
  1055. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1056. */
  1057. transformCenterX: number;
  1058. /**
  1059. * Gets or sets the horizontal alignment
  1060. * @see http://doc.babylonjs.com/how_to/gui#alignments
  1061. */
  1062. horizontalAlignment: number;
  1063. /**
  1064. * Gets or sets the vertical alignment
  1065. * @see http://doc.babylonjs.com/how_to/gui#alignments
  1066. */
  1067. verticalAlignment: number;
  1068. /**
  1069. * Gets or sets control width
  1070. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1071. */
  1072. width: string | number;
  1073. /**
  1074. * Gets control width in pixel
  1075. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1076. */
  1077. readonly widthInPixels: number;
  1078. /**
  1079. * Gets or sets control height
  1080. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1081. */
  1082. height: string | number;
  1083. /**
  1084. * Gets control height in pixel
  1085. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1086. */
  1087. readonly heightInPixels: number;
  1088. /** Gets or set font family */
  1089. fontFamily: string;
  1090. /** Gets or sets font style */
  1091. fontStyle: string;
  1092. /** Gets or sets font weight */
  1093. fontWeight: string;
  1094. /**
  1095. * Gets or sets style
  1096. * @see http://doc.babylonjs.com/how_to/gui#styles
  1097. */
  1098. style: Nullable<Style>;
  1099. /** @hidden */
  1100. readonly _isFontSizeInPercentage: boolean;
  1101. /** Gets font size in pixels */
  1102. readonly fontSizeInPixels: number;
  1103. /** Gets or sets font size */
  1104. fontSize: string | number;
  1105. /** Gets or sets foreground color */
  1106. color: string;
  1107. /** Gets or sets z index which is used to reorder controls on the z axis */
  1108. zIndex: number;
  1109. /** Gets or sets a boolean indicating if the control can be rendered */
  1110. notRenderable: boolean;
  1111. /** Gets or sets a boolean indicating if the control is visible */
  1112. isVisible: boolean;
  1113. /** Gets a boolean indicating that the control needs to update its rendering */
  1114. readonly isDirty: boolean;
  1115. /**
  1116. * Gets the current linked mesh (or null if none)
  1117. */
  1118. readonly linkedMesh: Nullable<AbstractMesh>;
  1119. /**
  1120. * Gets or sets a value indicating the padding to use on the left of the control
  1121. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1122. */
  1123. paddingLeft: string | number;
  1124. /**
  1125. * Gets a value indicating the padding in pixels to use on the left of the control
  1126. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1127. */
  1128. readonly paddingLeftInPixels: number;
  1129. /**
  1130. * Gets or sets a value indicating the padding to use on the right of the control
  1131. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1132. */
  1133. paddingRight: string | number;
  1134. /**
  1135. * Gets a value indicating the padding in pixels to use on the right of the control
  1136. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1137. */
  1138. readonly paddingRightInPixels: number;
  1139. /**
  1140. * Gets or sets a value indicating the padding to use on the top of the control
  1141. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1142. */
  1143. paddingTop: string | number;
  1144. /**
  1145. * Gets a value indicating the padding in pixels to use on the top of the control
  1146. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1147. */
  1148. readonly paddingTopInPixels: number;
  1149. /**
  1150. * Gets or sets a value indicating the padding to use on the bottom of the control
  1151. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1152. */
  1153. paddingBottom: string | number;
  1154. /**
  1155. * Gets a value indicating the padding in pixels to use on the bottom of the control
  1156. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1157. */
  1158. readonly paddingBottomInPixels: number;
  1159. /**
  1160. * Gets or sets a value indicating the left coordinate of the control
  1161. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1162. */
  1163. left: string | number;
  1164. /**
  1165. * Gets a value indicating the left coordinate in pixels of the control
  1166. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1167. */
  1168. readonly leftInPixels: number;
  1169. /**
  1170. * Gets or sets a value indicating the top coordinate of the control
  1171. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1172. */
  1173. top: string | number;
  1174. /**
  1175. * Gets a value indicating the top coordinate in pixels of the control
  1176. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1177. */
  1178. readonly topInPixels: number;
  1179. /**
  1180. * Gets or sets a value indicating the offset on X axis to the linked mesh
  1181. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1182. */
  1183. linkOffsetX: string | number;
  1184. /**
  1185. * Gets a value indicating the offset in pixels on X axis to the linked mesh
  1186. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1187. */
  1188. readonly linkOffsetXInPixels: number;
  1189. /**
  1190. * Gets or sets a value indicating the offset on Y axis to the linked mesh
  1191. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1192. */
  1193. linkOffsetY: string | number;
  1194. /**
  1195. * Gets a value indicating the offset in pixels on Y axis to the linked mesh
  1196. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1197. */
  1198. readonly linkOffsetYInPixels: number;
  1199. /** Gets the center coordinate on X axis */
  1200. readonly centerX: number;
  1201. /** Gets the center coordinate on Y axis */
  1202. readonly centerY: number;
  1203. /** Gets or sets if control is Enabled*/
  1204. isEnabled: boolean;
  1205. /** Gets or sets background color of control if it's disabled*/
  1206. disabledColor: string;
  1207. /**
  1208. * Creates a new control
  1209. * @param name defines the name of the control
  1210. */
  1211. constructor(
  1212. /** defines the name of the control */
  1213. name?: string | undefined);
  1214. /** @hidden */
  1215. protected _getTypeName(): string;
  1216. /** @hidden */
  1217. _resetFontCache(): void;
  1218. /**
  1219. * Determines if a container is an ascendant of the current control
  1220. * @param container defines the container to look for
  1221. * @returns true if the container is one of the ascendant of the control
  1222. */
  1223. isAscendant(container: Control): boolean;
  1224. /**
  1225. * Gets coordinates in local control space
  1226. * @param globalCoordinates defines the coordinates to transform
  1227. * @returns the new coordinates in local space
  1228. */
  1229. getLocalCoordinates(globalCoordinates: Vector2): Vector2;
  1230. /**
  1231. * Gets coordinates in local control space
  1232. * @param globalCoordinates defines the coordinates to transform
  1233. * @param result defines the target vector2 where to store the result
  1234. * @returns the current control
  1235. */
  1236. getLocalCoordinatesToRef(globalCoordinates: Vector2, result: Vector2): Control;
  1237. /**
  1238. * Gets coordinates in parent local control space
  1239. * @param globalCoordinates defines the coordinates to transform
  1240. * @returns the new coordinates in parent local space
  1241. */
  1242. getParentLocalCoordinates(globalCoordinates: Vector2): Vector2;
  1243. /**
  1244. * Move the current control to a vector3 position projected onto the screen.
  1245. * @param position defines the target position
  1246. * @param scene defines the hosting scene
  1247. */
  1248. moveToVector3(position: Vector3, scene: Scene): void;
  1249. /**
  1250. * Link current control with a target mesh
  1251. * @param mesh defines the mesh to link with
  1252. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1253. */
  1254. linkWithMesh(mesh: Nullable<AbstractMesh>): void;
  1255. /** @hidden */
  1256. _moveToProjectedPosition(projectedPosition: Vector3): void;
  1257. /** @hidden */
  1258. _markMatrixAsDirty(): void;
  1259. /** @hidden */
  1260. _flagDescendantsAsMatrixDirty(): void;
  1261. /** @hidden */
  1262. _markAsDirty(force?: boolean): void;
  1263. /** @hidden */
  1264. _markAllAsDirty(): void;
  1265. /** @hidden */
  1266. _link(root: Nullable<Container>, host: AdvancedDynamicTexture): void;
  1267. /** @hidden */
  1268. protected _transform(context: CanvasRenderingContext2D): void;
  1269. /** @hidden */
  1270. protected _applyStates(context: CanvasRenderingContext2D): void;
  1271. /** @hidden */
  1272. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  1273. /** @hidden */
  1274. protected _clip(context: CanvasRenderingContext2D): void;
  1275. /** @hidden */
  1276. _measure(): void;
  1277. /** @hidden */
  1278. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1279. /** @hidden */
  1280. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1281. /** @hidden */
  1282. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1283. /** @hidden */
  1284. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1285. /**
  1286. * Tests if a given coordinates belong to the current control
  1287. * @param x defines x coordinate to test
  1288. * @param y defines y coordinate to test
  1289. * @returns true if the coordinates are inside the control
  1290. */
  1291. contains(x: number, y: number): boolean;
  1292. /** @hidden */
  1293. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  1294. /** @hidden */
  1295. _onPointerMove(target: Control, coordinates: Vector2): void;
  1296. /** @hidden */
  1297. _onPointerEnter(target: Control): boolean;
  1298. /** @hidden */
  1299. _onPointerOut(target: Control): void;
  1300. /** @hidden */
  1301. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  1302. /** @hidden */
  1303. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  1304. /** @hidden */
  1305. _forcePointerUp(pointerId?: Nullable<number>): void;
  1306. /** @hidden */
  1307. _processObservables(type: number, x: number, y: number, pointerId: number, buttonIndex: number): boolean;
  1308. /** Releases associated resources */
  1309. dispose(): void;
  1310. /** HORIZONTAL_ALIGNMENT_LEFT */
  1311. static readonly HORIZONTAL_ALIGNMENT_LEFT: number;
  1312. /** HORIZONTAL_ALIGNMENT_RIGHT */
  1313. static readonly HORIZONTAL_ALIGNMENT_RIGHT: number;
  1314. /** HORIZONTAL_ALIGNMENT_CENTER */
  1315. static readonly HORIZONTAL_ALIGNMENT_CENTER: number;
  1316. /** VERTICAL_ALIGNMENT_TOP */
  1317. static readonly VERTICAL_ALIGNMENT_TOP: number;
  1318. /** VERTICAL_ALIGNMENT_BOTTOM */
  1319. static readonly VERTICAL_ALIGNMENT_BOTTOM: number;
  1320. /** VERTICAL_ALIGNMENT_CENTER */
  1321. static readonly VERTICAL_ALIGNMENT_CENTER: number;
  1322. /** @hidden */
  1323. static _GetFontOffset(font: string): {
  1324. ascent: number;
  1325. height: number;
  1326. descent: number;
  1327. };
  1328. /**
  1329. * Creates a stack panel that can be used to render headers
  1330. * @param control defines the control to associate with the header
  1331. * @param text defines the text of the header
  1332. * @param size defines the size of the header
  1333. * @param options defines options used to configure the header
  1334. * @returns a new StackPanel
  1335. * @ignore
  1336. * @hidden
  1337. */
  1338. static AddHeader: (control: Control, text: string, size: string | number, options: {
  1339. isHorizontal: boolean;
  1340. controlFirst: boolean;
  1341. }) => any;
  1342. /** @hidden */
  1343. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  1344. }
  1345. }
  1346. declare module 'babylonjs-gui/2D/controls/ellipse' {
  1347. import { Container } from "babylonjs-gui/2D/controls/container";
  1348. import { Measure } from "babylonjs-gui/2D/measure";
  1349. /** Class used to create 2D ellipse containers */
  1350. export class Ellipse extends Container {
  1351. name?: string | undefined;
  1352. /** Gets or sets border thickness */
  1353. thickness: number;
  1354. /**
  1355. * Creates a new Ellipse
  1356. * @param name defines the control name
  1357. */
  1358. constructor(name?: string | undefined);
  1359. protected _getTypeName(): string;
  1360. protected _localDraw(context: CanvasRenderingContext2D): void;
  1361. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1362. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  1363. }
  1364. }
  1365. declare module 'babylonjs-gui/2D/controls/grid' {
  1366. import { Container } from "babylonjs-gui/2D/controls/container";
  1367. import { Control } from "babylonjs-gui/2D/controls/control";
  1368. import { Measure } from "babylonjs-gui/2D/measure";
  1369. import { Nullable } from "babylonjs";
  1370. /**
  1371. * Class used to create a 2D grid container
  1372. */
  1373. export class Grid extends Container {
  1374. name?: string | undefined;
  1375. /**
  1376. * Gets the number of columns
  1377. */
  1378. readonly columnCount: number;
  1379. /**
  1380. * Gets the number of rows
  1381. */
  1382. readonly rowCount: number;
  1383. /** Gets the list of children */
  1384. readonly children: Control[];
  1385. /**
  1386. * Adds a new row to the grid
  1387. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  1388. * @param isPixel defines if the height is expressed in pixel (or in percentage)
  1389. * @returns the current grid
  1390. */
  1391. addRowDefinition(height: number, isPixel?: boolean): Grid;
  1392. /**
  1393. * Adds a new column to the grid
  1394. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  1395. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  1396. * @returns the current grid
  1397. */
  1398. addColumnDefinition(width: number, isPixel?: boolean): Grid;
  1399. /**
  1400. * Update a row definition
  1401. * @param index defines the index of the row to update
  1402. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  1403. * @param isPixel defines if the weight is expressed in pixel (or in percentage)
  1404. * @returns the current grid
  1405. */
  1406. setRowDefinition(index: number, height: number, isPixel?: boolean): Grid;
  1407. /**
  1408. * Update a column definition
  1409. * @param index defines the index of the column to update
  1410. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  1411. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  1412. * @returns the current grid
  1413. */
  1414. setColumnDefinition(index: number, width: number, isPixel?: boolean): Grid;
  1415. /**
  1416. * Gets the list of children stored in a specific cell
  1417. * @param row defines the row to check
  1418. * @param column defines the column to check
  1419. * @returns the list of controls
  1420. */
  1421. getChildrenAt(row: number, column: number): Nullable<Array<Control>>;
  1422. /**
  1423. * Remove a column definition at specified index
  1424. * @param index defines the index of the column to remove
  1425. * @returns the current grid
  1426. */
  1427. removeColumnDefinition(index: number): Grid;
  1428. /**
  1429. * Remove a row definition at specified index
  1430. * @param index defines the index of the row to remove
  1431. * @returns the current grid
  1432. */
  1433. removeRowDefinition(index: number): Grid;
  1434. /**
  1435. * Adds a new control to the current grid
  1436. * @param control defines the control to add
  1437. * @param row defines the row where to add the control (0 by default)
  1438. * @param column defines the column where to add the control (0 by default)
  1439. * @returns the current grid
  1440. */
  1441. addControl(control: Control, row?: number, column?: number): Grid;
  1442. /**
  1443. * Removes a control from the current container
  1444. * @param control defines the control to remove
  1445. * @returns the current container
  1446. */
  1447. removeControl(control: Control): Container;
  1448. /**
  1449. * Creates a new Grid
  1450. * @param name defines control name
  1451. */
  1452. constructor(name?: string | undefined);
  1453. protected _getTypeName(): string;
  1454. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1455. /** Releases associated resources */
  1456. dispose(): void;
  1457. }
  1458. }
  1459. declare module 'babylonjs-gui/2D/controls/image' {
  1460. import { Control } from "babylonjs-gui/2D/controls/control";
  1461. import { Nullable, Observable } from "babylonjs";
  1462. import { Measure } from "babylonjs-gui/2D/measure";
  1463. /**
  1464. * Class used to create 2D images
  1465. */
  1466. export class Image extends Control {
  1467. name?: string | undefined;
  1468. /**
  1469. * Observable notified when the content is loaded
  1470. */
  1471. onImageLoadedObservable: Observable<Image>;
  1472. /**
  1473. * Gets a boolean indicating that the content is loaded
  1474. */
  1475. readonly isLoaded: boolean;
  1476. /**
  1477. * Gets or sets the left coordinate in the source image
  1478. */
  1479. sourceLeft: number;
  1480. /**
  1481. * Gets or sets the top coordinate in the source image
  1482. */
  1483. sourceTop: number;
  1484. /**
  1485. * Gets or sets the width to capture in the source image
  1486. */
  1487. sourceWidth: number;
  1488. /**
  1489. * Gets or sets the height to capture in the source image
  1490. */
  1491. sourceHeight: number;
  1492. /**
  1493. * Gets or sets a boolean indicating if the image can force its container to adapt its size
  1494. * @see http://doc.babylonjs.com/how_to/gui#image
  1495. */
  1496. autoScale: boolean;
  1497. /** Gets or sets the streching mode used by the image */
  1498. stretch: number;
  1499. /**
  1500. * Gets or sets the internal DOM image used to render the control
  1501. */
  1502. domImage: HTMLImageElement;
  1503. /**
  1504. * Gets or sets image source url
  1505. */
  1506. source: Nullable<string>;
  1507. /**
  1508. * Gets or sets the cell width to use when animation sheet is enabled
  1509. * @see http://doc.babylonjs.com/how_to/gui#image
  1510. */
  1511. cellWidth: number;
  1512. /**
  1513. * Gets or sets the cell height to use when animation sheet is enabled
  1514. * @see http://doc.babylonjs.com/how_to/gui#image
  1515. */
  1516. cellHeight: number;
  1517. /**
  1518. * Gets or sets the cell id to use (this will turn on the animation sheet mode)
  1519. * @see http://doc.babylonjs.com/how_to/gui#image
  1520. */
  1521. cellId: number;
  1522. /**
  1523. * Creates a new Image
  1524. * @param name defines the control name
  1525. * @param url defines the image url
  1526. */
  1527. constructor(name?: string | undefined, url?: Nullable<string>);
  1528. protected _getTypeName(): string;
  1529. /** Force the control to synchronize with its content */
  1530. synchronizeSizeWithContent(): void;
  1531. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1532. dispose(): void;
  1533. /** STRETCH_NONE */
  1534. static readonly STRETCH_NONE: number;
  1535. /** STRETCH_FILL */
  1536. static readonly STRETCH_FILL: number;
  1537. /** STRETCH_UNIFORM */
  1538. static readonly STRETCH_UNIFORM: number;
  1539. /** STRETCH_EXTEND */
  1540. static readonly STRETCH_EXTEND: number;
  1541. }
  1542. }
  1543. declare module 'babylonjs-gui/2D/controls/inputText' {
  1544. import { Control } from "babylonjs-gui/2D/controls/control";
  1545. import { IFocusableControl } from "babylonjs-gui/2D/advancedDynamicTexture";
  1546. import { Nullable, Observable, Vector2 } from 'babylonjs';
  1547. import { Measure } from "babylonjs-gui/2D/measure";
  1548. import { VirtualKeyboard } from "babylonjs-gui/2D/controls/virtualKeyboard";
  1549. /**
  1550. * Class used to create input text control
  1551. */
  1552. export class InputText extends Control implements IFocusableControl {
  1553. name?: string | undefined;
  1554. /** @hidden */
  1555. _connectedVirtualKeyboard: Nullable<VirtualKeyboard>;
  1556. /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
  1557. promptMessage: string;
  1558. /** Observable raised when the text changes */
  1559. onTextChangedObservable: Observable<InputText>;
  1560. /** Observable raised just before an entered character is to be added */
  1561. onBeforeKeyAddObservable: Observable<InputText>;
  1562. /** Observable raised when the control gets the focus */
  1563. onFocusObservable: Observable<InputText>;
  1564. /** Observable raised when the control loses the focus */
  1565. onBlurObservable: Observable<InputText>;
  1566. /**Observable raised when the text is highlighted */
  1567. onTextHighlightObservable: Observable<InputText>;
  1568. /**Observable raised when copy event is triggered */
  1569. onTextCopyObservable: Observable<InputText>;
  1570. /** Observable raised when cut event is triggered */
  1571. onTextCutObservable: Observable<InputText>;
  1572. /** Observable raised when paste event is triggered */
  1573. onTextPasteObservable: Observable<InputText>;
  1574. /** Gets or sets the maximum width allowed by the control */
  1575. maxWidth: string | number;
  1576. /** Gets the maximum width allowed by the control in pixels */
  1577. readonly maxWidthInPixels: number;
  1578. /** Gets or sets the text highlighter transparency; default: 0.4 */
  1579. highligherOpacity: number;
  1580. /** Gets or sets a boolean indicating whether to select complete text by default on input focus */
  1581. onFocusSelectAll: boolean;
  1582. /** Gets or sets the text hightlight color */
  1583. textHighlightColor: string;
  1584. /** Gets or sets control margin */
  1585. margin: string;
  1586. /** Gets control margin in pixels */
  1587. readonly marginInPixels: number;
  1588. /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
  1589. autoStretchWidth: boolean;
  1590. /** Gets or sets border thickness */
  1591. thickness: number;
  1592. /** Gets or sets the background color when focused */
  1593. focusedBackground: string;
  1594. /** Gets or sets the background color */
  1595. background: string;
  1596. /** Gets or sets the placeholder color */
  1597. placeholderColor: string;
  1598. /** Gets or sets the text displayed when the control is empty */
  1599. placeholderText: string;
  1600. /** Gets or sets the dead key flag */
  1601. deadKey: boolean;
  1602. /** Gets or sets the highlight text */
  1603. highlightedText: string;
  1604. /** Gets or sets if the current key should be added */
  1605. addKey: boolean;
  1606. /** Gets or sets the value of the current key being entered */
  1607. currentKey: string;
  1608. /** Gets or sets the text displayed in the control */
  1609. text: string;
  1610. /** Gets or sets control width */
  1611. width: string | number;
  1612. /**
  1613. * Creates a new InputText
  1614. * @param name defines the control name
  1615. * @param text defines the text of the control
  1616. */
  1617. constructor(name?: string | undefined, text?: string);
  1618. /** @hidden */
  1619. onBlur(): void;
  1620. /** @hidden */
  1621. onFocus(): void;
  1622. protected _getTypeName(): string;
  1623. /**
  1624. * Function called to get the list of controls that should not steal the focus from this control
  1625. * @returns an array of controls
  1626. */
  1627. keepsFocusWith(): Nullable<Control[]>;
  1628. /** @hidden */
  1629. processKey(keyCode: number, key?: string, evt?: KeyboardEvent): void;
  1630. /**
  1631. * Handles the keyboard event
  1632. * @param evt Defines the KeyboardEvent
  1633. */
  1634. processKeyboard(evt: KeyboardEvent): void;
  1635. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1636. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  1637. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  1638. protected _beforeRenderText(text: string): string;
  1639. dispose(): void;
  1640. }
  1641. }
  1642. declare module 'babylonjs-gui/2D/controls/inputPassword' {
  1643. import { InputText } from "babylonjs-gui/2D/controls/inputText";
  1644. /**
  1645. * Class used to create a password control
  1646. */
  1647. export class InputPassword extends InputText {
  1648. protected _beforeRenderText(text: string): string;
  1649. }
  1650. }
  1651. declare module 'babylonjs-gui/2D/controls/line' {
  1652. import { Control } from "babylonjs-gui/2D/controls/control";
  1653. import { Vector3, Scene } from "babylonjs";
  1654. import { Measure } from "babylonjs-gui/2D/measure";
  1655. /** Class used to render 2D lines */
  1656. export class Line extends Control {
  1657. name?: string | undefined;
  1658. /** Gets or sets the dash pattern */
  1659. dash: Array<number>;
  1660. /** Gets or sets the control connected with the line end */
  1661. connectedControl: Control;
  1662. /** Gets or sets start coordinates on X axis */
  1663. x1: string | number;
  1664. /** Gets or sets start coordinates on Y axis */
  1665. y1: string | number;
  1666. /** Gets or sets end coordinates on X axis */
  1667. x2: string | number;
  1668. /** Gets or sets end coordinates on Y axis */
  1669. y2: string | number;
  1670. /** Gets or sets line width */
  1671. lineWidth: number;
  1672. /** Gets or sets horizontal alignment */
  1673. horizontalAlignment: number;
  1674. /** Gets or sets vertical alignment */
  1675. verticalAlignment: number;
  1676. /**
  1677. * Creates a new Line
  1678. * @param name defines the control name
  1679. */
  1680. constructor(name?: string | undefined);
  1681. protected _getTypeName(): string;
  1682. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1683. _measure(): void;
  1684. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1685. /**
  1686. * Move one end of the line given 3D cartesian coordinates.
  1687. * @param position Targeted world position
  1688. * @param scene Scene
  1689. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  1690. */
  1691. moveToVector3(position: Vector3, scene: Scene, end?: boolean): void;
  1692. /**
  1693. * Move one end of the line to a position in screen absolute space.
  1694. * @param projectedPosition Position in screen absolute space (X, Y)
  1695. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  1696. */
  1697. _moveToProjectedPosition(projectedPosition: Vector3, end?: boolean): void;
  1698. }
  1699. }
  1700. declare module 'babylonjs-gui/2D/controls/multiLine' {
  1701. import { Control } from "babylonjs-gui/2D/controls/control";
  1702. import { MultiLinePoint } from "babylonjs-gui/2D/multiLinePoint";
  1703. import { AbstractMesh } from "babylonjs";
  1704. import { Measure } from "babylonjs-gui/2D/measure";
  1705. /**
  1706. * Class used to create multi line control
  1707. */
  1708. export class MultiLine extends Control {
  1709. name?: string | undefined;
  1710. /**
  1711. * Creates a new MultiLine
  1712. * @param name defines the control name
  1713. */
  1714. constructor(name?: string | undefined);
  1715. /** Gets or sets dash pattern */
  1716. dash: Array<number>;
  1717. /**
  1718. * Gets point stored at specified index
  1719. * @param index defines the index to look for
  1720. * @returns the requested point if found
  1721. */
  1722. getAt(index: number): MultiLinePoint;
  1723. /** Function called when a point is updated */
  1724. onPointUpdate: () => void;
  1725. /**
  1726. * Adds new points to the point collection
  1727. * @param items defines the list of items (mesh, control or 2d coordiantes) to add
  1728. * @returns the list of created MultiLinePoint
  1729. */
  1730. add(...items: (AbstractMesh | Control | {
  1731. x: string | number;
  1732. y: string | number;
  1733. })[]): MultiLinePoint[];
  1734. /**
  1735. * Adds a new point to the point collection
  1736. * @param item defines the item (mesh, control or 2d coordiantes) to add
  1737. * @returns the created MultiLinePoint
  1738. */
  1739. push(item?: (AbstractMesh | Control | {
  1740. x: string | number;
  1741. y: string | number;
  1742. })): MultiLinePoint;
  1743. /**
  1744. * Remove a specific value or point from the active point collection
  1745. * @param value defines the value or point to remove
  1746. */
  1747. remove(value: number | MultiLinePoint): void;
  1748. /**
  1749. * Resets this object to initial state (no point)
  1750. */
  1751. reset(): void;
  1752. /**
  1753. * Resets all links
  1754. */
  1755. resetLinks(): void;
  1756. /** Gets or sets line width */
  1757. lineWidth: number;
  1758. horizontalAlignment: number;
  1759. verticalAlignment: number;
  1760. protected _getTypeName(): string;
  1761. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1762. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1763. _measure(): void;
  1764. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1765. dispose(): void;
  1766. }
  1767. }
  1768. declare module 'babylonjs-gui/2D/controls/radioButton' {
  1769. import { Control } from "babylonjs-gui/2D/controls/control";
  1770. import { Observable, Vector2 } from "babylonjs";
  1771. import { Measure } from "babylonjs-gui/2D/measure";
  1772. import { StackPanel } from "babylonjs-gui/2D/controls";
  1773. /**
  1774. * Class used to create radio button controls
  1775. */
  1776. export class RadioButton extends Control {
  1777. name?: string | undefined;
  1778. /** Gets or sets border thickness */
  1779. thickness: number;
  1780. /** Gets or sets group name */
  1781. group: string;
  1782. /** Observable raised when isChecked is changed */
  1783. onIsCheckedChangedObservable: Observable<boolean>;
  1784. /** Gets or sets a value indicating the ratio between overall size and check size */
  1785. checkSizeRatio: number;
  1786. /** Gets or sets background color */
  1787. background: string;
  1788. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  1789. isChecked: boolean;
  1790. /**
  1791. * Creates a new RadioButton
  1792. * @param name defines the control name
  1793. */
  1794. constructor(name?: string | undefined);
  1795. protected _getTypeName(): string;
  1796. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1797. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  1798. /**
  1799. * Utility function to easily create a radio button with a header
  1800. * @param title defines the label to use for the header
  1801. * @param group defines the group to use for the radio button
  1802. * @param isChecked defines the initial state of the radio button
  1803. * @param onValueChanged defines the callback to call when value changes
  1804. * @returns a StackPanel containing the radio button and a textBlock
  1805. */
  1806. static AddRadioButtonWithHeader(title: string, group: string, isChecked: boolean, onValueChanged: (button: RadioButton, value: boolean) => void): StackPanel;
  1807. }
  1808. }
  1809. declare module 'babylonjs-gui/2D/controls/stackPanel' {
  1810. import { Container } from "babylonjs-gui/2D/controls/container";
  1811. import { Measure } from "babylonjs-gui/2D/measure";
  1812. /**
  1813. * Class used to create a 2D stack panel container
  1814. */
  1815. export class StackPanel extends Container {
  1816. name?: string | undefined;
  1817. /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
  1818. isVertical: boolean;
  1819. /**
  1820. * Gets or sets panel width.
  1821. * This value should not be set when in horizontal mode as it will be computed automatically
  1822. */
  1823. width: string | number;
  1824. /**
  1825. * Gets or sets panel height.
  1826. * This value should not be set when in vertical mode as it will be computed automatically
  1827. */
  1828. height: string | number;
  1829. /**
  1830. * Creates a new StackPanel
  1831. * @param name defines control name
  1832. */
  1833. constructor(name?: string | undefined);
  1834. protected _getTypeName(): string;
  1835. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1836. }
  1837. }
  1838. declare module 'babylonjs-gui/2D/controls/selector' {
  1839. import { Rectangle } from "babylonjs-gui/2D/controls/rectangle";
  1840. import { StackPanel } from "babylonjs-gui/2D/controls/stackPanel";
  1841. /** Class used to create a RadioGroup
  1842. * which contains groups of radio buttons
  1843. */
  1844. export class SelectorGroup {
  1845. /** name of SelectorGroup */
  1846. name: string;
  1847. /**
  1848. * Creates a new SelectorGroup
  1849. * @param name of group, used as a group heading
  1850. */
  1851. constructor(
  1852. /** name of SelectorGroup */
  1853. name: string);
  1854. /** Gets the groupPanel of the SelectorGroup */
  1855. readonly groupPanel: StackPanel;
  1856. /** Gets the selectors array */
  1857. readonly selectors: StackPanel[];
  1858. /** Gets and sets the group header */
  1859. header: string;
  1860. /** @hidden*/
  1861. _getSelector(selectorNb: number): StackPanel | undefined;
  1862. /** Removes the selector at the given position
  1863. * @param selectorNb the position of the selector within the group
  1864. */
  1865. removeSelector(selectorNb: number): void;
  1866. }
  1867. /** Class used to create a CheckboxGroup
  1868. * which contains groups of checkbox buttons
  1869. */
  1870. export class CheckboxGroup extends SelectorGroup {
  1871. /** Adds a checkbox as a control
  1872. * @param text is the label for the selector
  1873. * @param func is the function called when the Selector is checked
  1874. * @param checked is true when Selector is checked
  1875. */
  1876. addCheckbox(text: string, func?: (s: boolean) => void, checked?: boolean): void;
  1877. /** @hidden */
  1878. _setSelectorLabel(selectorNb: number, label: string): void;
  1879. /** @hidden */
  1880. _setSelectorLabelColor(selectorNb: number, color: string): void;
  1881. /** @hidden */
  1882. _setSelectorButtonColor(selectorNb: number, color: string): void;
  1883. /** @hidden */
  1884. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  1885. }
  1886. /** Class used to create a RadioGroup
  1887. * which contains groups of radio buttons
  1888. */
  1889. export class RadioGroup extends SelectorGroup {
  1890. /** Adds a radio button as a control
  1891. * @param label is the label for the selector
  1892. * @param func is the function called when the Selector is checked
  1893. * @param checked is true when Selector is checked
  1894. */
  1895. addRadio(label: string, func?: (n: number) => void, checked?: boolean): void;
  1896. /** @hidden */
  1897. _setSelectorLabel(selectorNb: number, label: string): void;
  1898. /** @hidden */
  1899. _setSelectorLabelColor(selectorNb: number, color: string): void;
  1900. /** @hidden */
  1901. _setSelectorButtonColor(selectorNb: number, color: string): void;
  1902. /** @hidden */
  1903. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  1904. }
  1905. /** Class used to create a SliderGroup
  1906. * which contains groups of slider buttons
  1907. */
  1908. export class SliderGroup extends SelectorGroup {
  1909. /**
  1910. * Adds a slider to the SelectorGroup
  1911. * @param label is the label for the SliderBar
  1912. * @param func is the function called when the Slider moves
  1913. * @param unit is a string describing the units used, eg degrees or metres
  1914. * @param min is the minimum value for the Slider
  1915. * @param max is the maximum value for the Slider
  1916. * @param value is the start value for the Slider between min and max
  1917. * @param onValueChange is the function used to format the value displayed, eg radians to degrees
  1918. */
  1919. addSlider(label: string, func?: (v: number) => void, unit?: string, min?: number, max?: number, value?: number, onValueChange?: (v: number) => number): void;
  1920. /** @hidden */
  1921. _setSelectorLabel(selectorNb: number, label: string): void;
  1922. /** @hidden */
  1923. _setSelectorLabelColor(selectorNb: number, color: string): void;
  1924. /** @hidden */
  1925. _setSelectorButtonColor(selectorNb: number, color: string): void;
  1926. /** @hidden */
  1927. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  1928. }
  1929. /** Class used to hold the controls for the checkboxes, radio buttons and sliders
  1930. * @see http://doc.babylonjs.com/how_to/selector
  1931. */
  1932. export class SelectionPanel extends Rectangle {
  1933. /** name of SelectionPanel */
  1934. name: string;
  1935. /** an array of SelectionGroups */
  1936. groups: SelectorGroup[];
  1937. /**
  1938. * Creates a new SelectionPanel
  1939. * @param name of SelectionPanel
  1940. * @param groups is an array of SelectionGroups
  1941. */
  1942. constructor(
  1943. /** name of SelectionPanel */
  1944. name: string,
  1945. /** an array of SelectionGroups */
  1946. groups?: SelectorGroup[]);
  1947. protected _getTypeName(): string;
  1948. /** Gets or sets the headerColor */
  1949. headerColor: string;
  1950. /** Gets or sets the button color */
  1951. buttonColor: string;
  1952. /** Gets or sets the label color */
  1953. labelColor: string;
  1954. /** Gets or sets the button background */
  1955. buttonBackground: string;
  1956. /** Gets or sets the color of separator bar */
  1957. barColor: string;
  1958. /** Gets or sets the height of separator bar */
  1959. barHeight: string;
  1960. /** Gets or sets the height of spacers*/
  1961. spacerHeight: string;
  1962. /** Add a group to the selection panel
  1963. * @param group is the selector group to add
  1964. */
  1965. addGroup(group: SelectorGroup): void;
  1966. /** Remove the group from the given position
  1967. * @param groupNb is the position of the group in the list
  1968. */
  1969. removeGroup(groupNb: number): void;
  1970. /** Change a group header label
  1971. * @param label is the new group header label
  1972. * @param groupNb is the number of the group to relabel
  1973. * */
  1974. setHeaderName(label: string, groupNb: number): void;
  1975. /** Change selector label to the one given
  1976. * @param label is the new selector label
  1977. * @param groupNb is the number of the groupcontaining the selector
  1978. * @param selectorNb is the number of the selector within a group to relabel
  1979. * */
  1980. relabel(label: string, groupNb: number, selectorNb: number): void;
  1981. /** For a given group position remove the selector at the given position
  1982. * @param groupNb is the number of the group to remove the selector from
  1983. * @param selectorNb is the number of the selector within the group
  1984. */
  1985. removeFromGroupSelector(groupNb: number, selectorNb: number): void;
  1986. /** For a given group position of correct type add a checkbox button
  1987. * @param groupNb is the number of the group to remove the selector from
  1988. * @param label is the label for the selector
  1989. * @param func is the function called when the Selector is checked
  1990. * @param checked is true when Selector is checked
  1991. */
  1992. addToGroupCheckbox(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  1993. /** For a given group position of correct type add a radio button
  1994. * @param groupNb is the number of the group to remove the selector from
  1995. * @param label is the label for the selector
  1996. * @param func is the function called when the Selector is checked
  1997. * @param checked is true when Selector is checked
  1998. */
  1999. addToGroupRadio(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  2000. /**
  2001. * For a given slider group add a slider
  2002. * @param groupNb is the number of the group to add the slider to
  2003. * @param label is the label for the Slider
  2004. * @param func is the function called when the Slider moves
  2005. * @param unit is a string describing the units used, eg degrees or metres
  2006. * @param min is the minimum value for the Slider
  2007. * @param max is the maximum value for the Slider
  2008. * @param value is the start value for the Slider between min and max
  2009. * @param onVal is the function used to format the value displayed, eg radians to degrees
  2010. */
  2011. addToGroupSlider(groupNb: number, label: string, func?: () => void, unit?: string, min?: number, max?: number, value?: number, onVal?: (v: number) => number): void;
  2012. }
  2013. }
  2014. declare module 'babylonjs-gui/2D/controls/textBlock' {
  2015. import { Observable } from "babylonjs";
  2016. import { Measure } from "babylonjs-gui/2D/measure";
  2017. import { Control } from "babylonjs-gui/2D/controls/control";
  2018. /**
  2019. * Enum that determines the text-wrapping mode to use.
  2020. */
  2021. export enum TextWrapping {
  2022. /**
  2023. * Clip the text when it's larger than Control.width; this is the default mode.
  2024. */
  2025. Clip = 0,
  2026. /**
  2027. * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.
  2028. */
  2029. WordWrap = 1,
  2030. /**
  2031. * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.
  2032. */
  2033. Ellipsis = 2
  2034. }
  2035. /**
  2036. * Class used to create text block control
  2037. */
  2038. export class TextBlock extends Control {
  2039. /**
  2040. * Defines the name of the control
  2041. */
  2042. name?: string | undefined;
  2043. /**
  2044. * An event triggered after the text is changed
  2045. */
  2046. onTextChangedObservable: Observable<TextBlock>;
  2047. /**
  2048. * An event triggered after the text was broken up into lines
  2049. */
  2050. onLinesReadyObservable: Observable<TextBlock>;
  2051. /**
  2052. * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
  2053. */
  2054. readonly lines: any[];
  2055. /**
  2056. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  2057. */
  2058. resizeToFit: boolean;
  2059. /**
  2060. * Gets or sets a boolean indicating if text must be wrapped
  2061. */
  2062. textWrapping: TextWrapping | boolean;
  2063. /**
  2064. * Gets or sets text to display
  2065. */
  2066. text: string;
  2067. /**
  2068. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  2069. */
  2070. textHorizontalAlignment: number;
  2071. /**
  2072. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  2073. */
  2074. textVerticalAlignment: number;
  2075. /**
  2076. * Gets or sets line spacing value
  2077. */
  2078. lineSpacing: string | number;
  2079. /**
  2080. * Gets or sets outlineWidth of the text to display
  2081. */
  2082. outlineWidth: number;
  2083. /**
  2084. * Gets or sets outlineColor of the text to display
  2085. */
  2086. outlineColor: string;
  2087. /**
  2088. * Creates a new TextBlock object
  2089. * @param name defines the name of the control
  2090. * @param text defines the text to display (emptry string by default)
  2091. */
  2092. constructor(
  2093. /**
  2094. * Defines the name of the control
  2095. */
  2096. name?: string | undefined, text?: string);
  2097. protected _getTypeName(): string;
  2098. /** @hidden */
  2099. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2100. protected _applyStates(context: CanvasRenderingContext2D): void;
  2101. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2102. protected _breakLines(refWidth: number, context: CanvasRenderingContext2D): object[];
  2103. protected _parseLine(line: string | undefined, context: CanvasRenderingContext2D): object;
  2104. protected _parseLineEllipsis(line: string | undefined, width: number, context: CanvasRenderingContext2D): object;
  2105. protected _parseLineWordWrap(line: string | undefined, width: number, context: CanvasRenderingContext2D): object[];
  2106. protected _renderLines(context: CanvasRenderingContext2D): void;
  2107. /**
  2108. * Given a width constraint applied on the text block, find the expected height
  2109. * @returns expected height
  2110. */
  2111. computeExpectedHeight(): number;
  2112. dispose(): void;
  2113. }
  2114. }
  2115. declare module 'babylonjs-gui/2D/controls/virtualKeyboard' {
  2116. import { StackPanel } from "babylonjs-gui/2D/controls/stackPanel";
  2117. import { Observable, Nullable } from "babylonjs";
  2118. import { InputText } from "babylonjs-gui/2D/controls/inputText";
  2119. /**
  2120. * Class used to store key control properties
  2121. */
  2122. export class KeyPropertySet {
  2123. /** Width */
  2124. width?: string;
  2125. /** Height */
  2126. height?: string;
  2127. /** Left padding */
  2128. paddingLeft?: string;
  2129. /** Right padding */
  2130. paddingRight?: string;
  2131. /** Top padding */
  2132. paddingTop?: string;
  2133. /** Bottom padding */
  2134. paddingBottom?: string;
  2135. /** Foreground color */
  2136. color?: string;
  2137. /** Background color */
  2138. background?: string;
  2139. }
  2140. /**
  2141. * Class used to create virtual keyboard
  2142. */
  2143. export class VirtualKeyboard extends StackPanel {
  2144. /** Observable raised when a key is pressed */
  2145. onKeyPressObservable: Observable<string>;
  2146. /** Gets or sets default key button width */
  2147. defaultButtonWidth: string;
  2148. /** Gets or sets default key button height */
  2149. defaultButtonHeight: string;
  2150. /** Gets or sets default key button left padding */
  2151. defaultButtonPaddingLeft: string;
  2152. /** Gets or sets default key button right padding */
  2153. defaultButtonPaddingRight: string;
  2154. /** Gets or sets default key button top padding */
  2155. defaultButtonPaddingTop: string;
  2156. /** Gets or sets default key button bottom padding */
  2157. defaultButtonPaddingBottom: string;
  2158. /** Gets or sets default key button foreground color */
  2159. defaultButtonColor: string;
  2160. /** Gets or sets default key button background color */
  2161. defaultButtonBackground: string;
  2162. /** Gets or sets shift button foreground color */
  2163. shiftButtonColor: string;
  2164. /** Gets or sets shift button thickness*/
  2165. selectedShiftThickness: number;
  2166. /** Gets shift key state */
  2167. shiftState: number;
  2168. protected _getTypeName(): string;
  2169. /**
  2170. * Adds a new row of keys
  2171. * @param keys defines the list of keys to add
  2172. * @param propertySets defines the associated property sets
  2173. */
  2174. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  2175. /**
  2176. * Set the shift key to a specific state
  2177. * @param shiftState defines the new shift state
  2178. */
  2179. applyShiftState(shiftState: number): void;
  2180. /** Gets the input text control currently attached to the keyboard */
  2181. readonly connectedInputText: Nullable<InputText>;
  2182. /**
  2183. * Connects the keyboard with an input text control
  2184. *
  2185. * @param input defines the target control
  2186. */
  2187. connect(input: InputText): void;
  2188. /**
  2189. * Disconnects the keyboard from connected InputText controls
  2190. *
  2191. * @param input optionally defines a target control, otherwise all are disconnected
  2192. */
  2193. disconnect(input?: InputText): void;
  2194. /**
  2195. * Release all resources
  2196. */
  2197. dispose(): void;
  2198. /**
  2199. * Creates a new keyboard using a default layout
  2200. *
  2201. * @param name defines control name
  2202. * @returns a new VirtualKeyboard
  2203. */
  2204. static CreateDefaultLayout(name?: string): VirtualKeyboard;
  2205. }
  2206. }
  2207. declare module 'babylonjs-gui/2D/controls/rectangle' {
  2208. import { Container } from "babylonjs-gui/2D/controls/container";
  2209. import { Measure } from "babylonjs-gui/2D/measure";
  2210. /** Class used to create rectangle container */
  2211. export class Rectangle extends Container {
  2212. name?: string | undefined;
  2213. /** Gets or sets border thickness */
  2214. thickness: number;
  2215. /** Gets or sets the corner radius angle */
  2216. cornerRadius: number;
  2217. /**
  2218. * Creates a new Rectangle
  2219. * @param name defines the control name
  2220. */
  2221. constructor(name?: string | undefined);
  2222. protected _getTypeName(): string;
  2223. protected _localDraw(context: CanvasRenderingContext2D): void;
  2224. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2225. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  2226. }
  2227. }
  2228. declare module 'babylonjs-gui/2D/controls/displayGrid' {
  2229. import { Control } from "babylonjs-gui/2D/controls";
  2230. import { Measure } from "babylonjs-gui/2D";
  2231. /** Class used to render a grid */
  2232. export class DisplayGrid extends Control {
  2233. name?: string | undefined;
  2234. /** Gets or sets a boolean indicating if minor lines must be rendered (true by default)) */
  2235. displayMinorLines: boolean;
  2236. /** Gets or sets a boolean indicating if major lines must be rendered (true by default)) */
  2237. displayMajorLines: boolean;
  2238. /** Gets or sets background color (Black by default) */
  2239. background: string;
  2240. /** Gets or sets the width of each cell (20 by default) */
  2241. cellWidth: number;
  2242. /** Gets or sets the height of each cell (20 by default) */
  2243. cellHeight: number;
  2244. /** Gets or sets the tickness of minor lines (1 by default) */
  2245. minorLineTickness: number;
  2246. /** Gets or sets the color of minor lines (DarkGray by default) */
  2247. minorLineColor: string;
  2248. /** Gets or sets the tickness of major lines (2 by default) */
  2249. majorLineTickness: number;
  2250. /** Gets or sets the color of major lines (White by default) */
  2251. majorLineColor: string;
  2252. /** Gets or sets the frequency of major lines (default is 1 every 5 minor lines)*/
  2253. majorLineFrequency: number;
  2254. /**
  2255. * Creates a new GridDisplayRectangle
  2256. * @param name defines the control name
  2257. */
  2258. constructor(name?: string | undefined);
  2259. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2260. protected _getTypeName(): string;
  2261. }
  2262. }
  2263. declare module 'babylonjs-gui/2D/controls/baseSlider' {
  2264. import { Control } from "babylonjs-gui/2D/controls/control";
  2265. import { ValueAndUnit } from "babylonjs-gui/2D/valueAndUnit";
  2266. import { Observable, Vector2 } from "babylonjs";
  2267. /**
  2268. * Class used to create slider controls
  2269. */
  2270. export class BaseSlider extends Control {
  2271. name?: string | undefined;
  2272. protected _thumbWidth: ValueAndUnit;
  2273. protected _barOffset: ValueAndUnit;
  2274. protected _displayThumb: boolean;
  2275. protected _effectiveBarOffset: number;
  2276. protected _renderLeft: number;
  2277. protected _renderTop: number;
  2278. protected _renderWidth: number;
  2279. protected _renderHeight: number;
  2280. protected _backgroundBoxLength: number;
  2281. protected _backgroundBoxThickness: number;
  2282. protected _effectiveThumbThickness: number;
  2283. /** Observable raised when the sldier value changes */
  2284. onValueChangedObservable: Observable<number>;
  2285. /** Gets or sets a boolean indicating if the thumb must be rendered */
  2286. displayThumb: boolean;
  2287. /** Gets or sets main bar offset (ie. the margin applied to the value bar) */
  2288. barOffset: string | number;
  2289. /** Gets main bar offset in pixels*/
  2290. readonly barOffsetInPixels: number;
  2291. /** Gets or sets thumb width */
  2292. thumbWidth: string | number;
  2293. /** Gets thumb width in pixels */
  2294. readonly thumbWidthInPixels: number;
  2295. /** Gets or sets minimum value */
  2296. minimum: number;
  2297. /** Gets or sets maximum value */
  2298. maximum: number;
  2299. /** Gets or sets current value */
  2300. value: number;
  2301. /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */
  2302. isVertical: boolean;
  2303. /** Gets or sets a value indicating if the thumb can go over main bar extends */
  2304. isThumbClamped: boolean;
  2305. /**
  2306. * Creates a new BaseSlider
  2307. * @param name defines the control name
  2308. */
  2309. constructor(name?: string | undefined);
  2310. protected _getTypeName(): string;
  2311. protected _getThumbPosition(): number;
  2312. protected _getThumbThickness(type: string): number;
  2313. protected _prepareRenderingData(type: string): void;
  2314. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  2315. _onPointerMove(target: Control, coordinates: Vector2): void;
  2316. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  2317. }
  2318. }
  2319. declare module 'babylonjs-gui/2D/controls/slider' {
  2320. import { Measure } from "babylonjs-gui/2D/measure";
  2321. import { BaseSlider } from "babylonjs-gui/2D/controls/baseSlider";
  2322. /**
  2323. * Class used to create slider controls
  2324. */
  2325. export class Slider extends BaseSlider {
  2326. name?: string | undefined;
  2327. /** Gets or sets border color */
  2328. borderColor: string;
  2329. /** Gets or sets background color */
  2330. background: string;
  2331. /** Gets or sets a boolean indicating if the thumb should be round or square */
  2332. isThumbCircle: boolean;
  2333. /**
  2334. * Creates a new Slider
  2335. * @param name defines the control name
  2336. */
  2337. constructor(name?: string | undefined);
  2338. protected _getTypeName(): string;
  2339. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2340. }
  2341. }
  2342. declare module 'babylonjs-gui/2D/controls/imageBasedSlider' {
  2343. import { BaseSlider } from "babylonjs-gui/2D/controls/baseSlider";
  2344. import { Measure } from "babylonjs-gui/2D/measure";
  2345. import { Image } from "babylonjs-gui/2D/controls/image";
  2346. /**
  2347. * Class used to create slider controls based on images
  2348. */
  2349. export class ImageBasedSlider extends BaseSlider {
  2350. name?: string | undefined;
  2351. displayThumb: boolean;
  2352. /**
  2353. * Gets or sets the image used to render the background
  2354. */
  2355. backgroundImage: Image;
  2356. /**
  2357. * Gets or sets the image used to render the value bar
  2358. */
  2359. valueBarImage: Image;
  2360. /**
  2361. * Gets or sets the image used to render the thumb
  2362. */
  2363. thumbImage: Image;
  2364. /**
  2365. * Creates a new ImageBasedSlider
  2366. * @param name defines the control name
  2367. */
  2368. constructor(name?: string | undefined);
  2369. protected _getTypeName(): string;
  2370. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2371. }
  2372. }
  2373. declare module 'babylonjs-gui/2D/controls/statics' {
  2374. /**
  2375. * Forcing an export so that this code will execute
  2376. * @hidden
  2377. */
  2378. const name = "Statics";
  2379. export { name };
  2380. }
  2381. declare module 'babylonjs-gui/3D/controls/abstractButton3D' {
  2382. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2383. import { TransformNode, Scene } from "babylonjs";
  2384. /**
  2385. * Class used as a root to all buttons
  2386. */
  2387. export class AbstractButton3D extends Control3D {
  2388. /**
  2389. * Creates a new button
  2390. * @param name defines the control name
  2391. */
  2392. constructor(name?: string);
  2393. protected _getTypeName(): string;
  2394. protected _createNode(scene: Scene): TransformNode;
  2395. }
  2396. }
  2397. declare module 'babylonjs-gui/3D/controls/button3D' {
  2398. import { AbstractButton3D } from "babylonjs-gui/3D/controls/abstractButton3D";
  2399. import { Material, int, Scene, TransformNode, AbstractMesh } from "babylonjs";
  2400. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  2401. import { Control } from "babylonjs-gui/2D/controls/control";
  2402. /**
  2403. * Class used to create a button in 3D
  2404. */
  2405. export class Button3D extends AbstractButton3D {
  2406. /** @hidden */
  2407. protected _currentMaterial: Material;
  2408. /**
  2409. * Gets or sets the texture resolution used to render content (512 by default)
  2410. */
  2411. contentResolution: int;
  2412. /**
  2413. * Gets or sets the texture scale ratio used to render content (2 by default)
  2414. */
  2415. contentScaleRatio: number;
  2416. protected _disposeFacadeTexture(): void;
  2417. protected _resetContent(): void;
  2418. /**
  2419. * Creates a new button
  2420. * @param name defines the control name
  2421. */
  2422. constructor(name?: string);
  2423. /**
  2424. * Gets or sets the GUI 2D content used to display the button's facade
  2425. */
  2426. content: Control;
  2427. /**
  2428. * Apply the facade texture (created from the content property).
  2429. * This function can be overloaded by child classes
  2430. * @param facadeTexture defines the AdvancedDynamicTexture to use
  2431. */
  2432. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  2433. protected _getTypeName(): string;
  2434. protected _createNode(scene: Scene): TransformNode;
  2435. protected _affectMaterial(mesh: AbstractMesh): void;
  2436. /**
  2437. * Releases all associated resources
  2438. */
  2439. dispose(): void;
  2440. }
  2441. }
  2442. declare module 'babylonjs-gui/3D/controls/container3D' {
  2443. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2444. import { Scene, Nullable, TransformNode } from "babylonjs";
  2445. /**
  2446. * Class used to create containers for controls
  2447. */
  2448. export class Container3D extends Control3D {
  2449. /**
  2450. * Gets the list of child controls
  2451. */
  2452. protected _children: Control3D[];
  2453. /**
  2454. * Gets the list of child controls
  2455. */
  2456. readonly children: Array<Control3D>;
  2457. /**
  2458. * Gets or sets a boolean indicating if the layout must be blocked (default is false).
  2459. * This is helpful to optimize layout operation when adding multiple children in a row
  2460. */
  2461. blockLayout: boolean;
  2462. /**
  2463. * Creates a new container
  2464. * @param name defines the container name
  2465. */
  2466. constructor(name?: string);
  2467. /**
  2468. * Force the container to update the layout. Please note that it will not take blockLayout property in account
  2469. * @returns the current container
  2470. */
  2471. updateLayout(): Container3D;
  2472. /**
  2473. * Gets a boolean indicating if the given control is in the children of this control
  2474. * @param control defines the control to check
  2475. * @returns true if the control is in the child list
  2476. */
  2477. containsControl(control: Control3D): boolean;
  2478. /**
  2479. * Adds a control to the children of this control
  2480. * @param control defines the control to add
  2481. * @returns the current container
  2482. */
  2483. addControl(control: Control3D): Container3D;
  2484. /**
  2485. * This function will be called everytime a new control is added
  2486. */
  2487. protected _arrangeChildren(): void;
  2488. protected _createNode(scene: Scene): Nullable<TransformNode>;
  2489. /**
  2490. * Removes a control from the children of this control
  2491. * @param control defines the control to remove
  2492. * @returns the current container
  2493. */
  2494. removeControl(control: Control3D): Container3D;
  2495. protected _getTypeName(): string;
  2496. /**
  2497. * Releases all associated resources
  2498. */
  2499. dispose(): void;
  2500. /** Control rotation will remain unchanged */
  2501. static readonly UNSET_ORIENTATION: number;
  2502. /** Control will rotate to make it look at sphere central axis */
  2503. static readonly FACEORIGIN_ORIENTATION: number;
  2504. /** Control will rotate to make it look back at sphere central axis */
  2505. static readonly FACEORIGINREVERSED_ORIENTATION: number;
  2506. /** Control will rotate to look at z axis (0, 0, 1) */
  2507. static readonly FACEFORWARD_ORIENTATION: number;
  2508. /** Control will rotate to look at negative z axis (0, 0, -1) */
  2509. static readonly FACEFORWARDREVERSED_ORIENTATION: number;
  2510. }
  2511. }
  2512. declare module 'babylonjs-gui/3D/controls/control3D' {
  2513. import { IDisposable, IBehaviorAware, Nullable, TransformNode, Vector3, Observable, Behavior, AbstractMesh, Scene } from "babylonjs";
  2514. import { GUI3DManager } from "babylonjs-gui/3D/gui3DManager";
  2515. import { Vector3WithInfo } from "babylonjs-gui/3D/vector3WithInfo";
  2516. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  2517. /**
  2518. * Class used as base class for controls
  2519. */
  2520. export class Control3D implements IDisposable, IBehaviorAware<Control3D> {
  2521. /** Defines the control name */
  2522. name?: string | undefined;
  2523. /** @hidden */
  2524. _host: GUI3DManager;
  2525. /** Gets or sets the control position in world space */
  2526. position: Vector3;
  2527. /** Gets or sets the control scaling in world space */
  2528. scaling: Vector3;
  2529. /** Callback used to start pointer enter animation */
  2530. pointerEnterAnimation: () => void;
  2531. /** Callback used to start pointer out animation */
  2532. pointerOutAnimation: () => void;
  2533. /** Callback used to start pointer down animation */
  2534. pointerDownAnimation: () => void;
  2535. /** Callback used to start pointer up animation */
  2536. pointerUpAnimation: () => void;
  2537. /**
  2538. * An event triggered when the pointer move over the control
  2539. */
  2540. onPointerMoveObservable: Observable<Vector3>;
  2541. /**
  2542. * An event triggered when the pointer move out of the control
  2543. */
  2544. onPointerOutObservable: Observable<Control3D>;
  2545. /**
  2546. * An event triggered when the pointer taps the control
  2547. */
  2548. onPointerDownObservable: Observable<Vector3WithInfo>;
  2549. /**
  2550. * An event triggered when pointer is up
  2551. */
  2552. onPointerUpObservable: Observable<Vector3WithInfo>;
  2553. /**
  2554. * An event triggered when a control is clicked on (with a mouse)
  2555. */
  2556. onPointerClickObservable: Observable<Vector3WithInfo>;
  2557. /**
  2558. * An event triggered when pointer enters the control
  2559. */
  2560. onPointerEnterObservable: Observable<Control3D>;
  2561. /**
  2562. * Gets or sets the parent container
  2563. */
  2564. parent: Nullable<Container3D>;
  2565. /**
  2566. * Gets the list of attached behaviors
  2567. * @see http://doc.babylonjs.com/features/behaviour
  2568. */
  2569. readonly behaviors: Behavior<Control3D>[];
  2570. /**
  2571. * Attach a behavior to the control
  2572. * @see http://doc.babylonjs.com/features/behaviour
  2573. * @param behavior defines the behavior to attach
  2574. * @returns the current control
  2575. */
  2576. addBehavior(behavior: Behavior<Control3D>): Control3D;
  2577. /**
  2578. * Remove an attached behavior
  2579. * @see http://doc.babylonjs.com/features/behaviour
  2580. * @param behavior defines the behavior to attach
  2581. * @returns the current control
  2582. */
  2583. removeBehavior(behavior: Behavior<Control3D>): Control3D;
  2584. /**
  2585. * Gets an attached behavior by name
  2586. * @param name defines the name of the behavior to look for
  2587. * @see http://doc.babylonjs.com/features/behaviour
  2588. * @returns null if behavior was not found else the requested behavior
  2589. */
  2590. getBehaviorByName(name: string): Nullable<Behavior<Control3D>>;
  2591. /** Gets or sets a boolean indicating if the control is visible */
  2592. isVisible: boolean;
  2593. /**
  2594. * Creates a new control
  2595. * @param name defines the control name
  2596. */
  2597. constructor(
  2598. /** Defines the control name */
  2599. name?: string | undefined);
  2600. /**
  2601. * Gets a string representing the class name
  2602. */
  2603. readonly typeName: string;
  2604. protected _getTypeName(): string;
  2605. /**
  2606. * Gets the transform node used by this control
  2607. */
  2608. readonly node: Nullable<TransformNode>;
  2609. /**
  2610. * Gets the mesh used to render this control
  2611. */
  2612. readonly mesh: Nullable<AbstractMesh>;
  2613. /**
  2614. * Link the control as child of the given node
  2615. * @param node defines the node to link to. Use null to unlink the control
  2616. * @returns the current control
  2617. */
  2618. linkToTransformNode(node: Nullable<TransformNode>): Control3D;
  2619. /** @hidden **/
  2620. _prepareNode(scene: Scene): void;
  2621. /**
  2622. * Node creation.
  2623. * Can be overriden by children
  2624. * @param scene defines the scene where the node must be attached
  2625. * @returns the attached node or null if none. Must return a Mesh or AbstractMesh if there is an atttached visible object
  2626. */
  2627. protected _createNode(scene: Scene): Nullable<TransformNode>;
  2628. /**
  2629. * Affect a material to the given mesh
  2630. * @param mesh defines the mesh which will represent the control
  2631. */
  2632. protected _affectMaterial(mesh: AbstractMesh): void;
  2633. /** @hidden */
  2634. _onPointerMove(target: Control3D, coordinates: Vector3): void;
  2635. /** @hidden */
  2636. _onPointerEnter(target: Control3D): boolean;
  2637. /** @hidden */
  2638. _onPointerOut(target: Control3D): void;
  2639. /** @hidden */
  2640. _onPointerDown(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number): boolean;
  2641. /** @hidden */
  2642. _onPointerUp(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  2643. /** @hidden */
  2644. forcePointerUp(pointerId?: Nullable<number>): void;
  2645. /** @hidden */
  2646. _processObservables(type: number, pickedPoint: Vector3, pointerId: number, buttonIndex: number): boolean;
  2647. /** @hidden */
  2648. _disposeNode(): void;
  2649. /**
  2650. * Releases all associated resources
  2651. */
  2652. dispose(): void;
  2653. }
  2654. }
  2655. declare module 'babylonjs-gui/3D/controls/cylinderPanel' {
  2656. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  2657. import { float, Vector3 } from "babylonjs";
  2658. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2659. /**
  2660. * Class used to create a container panel deployed on the surface of a cylinder
  2661. */
  2662. export class CylinderPanel extends VolumeBasedPanel {
  2663. /**
  2664. * Gets or sets the radius of the cylinder where to project controls (5 by default)
  2665. */
  2666. radius: float;
  2667. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2668. }
  2669. }
  2670. declare module 'babylonjs-gui/3D/controls/holographicButton' {
  2671. import { Button3D } from "babylonjs-gui/3D/controls/button3D";
  2672. import { Mesh, StandardMaterial, Nullable, Scene, TransformNode } from "babylonjs";
  2673. import { FluentMaterial } from "babylonjs-gui/3D/materials/fluentMaterial";
  2674. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  2675. /**
  2676. * Class used to create a holographic button in 3D
  2677. */
  2678. export class HolographicButton extends Button3D {
  2679. /**
  2680. * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
  2681. */
  2682. tooltipText: Nullable<string>;
  2683. /**
  2684. * Gets or sets text for the button
  2685. */
  2686. text: string;
  2687. /**
  2688. * Gets or sets the image url for the button
  2689. */
  2690. imageUrl: string;
  2691. /**
  2692. * Gets the back material used by this button
  2693. */
  2694. readonly backMaterial: FluentMaterial;
  2695. /**
  2696. * Gets the front material used by this button
  2697. */
  2698. readonly frontMaterial: FluentMaterial;
  2699. /**
  2700. * Gets the plate material used by this button
  2701. */
  2702. readonly plateMaterial: StandardMaterial;
  2703. /**
  2704. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  2705. */
  2706. readonly shareMaterials: boolean;
  2707. /**
  2708. * Creates a new button
  2709. * @param name defines the control name
  2710. */
  2711. constructor(name?: string, shareMaterials?: boolean);
  2712. protected _getTypeName(): string;
  2713. protected _createNode(scene: Scene): TransformNode;
  2714. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  2715. protected _affectMaterial(mesh: Mesh): void;
  2716. /**
  2717. * Releases all associated resources
  2718. */
  2719. dispose(): void;
  2720. }
  2721. }
  2722. declare module 'babylonjs-gui/3D/controls/meshButton3D' {
  2723. import { Scene, TransformNode, AbstractMesh, Mesh } from "babylonjs";
  2724. import { Button3D } from "babylonjs-gui/3D/controls/button3D";
  2725. /**
  2726. * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene
  2727. */
  2728. export class MeshButton3D extends Button3D {
  2729. /** @hidden */
  2730. protected _currentMesh: Mesh;
  2731. /**
  2732. * Creates a new 3D button based on a mesh
  2733. * @param mesh mesh to become a 3D button
  2734. * @param name defines the control name
  2735. */
  2736. constructor(mesh: Mesh, name?: string);
  2737. protected _getTypeName(): string;
  2738. protected _createNode(scene: Scene): TransformNode;
  2739. protected _affectMaterial(mesh: AbstractMesh): void;
  2740. }
  2741. }
  2742. declare module 'babylonjs-gui/3D/controls/planePanel' {
  2743. import { Vector3 } from "babylonjs";
  2744. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2745. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  2746. /**
  2747. * Class used to create a container panel deployed on the surface of a plane
  2748. */
  2749. export class PlanePanel extends VolumeBasedPanel {
  2750. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2751. }
  2752. }
  2753. declare module 'babylonjs-gui/3D/controls/scatterPanel' {
  2754. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  2755. import { float, Vector3 } from "babylonjs";
  2756. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2757. /**
  2758. * Class used to create a container panel where items get randomized planar mapping
  2759. */
  2760. export class ScatterPanel extends VolumeBasedPanel {
  2761. /**
  2762. * Gets or sets the number of iteration to use to scatter the controls (100 by default)
  2763. */
  2764. iteration: float;
  2765. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2766. protected _finalProcessing(): void;
  2767. }
  2768. }
  2769. declare module 'babylonjs-gui/3D/controls/spherePanel' {
  2770. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  2771. import { float, Vector3 } from "babylonjs";
  2772. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2773. /**
  2774. * Class used to create a container panel deployed on the surface of a sphere
  2775. */
  2776. export class SpherePanel extends VolumeBasedPanel {
  2777. /**
  2778. * Gets or sets the radius of the sphere where to project controls (5 by default)
  2779. */
  2780. radius: float;
  2781. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2782. }
  2783. }
  2784. declare module 'babylonjs-gui/3D/controls/stackPanel3D' {
  2785. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  2786. /**
  2787. * Class used to create a stack panel in 3D on XY plane
  2788. */
  2789. export class StackPanel3D extends Container3D {
  2790. /**
  2791. * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)
  2792. */
  2793. isVertical: boolean;
  2794. /**
  2795. * Gets or sets the distance between elements
  2796. */
  2797. margin: number;
  2798. /**
  2799. * Creates new StackPanel
  2800. * @param isVertical
  2801. */
  2802. constructor(isVertical?: boolean);
  2803. protected _arrangeChildren(): void;
  2804. }
  2805. }
  2806. declare module 'babylonjs-gui/3D/controls/volumeBasedPanel' {
  2807. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  2808. import { int, Vector3 } from "babylonjs";
  2809. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2810. /**
  2811. * Abstract class used to create a container panel deployed on the surface of a volume
  2812. */
  2813. export abstract class VolumeBasedPanel extends Container3D {
  2814. protected _cellWidth: number;
  2815. protected _cellHeight: number;
  2816. /**
  2817. * Gets or sets the distance between elements
  2818. */
  2819. margin: number;
  2820. /**
  2821. * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)
  2822. * | Value | Type | Description |
  2823. * | ----- | ----------------------------------- | ----------- |
  2824. * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |
  2825. * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |
  2826. * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |
  2827. * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |
  2828. * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |
  2829. */
  2830. orientation: number;
  2831. /**
  2832. * Gets or sets the number of columns requested (10 by default).
  2833. * The panel will automatically compute the number of rows based on number of child controls.
  2834. */
  2835. columns: int;
  2836. /**
  2837. * Gets or sets a the number of rows requested.
  2838. * The panel will automatically compute the number of columns based on number of child controls.
  2839. */
  2840. rows: int;
  2841. /**
  2842. * Creates new VolumeBasedPanel
  2843. */
  2844. constructor();
  2845. protected _arrangeChildren(): void;
  2846. /** Child classes must implement this function to provide correct control positioning */
  2847. protected abstract _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2848. /** Child classes can implement this function to provide additional processing */
  2849. protected _finalProcessing(): void;
  2850. }
  2851. }
  2852. declare module 'babylonjs-gui/3D/materials/fluentMaterial' {
  2853. import { MaterialDefines, PushMaterial, Color3, Color4, Vector3, Scene, Nullable, BaseTexture, AbstractMesh, SubMesh, Matrix, Mesh } from "babylonjs";
  2854. /** @hidden */
  2855. export class FluentMaterialDefines extends MaterialDefines {
  2856. INNERGLOW: boolean;
  2857. BORDER: boolean;
  2858. HOVERLIGHT: boolean;
  2859. TEXTURE: boolean;
  2860. constructor();
  2861. }
  2862. /**
  2863. * Class used to render controls with fluent desgin
  2864. */
  2865. export class FluentMaterial extends PushMaterial {
  2866. /**
  2867. * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)
  2868. */
  2869. innerGlowColorIntensity: number;
  2870. /**
  2871. * Gets or sets the inner glow color (white by default)
  2872. */
  2873. innerGlowColor: Color3;
  2874. /**
  2875. * Gets or sets alpha value (default is 1.0)
  2876. */
  2877. alpha: number;
  2878. /**
  2879. * Gets or sets the albedo color (Default is Color3(0.3, 0.35, 0.4))
  2880. */
  2881. albedoColor: Color3;
  2882. /**
  2883. * Gets or sets a boolean indicating if borders must be rendered (default is false)
  2884. */
  2885. renderBorders: boolean;
  2886. /**
  2887. * Gets or sets border width (default is 0.5)
  2888. */
  2889. borderWidth: number;
  2890. /**
  2891. * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)
  2892. */
  2893. edgeSmoothingValue: number;
  2894. /**
  2895. * Gets or sets the minimum value that can be applied to border width (default is 0.1)
  2896. */
  2897. borderMinValue: number;
  2898. /**
  2899. * Gets or sets a boolean indicating if hover light must be rendered (default is false)
  2900. */
  2901. renderHoverLight: boolean;
  2902. /**
  2903. * Gets or sets the radius used to render the hover light (default is 1.0)
  2904. */
  2905. hoverRadius: number;
  2906. /**
  2907. * Gets or sets the color used to render the hover light (default is Color4(0.3, 0.3, 0.3, 1.0))
  2908. */
  2909. hoverColor: Color4;
  2910. /**
  2911. * Gets or sets the hover light position in world space (default is Vector3.Zero())
  2912. */
  2913. hoverPosition: Vector3;
  2914. /** Gets or sets the texture to use for albedo color */
  2915. albedoTexture: Nullable<BaseTexture>;
  2916. /**
  2917. * Creates a new Fluent material
  2918. * @param name defines the name of the material
  2919. * @param scene defines the hosting scene
  2920. */
  2921. constructor(name: string, scene: Scene);
  2922. needAlphaBlending(): boolean;
  2923. needAlphaTesting(): boolean;
  2924. getAlphaTestTexture(): Nullable<BaseTexture>;
  2925. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  2926. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  2927. getActiveTextures(): BaseTexture[];
  2928. hasTexture(texture: BaseTexture): boolean;
  2929. dispose(forceDisposeEffect?: boolean): void;
  2930. clone(name: string): FluentMaterial;
  2931. serialize(): any;
  2932. getClassName(): string;
  2933. static Parse(source: any, scene: Scene, rootUrl: string): FluentMaterial;
  2934. }
  2935. }
  2936. /*BabylonJS GUI*/
  2937. // Dependencies for this module:
  2938. // ../../../../Tools/Gulp/babylonjs
  2939. declare module BABYLON.GUI {
  2940. }
  2941. declare module BABYLON.GUI {
  2942. }
  2943. declare module BABYLON.GUI {
  2944. }
  2945. declare module BABYLON.GUI {
  2946. }
  2947. declare module BABYLON.GUI {
  2948. /**
  2949. * Interface used to define a control that can receive focus
  2950. */
  2951. export interface IFocusableControl {
  2952. /**
  2953. * Function called when the control receives the focus
  2954. */
  2955. onFocus(): void;
  2956. /**
  2957. * Function called when the control loses the focus
  2958. */
  2959. onBlur(): void;
  2960. /**
  2961. * Function called to let the control handle keyboard events
  2962. * @param evt defines the current keyboard event
  2963. */
  2964. processKeyboard(evt: KeyboardEvent): void;
  2965. /**
  2966. * Function called to get the list of controls that should not steal the focus from this control
  2967. * @returns an array of controls
  2968. */
  2969. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  2970. }
  2971. /**
  2972. * Class used to create texture to support 2D GUI elements
  2973. * @see http://doc.babylonjs.com/how_to/gui
  2974. */
  2975. export class AdvancedDynamicTexture extends BABYLON.DynamicTexture {
  2976. /** @hidden */
  2977. _rootContainer: Container;
  2978. /** @hidden */
  2979. _lastPickedControl: Control;
  2980. /** @hidden */
  2981. _lastControlOver: {
  2982. [pointerId: number]: Control;
  2983. };
  2984. /** @hidden */
  2985. _lastControlDown: {
  2986. [pointerId: number]: Control;
  2987. };
  2988. /** @hidden */
  2989. _capturingControl: {
  2990. [pointerId: number]: Control;
  2991. };
  2992. /** @hidden */
  2993. _shouldBlockPointer: boolean;
  2994. /** @hidden */
  2995. _layerToDispose: BABYLON.Nullable<BABYLON.Layer>;
  2996. /** @hidden */
  2997. _linkedControls: Control[];
  2998. /**
  2999. * BABYLON.Observable event triggered each time an clipboard event is received from the rendering canvas
  3000. */
  3001. onClipboardObservable: BABYLON.Observable<BABYLON.ClipboardInfo>;
  3002. /**
  3003. * Gets or sets a boolean defining if alpha is stored as premultiplied
  3004. */
  3005. premulAlpha: boolean;
  3006. /**
  3007. * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
  3008. * Useful when you want more antialiasing
  3009. */
  3010. renderScale: number;
  3011. /** Gets or sets the background color */
  3012. background: string;
  3013. /**
  3014. * Gets or sets the ideal width used to design controls.
  3015. * The GUI will then rescale everything accordingly
  3016. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  3017. */
  3018. idealWidth: number;
  3019. /**
  3020. * Gets or sets the ideal height used to design controls.
  3021. * The GUI will then rescale everything accordingly
  3022. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  3023. */
  3024. idealHeight: number;
  3025. /**
  3026. * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
  3027. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  3028. */
  3029. useSmallestIdeal: boolean;
  3030. /**
  3031. * Gets or sets a boolean indicating if adaptive scaling must be used
  3032. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  3033. */
  3034. renderAtIdealSize: boolean;
  3035. /**
  3036. * Gets the underlying layer used to render the texture when in fullscreen mode
  3037. */
  3038. readonly layer: BABYLON.Nullable<BABYLON.Layer>;
  3039. /**
  3040. * Gets the root container control
  3041. */
  3042. readonly rootContainer: Container;
  3043. /**
  3044. * Gets or sets the current focused control
  3045. */
  3046. focusedControl: BABYLON.Nullable<IFocusableControl>;
  3047. /**
  3048. * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
  3049. */
  3050. isForeground: boolean;
  3051. /**
  3052. * Gets or set information about clipboardData
  3053. */
  3054. clipboardData: string;
  3055. /**
  3056. * Creates a new AdvancedDynamicTexture
  3057. * @param name defines the name of the texture
  3058. * @param width defines the width of the texture
  3059. * @param height defines the height of the texture
  3060. * @param scene defines the hosting scene
  3061. * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
  3062. * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
  3063. */
  3064. constructor(name: string, width: number | undefined, height: number | undefined, scene: BABYLON.Nullable<BABYLON.Scene>, generateMipMaps?: boolean, samplingMode?: number);
  3065. /**
  3066. * Function used to execute a function on all controls
  3067. * @param func defines the function to execute
  3068. * @param container defines the container where controls belong. If null the root container will be used
  3069. */
  3070. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  3071. /**
  3072. * Marks the texture as dirty forcing a complete update
  3073. */
  3074. markAsDirty(): void;
  3075. /**
  3076. * Helper function used to create a new style
  3077. * @returns a new style
  3078. * @see http://doc.babylonjs.com/how_to/gui#styles
  3079. */
  3080. createStyle(): Style;
  3081. /**
  3082. * Adds a new control to the root container
  3083. * @param control defines the control to add
  3084. * @returns the current texture
  3085. */
  3086. addControl(control: Control): AdvancedDynamicTexture;
  3087. /**
  3088. * Removes a control from the root container
  3089. * @param control defines the control to remove
  3090. * @returns the current texture
  3091. */
  3092. removeControl(control: Control): AdvancedDynamicTexture;
  3093. /**
  3094. * Release all resources
  3095. */
  3096. dispose(): void;
  3097. /** @hidden */
  3098. _getGlobalViewport(scene: BABYLON.Scene): BABYLON.Viewport;
  3099. /**
  3100. * Get screen coordinates for a vector3
  3101. * @param position defines the position to project
  3102. * @param worldMatrix defines the world matrix to use
  3103. * @returns the projected position
  3104. */
  3105. getProjectedPosition(position: BABYLON.Vector3, worldMatrix: BABYLON.Matrix): BABYLON.Vector2;
  3106. /** @hidden */
  3107. _changeCursor(cursor: string): void;
  3108. /** @hidden */
  3109. _cleanControlAfterRemovalFromList(list: {
  3110. [pointerId: number]: Control;
  3111. }, control: Control): void;
  3112. /** @hidden */
  3113. _cleanControlAfterRemoval(control: Control): void;
  3114. /** Attach to all scene events required to support pointer events */
  3115. attach(): void;
  3116. /**
  3117. * Register the clipboard Events onto the canvas
  3118. */
  3119. registerClipboardEvents(): void;
  3120. /**
  3121. * Unregister the clipboard Events from the canvas
  3122. */
  3123. unRegisterClipboardEvents(): void;
  3124. /**
  3125. * Connect the texture to a hosting mesh to enable interactions
  3126. * @param mesh defines the mesh to attach to
  3127. * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
  3128. */
  3129. attachToMesh(mesh: BABYLON.AbstractMesh, supportPointerMove?: boolean): void;
  3130. /**
  3131. * Move the focus to a specific control
  3132. * @param control defines the control which will receive the focus
  3133. */
  3134. moveFocusToControl(control: IFocusableControl): void;
  3135. /**
  3136. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
  3137. * @param mesh defines the mesh which will receive the texture
  3138. * @param width defines the texture width (1024 by default)
  3139. * @param height defines the texture height (1024 by default)
  3140. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  3141. * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)
  3142. * @returns a new AdvancedDynamicTexture
  3143. */
  3144. static CreateForMesh(mesh: BABYLON.AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, onlyAlphaTesting?: boolean): AdvancedDynamicTexture;
  3145. /**
  3146. * Creates a new AdvancedDynamicTexture in fullscreen mode.
  3147. * In this mode the texture will rely on a layer for its rendering.
  3148. * This allows it to be treated like any other layer.
  3149. * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
  3150. * LayerMask is set through advancedTexture.layer.layerMask
  3151. * @param name defines name for the texture
  3152. * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
  3153. * @param scene defines the hsoting scene
  3154. * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
  3155. * @returns a new AdvancedDynamicTexture
  3156. */
  3157. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: BABYLON.Nullable<BABYLON.Scene>, sampling?: number): AdvancedDynamicTexture;
  3158. }
  3159. }
  3160. declare module BABYLON.GUI {
  3161. /**
  3162. * Class used to transport BABYLON.Vector2 information for pointer events
  3163. */
  3164. export class Vector2WithInfo extends BABYLON.Vector2 {
  3165. /** defines the current mouse button index */
  3166. buttonIndex: number;
  3167. /**
  3168. * Creates a new Vector2WithInfo
  3169. * @param source defines the vector2 data to transport
  3170. * @param buttonIndex defines the current mouse button index
  3171. */
  3172. constructor(source: BABYLON.Vector2,
  3173. /** defines the current mouse button index */
  3174. buttonIndex?: number);
  3175. }
  3176. /** Class used to provide 2D matrix features */
  3177. export class Matrix2D {
  3178. /** Gets the internal array of 6 floats used to store matrix data */
  3179. m: Float32Array;
  3180. /**
  3181. * Creates a new matrix
  3182. * @param m00 defines value for (0, 0)
  3183. * @param m01 defines value for (0, 1)
  3184. * @param m10 defines value for (1, 0)
  3185. * @param m11 defines value for (1, 1)
  3186. * @param m20 defines value for (2, 0)
  3187. * @param m21 defines value for (2, 1)
  3188. */
  3189. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  3190. /**
  3191. * Fills the matrix from direct values
  3192. * @param m00 defines value for (0, 0)
  3193. * @param m01 defines value for (0, 1)
  3194. * @param m10 defines value for (1, 0)
  3195. * @param m11 defines value for (1, 1)
  3196. * @param m20 defines value for (2, 0)
  3197. * @param m21 defines value for (2, 1)
  3198. * @returns the current modified matrix
  3199. */
  3200. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  3201. /**
  3202. * Gets matrix determinant
  3203. * @returns the determinant
  3204. */
  3205. determinant(): number;
  3206. /**
  3207. * Inverses the matrix and stores it in a target matrix
  3208. * @param result defines the target matrix
  3209. * @returns the current matrix
  3210. */
  3211. invertToRef(result: Matrix2D): Matrix2D;
  3212. /**
  3213. * Multiplies the current matrix with another one
  3214. * @param other defines the second operand
  3215. * @param result defines the target matrix
  3216. * @returns the current matrix
  3217. */
  3218. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  3219. /**
  3220. * Applies the current matrix to a set of 2 floats and stores the result in a vector2
  3221. * @param x defines the x coordinate to transform
  3222. * @param y defines the x coordinate to transform
  3223. * @param result defines the target vector2
  3224. * @returns the current matrix
  3225. */
  3226. transformCoordinates(x: number, y: number, result: BABYLON.Vector2): Matrix2D;
  3227. /**
  3228. * Creates an identity matrix
  3229. * @returns a new matrix
  3230. */
  3231. static Identity(): Matrix2D;
  3232. /**
  3233. * Creates a translation matrix and stores it in a target matrix
  3234. * @param x defines the x coordinate of the translation
  3235. * @param y defines the y coordinate of the translation
  3236. * @param result defines the target matrix
  3237. */
  3238. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  3239. /**
  3240. * Creates a scaling matrix and stores it in a target matrix
  3241. * @param x defines the x coordinate of the scaling
  3242. * @param y defines the y coordinate of the scaling
  3243. * @param result defines the target matrix
  3244. */
  3245. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  3246. /**
  3247. * Creates a rotation matrix and stores it in a target matrix
  3248. * @param angle defines the rotation angle
  3249. * @param result defines the target matrix
  3250. */
  3251. static RotationToRef(angle: number, result: Matrix2D): void;
  3252. /**
  3253. * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
  3254. * @param tx defines the x coordinate of the translation
  3255. * @param ty defines the y coordinate of the translation
  3256. * @param angle defines the rotation angle
  3257. * @param scaleX defines the x coordinate of the scaling
  3258. * @param scaleY defines the y coordinate of the scaling
  3259. * @param parentMatrix defines the parent matrix to multiply by (can be null)
  3260. * @param result defines the target matrix
  3261. */
  3262. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: BABYLON.Nullable<Matrix2D>, result: Matrix2D): void;
  3263. }
  3264. }
  3265. declare module BABYLON.GUI {
  3266. /**
  3267. * Class used to store 2D control sizes
  3268. */
  3269. export class Measure {
  3270. /** defines left coordinate */
  3271. left: number;
  3272. /** defines top coordinate */
  3273. top: number;
  3274. /** defines width dimension */
  3275. width: number;
  3276. /** defines height dimension */
  3277. height: number;
  3278. /**
  3279. * Creates a new measure
  3280. * @param left defines left coordinate
  3281. * @param top defines top coordinate
  3282. * @param width defines width dimension
  3283. * @param height defines height dimension
  3284. */
  3285. constructor(
  3286. /** defines left coordinate */
  3287. left: number,
  3288. /** defines top coordinate */
  3289. top: number,
  3290. /** defines width dimension */
  3291. width: number,
  3292. /** defines height dimension */
  3293. height: number);
  3294. /**
  3295. * Copy from another measure
  3296. * @param other defines the other measure to copy from
  3297. */
  3298. copyFrom(other: Measure): void;
  3299. /**
  3300. * Copy from a group of 4 floats
  3301. * @param left defines left coordinate
  3302. * @param top defines top coordinate
  3303. * @param width defines width dimension
  3304. * @param height defines height dimension
  3305. */
  3306. copyFromFloats(left: number, top: number, width: number, height: number): void;
  3307. /**
  3308. * Check equality between this measure and another one
  3309. * @param other defines the other measures
  3310. * @returns true if both measures are equals
  3311. */
  3312. isEqualsTo(other: Measure): boolean;
  3313. /**
  3314. * Creates an empty measure
  3315. * @returns a new measure
  3316. */
  3317. static Empty(): Measure;
  3318. }
  3319. }
  3320. declare module BABYLON.GUI {
  3321. /**
  3322. * Class used to store a point for a MultiLine object.
  3323. * The point can be pure 2D coordinates, a mesh or a control
  3324. */
  3325. export class MultiLinePoint {
  3326. /** @hidden */
  3327. _point: BABYLON.Vector2;
  3328. /**
  3329. * Creates a new MultiLinePoint
  3330. * @param multiLine defines the source MultiLine object
  3331. */
  3332. constructor(multiLine: MultiLine);
  3333. /** Gets or sets x coordinate */
  3334. x: string | number;
  3335. /** Gets or sets y coordinate */
  3336. y: string | number;
  3337. /** Gets or sets the control associated with this point */
  3338. control: BABYLON.Nullable<Control>;
  3339. /** Gets or sets the mesh associated with this point */
  3340. mesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  3341. /** Resets links */
  3342. resetLinks(): void;
  3343. /**
  3344. * Gets a translation vector
  3345. * @returns the translation vector
  3346. */
  3347. translate(): BABYLON.Vector2;
  3348. /** Release associated resources */
  3349. dispose(): void;
  3350. }
  3351. }
  3352. declare module BABYLON.GUI {
  3353. /**
  3354. * Define a style used by control to automatically setup properties based on a template.
  3355. * Only support font related properties so far
  3356. */
  3357. export class Style implements BABYLON.IDisposable {
  3358. /** @hidden */
  3359. _host: AdvancedDynamicTexture;
  3360. /** @hidden */
  3361. _fontSize: ValueAndUnit;
  3362. /**
  3363. * BABYLON.Observable raised when the style values are changed
  3364. */
  3365. onChangedObservable: BABYLON.Observable<Style>;
  3366. /**
  3367. * Creates a new style object
  3368. * @param host defines the AdvancedDynamicTexture which hosts this style
  3369. */
  3370. constructor(host: AdvancedDynamicTexture);
  3371. /**
  3372. * Gets or sets the font size
  3373. */
  3374. fontSize: string | number;
  3375. /**
  3376. * Gets or sets the font family
  3377. */
  3378. fontFamily: string;
  3379. /**
  3380. * Gets or sets the font style
  3381. */
  3382. fontStyle: string;
  3383. /** Gets or sets font weight */
  3384. fontWeight: string;
  3385. /** Dispose all associated resources */
  3386. dispose(): void;
  3387. }
  3388. }
  3389. declare module BABYLON.GUI {
  3390. /**
  3391. * Class used to specific a value and its associated unit
  3392. */
  3393. export class ValueAndUnit {
  3394. /** defines the unit to store */
  3395. unit: number;
  3396. /** defines a boolean indicating if the value can be negative */
  3397. negativeValueAllowed: boolean;
  3398. /**
  3399. * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
  3400. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  3401. */
  3402. ignoreAdaptiveScaling: boolean;
  3403. /**
  3404. * Creates a new ValueAndUnit
  3405. * @param value defines the value to store
  3406. * @param unit defines the unit to store
  3407. * @param negativeValueAllowed defines a boolean indicating if the value can be negative
  3408. */
  3409. constructor(value: number,
  3410. /** defines the unit to store */
  3411. unit?: number,
  3412. /** defines a boolean indicating if the value can be negative */
  3413. negativeValueAllowed?: boolean);
  3414. /** Gets a boolean indicating if the value is a percentage */
  3415. readonly isPercentage: boolean;
  3416. /** Gets a boolean indicating if the value is store as pixel */
  3417. readonly isPixel: boolean;
  3418. /** Gets direct internal value */
  3419. readonly internalValue: number;
  3420. /**
  3421. * Gets value as pixel
  3422. * @param host defines the root host
  3423. * @param refValue defines the reference value for percentages
  3424. * @returns the value as pixel
  3425. */
  3426. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  3427. /**
  3428. * Gets the value accordingly to its unit
  3429. * @param host defines the root host
  3430. * @returns the value
  3431. */
  3432. getValue(host: AdvancedDynamicTexture): number;
  3433. /**
  3434. * Gets a string representation of the value
  3435. * @param host defines the root host
  3436. * @returns a string
  3437. */
  3438. toString(host: AdvancedDynamicTexture): string;
  3439. /**
  3440. * Store a value parsed from a string
  3441. * @param source defines the source string
  3442. * @returns true if the value was successfully parsed
  3443. */
  3444. fromString(source: string | number): boolean;
  3445. /** UNITMODE_PERCENTAGE */
  3446. static readonly UNITMODE_PERCENTAGE: number;
  3447. /** UNITMODE_PIXEL */
  3448. static readonly UNITMODE_PIXEL: number;
  3449. }
  3450. }
  3451. declare module BABYLON.GUI {
  3452. }
  3453. declare module BABYLON.GUI {
  3454. }
  3455. declare module BABYLON.GUI {
  3456. /**
  3457. * Class used to manage 3D user interface
  3458. * @see http://doc.babylonjs.com/how_to/gui3d
  3459. */
  3460. export class GUI3DManager implements BABYLON.IDisposable {
  3461. /** @hidden */
  3462. _lastPickedControl: Control3D;
  3463. /** @hidden */
  3464. _lastControlOver: {
  3465. [pointerId: number]: Control3D;
  3466. };
  3467. /** @hidden */
  3468. _lastControlDown: {
  3469. [pointerId: number]: Control3D;
  3470. };
  3471. /**
  3472. * BABYLON.Observable raised when the point picked by the pointer events changed
  3473. */
  3474. onPickedPointChangedObservable: BABYLON.Observable<BABYLON.Nullable<BABYLON.Vector3>>;
  3475. /** @hidden */
  3476. _sharedMaterials: {
  3477. [key: string]: BABYLON.Material;
  3478. };
  3479. /** Gets the hosting scene */
  3480. readonly scene: BABYLON.Scene;
  3481. /** Gets associated utility layer */
  3482. readonly utilityLayer: BABYLON.Nullable<BABYLON.UtilityLayerRenderer>;
  3483. /**
  3484. * Creates a new GUI3DManager
  3485. * @param scene
  3486. */
  3487. constructor(scene?: BABYLON.Scene);
  3488. /**
  3489. * Gets the root container
  3490. */
  3491. readonly rootContainer: Container3D;
  3492. /**
  3493. * Gets a boolean indicating if the given control is in the root child list
  3494. * @param control defines the control to check
  3495. * @returns true if the control is in the root child list
  3496. */
  3497. containsControl(control: Control3D): boolean;
  3498. /**
  3499. * Adds a control to the root child list
  3500. * @param control defines the control to add
  3501. * @returns the current manager
  3502. */
  3503. addControl(control: Control3D): GUI3DManager;
  3504. /**
  3505. * Removes a control from the root child list
  3506. * @param control defines the control to remove
  3507. * @returns the current container
  3508. */
  3509. removeControl(control: Control3D): GUI3DManager;
  3510. /**
  3511. * Releases all associated resources
  3512. */
  3513. dispose(): void;
  3514. }
  3515. }
  3516. declare module BABYLON.GUI {
  3517. /**
  3518. * Class used to transport BABYLON.Vector3 information for pointer events
  3519. */
  3520. export class Vector3WithInfo extends BABYLON.Vector3 {
  3521. /** defines the current mouse button index */
  3522. buttonIndex: number;
  3523. /**
  3524. * Creates a new Vector3WithInfo
  3525. * @param source defines the vector3 data to transport
  3526. * @param buttonIndex defines the current mouse button index
  3527. */
  3528. constructor(source: BABYLON.Vector3,
  3529. /** defines the current mouse button index */
  3530. buttonIndex?: number);
  3531. }
  3532. }
  3533. declare module BABYLON.GUI {
  3534. /**
  3535. * Class used to create 2D buttons
  3536. */
  3537. export class Button extends Rectangle {
  3538. name?: string | undefined;
  3539. /**
  3540. * Function called to generate a pointer enter animation
  3541. */
  3542. pointerEnterAnimation: () => void;
  3543. /**
  3544. * Function called to generate a pointer out animation
  3545. */
  3546. pointerOutAnimation: () => void;
  3547. /**
  3548. * Function called to generate a pointer down animation
  3549. */
  3550. pointerDownAnimation: () => void;
  3551. /**
  3552. * Function called to generate a pointer up animation
  3553. */
  3554. pointerUpAnimation: () => void;
  3555. /**
  3556. * Returns the image part of the button (if any)
  3557. */
  3558. readonly image: BABYLON.Nullable<Image>;
  3559. /**
  3560. * Returns the image part of the button (if any)
  3561. */
  3562. readonly textBlock: BABYLON.Nullable<TextBlock>;
  3563. /**
  3564. * Creates a new Button
  3565. * @param name defines the name of the button
  3566. */
  3567. constructor(name?: string | undefined);
  3568. protected _getTypeName(): string;
  3569. /** @hidden */
  3570. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  3571. /** @hidden */
  3572. _onPointerEnter(target: Control): boolean;
  3573. /** @hidden */
  3574. _onPointerOut(target: Control): void;
  3575. /** @hidden */
  3576. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3577. /** @hidden */
  3578. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  3579. /**
  3580. * Creates a new button made with an image and a text
  3581. * @param name defines the name of the button
  3582. * @param text defines the text of the button
  3583. * @param imageUrl defines the url of the image
  3584. * @returns a new Button
  3585. */
  3586. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  3587. /**
  3588. * Creates a new button made with an image
  3589. * @param name defines the name of the button
  3590. * @param imageUrl defines the url of the image
  3591. * @returns a new Button
  3592. */
  3593. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  3594. /**
  3595. * Creates a new button made with a text
  3596. * @param name defines the name of the button
  3597. * @param text defines the text of the button
  3598. * @returns a new Button
  3599. */
  3600. static CreateSimpleButton(name: string, text: string): Button;
  3601. /**
  3602. * Creates a new button made with an image and a centered text
  3603. * @param name defines the name of the button
  3604. * @param text defines the text of the button
  3605. * @param imageUrl defines the url of the image
  3606. * @returns a new Button
  3607. */
  3608. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  3609. }
  3610. }
  3611. declare module BABYLON.GUI {
  3612. /**
  3613. * Class used to represent a 2D checkbox
  3614. */
  3615. export class Checkbox extends Control {
  3616. name?: string | undefined;
  3617. /** Gets or sets border thickness */
  3618. thickness: number;
  3619. /**
  3620. * BABYLON.Observable raised when isChecked property changes
  3621. */
  3622. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  3623. /** Gets or sets a value indicating the ratio between overall size and check size */
  3624. checkSizeRatio: number;
  3625. /** Gets or sets background color */
  3626. background: string;
  3627. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  3628. isChecked: boolean;
  3629. /**
  3630. * Creates a new CheckBox
  3631. * @param name defines the control name
  3632. */
  3633. constructor(name?: string | undefined);
  3634. protected _getTypeName(): string;
  3635. /** @hidden */
  3636. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3637. /** @hidden */
  3638. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3639. /**
  3640. * Utility function to easily create a checkbox with a header
  3641. * @param title defines the label to use for the header
  3642. * @param onValueChanged defines the callback to call when value changes
  3643. * @returns a StackPanel containing the checkbox and a textBlock
  3644. */
  3645. static AddCheckBoxWithHeader(title: string, onValueChanged: (value: boolean) => void): StackPanel;
  3646. }
  3647. }
  3648. declare module BABYLON.GUI {
  3649. /** Class used to create color pickers */
  3650. export class ColorPicker extends Control {
  3651. name?: string | undefined;
  3652. /**
  3653. * BABYLON.Observable raised when the value changes
  3654. */
  3655. onValueChangedObservable: BABYLON.Observable<BABYLON.Color3>;
  3656. /** Gets or sets the color of the color picker */
  3657. value: BABYLON.Color3;
  3658. /** Gets or sets control width */
  3659. width: string | number;
  3660. /** Gets or sets control height */
  3661. height: string | number;
  3662. /** Gets or sets control size */
  3663. size: string | number;
  3664. /**
  3665. * Creates a new ColorPicker
  3666. * @param name defines the control name
  3667. */
  3668. constructor(name?: string | undefined);
  3669. protected _getTypeName(): string;
  3670. /** @hidden */
  3671. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3672. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3673. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  3674. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  3675. }
  3676. }
  3677. declare module BABYLON.GUI {
  3678. /**
  3679. * Root class for 2D containers
  3680. * @see http://doc.babylonjs.com/how_to/gui#containers
  3681. */
  3682. export class Container extends Control {
  3683. name?: string | undefined;
  3684. /** @hidden */
  3685. protected _children: Control[];
  3686. /** @hidden */
  3687. protected _measureForChildren: Measure;
  3688. /** @hidden */
  3689. protected _background: string;
  3690. /** @hidden */
  3691. protected _adaptWidthToChildren: boolean;
  3692. /** @hidden */
  3693. protected _adaptHeightToChildren: boolean;
  3694. /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
  3695. adaptHeightToChildren: boolean;
  3696. /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
  3697. adaptWidthToChildren: boolean;
  3698. /** Gets or sets background color */
  3699. background: string;
  3700. /** Gets the list of children */
  3701. readonly children: Control[];
  3702. /**
  3703. * Creates a new Container
  3704. * @param name defines the name of the container
  3705. */
  3706. constructor(name?: string | undefined);
  3707. protected _getTypeName(): string;
  3708. _flagDescendantsAsMatrixDirty(): void;
  3709. /**
  3710. * Gets a child using its name
  3711. * @param name defines the child name to look for
  3712. * @returns the child control if found
  3713. */
  3714. getChildByName(name: string): BABYLON.Nullable<Control>;
  3715. /**
  3716. * Gets a child using its type and its name
  3717. * @param name defines the child name to look for
  3718. * @param type defines the child type to look for
  3719. * @returns the child control if found
  3720. */
  3721. getChildByType(name: string, type: string): BABYLON.Nullable<Control>;
  3722. /**
  3723. * Search for a specific control in children
  3724. * @param control defines the control to look for
  3725. * @returns true if the control is in child list
  3726. */
  3727. containsControl(control: Control): boolean;
  3728. /**
  3729. * Adds a new control to the current container
  3730. * @param control defines the control to add
  3731. * @returns the current container
  3732. */
  3733. addControl(control: BABYLON.Nullable<Control>): Container;
  3734. /**
  3735. * Removes all controls from the current container
  3736. * @returns the current container
  3737. */
  3738. clearControls(): Container;
  3739. /**
  3740. * Removes a control from the current container
  3741. * @param control defines the control to remove
  3742. * @returns the current container
  3743. */
  3744. removeControl(control: Control): Container;
  3745. /** @hidden */
  3746. _reOrderControl(control: Control): void;
  3747. /** @hidden */
  3748. _markAllAsDirty(): void;
  3749. /** @hidden */
  3750. protected _localDraw(context: CanvasRenderingContext2D): void;
  3751. /** @hidden */
  3752. _link(root: BABYLON.Nullable<Container>, host: AdvancedDynamicTexture): void;
  3753. /** @hidden */
  3754. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3755. /** @hidden */
  3756. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  3757. /** @hidden */
  3758. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  3759. /** @hidden */
  3760. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3761. /** Releases associated resources */
  3762. dispose(): void;
  3763. }
  3764. }
  3765. declare module BABYLON.GUI {
  3766. /**
  3767. * Root class used for all 2D controls
  3768. * @see http://doc.babylonjs.com/how_to/gui#controls
  3769. */
  3770. export class Control {
  3771. /** defines the name of the control */
  3772. name?: string | undefined;
  3773. /**
  3774. * Gets or sets a boolean indicating if alpha must be an inherited value (false by default)
  3775. */
  3776. static AllowAlphaInheritance: boolean;
  3777. /** @hidden */
  3778. _root: BABYLON.Nullable<Container>;
  3779. /** @hidden */
  3780. _host: AdvancedDynamicTexture;
  3781. /** Gets or sets the control parent */
  3782. parent: BABYLON.Nullable<Container>;
  3783. /** @hidden */
  3784. _currentMeasure: Measure;
  3785. /** @hidden */
  3786. _width: ValueAndUnit;
  3787. /** @hidden */
  3788. _height: ValueAndUnit;
  3789. /** @hidden */
  3790. protected _fontOffset: {
  3791. ascent: number;
  3792. height: number;
  3793. descent: number;
  3794. };
  3795. /** @hidden */
  3796. protected _horizontalAlignment: number;
  3797. /** @hidden */
  3798. protected _verticalAlignment: number;
  3799. /** @hidden */
  3800. _tempParentMeasure: Measure;
  3801. /** @hidden */
  3802. protected _cachedParentMeasure: Measure;
  3803. /** @hidden */
  3804. _left: ValueAndUnit;
  3805. /** @hidden */
  3806. _top: ValueAndUnit;
  3807. /** @hidden */
  3808. protected _invertTransformMatrix: Matrix2D;
  3809. /** @hidden */
  3810. protected _transformedPosition: BABYLON.Vector2;
  3811. /** @hidden */
  3812. _linkedMesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  3813. protected _isEnabled: boolean;
  3814. protected _disabledColor: string;
  3815. /** @hidden */
  3816. _tag: any;
  3817. /** Gets or sets a boolean indicating if the control can be hit with pointer events */
  3818. isHitTestVisible: boolean;
  3819. /** Gets or sets a boolean indicating if the control can block pointer events */
  3820. isPointerBlocker: boolean;
  3821. /** Gets or sets a boolean indicating if the control can be focusable */
  3822. isFocusInvisible: boolean;
  3823. /** Gets or sets a boolean indicating if the children are clipped to the current control bounds */
  3824. clipChildren: boolean;
  3825. /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
  3826. shadowOffsetX: number;
  3827. /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
  3828. shadowOffsetY: number;
  3829. /** Gets or sets a value indicating the amount of blur to use to render the shadow */
  3830. shadowBlur: number;
  3831. /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
  3832. shadowColor: string;
  3833. /** Gets or sets the cursor to use when the control is hovered */
  3834. hoverCursor: string;
  3835. /** @hidden */
  3836. protected _linkOffsetX: ValueAndUnit;
  3837. /** @hidden */
  3838. protected _linkOffsetY: ValueAndUnit;
  3839. /** Gets the control type name */
  3840. readonly typeName: string;
  3841. /**
  3842. * An event triggered when the pointer move over the control.
  3843. */
  3844. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector2>;
  3845. /**
  3846. * An event triggered when the pointer move out of the control.
  3847. */
  3848. onPointerOutObservable: BABYLON.Observable<Control>;
  3849. /**
  3850. * An event triggered when the pointer taps the control
  3851. */
  3852. onPointerDownObservable: BABYLON.Observable<Vector2WithInfo>;
  3853. /**
  3854. * An event triggered when pointer up
  3855. */
  3856. onPointerUpObservable: BABYLON.Observable<Vector2WithInfo>;
  3857. /**
  3858. * An event triggered when a control is clicked on
  3859. */
  3860. onPointerClickObservable: BABYLON.Observable<Vector2WithInfo>;
  3861. /**
  3862. * An event triggered when pointer enters the control
  3863. */
  3864. onPointerEnterObservable: BABYLON.Observable<Control>;
  3865. /**
  3866. * An event triggered when the control is marked as dirty
  3867. */
  3868. onDirtyObservable: BABYLON.Observable<Control>;
  3869. /**
  3870. * An event triggered before drawing the control
  3871. */
  3872. onBeforeDrawObservable: BABYLON.Observable<Control>;
  3873. /**
  3874. * An event triggered after the control was drawn
  3875. */
  3876. onAfterDrawObservable: BABYLON.Observable<Control>;
  3877. /** Gets or set information about font offsets (used to render and align text) */
  3878. fontOffset: {
  3879. ascent: number;
  3880. height: number;
  3881. descent: number;
  3882. };
  3883. /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
  3884. alpha: number;
  3885. /** Gets or sets a value indicating the scale factor on X axis (1 by default)
  3886. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3887. */
  3888. scaleX: number;
  3889. /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
  3890. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3891. */
  3892. scaleY: number;
  3893. /** Gets or sets the rotation angle (0 by default)
  3894. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3895. */
  3896. rotation: number;
  3897. /** Gets or sets the transformation center on Y axis (0 by default)
  3898. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3899. */
  3900. transformCenterY: number;
  3901. /** Gets or sets the transformation center on X axis (0 by default)
  3902. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3903. */
  3904. transformCenterX: number;
  3905. /**
  3906. * Gets or sets the horizontal alignment
  3907. * @see http://doc.babylonjs.com/how_to/gui#alignments
  3908. */
  3909. horizontalAlignment: number;
  3910. /**
  3911. * Gets or sets the vertical alignment
  3912. * @see http://doc.babylonjs.com/how_to/gui#alignments
  3913. */
  3914. verticalAlignment: number;
  3915. /**
  3916. * Gets or sets control width
  3917. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3918. */
  3919. width: string | number;
  3920. /**
  3921. * Gets control width in pixel
  3922. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3923. */
  3924. readonly widthInPixels: number;
  3925. /**
  3926. * Gets or sets control height
  3927. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3928. */
  3929. height: string | number;
  3930. /**
  3931. * Gets control height in pixel
  3932. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3933. */
  3934. readonly heightInPixels: number;
  3935. /** Gets or set font family */
  3936. fontFamily: string;
  3937. /** Gets or sets font style */
  3938. fontStyle: string;
  3939. /** Gets or sets font weight */
  3940. fontWeight: string;
  3941. /**
  3942. * Gets or sets style
  3943. * @see http://doc.babylonjs.com/how_to/gui#styles
  3944. */
  3945. style: BABYLON.Nullable<Style>;
  3946. /** @hidden */
  3947. readonly _isFontSizeInPercentage: boolean;
  3948. /** Gets font size in pixels */
  3949. readonly fontSizeInPixels: number;
  3950. /** Gets or sets font size */
  3951. fontSize: string | number;
  3952. /** Gets or sets foreground color */
  3953. color: string;
  3954. /** Gets or sets z index which is used to reorder controls on the z axis */
  3955. zIndex: number;
  3956. /** Gets or sets a boolean indicating if the control can be rendered */
  3957. notRenderable: boolean;
  3958. /** Gets or sets a boolean indicating if the control is visible */
  3959. isVisible: boolean;
  3960. /** Gets a boolean indicating that the control needs to update its rendering */
  3961. readonly isDirty: boolean;
  3962. /**
  3963. * Gets the current linked mesh (or null if none)
  3964. */
  3965. readonly linkedMesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  3966. /**
  3967. * Gets or sets a value indicating the padding to use on the left of the control
  3968. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3969. */
  3970. paddingLeft: string | number;
  3971. /**
  3972. * Gets a value indicating the padding in pixels to use on the left of the control
  3973. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3974. */
  3975. readonly paddingLeftInPixels: number;
  3976. /**
  3977. * Gets or sets a value indicating the padding to use on the right of the control
  3978. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3979. */
  3980. paddingRight: string | number;
  3981. /**
  3982. * Gets a value indicating the padding in pixels to use on the right of the control
  3983. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3984. */
  3985. readonly paddingRightInPixels: number;
  3986. /**
  3987. * Gets or sets a value indicating the padding to use on the top of the control
  3988. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3989. */
  3990. paddingTop: string | number;
  3991. /**
  3992. * Gets a value indicating the padding in pixels to use on the top of the control
  3993. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3994. */
  3995. readonly paddingTopInPixels: number;
  3996. /**
  3997. * Gets or sets a value indicating the padding to use on the bottom of the control
  3998. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3999. */
  4000. paddingBottom: string | number;
  4001. /**
  4002. * Gets a value indicating the padding in pixels to use on the bottom of the control
  4003. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4004. */
  4005. readonly paddingBottomInPixels: number;
  4006. /**
  4007. * Gets or sets a value indicating the left coordinate of the control
  4008. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4009. */
  4010. left: string | number;
  4011. /**
  4012. * Gets a value indicating the left coordinate in pixels of the control
  4013. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4014. */
  4015. readonly leftInPixels: number;
  4016. /**
  4017. * Gets or sets a value indicating the top coordinate of the control
  4018. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4019. */
  4020. top: string | number;
  4021. /**
  4022. * Gets a value indicating the top coordinate in pixels of the control
  4023. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4024. */
  4025. readonly topInPixels: number;
  4026. /**
  4027. * Gets or sets a value indicating the offset on X axis to the linked mesh
  4028. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  4029. */
  4030. linkOffsetX: string | number;
  4031. /**
  4032. * Gets a value indicating the offset in pixels on X axis to the linked mesh
  4033. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  4034. */
  4035. readonly linkOffsetXInPixels: number;
  4036. /**
  4037. * Gets or sets a value indicating the offset on Y axis to the linked mesh
  4038. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  4039. */
  4040. linkOffsetY: string | number;
  4041. /**
  4042. * Gets a value indicating the offset in pixels on Y axis to the linked mesh
  4043. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  4044. */
  4045. readonly linkOffsetYInPixels: number;
  4046. /** Gets the center coordinate on X axis */
  4047. readonly centerX: number;
  4048. /** Gets the center coordinate on Y axis */
  4049. readonly centerY: number;
  4050. /** Gets or sets if control is Enabled*/
  4051. isEnabled: boolean;
  4052. /** Gets or sets background color of control if it's disabled*/
  4053. disabledColor: string;
  4054. /**
  4055. * Creates a new control
  4056. * @param name defines the name of the control
  4057. */
  4058. constructor(
  4059. /** defines the name of the control */
  4060. name?: string | undefined);
  4061. /** @hidden */
  4062. protected _getTypeName(): string;
  4063. /** @hidden */
  4064. _resetFontCache(): void;
  4065. /**
  4066. * Determines if a container is an ascendant of the current control
  4067. * @param container defines the container to look for
  4068. * @returns true if the container is one of the ascendant of the control
  4069. */
  4070. isAscendant(container: Control): boolean;
  4071. /**
  4072. * Gets coordinates in local control space
  4073. * @param globalCoordinates defines the coordinates to transform
  4074. * @returns the new coordinates in local space
  4075. */
  4076. getLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  4077. /**
  4078. * Gets coordinates in local control space
  4079. * @param globalCoordinates defines the coordinates to transform
  4080. * @param result defines the target vector2 where to store the result
  4081. * @returns the current control
  4082. */
  4083. getLocalCoordinatesToRef(globalCoordinates: BABYLON.Vector2, result: BABYLON.Vector2): Control;
  4084. /**
  4085. * Gets coordinates in parent local control space
  4086. * @param globalCoordinates defines the coordinates to transform
  4087. * @returns the new coordinates in parent local space
  4088. */
  4089. getParentLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  4090. /**
  4091. * Move the current control to a vector3 position projected onto the screen.
  4092. * @param position defines the target position
  4093. * @param scene defines the hosting scene
  4094. */
  4095. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene): void;
  4096. /**
  4097. * Link current control with a target mesh
  4098. * @param mesh defines the mesh to link with
  4099. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  4100. */
  4101. linkWithMesh(mesh: BABYLON.Nullable<BABYLON.AbstractMesh>): void;
  4102. /** @hidden */
  4103. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3): void;
  4104. /** @hidden */
  4105. _markMatrixAsDirty(): void;
  4106. /** @hidden */
  4107. _flagDescendantsAsMatrixDirty(): void;
  4108. /** @hidden */
  4109. _markAsDirty(force?: boolean): void;
  4110. /** @hidden */
  4111. _markAllAsDirty(): void;
  4112. /** @hidden */
  4113. _link(root: BABYLON.Nullable<Container>, host: AdvancedDynamicTexture): void;
  4114. /** @hidden */
  4115. protected _transform(context: CanvasRenderingContext2D): void;
  4116. /** @hidden */
  4117. protected _applyStates(context: CanvasRenderingContext2D): void;
  4118. /** @hidden */
  4119. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  4120. /** @hidden */
  4121. protected _clip(context: CanvasRenderingContext2D): void;
  4122. /** @hidden */
  4123. _measure(): void;
  4124. /** @hidden */
  4125. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4126. /** @hidden */
  4127. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4128. /** @hidden */
  4129. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4130. /** @hidden */
  4131. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4132. /**
  4133. * Tests if a given coordinates belong to the current control
  4134. * @param x defines x coordinate to test
  4135. * @param y defines y coordinate to test
  4136. * @returns true if the coordinates are inside the control
  4137. */
  4138. contains(x: number, y: number): boolean;
  4139. /** @hidden */
  4140. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  4141. /** @hidden */
  4142. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  4143. /** @hidden */
  4144. _onPointerEnter(target: Control): boolean;
  4145. /** @hidden */
  4146. _onPointerOut(target: Control): void;
  4147. /** @hidden */
  4148. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  4149. /** @hidden */
  4150. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  4151. /** @hidden */
  4152. _forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  4153. /** @hidden */
  4154. _processObservables(type: number, x: number, y: number, pointerId: number, buttonIndex: number): boolean;
  4155. /** Releases associated resources */
  4156. dispose(): void;
  4157. /** HORIZONTAL_ALIGNMENT_LEFT */
  4158. static readonly HORIZONTAL_ALIGNMENT_LEFT: number;
  4159. /** HORIZONTAL_ALIGNMENT_RIGHT */
  4160. static readonly HORIZONTAL_ALIGNMENT_RIGHT: number;
  4161. /** HORIZONTAL_ALIGNMENT_CENTER */
  4162. static readonly HORIZONTAL_ALIGNMENT_CENTER: number;
  4163. /** VERTICAL_ALIGNMENT_TOP */
  4164. static readonly VERTICAL_ALIGNMENT_TOP: number;
  4165. /** VERTICAL_ALIGNMENT_BOTTOM */
  4166. static readonly VERTICAL_ALIGNMENT_BOTTOM: number;
  4167. /** VERTICAL_ALIGNMENT_CENTER */
  4168. static readonly VERTICAL_ALIGNMENT_CENTER: number;
  4169. /** @hidden */
  4170. static _GetFontOffset(font: string): {
  4171. ascent: number;
  4172. height: number;
  4173. descent: number;
  4174. };
  4175. /**
  4176. * Creates a stack panel that can be used to render headers
  4177. * @param control defines the control to associate with the header
  4178. * @param text defines the text of the header
  4179. * @param size defines the size of the header
  4180. * @param options defines options used to configure the header
  4181. * @returns a new StackPanel
  4182. * @ignore
  4183. * @hidden
  4184. */
  4185. static AddHeader: (control: Control, text: string, size: string | number, options: {
  4186. isHorizontal: boolean;
  4187. controlFirst: boolean;
  4188. }) => any;
  4189. /** @hidden */
  4190. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  4191. }
  4192. }
  4193. declare module BABYLON.GUI {
  4194. /** Class used to create 2D ellipse containers */
  4195. export class Ellipse extends Container {
  4196. name?: string | undefined;
  4197. /** Gets or sets border thickness */
  4198. thickness: number;
  4199. /**
  4200. * Creates a new Ellipse
  4201. * @param name defines the control name
  4202. */
  4203. constructor(name?: string | undefined);
  4204. protected _getTypeName(): string;
  4205. protected _localDraw(context: CanvasRenderingContext2D): void;
  4206. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4207. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  4208. }
  4209. }
  4210. declare module BABYLON.GUI {
  4211. /**
  4212. * Class used to create a 2D grid container
  4213. */
  4214. export class Grid extends Container {
  4215. name?: string | undefined;
  4216. /**
  4217. * Gets the number of columns
  4218. */
  4219. readonly columnCount: number;
  4220. /**
  4221. * Gets the number of rows
  4222. */
  4223. readonly rowCount: number;
  4224. /** Gets the list of children */
  4225. readonly children: Control[];
  4226. /**
  4227. * Adds a new row to the grid
  4228. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  4229. * @param isPixel defines if the height is expressed in pixel (or in percentage)
  4230. * @returns the current grid
  4231. */
  4232. addRowDefinition(height: number, isPixel?: boolean): Grid;
  4233. /**
  4234. * Adds a new column to the grid
  4235. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  4236. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  4237. * @returns the current grid
  4238. */
  4239. addColumnDefinition(width: number, isPixel?: boolean): Grid;
  4240. /**
  4241. * Update a row definition
  4242. * @param index defines the index of the row to update
  4243. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  4244. * @param isPixel defines if the weight is expressed in pixel (or in percentage)
  4245. * @returns the current grid
  4246. */
  4247. setRowDefinition(index: number, height: number, isPixel?: boolean): Grid;
  4248. /**
  4249. * Update a column definition
  4250. * @param index defines the index of the column to update
  4251. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  4252. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  4253. * @returns the current grid
  4254. */
  4255. setColumnDefinition(index: number, width: number, isPixel?: boolean): Grid;
  4256. /**
  4257. * Gets the list of children stored in a specific cell
  4258. * @param row defines the row to check
  4259. * @param column defines the column to check
  4260. * @returns the list of controls
  4261. */
  4262. getChildrenAt(row: number, column: number): BABYLON.Nullable<Array<Control>>;
  4263. /**
  4264. * Remove a column definition at specified index
  4265. * @param index defines the index of the column to remove
  4266. * @returns the current grid
  4267. */
  4268. removeColumnDefinition(index: number): Grid;
  4269. /**
  4270. * Remove a row definition at specified index
  4271. * @param index defines the index of the row to remove
  4272. * @returns the current grid
  4273. */
  4274. removeRowDefinition(index: number): Grid;
  4275. /**
  4276. * Adds a new control to the current grid
  4277. * @param control defines the control to add
  4278. * @param row defines the row where to add the control (0 by default)
  4279. * @param column defines the column where to add the control (0 by default)
  4280. * @returns the current grid
  4281. */
  4282. addControl(control: Control, row?: number, column?: number): Grid;
  4283. /**
  4284. * Removes a control from the current container
  4285. * @param control defines the control to remove
  4286. * @returns the current container
  4287. */
  4288. removeControl(control: Control): Container;
  4289. /**
  4290. * Creates a new Grid
  4291. * @param name defines control name
  4292. */
  4293. constructor(name?: string | undefined);
  4294. protected _getTypeName(): string;
  4295. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4296. /** Releases associated resources */
  4297. dispose(): void;
  4298. }
  4299. }
  4300. declare module BABYLON.GUI {
  4301. /**
  4302. * Class used to create 2D images
  4303. */
  4304. export class Image extends Control {
  4305. name?: string | undefined;
  4306. /**
  4307. * BABYLON.Observable notified when the content is loaded
  4308. */
  4309. onImageLoadedObservable: BABYLON.Observable<Image>;
  4310. /**
  4311. * Gets a boolean indicating that the content is loaded
  4312. */
  4313. readonly isLoaded: boolean;
  4314. /**
  4315. * Gets or sets the left coordinate in the source image
  4316. */
  4317. sourceLeft: number;
  4318. /**
  4319. * Gets or sets the top coordinate in the source image
  4320. */
  4321. sourceTop: number;
  4322. /**
  4323. * Gets or sets the width to capture in the source image
  4324. */
  4325. sourceWidth: number;
  4326. /**
  4327. * Gets or sets the height to capture in the source image
  4328. */
  4329. sourceHeight: number;
  4330. /**
  4331. * Gets or sets a boolean indicating if the image can force its container to adapt its size
  4332. * @see http://doc.babylonjs.com/how_to/gui#image
  4333. */
  4334. autoScale: boolean;
  4335. /** Gets or sets the streching mode used by the image */
  4336. stretch: number;
  4337. /**
  4338. * Gets or sets the internal DOM image used to render the control
  4339. */
  4340. domImage: HTMLImageElement;
  4341. /**
  4342. * Gets or sets image source url
  4343. */
  4344. source: BABYLON.Nullable<string>;
  4345. /**
  4346. * Gets or sets the cell width to use when animation sheet is enabled
  4347. * @see http://doc.babylonjs.com/how_to/gui#image
  4348. */
  4349. cellWidth: number;
  4350. /**
  4351. * Gets or sets the cell height to use when animation sheet is enabled
  4352. * @see http://doc.babylonjs.com/how_to/gui#image
  4353. */
  4354. cellHeight: number;
  4355. /**
  4356. * Gets or sets the cell id to use (this will turn on the animation sheet mode)
  4357. * @see http://doc.babylonjs.com/how_to/gui#image
  4358. */
  4359. cellId: number;
  4360. /**
  4361. * Creates a new Image
  4362. * @param name defines the control name
  4363. * @param url defines the image url
  4364. */
  4365. constructor(name?: string | undefined, url?: BABYLON.Nullable<string>);
  4366. protected _getTypeName(): string;
  4367. /** Force the control to synchronize with its content */
  4368. synchronizeSizeWithContent(): void;
  4369. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4370. dispose(): void;
  4371. /** STRETCH_NONE */
  4372. static readonly STRETCH_NONE: number;
  4373. /** STRETCH_FILL */
  4374. static readonly STRETCH_FILL: number;
  4375. /** STRETCH_UNIFORM */
  4376. static readonly STRETCH_UNIFORM: number;
  4377. /** STRETCH_EXTEND */
  4378. static readonly STRETCH_EXTEND: number;
  4379. }
  4380. }
  4381. declare module BABYLON.GUI {
  4382. /**
  4383. * Class used to create input text control
  4384. */
  4385. export class InputText extends Control implements IFocusableControl {
  4386. name?: string | undefined;
  4387. /** @hidden */
  4388. _connectedVirtualKeyboard: BABYLON.Nullable<VirtualKeyboard>;
  4389. /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
  4390. promptMessage: string;
  4391. /** BABYLON.Observable raised when the text changes */
  4392. onTextChangedObservable: BABYLON.Observable<InputText>;
  4393. /** BABYLON.Observable raised just before an entered character is to be added */
  4394. onBeforeKeyAddObservable: BABYLON.Observable<InputText>;
  4395. /** BABYLON.Observable raised when the control gets the focus */
  4396. onFocusObservable: BABYLON.Observable<InputText>;
  4397. /** BABYLON.Observable raised when the control loses the focus */
  4398. onBlurObservable: BABYLON.Observable<InputText>;
  4399. /**Observable raised when the text is highlighted */
  4400. onTextHighlightObservable: BABYLON.Observable<InputText>;
  4401. /**Observable raised when copy event is triggered */
  4402. onTextCopyObservable: BABYLON.Observable<InputText>;
  4403. /** BABYLON.Observable raised when cut event is triggered */
  4404. onTextCutObservable: BABYLON.Observable<InputText>;
  4405. /** BABYLON.Observable raised when paste event is triggered */
  4406. onTextPasteObservable: BABYLON.Observable<InputText>;
  4407. /** Gets or sets the maximum width allowed by the control */
  4408. maxWidth: string | number;
  4409. /** Gets the maximum width allowed by the control in pixels */
  4410. readonly maxWidthInPixels: number;
  4411. /** Gets or sets the text highlighter transparency; default: 0.4 */
  4412. highligherOpacity: number;
  4413. /** Gets or sets a boolean indicating whether to select complete text by default on input focus */
  4414. onFocusSelectAll: boolean;
  4415. /** Gets or sets the text hightlight color */
  4416. textHighlightColor: string;
  4417. /** Gets or sets control margin */
  4418. margin: string;
  4419. /** Gets control margin in pixels */
  4420. readonly marginInPixels: number;
  4421. /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
  4422. autoStretchWidth: boolean;
  4423. /** Gets or sets border thickness */
  4424. thickness: number;
  4425. /** Gets or sets the background color when focused */
  4426. focusedBackground: string;
  4427. /** Gets or sets the background color */
  4428. background: string;
  4429. /** Gets or sets the placeholder color */
  4430. placeholderColor: string;
  4431. /** Gets or sets the text displayed when the control is empty */
  4432. placeholderText: string;
  4433. /** Gets or sets the dead key flag */
  4434. deadKey: boolean;
  4435. /** Gets or sets the highlight text */
  4436. highlightedText: string;
  4437. /** Gets or sets if the current key should be added */
  4438. addKey: boolean;
  4439. /** Gets or sets the value of the current key being entered */
  4440. currentKey: string;
  4441. /** Gets or sets the text displayed in the control */
  4442. text: string;
  4443. /** Gets or sets control width */
  4444. width: string | number;
  4445. /**
  4446. * Creates a new InputText
  4447. * @param name defines the control name
  4448. * @param text defines the text of the control
  4449. */
  4450. constructor(name?: string | undefined, text?: string);
  4451. /** @hidden */
  4452. onBlur(): void;
  4453. /** @hidden */
  4454. onFocus(): void;
  4455. protected _getTypeName(): string;
  4456. /**
  4457. * Function called to get the list of controls that should not steal the focus from this control
  4458. * @returns an array of controls
  4459. */
  4460. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  4461. /** @hidden */
  4462. processKey(keyCode: number, key?: string, evt?: KeyboardEvent): void;
  4463. /**
  4464. * Handles the keyboard event
  4465. * @param evt Defines the KeyboardEvent
  4466. */
  4467. processKeyboard(evt: KeyboardEvent): void;
  4468. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4469. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  4470. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  4471. protected _beforeRenderText(text: string): string;
  4472. dispose(): void;
  4473. }
  4474. }
  4475. declare module BABYLON.GUI {
  4476. /**
  4477. * Class used to create a password control
  4478. */
  4479. export class InputPassword extends InputText {
  4480. protected _beforeRenderText(text: string): string;
  4481. }
  4482. }
  4483. declare module BABYLON.GUI {
  4484. /** Class used to render 2D lines */
  4485. export class Line extends Control {
  4486. name?: string | undefined;
  4487. /** Gets or sets the dash pattern */
  4488. dash: Array<number>;
  4489. /** Gets or sets the control connected with the line end */
  4490. connectedControl: Control;
  4491. /** Gets or sets start coordinates on X axis */
  4492. x1: string | number;
  4493. /** Gets or sets start coordinates on Y axis */
  4494. y1: string | number;
  4495. /** Gets or sets end coordinates on X axis */
  4496. x2: string | number;
  4497. /** Gets or sets end coordinates on Y axis */
  4498. y2: string | number;
  4499. /** Gets or sets line width */
  4500. lineWidth: number;
  4501. /** Gets or sets horizontal alignment */
  4502. horizontalAlignment: number;
  4503. /** Gets or sets vertical alignment */
  4504. verticalAlignment: number;
  4505. /**
  4506. * Creates a new Line
  4507. * @param name defines the control name
  4508. */
  4509. constructor(name?: string | undefined);
  4510. protected _getTypeName(): string;
  4511. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4512. _measure(): void;
  4513. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4514. /**
  4515. * Move one end of the line given 3D cartesian coordinates.
  4516. * @param position Targeted world position
  4517. * @param scene BABYLON.Scene
  4518. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  4519. */
  4520. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene, end?: boolean): void;
  4521. /**
  4522. * Move one end of the line to a position in screen absolute space.
  4523. * @param projectedPosition Position in screen absolute space (X, Y)
  4524. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  4525. */
  4526. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3, end?: boolean): void;
  4527. }
  4528. }
  4529. declare module BABYLON.GUI {
  4530. /**
  4531. * Class used to create multi line control
  4532. */
  4533. export class MultiLine extends Control {
  4534. name?: string | undefined;
  4535. /**
  4536. * Creates a new MultiLine
  4537. * @param name defines the control name
  4538. */
  4539. constructor(name?: string | undefined);
  4540. /** Gets or sets dash pattern */
  4541. dash: Array<number>;
  4542. /**
  4543. * Gets point stored at specified index
  4544. * @param index defines the index to look for
  4545. * @returns the requested point if found
  4546. */
  4547. getAt(index: number): MultiLinePoint;
  4548. /** Function called when a point is updated */
  4549. onPointUpdate: () => void;
  4550. /**
  4551. * Adds new points to the point collection
  4552. * @param items defines the list of items (mesh, control or 2d coordiantes) to add
  4553. * @returns the list of created MultiLinePoint
  4554. */
  4555. add(...items: (AbstractMesh | Control | {
  4556. x: string | number;
  4557. y: string | number;
  4558. })[]): MultiLinePoint[];
  4559. /**
  4560. * Adds a new point to the point collection
  4561. * @param item defines the item (mesh, control or 2d coordiantes) to add
  4562. * @returns the created MultiLinePoint
  4563. */
  4564. push(item?: (AbstractMesh | Control | {
  4565. x: string | number;
  4566. y: string | number;
  4567. })): MultiLinePoint;
  4568. /**
  4569. * Remove a specific value or point from the active point collection
  4570. * @param value defines the value or point to remove
  4571. */
  4572. remove(value: number | MultiLinePoint): void;
  4573. /**
  4574. * Resets this object to initial state (no point)
  4575. */
  4576. reset(): void;
  4577. /**
  4578. * Resets all links
  4579. */
  4580. resetLinks(): void;
  4581. /** Gets or sets line width */
  4582. lineWidth: number;
  4583. horizontalAlignment: number;
  4584. verticalAlignment: number;
  4585. protected _getTypeName(): string;
  4586. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4587. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4588. _measure(): void;
  4589. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4590. dispose(): void;
  4591. }
  4592. }
  4593. declare module BABYLON.GUI {
  4594. /**
  4595. * Class used to create radio button controls
  4596. */
  4597. export class RadioButton extends Control {
  4598. name?: string | undefined;
  4599. /** Gets or sets border thickness */
  4600. thickness: number;
  4601. /** Gets or sets group name */
  4602. group: string;
  4603. /** BABYLON.Observable raised when isChecked is changed */
  4604. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  4605. /** Gets or sets a value indicating the ratio between overall size and check size */
  4606. checkSizeRatio: number;
  4607. /** Gets or sets background color */
  4608. background: string;
  4609. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  4610. isChecked: boolean;
  4611. /**
  4612. * Creates a new RadioButton
  4613. * @param name defines the control name
  4614. */
  4615. constructor(name?: string | undefined);
  4616. protected _getTypeName(): string;
  4617. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4618. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  4619. /**
  4620. * Utility function to easily create a radio button with a header
  4621. * @param title defines the label to use for the header
  4622. * @param group defines the group to use for the radio button
  4623. * @param isChecked defines the initial state of the radio button
  4624. * @param onValueChanged defines the callback to call when value changes
  4625. * @returns a StackPanel containing the radio button and a textBlock
  4626. */
  4627. static AddRadioButtonWithHeader(title: string, group: string, isChecked: boolean, onValueChanged: (button: RadioButton, value: boolean) => void): StackPanel;
  4628. }
  4629. }
  4630. declare module BABYLON.GUI {
  4631. /**
  4632. * Class used to create a 2D stack panel container
  4633. */
  4634. export class StackPanel extends Container {
  4635. name?: string | undefined;
  4636. /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
  4637. isVertical: boolean;
  4638. /**
  4639. * Gets or sets panel width.
  4640. * This value should not be set when in horizontal mode as it will be computed automatically
  4641. */
  4642. width: string | number;
  4643. /**
  4644. * Gets or sets panel height.
  4645. * This value should not be set when in vertical mode as it will be computed automatically
  4646. */
  4647. height: string | number;
  4648. /**
  4649. * Creates a new StackPanel
  4650. * @param name defines control name
  4651. */
  4652. constructor(name?: string | undefined);
  4653. protected _getTypeName(): string;
  4654. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4655. }
  4656. }
  4657. declare module BABYLON.GUI {
  4658. /** Class used to create a RadioGroup
  4659. * which contains groups of radio buttons
  4660. */
  4661. export class SelectorGroup {
  4662. /** name of SelectorGroup */
  4663. name: string;
  4664. /**
  4665. * Creates a new SelectorGroup
  4666. * @param name of group, used as a group heading
  4667. */
  4668. constructor(
  4669. /** name of SelectorGroup */
  4670. name: string);
  4671. /** Gets the groupPanel of the SelectorGroup */
  4672. readonly groupPanel: StackPanel;
  4673. /** Gets the selectors array */
  4674. readonly selectors: StackPanel[];
  4675. /** Gets and sets the group header */
  4676. header: string;
  4677. /** @hidden*/
  4678. _getSelector(selectorNb: number): StackPanel | undefined;
  4679. /** Removes the selector at the given position
  4680. * @param selectorNb the position of the selector within the group
  4681. */
  4682. removeSelector(selectorNb: number): void;
  4683. }
  4684. /** Class used to create a CheckboxGroup
  4685. * which contains groups of checkbox buttons
  4686. */
  4687. export class CheckboxGroup extends SelectorGroup {
  4688. /** Adds a checkbox as a control
  4689. * @param text is the label for the selector
  4690. * @param func is the function called when the Selector is checked
  4691. * @param checked is true when Selector is checked
  4692. */
  4693. addCheckbox(text: string, func?: (s: boolean) => void, checked?: boolean): void;
  4694. /** @hidden */
  4695. _setSelectorLabel(selectorNb: number, label: string): void;
  4696. /** @hidden */
  4697. _setSelectorLabelColor(selectorNb: number, color: string): void;
  4698. /** @hidden */
  4699. _setSelectorButtonColor(selectorNb: number, color: string): void;
  4700. /** @hidden */
  4701. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  4702. }
  4703. /** Class used to create a RadioGroup
  4704. * which contains groups of radio buttons
  4705. */
  4706. export class RadioGroup extends SelectorGroup {
  4707. /** Adds a radio button as a control
  4708. * @param label is the label for the selector
  4709. * @param func is the function called when the Selector is checked
  4710. * @param checked is true when Selector is checked
  4711. */
  4712. addRadio(label: string, func?: (n: number) => void, checked?: boolean): void;
  4713. /** @hidden */
  4714. _setSelectorLabel(selectorNb: number, label: string): void;
  4715. /** @hidden */
  4716. _setSelectorLabelColor(selectorNb: number, color: string): void;
  4717. /** @hidden */
  4718. _setSelectorButtonColor(selectorNb: number, color: string): void;
  4719. /** @hidden */
  4720. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  4721. }
  4722. /** Class used to create a SliderGroup
  4723. * which contains groups of slider buttons
  4724. */
  4725. export class SliderGroup extends SelectorGroup {
  4726. /**
  4727. * Adds a slider to the SelectorGroup
  4728. * @param label is the label for the SliderBar
  4729. * @param func is the function called when the Slider moves
  4730. * @param unit is a string describing the units used, eg degrees or metres
  4731. * @param min is the minimum value for the Slider
  4732. * @param max is the maximum value for the Slider
  4733. * @param value is the start value for the Slider between min and max
  4734. * @param onValueChange is the function used to format the value displayed, eg radians to degrees
  4735. */
  4736. addSlider(label: string, func?: (v: number) => void, unit?: string, min?: number, max?: number, value?: number, onValueChange?: (v: number) => number): void;
  4737. /** @hidden */
  4738. _setSelectorLabel(selectorNb: number, label: string): void;
  4739. /** @hidden */
  4740. _setSelectorLabelColor(selectorNb: number, color: string): void;
  4741. /** @hidden */
  4742. _setSelectorButtonColor(selectorNb: number, color: string): void;
  4743. /** @hidden */
  4744. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  4745. }
  4746. /** Class used to hold the controls for the checkboxes, radio buttons and sliders
  4747. * @see http://doc.babylonjs.com/how_to/selector
  4748. */
  4749. export class SelectionPanel extends Rectangle {
  4750. /** name of SelectionPanel */
  4751. name: string;
  4752. /** an array of SelectionGroups */
  4753. groups: SelectorGroup[];
  4754. /**
  4755. * Creates a new SelectionPanel
  4756. * @param name of SelectionPanel
  4757. * @param groups is an array of SelectionGroups
  4758. */
  4759. constructor(
  4760. /** name of SelectionPanel */
  4761. name: string,
  4762. /** an array of SelectionGroups */
  4763. groups?: SelectorGroup[]);
  4764. protected _getTypeName(): string;
  4765. /** Gets or sets the headerColor */
  4766. headerColor: string;
  4767. /** Gets or sets the button color */
  4768. buttonColor: string;
  4769. /** Gets or sets the label color */
  4770. labelColor: string;
  4771. /** Gets or sets the button background */
  4772. buttonBackground: string;
  4773. /** Gets or sets the color of separator bar */
  4774. barColor: string;
  4775. /** Gets or sets the height of separator bar */
  4776. barHeight: string;
  4777. /** Gets or sets the height of spacers*/
  4778. spacerHeight: string;
  4779. /** Add a group to the selection panel
  4780. * @param group is the selector group to add
  4781. */
  4782. addGroup(group: SelectorGroup): void;
  4783. /** Remove the group from the given position
  4784. * @param groupNb is the position of the group in the list
  4785. */
  4786. removeGroup(groupNb: number): void;
  4787. /** Change a group header label
  4788. * @param label is the new group header label
  4789. * @param groupNb is the number of the group to relabel
  4790. * */
  4791. setHeaderName(label: string, groupNb: number): void;
  4792. /** Change selector label to the one given
  4793. * @param label is the new selector label
  4794. * @param groupNb is the number of the groupcontaining the selector
  4795. * @param selectorNb is the number of the selector within a group to relabel
  4796. * */
  4797. relabel(label: string, groupNb: number, selectorNb: number): void;
  4798. /** For a given group position remove the selector at the given position
  4799. * @param groupNb is the number of the group to remove the selector from
  4800. * @param selectorNb is the number of the selector within the group
  4801. */
  4802. removeFromGroupSelector(groupNb: number, selectorNb: number): void;
  4803. /** For a given group position of correct type add a checkbox button
  4804. * @param groupNb is the number of the group to remove the selector from
  4805. * @param label is the label for the selector
  4806. * @param func is the function called when the Selector is checked
  4807. * @param checked is true when Selector is checked
  4808. */
  4809. addToGroupCheckbox(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  4810. /** For a given group position of correct type add a radio button
  4811. * @param groupNb is the number of the group to remove the selector from
  4812. * @param label is the label for the selector
  4813. * @param func is the function called when the Selector is checked
  4814. * @param checked is true when Selector is checked
  4815. */
  4816. addToGroupRadio(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  4817. /**
  4818. * For a given slider group add a slider
  4819. * @param groupNb is the number of the group to add the slider to
  4820. * @param label is the label for the Slider
  4821. * @param func is the function called when the Slider moves
  4822. * @param unit is a string describing the units used, eg degrees or metres
  4823. * @param min is the minimum value for the Slider
  4824. * @param max is the maximum value for the Slider
  4825. * @param value is the start value for the Slider between min and max
  4826. * @param onVal is the function used to format the value displayed, eg radians to degrees
  4827. */
  4828. addToGroupSlider(groupNb: number, label: string, func?: () => void, unit?: string, min?: number, max?: number, value?: number, onVal?: (v: number) => number): void;
  4829. }
  4830. }
  4831. declare module BABYLON.GUI {
  4832. /**
  4833. * Enum that determines the text-wrapping mode to use.
  4834. */
  4835. export enum TextWrapping {
  4836. /**
  4837. * Clip the text when it's larger than Control.width; this is the default mode.
  4838. */
  4839. Clip = 0,
  4840. /**
  4841. * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.
  4842. */
  4843. WordWrap = 1,
  4844. /**
  4845. * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.
  4846. */
  4847. Ellipsis = 2
  4848. }
  4849. /**
  4850. * Class used to create text block control
  4851. */
  4852. export class TextBlock extends Control {
  4853. /**
  4854. * Defines the name of the control
  4855. */
  4856. name?: string | undefined;
  4857. /**
  4858. * An event triggered after the text is changed
  4859. */
  4860. onTextChangedObservable: BABYLON.Observable<TextBlock>;
  4861. /**
  4862. * An event triggered after the text was broken up into lines
  4863. */
  4864. onLinesReadyObservable: BABYLON.Observable<TextBlock>;
  4865. /**
  4866. * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
  4867. */
  4868. readonly lines: any[];
  4869. /**
  4870. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  4871. */
  4872. resizeToFit: boolean;
  4873. /**
  4874. * Gets or sets a boolean indicating if text must be wrapped
  4875. */
  4876. textWrapping: TextWrapping | boolean;
  4877. /**
  4878. * Gets or sets text to display
  4879. */
  4880. text: string;
  4881. /**
  4882. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  4883. */
  4884. textHorizontalAlignment: number;
  4885. /**
  4886. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  4887. */
  4888. textVerticalAlignment: number;
  4889. /**
  4890. * Gets or sets line spacing value
  4891. */
  4892. lineSpacing: string | number;
  4893. /**
  4894. * Gets or sets outlineWidth of the text to display
  4895. */
  4896. outlineWidth: number;
  4897. /**
  4898. * Gets or sets outlineColor of the text to display
  4899. */
  4900. outlineColor: string;
  4901. /**
  4902. * Creates a new TextBlock object
  4903. * @param name defines the name of the control
  4904. * @param text defines the text to display (emptry string by default)
  4905. */
  4906. constructor(
  4907. /**
  4908. * Defines the name of the control
  4909. */
  4910. name?: string | undefined, text?: string);
  4911. protected _getTypeName(): string;
  4912. /** @hidden */
  4913. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4914. protected _applyStates(context: CanvasRenderingContext2D): void;
  4915. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4916. protected _breakLines(refWidth: number, context: CanvasRenderingContext2D): object[];
  4917. protected _parseLine(line: string | undefined, context: CanvasRenderingContext2D): object;
  4918. protected _parseLineEllipsis(line: string | undefined, width: number, context: CanvasRenderingContext2D): object;
  4919. protected _parseLineWordWrap(line: string | undefined, width: number, context: CanvasRenderingContext2D): object[];
  4920. protected _renderLines(context: CanvasRenderingContext2D): void;
  4921. /**
  4922. * Given a width constraint applied on the text block, find the expected height
  4923. * @returns expected height
  4924. */
  4925. computeExpectedHeight(): number;
  4926. dispose(): void;
  4927. }
  4928. }
  4929. declare module BABYLON.GUI {
  4930. /**
  4931. * Class used to store key control properties
  4932. */
  4933. export class KeyPropertySet {
  4934. /** Width */
  4935. width?: string;
  4936. /** Height */
  4937. height?: string;
  4938. /** Left padding */
  4939. paddingLeft?: string;
  4940. /** Right padding */
  4941. paddingRight?: string;
  4942. /** Top padding */
  4943. paddingTop?: string;
  4944. /** Bottom padding */
  4945. paddingBottom?: string;
  4946. /** Foreground color */
  4947. color?: string;
  4948. /** Background color */
  4949. background?: string;
  4950. }
  4951. /**
  4952. * Class used to create virtual keyboard
  4953. */
  4954. export class VirtualKeyboard extends StackPanel {
  4955. /** BABYLON.Observable raised when a key is pressed */
  4956. onKeyPressObservable: BABYLON.Observable<string>;
  4957. /** Gets or sets default key button width */
  4958. defaultButtonWidth: string;
  4959. /** Gets or sets default key button height */
  4960. defaultButtonHeight: string;
  4961. /** Gets or sets default key button left padding */
  4962. defaultButtonPaddingLeft: string;
  4963. /** Gets or sets default key button right padding */
  4964. defaultButtonPaddingRight: string;
  4965. /** Gets or sets default key button top padding */
  4966. defaultButtonPaddingTop: string;
  4967. /** Gets or sets default key button bottom padding */
  4968. defaultButtonPaddingBottom: string;
  4969. /** Gets or sets default key button foreground color */
  4970. defaultButtonColor: string;
  4971. /** Gets or sets default key button background color */
  4972. defaultButtonBackground: string;
  4973. /** Gets or sets shift button foreground color */
  4974. shiftButtonColor: string;
  4975. /** Gets or sets shift button thickness*/
  4976. selectedShiftThickness: number;
  4977. /** Gets shift key state */
  4978. shiftState: number;
  4979. protected _getTypeName(): string;
  4980. /**
  4981. * Adds a new row of keys
  4982. * @param keys defines the list of keys to add
  4983. * @param propertySets defines the associated property sets
  4984. */
  4985. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  4986. /**
  4987. * Set the shift key to a specific state
  4988. * @param shiftState defines the new shift state
  4989. */
  4990. applyShiftState(shiftState: number): void;
  4991. /** Gets the input text control currently attached to the keyboard */
  4992. readonly connectedInputText: BABYLON.Nullable<InputText>;
  4993. /**
  4994. * Connects the keyboard with an input text control
  4995. *
  4996. * @param input defines the target control
  4997. */
  4998. connect(input: InputText): void;
  4999. /**
  5000. * Disconnects the keyboard from connected InputText controls
  5001. *
  5002. * @param input optionally defines a target control, otherwise all are disconnected
  5003. */
  5004. disconnect(input?: InputText): void;
  5005. /**
  5006. * Release all resources
  5007. */
  5008. dispose(): void;
  5009. /**
  5010. * Creates a new keyboard using a default layout
  5011. *
  5012. * @param name defines control name
  5013. * @returns a new VirtualKeyboard
  5014. */
  5015. static CreateDefaultLayout(name?: string): VirtualKeyboard;
  5016. }
  5017. }
  5018. declare module BABYLON.GUI {
  5019. /** Class used to create rectangle container */
  5020. export class Rectangle extends Container {
  5021. name?: string | undefined;
  5022. /** Gets or sets border thickness */
  5023. thickness: number;
  5024. /** Gets or sets the corner radius angle */
  5025. cornerRadius: number;
  5026. /**
  5027. * Creates a new Rectangle
  5028. * @param name defines the control name
  5029. */
  5030. constructor(name?: string | undefined);
  5031. protected _getTypeName(): string;
  5032. protected _localDraw(context: CanvasRenderingContext2D): void;
  5033. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5034. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  5035. }
  5036. }
  5037. declare module BABYLON.GUI {
  5038. /** Class used to render a grid */
  5039. export class DisplayGrid extends Control {
  5040. name?: string | undefined;
  5041. /** Gets or sets a boolean indicating if minor lines must be rendered (true by default)) */
  5042. displayMinorLines: boolean;
  5043. /** Gets or sets a boolean indicating if major lines must be rendered (true by default)) */
  5044. displayMajorLines: boolean;
  5045. /** Gets or sets background color (Black by default) */
  5046. background: string;
  5047. /** Gets or sets the width of each cell (20 by default) */
  5048. cellWidth: number;
  5049. /** Gets or sets the height of each cell (20 by default) */
  5050. cellHeight: number;
  5051. /** Gets or sets the tickness of minor lines (1 by default) */
  5052. minorLineTickness: number;
  5053. /** Gets or sets the color of minor lines (DarkGray by default) */
  5054. minorLineColor: string;
  5055. /** Gets or sets the tickness of major lines (2 by default) */
  5056. majorLineTickness: number;
  5057. /** Gets or sets the color of major lines (White by default) */
  5058. majorLineColor: string;
  5059. /** Gets or sets the frequency of major lines (default is 1 every 5 minor lines)*/
  5060. majorLineFrequency: number;
  5061. /**
  5062. * Creates a new GridDisplayRectangle
  5063. * @param name defines the control name
  5064. */
  5065. constructor(name?: string | undefined);
  5066. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5067. protected _getTypeName(): string;
  5068. }
  5069. }
  5070. declare module BABYLON.GUI {
  5071. /**
  5072. * Class used to create slider controls
  5073. */
  5074. export class BaseSlider extends Control {
  5075. name?: string | undefined;
  5076. protected _thumbWidth: ValueAndUnit;
  5077. protected _barOffset: ValueAndUnit;
  5078. protected _displayThumb: boolean;
  5079. protected _effectiveBarOffset: number;
  5080. protected _renderLeft: number;
  5081. protected _renderTop: number;
  5082. protected _renderWidth: number;
  5083. protected _renderHeight: number;
  5084. protected _backgroundBoxLength: number;
  5085. protected _backgroundBoxThickness: number;
  5086. protected _effectiveThumbThickness: number;
  5087. /** BABYLON.Observable raised when the sldier value changes */
  5088. onValueChangedObservable: BABYLON.Observable<number>;
  5089. /** Gets or sets a boolean indicating if the thumb must be rendered */
  5090. displayThumb: boolean;
  5091. /** Gets or sets main bar offset (ie. the margin applied to the value bar) */
  5092. barOffset: string | number;
  5093. /** Gets main bar offset in pixels*/
  5094. readonly barOffsetInPixels: number;
  5095. /** Gets or sets thumb width */
  5096. thumbWidth: string | number;
  5097. /** Gets thumb width in pixels */
  5098. readonly thumbWidthInPixels: number;
  5099. /** Gets or sets minimum value */
  5100. minimum: number;
  5101. /** Gets or sets maximum value */
  5102. maximum: number;
  5103. /** Gets or sets current value */
  5104. value: number;
  5105. /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */
  5106. isVertical: boolean;
  5107. /** Gets or sets a value indicating if the thumb can go over main bar extends */
  5108. isThumbClamped: boolean;
  5109. /**
  5110. * Creates a new BaseSlider
  5111. * @param name defines the control name
  5112. */
  5113. constructor(name?: string | undefined);
  5114. protected _getTypeName(): string;
  5115. protected _getThumbPosition(): number;
  5116. protected _getThumbThickness(type: string): number;
  5117. protected _prepareRenderingData(type: string): void;
  5118. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  5119. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  5120. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  5121. }
  5122. }
  5123. declare module BABYLON.GUI {
  5124. /**
  5125. * Class used to create slider controls
  5126. */
  5127. export class Slider extends BaseSlider {
  5128. name?: string | undefined;
  5129. /** Gets or sets border color */
  5130. borderColor: string;
  5131. /** Gets or sets background color */
  5132. background: string;
  5133. /** Gets or sets a boolean indicating if the thumb should be round or square */
  5134. isThumbCircle: boolean;
  5135. /**
  5136. * Creates a new Slider
  5137. * @param name defines the control name
  5138. */
  5139. constructor(name?: string | undefined);
  5140. protected _getTypeName(): string;
  5141. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5142. }
  5143. }
  5144. declare module BABYLON.GUI {
  5145. /**
  5146. * Class used to create slider controls based on images
  5147. */
  5148. export class ImageBasedSlider extends BaseSlider {
  5149. name?: string | undefined;
  5150. displayThumb: boolean;
  5151. /**
  5152. * Gets or sets the image used to render the background
  5153. */
  5154. backgroundImage: Image;
  5155. /**
  5156. * Gets or sets the image used to render the value bar
  5157. */
  5158. valueBarImage: Image;
  5159. /**
  5160. * Gets or sets the image used to render the thumb
  5161. */
  5162. thumbImage: Image;
  5163. /**
  5164. * Creates a new ImageBasedSlider
  5165. * @param name defines the control name
  5166. */
  5167. constructor(name?: string | undefined);
  5168. protected _getTypeName(): string;
  5169. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5170. }
  5171. }
  5172. declare module BABYLON.GUI {
  5173. /**
  5174. * Forcing an export so that this code will execute
  5175. * @hidden
  5176. */
  5177. const name = "Statics";
  5178. }
  5179. declare module BABYLON.GUI {
  5180. /**
  5181. * Class used as a root to all buttons
  5182. */
  5183. export class AbstractButton3D extends Control3D {
  5184. /**
  5185. * Creates a new button
  5186. * @param name defines the control name
  5187. */
  5188. constructor(name?: string);
  5189. protected _getTypeName(): string;
  5190. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  5191. }
  5192. }
  5193. declare module BABYLON.GUI {
  5194. /**
  5195. * Class used to create a button in 3D
  5196. */
  5197. export class Button3D extends AbstractButton3D {
  5198. /** @hidden */
  5199. protected _currentMaterial: BABYLON.Material;
  5200. /**
  5201. * Gets or sets the texture resolution used to render content (512 by default)
  5202. */
  5203. contentResolution: BABYLON.int;
  5204. /**
  5205. * Gets or sets the texture scale ratio used to render content (2 by default)
  5206. */
  5207. contentScaleRatio: number;
  5208. protected _disposeFacadeTexture(): void;
  5209. protected _resetContent(): void;
  5210. /**
  5211. * Creates a new button
  5212. * @param name defines the control name
  5213. */
  5214. constructor(name?: string);
  5215. /**
  5216. * Gets or sets the GUI 2D content used to display the button's facade
  5217. */
  5218. content: Control;
  5219. /**
  5220. * Apply the facade texture (created from the content property).
  5221. * This function can be overloaded by child classes
  5222. * @param facadeTexture defines the AdvancedDynamicTexture to use
  5223. */
  5224. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  5225. protected _getTypeName(): string;
  5226. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  5227. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  5228. /**
  5229. * Releases all associated resources
  5230. */
  5231. dispose(): void;
  5232. }
  5233. }
  5234. declare module BABYLON.GUI {
  5235. /**
  5236. * Class used to create containers for controls
  5237. */
  5238. export class Container3D extends Control3D {
  5239. /**
  5240. * Gets the list of child controls
  5241. */
  5242. protected _children: Control3D[];
  5243. /**
  5244. * Gets the list of child controls
  5245. */
  5246. readonly children: Array<Control3D>;
  5247. /**
  5248. * Gets or sets a boolean indicating if the layout must be blocked (default is false).
  5249. * This is helpful to optimize layout operation when adding multiple children in a row
  5250. */
  5251. blockLayout: boolean;
  5252. /**
  5253. * Creates a new container
  5254. * @param name defines the container name
  5255. */
  5256. constructor(name?: string);
  5257. /**
  5258. * Force the container to update the layout. Please note that it will not take blockLayout property in account
  5259. * @returns the current container
  5260. */
  5261. updateLayout(): Container3D;
  5262. /**
  5263. * Gets a boolean indicating if the given control is in the children of this control
  5264. * @param control defines the control to check
  5265. * @returns true if the control is in the child list
  5266. */
  5267. containsControl(control: Control3D): boolean;
  5268. /**
  5269. * Adds a control to the children of this control
  5270. * @param control defines the control to add
  5271. * @returns the current container
  5272. */
  5273. addControl(control: Control3D): Container3D;
  5274. /**
  5275. * This function will be called everytime a new control is added
  5276. */
  5277. protected _arrangeChildren(): void;
  5278. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  5279. /**
  5280. * Removes a control from the children of this control
  5281. * @param control defines the control to remove
  5282. * @returns the current container
  5283. */
  5284. removeControl(control: Control3D): Container3D;
  5285. protected _getTypeName(): string;
  5286. /**
  5287. * Releases all associated resources
  5288. */
  5289. dispose(): void;
  5290. /** Control rotation will remain unchanged */
  5291. static readonly UNSET_ORIENTATION: number;
  5292. /** Control will rotate to make it look at sphere central axis */
  5293. static readonly FACEORIGIN_ORIENTATION: number;
  5294. /** Control will rotate to make it look back at sphere central axis */
  5295. static readonly FACEORIGINREVERSED_ORIENTATION: number;
  5296. /** Control will rotate to look at z axis (0, 0, 1) */
  5297. static readonly FACEFORWARD_ORIENTATION: number;
  5298. /** Control will rotate to look at negative z axis (0, 0, -1) */
  5299. static readonly FACEFORWARDREVERSED_ORIENTATION: number;
  5300. }
  5301. }
  5302. declare module BABYLON.GUI {
  5303. /**
  5304. * Class used as base class for controls
  5305. */
  5306. export class Control3D implements BABYLON.IDisposable, BABYLON.IBehaviorAware<Control3D> {
  5307. /** Defines the control name */
  5308. name?: string | undefined;
  5309. /** @hidden */
  5310. _host: GUI3DManager;
  5311. /** Gets or sets the control position in world space */
  5312. position: BABYLON.Vector3;
  5313. /** Gets or sets the control scaling in world space */
  5314. scaling: BABYLON.Vector3;
  5315. /** Callback used to start pointer enter animation */
  5316. pointerEnterAnimation: () => void;
  5317. /** Callback used to start pointer out animation */
  5318. pointerOutAnimation: () => void;
  5319. /** Callback used to start pointer down animation */
  5320. pointerDownAnimation: () => void;
  5321. /** Callback used to start pointer up animation */
  5322. pointerUpAnimation: () => void;
  5323. /**
  5324. * An event triggered when the pointer move over the control
  5325. */
  5326. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector3>;
  5327. /**
  5328. * An event triggered when the pointer move out of the control
  5329. */
  5330. onPointerOutObservable: BABYLON.Observable<Control3D>;
  5331. /**
  5332. * An event triggered when the pointer taps the control
  5333. */
  5334. onPointerDownObservable: BABYLON.Observable<Vector3WithInfo>;
  5335. /**
  5336. * An event triggered when pointer is up
  5337. */
  5338. onPointerUpObservable: BABYLON.Observable<Vector3WithInfo>;
  5339. /**
  5340. * An event triggered when a control is clicked on (with a mouse)
  5341. */
  5342. onPointerClickObservable: BABYLON.Observable<Vector3WithInfo>;
  5343. /**
  5344. * An event triggered when pointer enters the control
  5345. */
  5346. onPointerEnterObservable: BABYLON.Observable<Control3D>;
  5347. /**
  5348. * Gets or sets the parent container
  5349. */
  5350. parent: BABYLON.Nullable<Container3D>;
  5351. /**
  5352. * Gets the list of attached behaviors
  5353. * @see http://doc.babylonjs.com/features/behaviour
  5354. */
  5355. readonly behaviors: BABYLON.Behavior<Control3D>[];
  5356. /**
  5357. * Attach a behavior to the control
  5358. * @see http://doc.babylonjs.com/features/behaviour
  5359. * @param behavior defines the behavior to attach
  5360. * @returns the current control
  5361. */
  5362. addBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  5363. /**
  5364. * Remove an attached behavior
  5365. * @see http://doc.babylonjs.com/features/behaviour
  5366. * @param behavior defines the behavior to attach
  5367. * @returns the current control
  5368. */
  5369. removeBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  5370. /**
  5371. * Gets an attached behavior by name
  5372. * @param name defines the name of the behavior to look for
  5373. * @see http://doc.babylonjs.com/features/behaviour
  5374. * @returns null if behavior was not found else the requested behavior
  5375. */
  5376. getBehaviorByName(name: string): BABYLON.Nullable<BABYLON.Behavior<Control3D>>;
  5377. /** Gets or sets a boolean indicating if the control is visible */
  5378. isVisible: boolean;
  5379. /**
  5380. * Creates a new control
  5381. * @param name defines the control name
  5382. */
  5383. constructor(
  5384. /** Defines the control name */
  5385. name?: string | undefined);
  5386. /**
  5387. * Gets a string representing the class name
  5388. */
  5389. readonly typeName: string;
  5390. protected _getTypeName(): string;
  5391. /**
  5392. * Gets the transform node used by this control
  5393. */
  5394. readonly node: BABYLON.Nullable<BABYLON.TransformNode>;
  5395. /**
  5396. * Gets the mesh used to render this control
  5397. */
  5398. readonly mesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  5399. /**
  5400. * Link the control as child of the given node
  5401. * @param node defines the node to link to. Use null to unlink the control
  5402. * @returns the current control
  5403. */
  5404. linkToTransformNode(node: BABYLON.Nullable<BABYLON.TransformNode>): Control3D;
  5405. /** @hidden **/
  5406. _prepareNode(scene: BABYLON.Scene): void;
  5407. /**
  5408. * Node creation.
  5409. * Can be overriden by children
  5410. * @param scene defines the scene where the node must be attached
  5411. * @returns the attached node or null if none. Must return a BABYLON.Mesh or BABYLON.AbstractMesh if there is an atttached visible object
  5412. */
  5413. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  5414. /**
  5415. * Affect a material to the given mesh
  5416. * @param mesh defines the mesh which will represent the control
  5417. */
  5418. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  5419. /** @hidden */
  5420. _onPointerMove(target: Control3D, coordinates: BABYLON.Vector3): void;
  5421. /** @hidden */
  5422. _onPointerEnter(target: Control3D): boolean;
  5423. /** @hidden */
  5424. _onPointerOut(target: Control3D): void;
  5425. /** @hidden */
  5426. _onPointerDown(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  5427. /** @hidden */
  5428. _onPointerUp(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  5429. /** @hidden */
  5430. forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  5431. /** @hidden */
  5432. _processObservables(type: number, pickedPoint: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  5433. /** @hidden */
  5434. _disposeNode(): void;
  5435. /**
  5436. * Releases all associated resources
  5437. */
  5438. dispose(): void;
  5439. }
  5440. }
  5441. declare module BABYLON.GUI {
  5442. /**
  5443. * Class used to create a container panel deployed on the surface of a cylinder
  5444. */
  5445. export class CylinderPanel extends VolumeBasedPanel {
  5446. /**
  5447. * Gets or sets the radius of the cylinder where to project controls (5 by default)
  5448. */
  5449. radius: BABYLON.float;
  5450. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  5451. }
  5452. }
  5453. declare module BABYLON.GUI {
  5454. /**
  5455. * Class used to create a holographic button in 3D
  5456. */
  5457. export class HolographicButton extends Button3D {
  5458. /**
  5459. * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
  5460. */
  5461. tooltipText: BABYLON.Nullable<string>;
  5462. /**
  5463. * Gets or sets text for the button
  5464. */
  5465. text: string;
  5466. /**
  5467. * Gets or sets the image url for the button
  5468. */
  5469. imageUrl: string;
  5470. /**
  5471. * Gets the back material used by this button
  5472. */
  5473. readonly backMaterial: FluentMaterial;
  5474. /**
  5475. * Gets the front material used by this button
  5476. */
  5477. readonly frontMaterial: FluentMaterial;
  5478. /**
  5479. * Gets the plate material used by this button
  5480. */
  5481. readonly plateMaterial: BABYLON.StandardMaterial;
  5482. /**
  5483. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  5484. */
  5485. readonly shareMaterials: boolean;
  5486. /**
  5487. * Creates a new button
  5488. * @param name defines the control name
  5489. */
  5490. constructor(name?: string, shareMaterials?: boolean);
  5491. protected _getTypeName(): string;
  5492. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  5493. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  5494. protected _affectMaterial(mesh: BABYLON.Mesh): void;
  5495. /**
  5496. * Releases all associated resources
  5497. */
  5498. dispose(): void;
  5499. }
  5500. }
  5501. declare module BABYLON.GUI {
  5502. /**
  5503. * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene
  5504. */
  5505. export class MeshButton3D extends Button3D {
  5506. /** @hidden */
  5507. protected _currentMesh: BABYLON.Mesh;
  5508. /**
  5509. * Creates a new 3D button based on a mesh
  5510. * @param mesh mesh to become a 3D button
  5511. * @param name defines the control name
  5512. */
  5513. constructor(mesh: BABYLON.Mesh, name?: string);
  5514. protected _getTypeName(): string;
  5515. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  5516. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  5517. }
  5518. }
  5519. declare module BABYLON.GUI {
  5520. /**
  5521. * Class used to create a container panel deployed on the surface of a plane
  5522. */
  5523. export class PlanePanel extends VolumeBasedPanel {
  5524. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  5525. }
  5526. }
  5527. declare module BABYLON.GUI {
  5528. /**
  5529. * Class used to create a container panel where items get randomized planar mapping
  5530. */
  5531. export class ScatterPanel extends VolumeBasedPanel {
  5532. /**
  5533. * Gets or sets the number of iteration to use to scatter the controls (100 by default)
  5534. */
  5535. iteration: BABYLON.float;
  5536. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  5537. protected _finalProcessing(): void;
  5538. }
  5539. }
  5540. declare module BABYLON.GUI {
  5541. /**
  5542. * Class used to create a container panel deployed on the surface of a sphere
  5543. */
  5544. export class SpherePanel extends VolumeBasedPanel {
  5545. /**
  5546. * Gets or sets the radius of the sphere where to project controls (5 by default)
  5547. */
  5548. radius: BABYLON.float;
  5549. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  5550. }
  5551. }
  5552. declare module BABYLON.GUI {
  5553. /**
  5554. * Class used to create a stack panel in 3D on XY plane
  5555. */
  5556. export class StackPanel3D extends Container3D {
  5557. /**
  5558. * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)
  5559. */
  5560. isVertical: boolean;
  5561. /**
  5562. * Gets or sets the distance between elements
  5563. */
  5564. margin: number;
  5565. /**
  5566. * Creates new StackPanel
  5567. * @param isVertical
  5568. */
  5569. constructor(isVertical?: boolean);
  5570. protected _arrangeChildren(): void;
  5571. }
  5572. }
  5573. declare module BABYLON.GUI {
  5574. /**
  5575. * Abstract class used to create a container panel deployed on the surface of a volume
  5576. */
  5577. export abstract class VolumeBasedPanel extends Container3D {
  5578. protected _cellWidth: number;
  5579. protected _cellHeight: number;
  5580. /**
  5581. * Gets or sets the distance between elements
  5582. */
  5583. margin: number;
  5584. /**
  5585. * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)
  5586. * | Value | Type | Description |
  5587. * | ----- | ----------------------------------- | ----------- |
  5588. * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |
  5589. * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |
  5590. * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |
  5591. * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |
  5592. * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |
  5593. */
  5594. orientation: number;
  5595. /**
  5596. * Gets or sets the number of columns requested (10 by default).
  5597. * The panel will automatically compute the number of rows based on number of child controls.
  5598. */
  5599. columns: BABYLON.int;
  5600. /**
  5601. * Gets or sets a the number of rows requested.
  5602. * The panel will automatically compute the number of columns based on number of child controls.
  5603. */
  5604. rows: BABYLON.int;
  5605. /**
  5606. * Creates new VolumeBasedPanel
  5607. */
  5608. constructor();
  5609. protected _arrangeChildren(): void;
  5610. /** Child classes must implement this function to provide correct control positioning */
  5611. protected abstract _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  5612. /** Child classes can implement this function to provide additional processing */
  5613. protected _finalProcessing(): void;
  5614. }
  5615. }
  5616. declare module BABYLON.GUI {
  5617. /** @hidden */
  5618. export class FluentMaterialDefines extends BABYLON.MaterialDefines {
  5619. INNERGLOW: boolean;
  5620. BORDER: boolean;
  5621. HOVERLIGHT: boolean;
  5622. TEXTURE: boolean;
  5623. constructor();
  5624. }
  5625. /**
  5626. * Class used to render controls with fluent desgin
  5627. */
  5628. export class FluentMaterial extends BABYLON.PushMaterial {
  5629. /**
  5630. * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)
  5631. */
  5632. innerGlowColorIntensity: number;
  5633. /**
  5634. * Gets or sets the inner glow color (white by default)
  5635. */
  5636. innerGlowColor: BABYLON.Color3;
  5637. /**
  5638. * Gets or sets alpha value (default is 1.0)
  5639. */
  5640. alpha: number;
  5641. /**
  5642. * Gets or sets the albedo color (Default is BABYLON.Color3(0.3, 0.35, 0.4))
  5643. */
  5644. albedoColor: BABYLON.Color3;
  5645. /**
  5646. * Gets or sets a boolean indicating if borders must be rendered (default is false)
  5647. */
  5648. renderBorders: boolean;
  5649. /**
  5650. * Gets or sets border width (default is 0.5)
  5651. */
  5652. borderWidth: number;
  5653. /**
  5654. * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)
  5655. */
  5656. edgeSmoothingValue: number;
  5657. /**
  5658. * Gets or sets the minimum value that can be applied to border width (default is 0.1)
  5659. */
  5660. borderMinValue: number;
  5661. /**
  5662. * Gets or sets a boolean indicating if hover light must be rendered (default is false)
  5663. */
  5664. renderHoverLight: boolean;
  5665. /**
  5666. * Gets or sets the radius used to render the hover light (default is 1.0)
  5667. */
  5668. hoverRadius: number;
  5669. /**
  5670. * Gets or sets the color used to render the hover light (default is BABYLON.Color4(0.3, 0.3, 0.3, 1.0))
  5671. */
  5672. hoverColor: BABYLON.Color4;
  5673. /**
  5674. * Gets or sets the hover light position in world space (default is BABYLON.Vector3.Zero())
  5675. */
  5676. hoverPosition: BABYLON.Vector3;
  5677. /** Gets or sets the texture to use for albedo color */
  5678. albedoTexture: BABYLON.Nullable<BABYLON.BaseTexture>;
  5679. /**
  5680. * Creates a new Fluent material
  5681. * @param name defines the name of the material
  5682. * @param scene defines the hosting scene
  5683. */
  5684. constructor(name: string, scene: BABYLON.Scene);
  5685. needAlphaBlending(): boolean;
  5686. needAlphaTesting(): boolean;
  5687. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  5688. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  5689. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  5690. getActiveTextures(): BABYLON.BaseTexture[];
  5691. hasTexture(texture: BABYLON.BaseTexture): boolean;
  5692. dispose(forceDisposeEffect?: boolean): void;
  5693. clone(name: string): FluentMaterial;
  5694. serialize(): any;
  5695. getClassName(): string;
  5696. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): FluentMaterial;
  5697. }
  5698. }