babylon.gui.module.d.ts 254 KB

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