babylon.gui.module.d.ts 256 KB

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