babylon.gui.module.d.ts 260 KB

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