babylon.gui.d.ts 142 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575
  1. declare module BABYLON.GUI {
  2. /**
  3. * Class used to specific a value and its associated unit
  4. */
  5. export class ValueAndUnit {
  6. /** defines the unit to store */
  7. unit: number;
  8. /** defines a boolean indicating if the value can be negative */
  9. negativeValueAllowed: boolean;
  10. private _value;
  11. private _originalUnit;
  12. /**
  13. * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
  14. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  15. */
  16. ignoreAdaptiveScaling: boolean;
  17. /**
  18. * Creates a new ValueAndUnit
  19. * @param value defines the value to store
  20. * @param unit defines the unit to store
  21. * @param negativeValueAllowed defines a boolean indicating if the value can be negative
  22. */
  23. constructor(value: number,
  24. /** defines the unit to store */
  25. unit?: number,
  26. /** defines a boolean indicating if the value can be negative */
  27. negativeValueAllowed?: boolean);
  28. /** Gets a boolean indicating if the value is a percentage */
  29. readonly isPercentage: boolean;
  30. /** Gets a boolean indicating if the value is store as pixel */
  31. readonly isPixel: boolean;
  32. /** Gets direct internal value */
  33. readonly internalValue: number;
  34. /**
  35. * Gets value as pixel
  36. * @param host defines the root host
  37. * @param refValue defines the reference value for percentages
  38. * @returns the value as pixel
  39. */
  40. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  41. /**
  42. * Update the current value and unit. This should be done cautiously as the GUi won't be marked as dirty with this function.
  43. * @param value defines the value to store
  44. * @param unit defines the unit to store
  45. * @returns the current ValueAndUnit
  46. */
  47. updateInPlace(value: number, unit?: number): ValueAndUnit;
  48. /**
  49. * Gets the value accordingly to its unit
  50. * @param host defines the root host
  51. * @returns the value
  52. */
  53. getValue(host: AdvancedDynamicTexture): number;
  54. /**
  55. * Gets a string representation of the value
  56. * @param host defines the root host
  57. * @returns a string
  58. */
  59. toString(host: AdvancedDynamicTexture): string;
  60. /**
  61. * Store a value parsed from a string
  62. * @param source defines the source string
  63. * @returns true if the value was successfully parsed
  64. */
  65. fromString(source: string | number): boolean;
  66. private static _Regex;
  67. private static _UNITMODE_PERCENTAGE;
  68. private static _UNITMODE_PIXEL;
  69. /** UNITMODE_PERCENTAGE */
  70. static readonly UNITMODE_PERCENTAGE: number;
  71. /** UNITMODE_PIXEL */
  72. static readonly UNITMODE_PIXEL: number;
  73. }
  74. }
  75. declare module BABYLON.GUI {
  76. /**
  77. * Define a style used by control to automatically setup properties based on a template.
  78. * Only support font related properties so far
  79. */
  80. export class Style implements BABYLON.IDisposable {
  81. private _fontFamily;
  82. private _fontStyle;
  83. private _fontWeight;
  84. /** @hidden */
  85. _host: AdvancedDynamicTexture;
  86. /** @hidden */
  87. _fontSize: ValueAndUnit;
  88. /**
  89. * BABYLON.Observable raised when the style values are changed
  90. */
  91. onChangedObservable: BABYLON.Observable<Style>;
  92. /**
  93. * Creates a new style object
  94. * @param host defines the AdvancedDynamicTexture which hosts this style
  95. */
  96. constructor(host: AdvancedDynamicTexture);
  97. /**
  98. * Gets or sets the font size
  99. */
  100. fontSize: string | number;
  101. /**
  102. * Gets or sets the font family
  103. */
  104. fontFamily: string;
  105. /**
  106. * Gets or sets the font style
  107. */
  108. fontStyle: string;
  109. /** Gets or sets font weight */
  110. fontWeight: string;
  111. /** Dispose all associated resources */
  112. dispose(): void;
  113. }
  114. }
  115. declare module BABYLON.GUI {
  116. /**
  117. * Class used to transport BABYLON.Vector2 information for pointer events
  118. */
  119. export class Vector2WithInfo extends BABYLON.Vector2 {
  120. /** defines the current mouse button index */
  121. buttonIndex: number;
  122. /**
  123. * Creates a new Vector2WithInfo
  124. * @param source defines the vector2 data to transport
  125. * @param buttonIndex defines the current mouse button index
  126. */
  127. constructor(source: BABYLON.Vector2,
  128. /** defines the current mouse button index */
  129. buttonIndex?: number);
  130. }
  131. /** Class used to provide 2D matrix features */
  132. export class Matrix2D {
  133. /** Gets the internal array of 6 floats used to store matrix data */
  134. m: Float32Array;
  135. /**
  136. * Creates a new matrix
  137. * @param m00 defines value for (0, 0)
  138. * @param m01 defines value for (0, 1)
  139. * @param m10 defines value for (1, 0)
  140. * @param m11 defines value for (1, 1)
  141. * @param m20 defines value for (2, 0)
  142. * @param m21 defines value for (2, 1)
  143. */
  144. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  145. /**
  146. * Fills the matrix from direct values
  147. * @param m00 defines value for (0, 0)
  148. * @param m01 defines value for (0, 1)
  149. * @param m10 defines value for (1, 0)
  150. * @param m11 defines value for (1, 1)
  151. * @param m20 defines value for (2, 0)
  152. * @param m21 defines value for (2, 1)
  153. * @returns the current modified matrix
  154. */
  155. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  156. /**
  157. * Gets matrix determinant
  158. * @returns the determinant
  159. */
  160. determinant(): number;
  161. /**
  162. * Inverses the matrix and stores it in a target matrix
  163. * @param result defines the target matrix
  164. * @returns the current matrix
  165. */
  166. invertToRef(result: Matrix2D): Matrix2D;
  167. /**
  168. * Multiplies the current matrix with another one
  169. * @param other defines the second operand
  170. * @param result defines the target matrix
  171. * @returns the current matrix
  172. */
  173. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  174. /**
  175. * Applies the current matrix to a set of 2 floats and stores the result in a vector2
  176. * @param x defines the x coordinate to transform
  177. * @param y defines the x coordinate to transform
  178. * @param result defines the target vector2
  179. * @returns the current matrix
  180. */
  181. transformCoordinates(x: number, y: number, result: BABYLON.Vector2): Matrix2D;
  182. /**
  183. * Creates an identity matrix
  184. * @returns a new matrix
  185. */
  186. static Identity(): Matrix2D;
  187. /**
  188. * Creates a translation matrix and stores it in a target matrix
  189. * @param x defines the x coordinate of the translation
  190. * @param y defines the y coordinate of the translation
  191. * @param result defines the target matrix
  192. */
  193. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  194. /**
  195. * Creates a scaling matrix and stores it in a target matrix
  196. * @param x defines the x coordinate of the scaling
  197. * @param y defines the y coordinate of the scaling
  198. * @param result defines the target matrix
  199. */
  200. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  201. /**
  202. * Creates a rotation matrix and stores it in a target matrix
  203. * @param angle defines the rotation angle
  204. * @param result defines the target matrix
  205. */
  206. static RotationToRef(angle: number, result: Matrix2D): void;
  207. private static _TempPreTranslationMatrix;
  208. private static _TempPostTranslationMatrix;
  209. private static _TempRotationMatrix;
  210. private static _TempScalingMatrix;
  211. private static _TempCompose0;
  212. private static _TempCompose1;
  213. private static _TempCompose2;
  214. /**
  215. * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
  216. * @param tx defines the x coordinate of the translation
  217. * @param ty defines the y coordinate of the translation
  218. * @param angle defines the rotation angle
  219. * @param scaleX defines the x coordinate of the scaling
  220. * @param scaleY defines the y coordinate of the scaling
  221. * @param parentMatrix defines the parent matrix to multiply by (can be null)
  222. * @param result defines the target matrix
  223. */
  224. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: BABYLON.Nullable<Matrix2D>, result: Matrix2D): void;
  225. }
  226. }
  227. declare module BABYLON.GUI {
  228. /**
  229. * Class used to store 2D control sizes
  230. */
  231. export class Measure {
  232. /** defines left coordinate */
  233. left: number;
  234. /** defines top coordinate */
  235. top: number;
  236. /** defines width dimension */
  237. width: number;
  238. /** defines height dimension */
  239. height: number;
  240. /**
  241. * Creates a new measure
  242. * @param left defines left coordinate
  243. * @param top defines top coordinate
  244. * @param width defines width dimension
  245. * @param height defines height dimension
  246. */
  247. constructor(
  248. /** defines left coordinate */
  249. left: number,
  250. /** defines top coordinate */
  251. top: number,
  252. /** defines width dimension */
  253. width: number,
  254. /** defines height dimension */
  255. height: number);
  256. /**
  257. * Copy from another measure
  258. * @param other defines the other measure to copy from
  259. */
  260. copyFrom(other: Measure): void;
  261. /**
  262. * Copy from a group of 4 floats
  263. * @param left defines left coordinate
  264. * @param top defines top coordinate
  265. * @param width defines width dimension
  266. * @param height defines height dimension
  267. */
  268. copyFromFloats(left: number, top: number, width: number, height: number): void;
  269. /**
  270. * Computes the axis aligned bounding box measure for two given measures
  271. * @param a Input measure
  272. * @param b Input measure
  273. * @param result the resulting bounding measure
  274. */
  275. static CombineToRef(a: Measure, b: Measure, result: Measure): void;
  276. /**
  277. * Computes the axis aligned bounding box of the measure after it is modified by a given transform
  278. * @param transform the matrix to transform the measure before computing the AABB
  279. * @param result the resulting AABB
  280. */
  281. transformToRef(transform: Matrix2D, result: Measure): void;
  282. /**
  283. * Check equality between this measure and another one
  284. * @param other defines the other measures
  285. * @returns true if both measures are equals
  286. */
  287. isEqualsTo(other: Measure): boolean;
  288. /**
  289. * Creates an empty measure
  290. * @returns a new measure
  291. */
  292. static Empty(): Measure;
  293. }
  294. }
  295. declare module BABYLON.GUI {
  296. /**
  297. * Interface used to define a control that can receive focus
  298. */
  299. export interface IFocusableControl {
  300. /**
  301. * Function called when the control receives the focus
  302. */
  303. onFocus(): void;
  304. /**
  305. * Function called when the control loses the focus
  306. */
  307. onBlur(): void;
  308. /**
  309. * Function called to let the control handle keyboard events
  310. * @param evt defines the current keyboard event
  311. */
  312. processKeyboard(evt: KeyboardEvent): void;
  313. /**
  314. * Function called to get the list of controls that should not steal the focus from this control
  315. * @returns an array of controls
  316. */
  317. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  318. }
  319. /**
  320. * Class used to create texture to support 2D GUI elements
  321. * @see http://doc.babylonjs.com/how_to/gui
  322. */
  323. export class AdvancedDynamicTexture extends BABYLON.DynamicTexture {
  324. private _isDirty;
  325. private _renderObserver;
  326. private _resizeObserver;
  327. private _preKeyboardObserver;
  328. private _pointerMoveObserver;
  329. private _pointerObserver;
  330. private _canvasPointerOutObserver;
  331. private _background;
  332. /** @hidden */
  333. _rootContainer: Container;
  334. /** @hidden */
  335. _lastPickedControl: Control;
  336. /** @hidden */
  337. _lastControlOver: {
  338. [pointerId: number]: Control;
  339. };
  340. /** @hidden */
  341. _lastControlDown: {
  342. [pointerId: number]: Control;
  343. };
  344. /** @hidden */
  345. _capturingControl: {
  346. [pointerId: number]: Control;
  347. };
  348. /** @hidden */
  349. _shouldBlockPointer: boolean;
  350. /** @hidden */
  351. _layerToDispose: BABYLON.Nullable<BABYLON.Layer>;
  352. /** @hidden */
  353. _linkedControls: Control[];
  354. private _isFullscreen;
  355. private _fullscreenViewport;
  356. private _idealWidth;
  357. private _idealHeight;
  358. private _useSmallestIdeal;
  359. private _renderAtIdealSize;
  360. private _focusedControl;
  361. private _blockNextFocusCheck;
  362. private _renderScale;
  363. private _rootCanvas;
  364. /**
  365. * Define type to string to ensure compatibility across browsers
  366. * Safari doesn't support DataTransfer constructor
  367. */
  368. private _clipboardData;
  369. /**
  370. * BABYLON.Observable event triggered each time an clipboard event is received from the rendering canvas
  371. */
  372. onClipboardObservable: BABYLON.Observable<BABYLON.ClipboardInfo>;
  373. /**
  374. * BABYLON.Observable event triggered each time a pointer down is intercepted by a control
  375. */
  376. onControlPickedObservable: BABYLON.Observable<Control>;
  377. /**
  378. * BABYLON.Observable event triggered before layout is evaluated
  379. */
  380. onBeginLayoutObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  381. /**
  382. * BABYLON.Observable event triggered after the layout was evaluated
  383. */
  384. onEndLayoutObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  385. /**
  386. * BABYLON.Observable event triggered before the texture is rendered
  387. */
  388. onBeginRenderObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  389. /**
  390. * BABYLON.Observable event triggered after the texture was rendered
  391. */
  392. onEndRenderObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  393. /**
  394. * Gets or sets a boolean defining if alpha is stored as premultiplied
  395. */
  396. premulAlpha: boolean;
  397. /**
  398. * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
  399. * Useful when you want more antialiasing
  400. */
  401. renderScale: number;
  402. /** Gets or sets the background color */
  403. background: string;
  404. /**
  405. * Gets or sets the ideal width used to design controls.
  406. * The GUI will then rescale everything accordingly
  407. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  408. */
  409. idealWidth: number;
  410. /**
  411. * Gets or sets the ideal height used to design controls.
  412. * The GUI will then rescale everything accordingly
  413. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  414. */
  415. idealHeight: number;
  416. /**
  417. * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
  418. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  419. */
  420. useSmallestIdeal: boolean;
  421. /**
  422. * Gets or sets a boolean indicating if adaptive scaling must be used
  423. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  424. */
  425. renderAtIdealSize: boolean;
  426. /**
  427. * Gets the underlying layer used to render the texture when in fullscreen mode
  428. */
  429. readonly layer: BABYLON.Nullable<BABYLON.Layer>;
  430. /**
  431. * Gets the root container control
  432. */
  433. readonly rootContainer: Container;
  434. /**
  435. * Returns an array containing the root container.
  436. * This is mostly used to let the Inspector introspects the ADT
  437. * @returns an array containing the rootContainer
  438. */
  439. getChildren(): Array<Container>;
  440. /**
  441. * Will return all controls that are inside this texture
  442. * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
  443. * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
  444. * @return all child controls
  445. */
  446. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  447. /**
  448. * Gets or sets the current focused control
  449. */
  450. focusedControl: BABYLON.Nullable<IFocusableControl>;
  451. /**
  452. * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
  453. */
  454. isForeground: boolean;
  455. /**
  456. * Gets or set information about clipboardData
  457. */
  458. clipboardData: string;
  459. /**
  460. * Creates a new AdvancedDynamicTexture
  461. * @param name defines the name of the texture
  462. * @param width defines the width of the texture
  463. * @param height defines the height of the texture
  464. * @param scene defines the hosting scene
  465. * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
  466. * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
  467. */
  468. constructor(name: string, width: number | undefined, height: number | undefined, scene: BABYLON.Nullable<BABYLON.Scene>, generateMipMaps?: boolean, samplingMode?: number);
  469. /**
  470. * Get the current class name of the texture useful for serialization or dynamic coding.
  471. * @returns "AdvancedDynamicTexture"
  472. */
  473. getClassName(): string;
  474. /**
  475. * Function used to execute a function on all controls
  476. * @param func defines the function to execute
  477. * @param container defines the container where controls belong. If null the root container will be used
  478. */
  479. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  480. private _useInvalidateRectOptimization;
  481. /**
  482. * Gets or sets a boolean indicating if the InvalidateRect optimization should be turned on
  483. */
  484. useInvalidateRectOptimization: boolean;
  485. private _invalidatedRectangle;
  486. /**
  487. * Invalidates a rectangle area on the gui texture
  488. * @param invalidMinX left most position of the rectangle to invalidate in the texture
  489. * @param invalidMinY top most position of the rectangle to invalidate in the texture
  490. * @param invalidMaxX right most position of the rectangle to invalidate in the texture
  491. * @param invalidMaxY bottom most position of the rectangle to invalidate in the texture
  492. */
  493. invalidateRect(invalidMinX: number, invalidMinY: number, invalidMaxX: number, invalidMaxY: number): void;
  494. /**
  495. * Marks the texture as dirty forcing a complete update
  496. */
  497. markAsDirty(): void;
  498. /**
  499. * Helper function used to create a new style
  500. * @returns a new style
  501. * @see http://doc.babylonjs.com/how_to/gui#styles
  502. */
  503. createStyle(): Style;
  504. /**
  505. * Adds a new control to the root container
  506. * @param control defines the control to add
  507. * @returns the current texture
  508. */
  509. addControl(control: Control): AdvancedDynamicTexture;
  510. /**
  511. * Removes a control from the root container
  512. * @param control defines the control to remove
  513. * @returns the current texture
  514. */
  515. removeControl(control: Control): AdvancedDynamicTexture;
  516. /**
  517. * Release all resources
  518. */
  519. dispose(): void;
  520. private _onResize;
  521. /** @hidden */
  522. _getGlobalViewport(scene: BABYLON.Scene): BABYLON.Viewport;
  523. /**
  524. * Get screen coordinates for a vector3
  525. * @param position defines the position to project
  526. * @param worldMatrix defines the world matrix to use
  527. * @returns the projected position
  528. */
  529. getProjectedPosition(position: BABYLON.Vector3, worldMatrix: BABYLON.Matrix): BABYLON.Vector2;
  530. private _checkUpdate;
  531. private _clearMeasure;
  532. private _render;
  533. /** @hidden */
  534. _changeCursor(cursor: string): void;
  535. /** @hidden */
  536. _registerLastControlDown(control: Control, pointerId: number): void;
  537. private _doPicking;
  538. /** @hidden */
  539. _cleanControlAfterRemovalFromList(list: {
  540. [pointerId: number]: Control;
  541. }, control: Control): void;
  542. /** @hidden */
  543. _cleanControlAfterRemoval(control: Control): void;
  544. /** Attach to all scene events required to support pointer events */
  545. attach(): void;
  546. /** @hidden */
  547. private onClipboardCopy;
  548. /** @hidden */
  549. private onClipboardCut;
  550. /** @hidden */
  551. private onClipboardPaste;
  552. /**
  553. * Register the clipboard Events onto the canvas
  554. */
  555. registerClipboardEvents(): void;
  556. /**
  557. * Unregister the clipboard Events from the canvas
  558. */
  559. unRegisterClipboardEvents(): void;
  560. /**
  561. * Connect the texture to a hosting mesh to enable interactions
  562. * @param mesh defines the mesh to attach to
  563. * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
  564. */
  565. attachToMesh(mesh: BABYLON.AbstractMesh, supportPointerMove?: boolean): void;
  566. /**
  567. * Move the focus to a specific control
  568. * @param control defines the control which will receive the focus
  569. */
  570. moveFocusToControl(control: IFocusableControl): void;
  571. private _manageFocus;
  572. private _attachToOnPointerOut;
  573. /**
  574. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
  575. * @param mesh defines the mesh which will receive the texture
  576. * @param width defines the texture width (1024 by default)
  577. * @param height defines the texture height (1024 by default)
  578. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  579. * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)
  580. * @returns a new AdvancedDynamicTexture
  581. */
  582. static CreateForMesh(mesh: BABYLON.AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, onlyAlphaTesting?: boolean): AdvancedDynamicTexture;
  583. /**
  584. * Creates a new AdvancedDynamicTexture in fullscreen mode.
  585. * In this mode the texture will rely on a layer for its rendering.
  586. * This allows it to be treated like any other layer.
  587. * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
  588. * LayerMask is set through advancedTexture.layer.layerMask
  589. * @param name defines name for the texture
  590. * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
  591. * @param scene defines the hsoting scene
  592. * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
  593. * @returns a new AdvancedDynamicTexture
  594. */
  595. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: BABYLON.Nullable<BABYLON.Scene>, sampling?: number): AdvancedDynamicTexture;
  596. }
  597. }
  598. declare module BABYLON.GUI {
  599. /**
  600. * Root class used for all 2D controls
  601. * @see http://doc.babylonjs.com/how_to/gui#controls
  602. */
  603. export class Control {
  604. /** defines the name of the control */
  605. name?: string | undefined;
  606. /**
  607. * Gets or sets a boolean indicating if alpha must be an inherited value (false by default)
  608. */
  609. static AllowAlphaInheritance: boolean;
  610. private _alpha;
  611. private _alphaSet;
  612. private _zIndex;
  613. /** @hidden */
  614. _host: AdvancedDynamicTexture;
  615. /** Gets or sets the control parent */
  616. parent: BABYLON.Nullable<Container>;
  617. /** @hidden */
  618. _currentMeasure: Measure;
  619. private _fontFamily;
  620. private _fontStyle;
  621. private _fontWeight;
  622. private _fontSize;
  623. private _font;
  624. /** @hidden */
  625. _width: ValueAndUnit;
  626. /** @hidden */
  627. _height: ValueAndUnit;
  628. /** @hidden */
  629. protected _fontOffset: {
  630. ascent: number;
  631. height: number;
  632. descent: number;
  633. };
  634. private _color;
  635. private _style;
  636. private _styleObserver;
  637. /** @hidden */
  638. protected _horizontalAlignment: number;
  639. /** @hidden */
  640. protected _verticalAlignment: number;
  641. /** @hidden */
  642. protected _isDirty: boolean;
  643. /** @hidden */
  644. protected _wasDirty: boolean;
  645. /** @hidden */
  646. _tempParentMeasure: Measure;
  647. /** @hidden */
  648. _prevCurrentMeasureTransformedIntoGlobalSpace: Measure;
  649. /** @hidden */
  650. protected _cachedParentMeasure: Measure;
  651. private _paddingLeft;
  652. private _paddingRight;
  653. private _paddingTop;
  654. private _paddingBottom;
  655. /** @hidden */
  656. _left: ValueAndUnit;
  657. /** @hidden */
  658. _top: ValueAndUnit;
  659. private _scaleX;
  660. private _scaleY;
  661. private _rotation;
  662. private _transformCenterX;
  663. private _transformCenterY;
  664. /** @hidden */
  665. _transformMatrix: Matrix2D;
  666. /** @hidden */
  667. protected _invertTransformMatrix: Matrix2D;
  668. /** @hidden */
  669. protected _transformedPosition: BABYLON.Vector2;
  670. private _isMatrixDirty;
  671. private _cachedOffsetX;
  672. private _cachedOffsetY;
  673. private _isVisible;
  674. private _isHighlighted;
  675. /** @hidden */
  676. _linkedMesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  677. private _fontSet;
  678. private _dummyVector2;
  679. private _downCount;
  680. private _enterCount;
  681. private _doNotRender;
  682. private _downPointerIds;
  683. protected _isEnabled: boolean;
  684. protected _disabledColor: string;
  685. /** @hidden */
  686. protected _rebuildLayout: boolean;
  687. /** @hidden */
  688. _isClipped: boolean;
  689. /** @hidden */
  690. _tag: any;
  691. /**
  692. * Gets or sets the unique id of the node. Please note that this number will be updated when the control is added to a container
  693. */
  694. uniqueId: number;
  695. /**
  696. * Gets or sets an object used to store user defined information for the node
  697. */
  698. metadata: any;
  699. /** Gets or sets a boolean indicating if the control can be hit with pointer events */
  700. isHitTestVisible: boolean;
  701. /** Gets or sets a boolean indicating if the control can block pointer events */
  702. isPointerBlocker: boolean;
  703. /** Gets or sets a boolean indicating if the control can be focusable */
  704. isFocusInvisible: boolean;
  705. /**
  706. * Gets or sets a boolean indicating if the children are clipped to the current control bounds.
  707. * Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
  708. */
  709. clipChildren: boolean;
  710. /**
  711. * Gets or sets a boolean indicating that the current control should cache its rendering (useful when the control does not change often)
  712. */
  713. useBitmapCache: boolean;
  714. private _cacheData;
  715. private _shadowOffsetX;
  716. /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
  717. shadowOffsetX: number;
  718. private _shadowOffsetY;
  719. /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
  720. shadowOffsetY: number;
  721. private _shadowBlur;
  722. /** Gets or sets a value indicating the amount of blur to use to render the shadow */
  723. shadowBlur: number;
  724. private _shadowColor;
  725. /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
  726. shadowColor: string;
  727. /** Gets or sets the cursor to use when the control is hovered */
  728. hoverCursor: string;
  729. /** @hidden */
  730. protected _linkOffsetX: ValueAndUnit;
  731. /** @hidden */
  732. protected _linkOffsetY: ValueAndUnit;
  733. /** Gets the control type name */
  734. readonly typeName: string;
  735. /**
  736. * Get the current class name of the control.
  737. * @returns current class name
  738. */
  739. getClassName(): string;
  740. /**
  741. * An event triggered when the pointer move over the control.
  742. */
  743. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector2>;
  744. /**
  745. * An event triggered when the pointer move out of the control.
  746. */
  747. onPointerOutObservable: BABYLON.Observable<Control>;
  748. /**
  749. * An event triggered when the pointer taps the control
  750. */
  751. onPointerDownObservable: BABYLON.Observable<Vector2WithInfo>;
  752. /**
  753. * An event triggered when pointer up
  754. */
  755. onPointerUpObservable: BABYLON.Observable<Vector2WithInfo>;
  756. /**
  757. * An event triggered when a control is clicked on
  758. */
  759. onPointerClickObservable: BABYLON.Observable<Vector2WithInfo>;
  760. /**
  761. * An event triggered when pointer enters the control
  762. */
  763. onPointerEnterObservable: BABYLON.Observable<Control>;
  764. /**
  765. * An event triggered when the control is marked as dirty
  766. */
  767. onDirtyObservable: BABYLON.Observable<Control>;
  768. /**
  769. * An event triggered before drawing the control
  770. */
  771. onBeforeDrawObservable: BABYLON.Observable<Control>;
  772. /**
  773. * An event triggered after the control was drawn
  774. */
  775. onAfterDrawObservable: BABYLON.Observable<Control>;
  776. /**
  777. * Get the hosting AdvancedDynamicTexture
  778. */
  779. readonly host: AdvancedDynamicTexture;
  780. /** Gets or set information about font offsets (used to render and align text) */
  781. fontOffset: {
  782. ascent: number;
  783. height: number;
  784. descent: number;
  785. };
  786. /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
  787. alpha: number;
  788. /**
  789. * Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)
  790. */
  791. isHighlighted: boolean;
  792. /** Gets or sets a value indicating the scale factor on X axis (1 by default)
  793. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  794. */
  795. scaleX: number;
  796. /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
  797. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  798. */
  799. scaleY: number;
  800. /** Gets or sets the rotation angle (0 by default)
  801. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  802. */
  803. rotation: number;
  804. /** Gets or sets the transformation center on Y axis (0 by default)
  805. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  806. */
  807. transformCenterY: number;
  808. /** Gets or sets the transformation center on X axis (0 by default)
  809. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  810. */
  811. transformCenterX: number;
  812. /**
  813. * Gets or sets the horizontal alignment
  814. * @see http://doc.babylonjs.com/how_to/gui#alignments
  815. */
  816. horizontalAlignment: number;
  817. /**
  818. * Gets or sets the vertical alignment
  819. * @see http://doc.babylonjs.com/how_to/gui#alignments
  820. */
  821. verticalAlignment: number;
  822. /**
  823. * Gets or sets control width
  824. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  825. */
  826. width: string | number;
  827. /**
  828. * Gets control width in pixel
  829. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  830. */
  831. readonly widthInPixels: number;
  832. /**
  833. * Gets or sets control height
  834. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  835. */
  836. height: string | number;
  837. /**
  838. * Gets control height in pixel
  839. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  840. */
  841. readonly heightInPixels: number;
  842. /** Gets or set font family */
  843. fontFamily: string;
  844. /** Gets or sets font style */
  845. fontStyle: string;
  846. /** Gets or sets font weight */
  847. fontWeight: string;
  848. /**
  849. * Gets or sets style
  850. * @see http://doc.babylonjs.com/how_to/gui#styles
  851. */
  852. style: BABYLON.Nullable<Style>;
  853. /** @hidden */
  854. readonly _isFontSizeInPercentage: boolean;
  855. /** Gets font size in pixels */
  856. readonly fontSizeInPixels: number;
  857. /** Gets or sets font size */
  858. fontSize: string | number;
  859. /** Gets or sets foreground color */
  860. color: string;
  861. /** Gets or sets z index which is used to reorder controls on the z axis */
  862. zIndex: number;
  863. /** Gets or sets a boolean indicating if the control can be rendered */
  864. notRenderable: boolean;
  865. /** Gets or sets a boolean indicating if the control is visible */
  866. isVisible: boolean;
  867. /** Gets a boolean indicating that the control needs to update its rendering */
  868. readonly isDirty: boolean;
  869. /**
  870. * Gets the current linked mesh (or null if none)
  871. */
  872. readonly linkedMesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  873. /**
  874. * Gets or sets a value indicating the padding to use on the left of the control
  875. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  876. */
  877. paddingLeft: string | number;
  878. /**
  879. * Gets a value indicating the padding in pixels to use on the left of the control
  880. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  881. */
  882. readonly paddingLeftInPixels: number;
  883. /**
  884. * Gets or sets a value indicating the padding to use on the right of the control
  885. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  886. */
  887. paddingRight: string | number;
  888. /**
  889. * Gets a value indicating the padding in pixels to use on the right of the control
  890. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  891. */
  892. readonly paddingRightInPixels: number;
  893. /**
  894. * Gets or sets a value indicating the padding to use on the top of the control
  895. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  896. */
  897. paddingTop: string | number;
  898. /**
  899. * Gets a value indicating the padding in pixels to use on the top of the control
  900. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  901. */
  902. readonly paddingTopInPixels: number;
  903. /**
  904. * Gets or sets a value indicating the padding to use on the bottom of the control
  905. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  906. */
  907. paddingBottom: string | number;
  908. /**
  909. * Gets a value indicating the padding in pixels to use on the bottom of the control
  910. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  911. */
  912. readonly paddingBottomInPixels: number;
  913. /**
  914. * Gets or sets a value indicating the left coordinate of the control
  915. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  916. */
  917. left: string | number;
  918. /**
  919. * Gets a value indicating the left coordinate in pixels of the control
  920. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  921. */
  922. readonly leftInPixels: number;
  923. /**
  924. * Gets or sets a value indicating the top coordinate of the control
  925. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  926. */
  927. top: string | number;
  928. /**
  929. * Gets a value indicating the top coordinate in pixels of the control
  930. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  931. */
  932. readonly topInPixels: number;
  933. /**
  934. * Gets or sets a value indicating the offset on X axis to the linked mesh
  935. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  936. */
  937. linkOffsetX: string | number;
  938. /**
  939. * Gets a value indicating the offset in pixels on X axis to the linked mesh
  940. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  941. */
  942. readonly linkOffsetXInPixels: number;
  943. /**
  944. * Gets or sets a value indicating the offset on Y axis to the linked mesh
  945. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  946. */
  947. linkOffsetY: string | number;
  948. /**
  949. * Gets a value indicating the offset in pixels on Y axis to the linked mesh
  950. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  951. */
  952. readonly linkOffsetYInPixels: number;
  953. /** Gets the center coordinate on X axis */
  954. readonly centerX: number;
  955. /** Gets the center coordinate on Y axis */
  956. readonly centerY: number;
  957. /** Gets or sets if control is Enabled*/
  958. isEnabled: boolean;
  959. /** Gets or sets background color of control if it's disabled*/
  960. disabledColor: string;
  961. /**
  962. * Creates a new control
  963. * @param name defines the name of the control
  964. */
  965. constructor(
  966. /** defines the name of the control */
  967. name?: string | undefined);
  968. /** @hidden */
  969. protected _getTypeName(): string;
  970. /**
  971. * Gets the first ascendant in the hierarchy of the given type
  972. * @param className defines the required type
  973. * @returns the ascendant or null if not found
  974. */
  975. getAscendantOfClass(className: string): BABYLON.Nullable<Control>;
  976. /** @hidden */
  977. _resetFontCache(): void;
  978. /**
  979. * Determines if a container is an ascendant of the current control
  980. * @param container defines the container to look for
  981. * @returns true if the container is one of the ascendant of the control
  982. */
  983. isAscendant(container: Control): boolean;
  984. /**
  985. * Gets coordinates in local control space
  986. * @param globalCoordinates defines the coordinates to transform
  987. * @returns the new coordinates in local space
  988. */
  989. getLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  990. /**
  991. * Gets coordinates in local control space
  992. * @param globalCoordinates defines the coordinates to transform
  993. * @param result defines the target vector2 where to store the result
  994. * @returns the current control
  995. */
  996. getLocalCoordinatesToRef(globalCoordinates: BABYLON.Vector2, result: BABYLON.Vector2): Control;
  997. /**
  998. * Gets coordinates in parent local control space
  999. * @param globalCoordinates defines the coordinates to transform
  1000. * @returns the new coordinates in parent local space
  1001. */
  1002. getParentLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  1003. /**
  1004. * Move the current control to a vector3 position projected onto the screen.
  1005. * @param position defines the target position
  1006. * @param scene defines the hosting scene
  1007. */
  1008. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene): void;
  1009. /** @hidden */
  1010. _getDescendants(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  1011. /**
  1012. * Will return all controls that have this control as ascendant
  1013. * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
  1014. * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
  1015. * @return all child controls
  1016. */
  1017. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  1018. /**
  1019. * Link current control with a target mesh
  1020. * @param mesh defines the mesh to link with
  1021. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1022. */
  1023. linkWithMesh(mesh: BABYLON.Nullable<BABYLON.AbstractMesh>): void;
  1024. /** @hidden */
  1025. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3): void;
  1026. /** @hidden */
  1027. _offsetLeft(offset: number): void;
  1028. /** @hidden */
  1029. _offsetTop(offset: number): void;
  1030. /** @hidden */
  1031. _markMatrixAsDirty(): void;
  1032. /** @hidden */
  1033. _flagDescendantsAsMatrixDirty(): void;
  1034. /** @hidden */
  1035. _intersectsRect(rect: Measure): boolean;
  1036. /** @hidden */
  1037. protected invalidateRect(): void;
  1038. /** @hidden */
  1039. _markAsDirty(force?: boolean): void;
  1040. /** @hidden */
  1041. _markAllAsDirty(): void;
  1042. /** @hidden */
  1043. _link(host: AdvancedDynamicTexture): void;
  1044. /** @hidden */
  1045. protected _transform(context?: CanvasRenderingContext2D): void;
  1046. /** @hidden */
  1047. _renderHighlight(context: CanvasRenderingContext2D): void;
  1048. /** @hidden */
  1049. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  1050. /** @hidden */
  1051. protected _applyStates(context: CanvasRenderingContext2D): void;
  1052. /** @hidden */
  1053. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  1054. /** @hidden */
  1055. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1056. protected _evaluateClippingState(parentMeasure: Measure): void;
  1057. /** @hidden */
  1058. _measure(): void;
  1059. /** @hidden */
  1060. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1061. /** @hidden */
  1062. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1063. /** @hidden */
  1064. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1065. /** @hidden */
  1066. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  1067. private static _ClipMeasure;
  1068. private _tmpMeasureA;
  1069. private _clip;
  1070. /** @hidden */
  1071. _render(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): boolean;
  1072. /** @hidden */
  1073. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  1074. /**
  1075. * Tests if a given coordinates belong to the current control
  1076. * @param x defines x coordinate to test
  1077. * @param y defines y coordinate to test
  1078. * @returns true if the coordinates are inside the control
  1079. */
  1080. contains(x: number, y: number): boolean;
  1081. /** @hidden */
  1082. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  1083. /** @hidden */
  1084. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  1085. /** @hidden */
  1086. _onPointerEnter(target: Control): boolean;
  1087. /** @hidden */
  1088. _onPointerOut(target: Control, force?: boolean): void;
  1089. /** @hidden */
  1090. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  1091. /** @hidden */
  1092. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  1093. /** @hidden */
  1094. _forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  1095. /** @hidden */
  1096. _processObservables(type: number, x: number, y: number, pointerId: number, buttonIndex: number): boolean;
  1097. private _prepareFont;
  1098. /** Releases associated resources */
  1099. dispose(): void;
  1100. private static _HORIZONTAL_ALIGNMENT_LEFT;
  1101. private static _HORIZONTAL_ALIGNMENT_RIGHT;
  1102. private static _HORIZONTAL_ALIGNMENT_CENTER;
  1103. private static _VERTICAL_ALIGNMENT_TOP;
  1104. private static _VERTICAL_ALIGNMENT_BOTTOM;
  1105. private static _VERTICAL_ALIGNMENT_CENTER;
  1106. /** HORIZONTAL_ALIGNMENT_LEFT */
  1107. static readonly HORIZONTAL_ALIGNMENT_LEFT: number;
  1108. /** HORIZONTAL_ALIGNMENT_RIGHT */
  1109. static readonly HORIZONTAL_ALIGNMENT_RIGHT: number;
  1110. /** HORIZONTAL_ALIGNMENT_CENTER */
  1111. static readonly HORIZONTAL_ALIGNMENT_CENTER: number;
  1112. /** VERTICAL_ALIGNMENT_TOP */
  1113. static readonly VERTICAL_ALIGNMENT_TOP: number;
  1114. /** VERTICAL_ALIGNMENT_BOTTOM */
  1115. static readonly VERTICAL_ALIGNMENT_BOTTOM: number;
  1116. /** VERTICAL_ALIGNMENT_CENTER */
  1117. static readonly VERTICAL_ALIGNMENT_CENTER: number;
  1118. private static _FontHeightSizes;
  1119. /** @hidden */
  1120. static _GetFontOffset(font: string): {
  1121. ascent: number;
  1122. height: number;
  1123. descent: number;
  1124. };
  1125. /**
  1126. * Creates a stack panel that can be used to render headers
  1127. * @param control defines the control to associate with the header
  1128. * @param text defines the text of the header
  1129. * @param size defines the size of the header
  1130. * @param options defines options used to configure the header
  1131. * @returns a new StackPanel
  1132. * @ignore
  1133. * @hidden
  1134. */
  1135. static AddHeader: (control: Control, text: string, size: string | number, options: {
  1136. isHorizontal: boolean;
  1137. controlFirst: boolean;
  1138. }) => any;
  1139. /** @hidden */
  1140. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  1141. }
  1142. }
  1143. declare module BABYLON.GUI {
  1144. /**
  1145. * Root class for 2D containers
  1146. * @see http://doc.babylonjs.com/how_to/gui#containers
  1147. */
  1148. export class Container extends Control {
  1149. name?: string | undefined;
  1150. /** @hidden */
  1151. protected _children: Control[];
  1152. /** @hidden */
  1153. protected _measureForChildren: Measure;
  1154. /** @hidden */
  1155. protected _background: string;
  1156. /** @hidden */
  1157. protected _adaptWidthToChildren: boolean;
  1158. /** @hidden */
  1159. protected _adaptHeightToChildren: boolean;
  1160. /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
  1161. adaptHeightToChildren: boolean;
  1162. /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
  1163. adaptWidthToChildren: boolean;
  1164. /** Gets or sets background color */
  1165. background: string;
  1166. /** Gets the list of children */
  1167. readonly children: Control[];
  1168. /**
  1169. * Creates a new Container
  1170. * @param name defines the name of the container
  1171. */
  1172. constructor(name?: string | undefined);
  1173. protected _getTypeName(): string;
  1174. _flagDescendantsAsMatrixDirty(): void;
  1175. /**
  1176. * Gets a child using its name
  1177. * @param name defines the child name to look for
  1178. * @returns the child control if found
  1179. */
  1180. getChildByName(name: string): BABYLON.Nullable<Control>;
  1181. /**
  1182. * Gets a child using its type and its name
  1183. * @param name defines the child name to look for
  1184. * @param type defines the child type to look for
  1185. * @returns the child control if found
  1186. */
  1187. getChildByType(name: string, type: string): BABYLON.Nullable<Control>;
  1188. /**
  1189. * Search for a specific control in children
  1190. * @param control defines the control to look for
  1191. * @returns true if the control is in child list
  1192. */
  1193. containsControl(control: Control): boolean;
  1194. /**
  1195. * Adds a new control to the current container
  1196. * @param control defines the control to add
  1197. * @returns the current container
  1198. */
  1199. addControl(control: BABYLON.Nullable<Control>): Container;
  1200. /**
  1201. * Removes all controls from the current container
  1202. * @returns the current container
  1203. */
  1204. clearControls(): Container;
  1205. /**
  1206. * Removes a control from the current container
  1207. * @param control defines the control to remove
  1208. * @returns the current container
  1209. */
  1210. removeControl(control: Control): Container;
  1211. /** @hidden */
  1212. _reOrderControl(control: Control): void;
  1213. /** @hidden */
  1214. _offsetLeft(offset: number): void;
  1215. /** @hidden */
  1216. _offsetTop(offset: number): void;
  1217. /** @hidden */
  1218. _markAllAsDirty(): void;
  1219. /** @hidden */
  1220. protected _localDraw(context: CanvasRenderingContext2D): void;
  1221. /** @hidden */
  1222. _link(host: AdvancedDynamicTexture): void;
  1223. /** @hidden */
  1224. protected _beforeLayout(): void;
  1225. /** @hidden */
  1226. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1227. /** @hidden */
  1228. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  1229. protected _postMeasure(): void;
  1230. /** @hidden */
  1231. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Measure): void;
  1232. /** @hidden */
  1233. _getDescendants(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  1234. /** @hidden */
  1235. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  1236. /** @hidden */
  1237. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1238. /** Releases associated resources */
  1239. dispose(): void;
  1240. }
  1241. }
  1242. declare module BABYLON.GUI {
  1243. /** Class used to create rectangle container */
  1244. export class Rectangle extends Container {
  1245. name?: string | undefined;
  1246. private _thickness;
  1247. private _cornerRadius;
  1248. /** Gets or sets border thickness */
  1249. thickness: number;
  1250. /** Gets or sets the corner radius angle */
  1251. cornerRadius: number;
  1252. /**
  1253. * Creates a new Rectangle
  1254. * @param name defines the control name
  1255. */
  1256. constructor(name?: string | undefined);
  1257. protected _getTypeName(): string;
  1258. protected _localDraw(context: CanvasRenderingContext2D): void;
  1259. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1260. private _drawRoundedRect;
  1261. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  1262. }
  1263. }
  1264. declare module BABYLON.GUI {
  1265. /**
  1266. * Enum that determines the text-wrapping mode to use.
  1267. */
  1268. export enum TextWrapping {
  1269. /**
  1270. * Clip the text when it's larger than Control.width; this is the default mode.
  1271. */
  1272. Clip = 0,
  1273. /**
  1274. * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.
  1275. */
  1276. WordWrap = 1,
  1277. /**
  1278. * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.
  1279. */
  1280. Ellipsis = 2
  1281. }
  1282. /**
  1283. * Class used to create text block control
  1284. */
  1285. export class TextBlock extends Control {
  1286. /**
  1287. * Defines the name of the control
  1288. */
  1289. name?: string | undefined;
  1290. private _text;
  1291. private _textWrapping;
  1292. private _textHorizontalAlignment;
  1293. private _textVerticalAlignment;
  1294. private _lines;
  1295. private _resizeToFit;
  1296. private _lineSpacing;
  1297. private _outlineWidth;
  1298. private _outlineColor;
  1299. /**
  1300. * An event triggered after the text is changed
  1301. */
  1302. onTextChangedObservable: BABYLON.Observable<TextBlock>;
  1303. /**
  1304. * An event triggered after the text was broken up into lines
  1305. */
  1306. onLinesReadyObservable: BABYLON.Observable<TextBlock>;
  1307. /**
  1308. * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
  1309. */
  1310. readonly lines: any[];
  1311. /**
  1312. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  1313. */
  1314. /**
  1315. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  1316. */
  1317. resizeToFit: boolean;
  1318. /**
  1319. * Gets or sets a boolean indicating if text must be wrapped
  1320. */
  1321. /**
  1322. * Gets or sets a boolean indicating if text must be wrapped
  1323. */
  1324. textWrapping: TextWrapping | boolean;
  1325. /**
  1326. * Gets or sets text to display
  1327. */
  1328. /**
  1329. * Gets or sets text to display
  1330. */
  1331. text: string;
  1332. /**
  1333. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  1334. */
  1335. /**
  1336. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  1337. */
  1338. textHorizontalAlignment: number;
  1339. /**
  1340. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  1341. */
  1342. /**
  1343. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  1344. */
  1345. textVerticalAlignment: number;
  1346. /**
  1347. * Gets or sets line spacing value
  1348. */
  1349. /**
  1350. * Gets or sets line spacing value
  1351. */
  1352. lineSpacing: string | number;
  1353. /**
  1354. * Gets or sets outlineWidth of the text to display
  1355. */
  1356. /**
  1357. * Gets or sets outlineWidth of the text to display
  1358. */
  1359. outlineWidth: number;
  1360. /**
  1361. * Gets or sets outlineColor of the text to display
  1362. */
  1363. /**
  1364. * Gets or sets outlineColor of the text to display
  1365. */
  1366. outlineColor: string;
  1367. /**
  1368. * Creates a new TextBlock object
  1369. * @param name defines the name of the control
  1370. * @param text defines the text to display (emptry string by default)
  1371. */
  1372. constructor(
  1373. /**
  1374. * Defines the name of the control
  1375. */
  1376. name?: string | undefined, text?: string);
  1377. protected _getTypeName(): string;
  1378. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1379. private _drawText;
  1380. /** @hidden */
  1381. _draw(context: CanvasRenderingContext2D): void;
  1382. protected _applyStates(context: CanvasRenderingContext2D): void;
  1383. protected _breakLines(refWidth: number, context: CanvasRenderingContext2D): object[];
  1384. protected _parseLine(line: string | undefined, context: CanvasRenderingContext2D): object;
  1385. protected _parseLineEllipsis(line: string | undefined, width: number, context: CanvasRenderingContext2D): object;
  1386. protected _parseLineWordWrap(line: string | undefined, width: number, context: CanvasRenderingContext2D): object[];
  1387. protected _renderLines(context: CanvasRenderingContext2D): void;
  1388. /**
  1389. * Given a width constraint applied on the text block, find the expected height
  1390. * @returns expected height
  1391. */
  1392. computeExpectedHeight(): number;
  1393. dispose(): void;
  1394. }
  1395. }
  1396. declare module BABYLON.GUI {
  1397. /**
  1398. * Class used to create 2D images
  1399. */
  1400. export class Image extends Control {
  1401. name?: string | undefined;
  1402. private static _WorkingCanvas;
  1403. private _domImage;
  1404. private _imageWidth;
  1405. private _imageHeight;
  1406. private _loaded;
  1407. private _stretch;
  1408. private _source;
  1409. private _autoScale;
  1410. private _sourceLeft;
  1411. private _sourceTop;
  1412. private _sourceWidth;
  1413. private _sourceHeight;
  1414. private _cellWidth;
  1415. private _cellHeight;
  1416. private _cellId;
  1417. private _populateNinePatchSlicesFromImage;
  1418. private _sliceLeft;
  1419. private _sliceRight;
  1420. private _sliceTop;
  1421. private _sliceBottom;
  1422. private _detectPointerOnOpaqueOnly;
  1423. /**
  1424. * BABYLON.Observable notified when the content is loaded
  1425. */
  1426. onImageLoadedObservable: BABYLON.Observable<Image>;
  1427. /**
  1428. * Gets a boolean indicating that the content is loaded
  1429. */
  1430. readonly isLoaded: boolean;
  1431. /**
  1432. * Gets or sets a boolean indicating if nine patch slices (left, top, right, bottom) should be read from image data
  1433. */
  1434. populateNinePatchSlicesFromImage: boolean;
  1435. /**
  1436. * Gets or sets a boolean indicating if pointers should only be validated on pixels with alpha > 0.
  1437. * Beware using this as this will comsume more memory as the image has to be stored twice
  1438. */
  1439. detectPointerOnOpaqueOnly: boolean;
  1440. /**
  1441. * Gets or sets the left value for slicing (9-patch)
  1442. */
  1443. sliceLeft: number;
  1444. /**
  1445. * Gets or sets the right value for slicing (9-patch)
  1446. */
  1447. sliceRight: number;
  1448. /**
  1449. * Gets or sets the top value for slicing (9-patch)
  1450. */
  1451. sliceTop: number;
  1452. /**
  1453. * Gets or sets the bottom value for slicing (9-patch)
  1454. */
  1455. sliceBottom: number;
  1456. /**
  1457. * Gets or sets the left coordinate in the source image
  1458. */
  1459. sourceLeft: number;
  1460. /**
  1461. * Gets or sets the top coordinate in the source image
  1462. */
  1463. sourceTop: number;
  1464. /**
  1465. * Gets or sets the width to capture in the source image
  1466. */
  1467. sourceWidth: number;
  1468. /**
  1469. * Gets or sets the height to capture in the source image
  1470. */
  1471. sourceHeight: number;
  1472. /**
  1473. * Gets or sets a boolean indicating if the image can force its container to adapt its size
  1474. * @see http://doc.babylonjs.com/how_to/gui#image
  1475. */
  1476. autoScale: boolean;
  1477. /** Gets or sets the streching mode used by the image */
  1478. stretch: number;
  1479. /**
  1480. * Gets or sets the internal DOM image used to render the control
  1481. */
  1482. domImage: HTMLImageElement;
  1483. private _onImageLoaded;
  1484. private _extractNinePatchSliceDataFromImage;
  1485. /**
  1486. * Gets or sets image source url
  1487. */
  1488. source: BABYLON.Nullable<string>;
  1489. /**
  1490. * Gets or sets the cell width to use when animation sheet is enabled
  1491. * @see http://doc.babylonjs.com/how_to/gui#image
  1492. */
  1493. cellWidth: number;
  1494. /**
  1495. * Gets or sets the cell height to use when animation sheet is enabled
  1496. * @see http://doc.babylonjs.com/how_to/gui#image
  1497. */
  1498. cellHeight: number;
  1499. /**
  1500. * Gets or sets the cell id to use (this will turn on the animation sheet mode)
  1501. * @see http://doc.babylonjs.com/how_to/gui#image
  1502. */
  1503. cellId: number;
  1504. /**
  1505. * Creates a new Image
  1506. * @param name defines the control name
  1507. * @param url defines the image url
  1508. */
  1509. constructor(name?: string | undefined, url?: BABYLON.Nullable<string>);
  1510. /**
  1511. * Tests if a given coordinates belong to the current control
  1512. * @param x defines x coordinate to test
  1513. * @param y defines y coordinate to test
  1514. * @returns true if the coordinates are inside the control
  1515. */
  1516. contains(x: number, y: number): boolean;
  1517. protected _getTypeName(): string;
  1518. /** Force the control to synchronize with its content */
  1519. synchronizeSizeWithContent(): void;
  1520. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1521. private _prepareWorkingCanvasForOpaqueDetection;
  1522. private _drawImage;
  1523. _draw(context: CanvasRenderingContext2D): void;
  1524. private _renderCornerPatch;
  1525. private _renderNinePatch;
  1526. dispose(): void;
  1527. /** STRETCH_NONE */
  1528. static readonly STRETCH_NONE: number;
  1529. /** STRETCH_FILL */
  1530. static readonly STRETCH_FILL: number;
  1531. /** STRETCH_UNIFORM */
  1532. static readonly STRETCH_UNIFORM: number;
  1533. /** STRETCH_EXTEND */
  1534. static readonly STRETCH_EXTEND: number;
  1535. /** NINE_PATCH */
  1536. static readonly STRETCH_NINE_PATCH: number;
  1537. }
  1538. }
  1539. declare module BABYLON.GUI {
  1540. /**
  1541. * Class used to create 2D buttons
  1542. */
  1543. export class Button extends Rectangle {
  1544. name?: string | undefined;
  1545. /**
  1546. * Function called to generate a pointer enter animation
  1547. */
  1548. pointerEnterAnimation: () => void;
  1549. /**
  1550. * Function called to generate a pointer out animation
  1551. */
  1552. pointerOutAnimation: () => void;
  1553. /**
  1554. * Function called to generate a pointer down animation
  1555. */
  1556. pointerDownAnimation: () => void;
  1557. /**
  1558. * Function called to generate a pointer up animation
  1559. */
  1560. pointerUpAnimation: () => void;
  1561. private _image;
  1562. /**
  1563. * Returns the image part of the button (if any)
  1564. */
  1565. readonly image: BABYLON.Nullable<Image>;
  1566. private _textBlock;
  1567. /**
  1568. * Returns the image part of the button (if any)
  1569. */
  1570. readonly textBlock: BABYLON.Nullable<TextBlock>;
  1571. /**
  1572. * Creates a new Button
  1573. * @param name defines the name of the button
  1574. */
  1575. constructor(name?: string | undefined);
  1576. protected _getTypeName(): string;
  1577. /** @hidden */
  1578. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  1579. /** @hidden */
  1580. _onPointerEnter(target: Control): boolean;
  1581. /** @hidden */
  1582. _onPointerOut(target: Control, force?: boolean): void;
  1583. /** @hidden */
  1584. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  1585. /** @hidden */
  1586. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  1587. /**
  1588. * Creates a new button made with an image and a text
  1589. * @param name defines the name of the button
  1590. * @param text defines the text of the button
  1591. * @param imageUrl defines the url of the image
  1592. * @returns a new Button
  1593. */
  1594. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  1595. /**
  1596. * Creates a new button made with an image
  1597. * @param name defines the name of the button
  1598. * @param imageUrl defines the url of the image
  1599. * @returns a new Button
  1600. */
  1601. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  1602. /**
  1603. * Creates a new button made with a text
  1604. * @param name defines the name of the button
  1605. * @param text defines the text of the button
  1606. * @returns a new Button
  1607. */
  1608. static CreateSimpleButton(name: string, text: string): Button;
  1609. /**
  1610. * Creates a new button made with an image and a centered text
  1611. * @param name defines the name of the button
  1612. * @param text defines the text of the button
  1613. * @param imageUrl defines the url of the image
  1614. * @returns a new Button
  1615. */
  1616. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  1617. }
  1618. }
  1619. declare module BABYLON.GUI {
  1620. /**
  1621. * Class used to create a 2D stack panel container
  1622. */
  1623. export class StackPanel extends Container {
  1624. name?: string | undefined;
  1625. private _isVertical;
  1626. private _manualWidth;
  1627. private _manualHeight;
  1628. private _doNotTrackManualChanges;
  1629. /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
  1630. isVertical: boolean;
  1631. /**
  1632. * Gets or sets panel width.
  1633. * This value should not be set when in horizontal mode as it will be computed automatically
  1634. */
  1635. width: string | number;
  1636. /**
  1637. * Gets or sets panel height.
  1638. * This value should not be set when in vertical mode as it will be computed automatically
  1639. */
  1640. height: string | number;
  1641. /**
  1642. * Creates a new StackPanel
  1643. * @param name defines control name
  1644. */
  1645. constructor(name?: string | undefined);
  1646. protected _getTypeName(): string;
  1647. /** @hidden */
  1648. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1649. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1650. protected _postMeasure(): void;
  1651. }
  1652. }
  1653. declare module BABYLON.GUI {
  1654. /**
  1655. * Class used to represent a 2D checkbox
  1656. */
  1657. export class Checkbox extends Control {
  1658. name?: string | undefined;
  1659. private _isChecked;
  1660. private _background;
  1661. private _checkSizeRatio;
  1662. private _thickness;
  1663. /** Gets or sets border thickness */
  1664. thickness: number;
  1665. /**
  1666. * BABYLON.Observable raised when isChecked property changes
  1667. */
  1668. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  1669. /** Gets or sets a value indicating the ratio between overall size and check size */
  1670. checkSizeRatio: number;
  1671. /** Gets or sets background color */
  1672. background: string;
  1673. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  1674. isChecked: boolean;
  1675. /**
  1676. * Creates a new CheckBox
  1677. * @param name defines the control name
  1678. */
  1679. constructor(name?: string | undefined);
  1680. protected _getTypeName(): string;
  1681. /** @hidden */
  1682. _draw(context: CanvasRenderingContext2D): void;
  1683. /** @hidden */
  1684. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  1685. /**
  1686. * Utility function to easily create a checkbox with a header
  1687. * @param title defines the label to use for the header
  1688. * @param onValueChanged defines the callback to call when value changes
  1689. * @returns a StackPanel containing the checkbox and a textBlock
  1690. */
  1691. static AddCheckBoxWithHeader(title: string, onValueChanged: (value: boolean) => void): StackPanel;
  1692. }
  1693. }
  1694. declare module BABYLON.GUI {
  1695. /**
  1696. * Class used to store key control properties
  1697. */
  1698. export class KeyPropertySet {
  1699. /** Width */
  1700. width?: string;
  1701. /** Height */
  1702. height?: string;
  1703. /** Left padding */
  1704. paddingLeft?: string;
  1705. /** Right padding */
  1706. paddingRight?: string;
  1707. /** Top padding */
  1708. paddingTop?: string;
  1709. /** Bottom padding */
  1710. paddingBottom?: string;
  1711. /** Foreground color */
  1712. color?: string;
  1713. /** Background color */
  1714. background?: string;
  1715. }
  1716. /**
  1717. * Class used to create virtual keyboard
  1718. */
  1719. export class VirtualKeyboard extends StackPanel {
  1720. /** BABYLON.Observable raised when a key is pressed */
  1721. onKeyPressObservable: BABYLON.Observable<string>;
  1722. /** Gets or sets default key button width */
  1723. defaultButtonWidth: string;
  1724. /** Gets or sets default key button height */
  1725. defaultButtonHeight: string;
  1726. /** Gets or sets default key button left padding */
  1727. defaultButtonPaddingLeft: string;
  1728. /** Gets or sets default key button right padding */
  1729. defaultButtonPaddingRight: string;
  1730. /** Gets or sets default key button top padding */
  1731. defaultButtonPaddingTop: string;
  1732. /** Gets or sets default key button bottom padding */
  1733. defaultButtonPaddingBottom: string;
  1734. /** Gets or sets default key button foreground color */
  1735. defaultButtonColor: string;
  1736. /** Gets or sets default key button background color */
  1737. defaultButtonBackground: string;
  1738. /** Gets or sets shift button foreground color */
  1739. shiftButtonColor: string;
  1740. /** Gets or sets shift button thickness*/
  1741. selectedShiftThickness: number;
  1742. /** Gets shift key state */
  1743. shiftState: number;
  1744. protected _getTypeName(): string;
  1745. private _createKey;
  1746. /**
  1747. * Adds a new row of keys
  1748. * @param keys defines the list of keys to add
  1749. * @param propertySets defines the associated property sets
  1750. */
  1751. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  1752. /**
  1753. * Set the shift key to a specific state
  1754. * @param shiftState defines the new shift state
  1755. */
  1756. applyShiftState(shiftState: number): void;
  1757. private _currentlyConnectedInputText;
  1758. private _connectedInputTexts;
  1759. private _onKeyPressObserver;
  1760. /** Gets the input text control currently attached to the keyboard */
  1761. readonly connectedInputText: BABYLON.Nullable<InputText>;
  1762. /**
  1763. * Connects the keyboard with an input text control
  1764. *
  1765. * @param input defines the target control
  1766. */
  1767. connect(input: InputText): void;
  1768. /**
  1769. * Disconnects the keyboard from connected InputText controls
  1770. *
  1771. * @param input optionally defines a target control, otherwise all are disconnected
  1772. */
  1773. disconnect(input?: InputText): void;
  1774. private _removeConnectedInputObservables;
  1775. /**
  1776. * Release all resources
  1777. */
  1778. dispose(): void;
  1779. /**
  1780. * Creates a new keyboard using a default layout
  1781. *
  1782. * @param name defines control name
  1783. * @returns a new VirtualKeyboard
  1784. */
  1785. static CreateDefaultLayout(name?: string): VirtualKeyboard;
  1786. }
  1787. }
  1788. declare module BABYLON.GUI {
  1789. /**
  1790. * Class used to create input text control
  1791. */
  1792. export class InputText extends Control implements IFocusableControl {
  1793. name?: string | undefined;
  1794. private _text;
  1795. private _placeholderText;
  1796. private _background;
  1797. private _focusedBackground;
  1798. private _focusedColor;
  1799. private _placeholderColor;
  1800. private _thickness;
  1801. private _margin;
  1802. private _autoStretchWidth;
  1803. private _maxWidth;
  1804. private _isFocused;
  1805. private _blinkTimeout;
  1806. private _blinkIsEven;
  1807. private _cursorOffset;
  1808. private _scrollLeft;
  1809. private _textWidth;
  1810. private _clickedCoordinate;
  1811. private _deadKey;
  1812. private _addKey;
  1813. private _currentKey;
  1814. private _isTextHighlightOn;
  1815. private _textHighlightColor;
  1816. private _highligherOpacity;
  1817. private _highlightedText;
  1818. private _startHighlightIndex;
  1819. private _endHighlightIndex;
  1820. private _cursorIndex;
  1821. private _onFocusSelectAll;
  1822. private _isPointerDown;
  1823. private _onClipboardObserver;
  1824. private _onPointerDblTapObserver;
  1825. /** @hidden */
  1826. _connectedVirtualKeyboard: BABYLON.Nullable<VirtualKeyboard>;
  1827. /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
  1828. promptMessage: string;
  1829. /** BABYLON.Observable raised when the text changes */
  1830. onTextChangedObservable: BABYLON.Observable<InputText>;
  1831. /** BABYLON.Observable raised just before an entered character is to be added */
  1832. onBeforeKeyAddObservable: BABYLON.Observable<InputText>;
  1833. /** BABYLON.Observable raised when the control gets the focus */
  1834. onFocusObservable: BABYLON.Observable<InputText>;
  1835. /** BABYLON.Observable raised when the control loses the focus */
  1836. onBlurObservable: BABYLON.Observable<InputText>;
  1837. /**Observable raised when the text is highlighted */
  1838. onTextHighlightObservable: BABYLON.Observable<InputText>;
  1839. /**Observable raised when copy event is triggered */
  1840. onTextCopyObservable: BABYLON.Observable<InputText>;
  1841. /** BABYLON.Observable raised when cut event is triggered */
  1842. onTextCutObservable: BABYLON.Observable<InputText>;
  1843. /** BABYLON.Observable raised when paste event is triggered */
  1844. onTextPasteObservable: BABYLON.Observable<InputText>;
  1845. /** BABYLON.Observable raised when a key event was processed */
  1846. onKeyboardEventProcessedObservable: BABYLON.Observable<KeyboardEvent>;
  1847. /** Gets or sets the maximum width allowed by the control */
  1848. maxWidth: string | number;
  1849. /** Gets the maximum width allowed by the control in pixels */
  1850. readonly maxWidthInPixels: number;
  1851. /** Gets or sets the text highlighter transparency; default: 0.4 */
  1852. highligherOpacity: number;
  1853. /** Gets or sets a boolean indicating whether to select complete text by default on input focus */
  1854. onFocusSelectAll: boolean;
  1855. /** Gets or sets the text hightlight color */
  1856. textHighlightColor: string;
  1857. /** Gets or sets control margin */
  1858. margin: string;
  1859. /** Gets control margin in pixels */
  1860. readonly marginInPixels: number;
  1861. /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
  1862. autoStretchWidth: boolean;
  1863. /** Gets or sets border thickness */
  1864. thickness: number;
  1865. /** Gets or sets the background color when focused */
  1866. focusedBackground: string;
  1867. /** Gets or sets the background color when focused */
  1868. focusedColor: string;
  1869. /** Gets or sets the background color */
  1870. background: string;
  1871. /** Gets or sets the placeholder color */
  1872. placeholderColor: string;
  1873. /** Gets or sets the text displayed when the control is empty */
  1874. placeholderText: string;
  1875. /** Gets or sets the dead key flag */
  1876. deadKey: boolean;
  1877. /** Gets or sets the highlight text */
  1878. highlightedText: string;
  1879. /** Gets or sets if the current key should be added */
  1880. addKey: boolean;
  1881. /** Gets or sets the value of the current key being entered */
  1882. currentKey: string;
  1883. /** Gets or sets the text displayed in the control */
  1884. text: string;
  1885. /** Gets or sets control width */
  1886. width: string | number;
  1887. /**
  1888. * Creates a new InputText
  1889. * @param name defines the control name
  1890. * @param text defines the text of the control
  1891. */
  1892. constructor(name?: string | undefined, text?: string);
  1893. /** @hidden */
  1894. onBlur(): void;
  1895. /** @hidden */
  1896. onFocus(): void;
  1897. protected _getTypeName(): string;
  1898. /**
  1899. * Function called to get the list of controls that should not steal the focus from this control
  1900. * @returns an array of controls
  1901. */
  1902. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  1903. /** @hidden */
  1904. processKey(keyCode: number, key?: string, evt?: KeyboardEvent): void;
  1905. /** @hidden */
  1906. private _updateValueFromCursorIndex;
  1907. /** @hidden */
  1908. private _processDblClick;
  1909. /** @hidden */
  1910. private _selectAllText;
  1911. /**
  1912. * Handles the keyboard event
  1913. * @param evt Defines the KeyboardEvent
  1914. */
  1915. processKeyboard(evt: KeyboardEvent): void;
  1916. /** @hidden */
  1917. private _onCopyText;
  1918. /** @hidden */
  1919. private _onCutText;
  1920. /** @hidden */
  1921. private _onPasteText;
  1922. _draw(context: CanvasRenderingContext2D): void;
  1923. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  1924. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  1925. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  1926. protected _beforeRenderText(text: string): string;
  1927. dispose(): void;
  1928. }
  1929. }
  1930. declare module BABYLON.GUI {
  1931. /**
  1932. * Class used to create a 2D grid container
  1933. */
  1934. export class Grid extends Container {
  1935. name?: string | undefined;
  1936. private _rowDefinitions;
  1937. private _columnDefinitions;
  1938. private _cells;
  1939. private _childControls;
  1940. /**
  1941. * Gets the number of columns
  1942. */
  1943. readonly columnCount: number;
  1944. /**
  1945. * Gets the number of rows
  1946. */
  1947. readonly rowCount: number;
  1948. /** Gets the list of children */
  1949. readonly children: Control[];
  1950. /**
  1951. * Gets the definition of a specific row
  1952. * @param index defines the index of the row
  1953. * @returns the row definition
  1954. */
  1955. getRowDefinition(index: number): BABYLON.Nullable<ValueAndUnit>;
  1956. /**
  1957. * Gets the definition of a specific column
  1958. * @param index defines the index of the column
  1959. * @returns the column definition
  1960. */
  1961. getColumnDefinition(index: number): BABYLON.Nullable<ValueAndUnit>;
  1962. /**
  1963. * Adds a new row to the grid
  1964. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  1965. * @param isPixel defines if the height is expressed in pixel (or in percentage)
  1966. * @returns the current grid
  1967. */
  1968. addRowDefinition(height: number, isPixel?: boolean): Grid;
  1969. /**
  1970. * Adds a new column to the grid
  1971. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  1972. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  1973. * @returns the current grid
  1974. */
  1975. addColumnDefinition(width: number, isPixel?: boolean): Grid;
  1976. /**
  1977. * Update a row definition
  1978. * @param index defines the index of the row to update
  1979. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  1980. * @param isPixel defines if the weight is expressed in pixel (or in percentage)
  1981. * @returns the current grid
  1982. */
  1983. setRowDefinition(index: number, height: number, isPixel?: boolean): Grid;
  1984. /**
  1985. * Update a column definition
  1986. * @param index defines the index of the column to update
  1987. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  1988. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  1989. * @returns the current grid
  1990. */
  1991. setColumnDefinition(index: number, width: number, isPixel?: boolean): Grid;
  1992. /**
  1993. * Gets the list of children stored in a specific cell
  1994. * @param row defines the row to check
  1995. * @param column defines the column to check
  1996. * @returns the list of controls
  1997. */
  1998. getChildrenAt(row: number, column: number): BABYLON.Nullable<Array<Control>>;
  1999. /**
  2000. * Gets a string representing the child cell info (row x column)
  2001. * @param child defines the control to get info from
  2002. * @returns a string containing the child cell info (row x column)
  2003. */
  2004. getChildCellInfo(child: Control): string;
  2005. private _removeCell;
  2006. private _offsetCell;
  2007. /**
  2008. * Remove a column definition at specified index
  2009. * @param index defines the index of the column to remove
  2010. * @returns the current grid
  2011. */
  2012. removeColumnDefinition(index: number): Grid;
  2013. /**
  2014. * Remove a row definition at specified index
  2015. * @param index defines the index of the row to remove
  2016. * @returns the current grid
  2017. */
  2018. removeRowDefinition(index: number): Grid;
  2019. /**
  2020. * Adds a new control to the current grid
  2021. * @param control defines the control to add
  2022. * @param row defines the row where to add the control (0 by default)
  2023. * @param column defines the column where to add the control (0 by default)
  2024. * @returns the current grid
  2025. */
  2026. addControl(control: Control, row?: number, column?: number): Grid;
  2027. /**
  2028. * Removes a control from the current container
  2029. * @param control defines the control to remove
  2030. * @returns the current container
  2031. */
  2032. removeControl(control: Control): Container;
  2033. /**
  2034. * Creates a new Grid
  2035. * @param name defines control name
  2036. */
  2037. constructor(name?: string | undefined);
  2038. protected _getTypeName(): string;
  2039. protected _getGridDefinitions(definitionCallback: (lefts: number[], tops: number[], widths: number[], heights: number[]) => void): void;
  2040. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2041. _flagDescendantsAsMatrixDirty(): void;
  2042. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  2043. /** Releases associated resources */
  2044. dispose(): void;
  2045. }
  2046. }
  2047. declare module BABYLON.GUI {
  2048. /** Class used to create color pickers */
  2049. export class ColorPicker extends Control {
  2050. name?: string | undefined;
  2051. private static _Epsilon;
  2052. private _colorWheelCanvas;
  2053. private _value;
  2054. private _tmpColor;
  2055. private _pointerStartedOnSquare;
  2056. private _pointerStartedOnWheel;
  2057. private _squareLeft;
  2058. private _squareTop;
  2059. private _squareSize;
  2060. private _h;
  2061. private _s;
  2062. private _v;
  2063. /**
  2064. * BABYLON.Observable raised when the value changes
  2065. */
  2066. onValueChangedObservable: BABYLON.Observable<BABYLON.Color3>;
  2067. /** Gets or sets the color of the color picker */
  2068. value: BABYLON.Color3;
  2069. /**
  2070. * Gets or sets control width
  2071. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  2072. */
  2073. width: string | number;
  2074. /**
  2075. * Gets or sets control height
  2076. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  2077. */
  2078. /** Gets or sets control height */
  2079. height: string | number;
  2080. /** Gets or sets control size */
  2081. size: string | number;
  2082. /**
  2083. * Creates a new ColorPicker
  2084. * @param name defines the control name
  2085. */
  2086. constructor(name?: string | undefined);
  2087. protected _getTypeName(): string;
  2088. /** @hidden */
  2089. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2090. private _updateSquareProps;
  2091. private _drawGradientSquare;
  2092. private _drawCircle;
  2093. private _createColorWheelCanvas;
  2094. private _RGBtoHSV;
  2095. private _HSVtoRGB;
  2096. /** @hidden */
  2097. _draw(context: CanvasRenderingContext2D): void;
  2098. private _pointerIsDown;
  2099. private _updateValueFromPointer;
  2100. private _isPointOnSquare;
  2101. private _isPointOnWheel;
  2102. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  2103. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  2104. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  2105. /**
  2106. * This function expands the color picker by creating a color picker dialog with manual
  2107. * color value input and the ability to save colors into an array to be used later in
  2108. * subsequent launches of the dialogue.
  2109. * @param advancedTexture defines the AdvancedDynamicTexture the dialog is assigned to
  2110. * @param options defines size for dialog and options for saved colors. Also accepts last color picked as hex string and saved colors array as hex strings.
  2111. * @returns picked color as a hex string and the saved colors array as hex strings.
  2112. */
  2113. static ShowPickerDialogAsync(advancedTexture: AdvancedDynamicTexture, options: {
  2114. pickerWidth?: string;
  2115. pickerHeight?: string;
  2116. headerHeight?: string;
  2117. lastColor?: string;
  2118. swatchLimit?: number;
  2119. numSwatchesPerLine?: number;
  2120. savedColors?: Array<string>;
  2121. }): Promise<{
  2122. savedColors?: string[];
  2123. pickedColor: string;
  2124. }>;
  2125. }
  2126. }
  2127. declare module BABYLON.GUI {
  2128. /** Class used to create 2D ellipse containers */
  2129. export class Ellipse extends Container {
  2130. name?: string | undefined;
  2131. private _thickness;
  2132. /** Gets or sets border thickness */
  2133. thickness: number;
  2134. /**
  2135. * Creates a new Ellipse
  2136. * @param name defines the control name
  2137. */
  2138. constructor(name?: string | undefined);
  2139. protected _getTypeName(): string;
  2140. protected _localDraw(context: CanvasRenderingContext2D): void;
  2141. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2142. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  2143. }
  2144. }
  2145. declare module BABYLON.GUI {
  2146. /**
  2147. * Class used to create a password control
  2148. */
  2149. export class InputPassword extends InputText {
  2150. protected _beforeRenderText(text: string): string;
  2151. }
  2152. }
  2153. declare module BABYLON.GUI {
  2154. /** Class used to render 2D lines */
  2155. export class Line extends Control {
  2156. name?: string | undefined;
  2157. private _lineWidth;
  2158. private _x1;
  2159. private _y1;
  2160. private _x2;
  2161. private _y2;
  2162. private _dash;
  2163. private _connectedControl;
  2164. private _connectedControlDirtyObserver;
  2165. /** Gets or sets the dash pattern */
  2166. dash: Array<number>;
  2167. /** Gets or sets the control connected with the line end */
  2168. connectedControl: Control;
  2169. /** Gets or sets start coordinates on X axis */
  2170. x1: string | number;
  2171. /** Gets or sets start coordinates on Y axis */
  2172. y1: string | number;
  2173. /** Gets or sets end coordinates on X axis */
  2174. x2: string | number;
  2175. /** Gets or sets end coordinates on Y axis */
  2176. y2: string | number;
  2177. /** Gets or sets line width */
  2178. lineWidth: number;
  2179. /** Gets or sets horizontal alignment */
  2180. horizontalAlignment: number;
  2181. /** Gets or sets vertical alignment */
  2182. verticalAlignment: number;
  2183. private readonly _effectiveX2;
  2184. private readonly _effectiveY2;
  2185. /**
  2186. * Creates a new Line
  2187. * @param name defines the control name
  2188. */
  2189. constructor(name?: string | undefined);
  2190. protected _getTypeName(): string;
  2191. _draw(context: CanvasRenderingContext2D): void;
  2192. _measure(): void;
  2193. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2194. /**
  2195. * Move one end of the line given 3D cartesian coordinates.
  2196. * @param position Targeted world position
  2197. * @param scene BABYLON.Scene
  2198. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  2199. */
  2200. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene, end?: boolean): void;
  2201. /**
  2202. * Move one end of the line to a position in screen absolute space.
  2203. * @param projectedPosition Position in screen absolute space (X, Y)
  2204. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  2205. */
  2206. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3, end?: boolean): void;
  2207. }
  2208. }
  2209. declare module BABYLON.GUI {
  2210. /**
  2211. * Class used to store a point for a MultiLine object.
  2212. * The point can be pure 2D coordinates, a mesh or a control
  2213. */
  2214. export class MultiLinePoint {
  2215. private _multiLine;
  2216. private _x;
  2217. private _y;
  2218. private _control;
  2219. private _mesh;
  2220. private _controlObserver;
  2221. private _meshObserver;
  2222. /** @hidden */
  2223. _point: BABYLON.Vector2;
  2224. /**
  2225. * Creates a new MultiLinePoint
  2226. * @param multiLine defines the source MultiLine object
  2227. */
  2228. constructor(multiLine: MultiLine);
  2229. /** Gets or sets x coordinate */
  2230. x: string | number;
  2231. /** Gets or sets y coordinate */
  2232. y: string | number;
  2233. /** Gets or sets the control associated with this point */
  2234. control: BABYLON.Nullable<Control>;
  2235. /** Gets or sets the mesh associated with this point */
  2236. mesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  2237. /** Resets links */
  2238. resetLinks(): void;
  2239. /**
  2240. * Gets a translation vector
  2241. * @returns the translation vector
  2242. */
  2243. translate(): BABYLON.Vector2;
  2244. private _translatePoint;
  2245. /** Release associated resources */
  2246. dispose(): void;
  2247. }
  2248. }
  2249. declare module BABYLON.GUI {
  2250. /**
  2251. * Class used to create multi line control
  2252. */
  2253. export class MultiLine extends Control {
  2254. name?: string | undefined;
  2255. private _lineWidth;
  2256. private _dash;
  2257. private _points;
  2258. private _minX;
  2259. private _minY;
  2260. private _maxX;
  2261. private _maxY;
  2262. /**
  2263. * Creates a new MultiLine
  2264. * @param name defines the control name
  2265. */
  2266. constructor(name?: string | undefined);
  2267. /** Gets or sets dash pattern */
  2268. dash: Array<number>;
  2269. /**
  2270. * Gets point stored at specified index
  2271. * @param index defines the index to look for
  2272. * @returns the requested point if found
  2273. */
  2274. getAt(index: number): MultiLinePoint;
  2275. /** Function called when a point is updated */
  2276. onPointUpdate: () => void;
  2277. /**
  2278. * Adds new points to the point collection
  2279. * @param items defines the list of items (mesh, control or 2d coordiantes) to add
  2280. * @returns the list of created MultiLinePoint
  2281. */
  2282. add(...items: (AbstractMesh | Control | {
  2283. x: string | number;
  2284. y: string | number;
  2285. })[]): MultiLinePoint[];
  2286. /**
  2287. * Adds a new point to the point collection
  2288. * @param item defines the item (mesh, control or 2d coordiantes) to add
  2289. * @returns the created MultiLinePoint
  2290. */
  2291. push(item?: (AbstractMesh | Control | {
  2292. x: string | number;
  2293. y: string | number;
  2294. })): MultiLinePoint;
  2295. /**
  2296. * Remove a specific value or point from the active point collection
  2297. * @param value defines the value or point to remove
  2298. */
  2299. remove(value: number | MultiLinePoint): void;
  2300. /**
  2301. * Resets this object to initial state (no point)
  2302. */
  2303. reset(): void;
  2304. /**
  2305. * Resets all links
  2306. */
  2307. resetLinks(): void;
  2308. /** Gets or sets line width */
  2309. lineWidth: number;
  2310. horizontalAlignment: number;
  2311. verticalAlignment: number;
  2312. protected _getTypeName(): string;
  2313. _draw(context: CanvasRenderingContext2D): void;
  2314. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2315. _measure(): void;
  2316. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2317. dispose(): void;
  2318. }
  2319. }
  2320. declare module BABYLON.GUI {
  2321. /**
  2322. * Class used to create radio button controls
  2323. */
  2324. export class RadioButton extends Control {
  2325. name?: string | undefined;
  2326. private _isChecked;
  2327. private _background;
  2328. private _checkSizeRatio;
  2329. private _thickness;
  2330. /** Gets or sets border thickness */
  2331. thickness: number;
  2332. /** Gets or sets group name */
  2333. group: string;
  2334. /** BABYLON.Observable raised when isChecked is changed */
  2335. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  2336. /** Gets or sets a value indicating the ratio between overall size and check size */
  2337. checkSizeRatio: number;
  2338. /** Gets or sets background color */
  2339. background: string;
  2340. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  2341. isChecked: boolean;
  2342. /**
  2343. * Creates a new RadioButton
  2344. * @param name defines the control name
  2345. */
  2346. constructor(name?: string | undefined);
  2347. protected _getTypeName(): string;
  2348. _draw(context: CanvasRenderingContext2D): void;
  2349. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  2350. /**
  2351. * Utility function to easily create a radio button with a header
  2352. * @param title defines the label to use for the header
  2353. * @param group defines the group to use for the radio button
  2354. * @param isChecked defines the initial state of the radio button
  2355. * @param onValueChanged defines the callback to call when value changes
  2356. * @returns a StackPanel containing the radio button and a textBlock
  2357. */
  2358. static AddRadioButtonWithHeader(title: string, group: string, isChecked: boolean, onValueChanged: (button: RadioButton, value: boolean) => void): StackPanel;
  2359. }
  2360. }
  2361. declare module BABYLON.GUI {
  2362. /**
  2363. * Class used to create slider controls
  2364. */
  2365. export class BaseSlider extends Control {
  2366. name?: string | undefined;
  2367. protected _thumbWidth: ValueAndUnit;
  2368. private _minimum;
  2369. private _maximum;
  2370. private _value;
  2371. private _isVertical;
  2372. protected _barOffset: ValueAndUnit;
  2373. private _isThumbClamped;
  2374. protected _displayThumb: boolean;
  2375. private _step;
  2376. protected _effectiveBarOffset: number;
  2377. protected _renderLeft: number;
  2378. protected _renderTop: number;
  2379. protected _renderWidth: number;
  2380. protected _renderHeight: number;
  2381. protected _backgroundBoxLength: number;
  2382. protected _backgroundBoxThickness: number;
  2383. protected _effectiveThumbThickness: number;
  2384. /** BABYLON.Observable raised when the sldier value changes */
  2385. onValueChangedObservable: BABYLON.Observable<number>;
  2386. /** Gets or sets a boolean indicating if the thumb must be rendered */
  2387. displayThumb: boolean;
  2388. /** Gets or sets a step to apply to values (0 by default) */
  2389. step: number;
  2390. /** Gets or sets main bar offset (ie. the margin applied to the value bar) */
  2391. barOffset: string | number;
  2392. /** Gets main bar offset in pixels*/
  2393. readonly barOffsetInPixels: number;
  2394. /** Gets or sets thumb width */
  2395. thumbWidth: string | number;
  2396. /** Gets thumb width in pixels */
  2397. readonly thumbWidthInPixels: number;
  2398. /** Gets or sets minimum value */
  2399. minimum: number;
  2400. /** Gets or sets maximum value */
  2401. maximum: number;
  2402. /** Gets or sets current value */
  2403. value: number;
  2404. /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */
  2405. isVertical: boolean;
  2406. /** Gets or sets a value indicating if the thumb can go over main bar extends */
  2407. isThumbClamped: boolean;
  2408. /**
  2409. * Creates a new BaseSlider
  2410. * @param name defines the control name
  2411. */
  2412. constructor(name?: string | undefined);
  2413. protected _getTypeName(): string;
  2414. protected _getThumbPosition(): number;
  2415. protected _getThumbThickness(type: string): number;
  2416. protected _prepareRenderingData(type: string): void;
  2417. private _pointerIsDown;
  2418. /** @hidden */
  2419. protected _updateValueFromPointer(x: number, y: number): void;
  2420. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  2421. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  2422. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  2423. }
  2424. }
  2425. declare module BABYLON.GUI {
  2426. /**
  2427. * Class used to create slider controls
  2428. */
  2429. export class Slider extends BaseSlider {
  2430. name?: string | undefined;
  2431. private _background;
  2432. private _borderColor;
  2433. private _isThumbCircle;
  2434. protected _displayValueBar: boolean;
  2435. /** Gets or sets a boolean indicating if the value bar must be rendered */
  2436. displayValueBar: boolean;
  2437. /** Gets or sets border color */
  2438. borderColor: string;
  2439. /** Gets or sets background color */
  2440. background: string;
  2441. /** Gets or sets a boolean indicating if the thumb should be round or square */
  2442. isThumbCircle: boolean;
  2443. /**
  2444. * Creates a new Slider
  2445. * @param name defines the control name
  2446. */
  2447. constructor(name?: string | undefined);
  2448. protected _getTypeName(): string;
  2449. _draw(context: CanvasRenderingContext2D): void;
  2450. }
  2451. }
  2452. declare module BABYLON.GUI {
  2453. /** Class used to create a RadioGroup
  2454. * which contains groups of radio buttons
  2455. */
  2456. export class SelectorGroup {
  2457. /** name of SelectorGroup */
  2458. name: string;
  2459. private _groupPanel;
  2460. private _selectors;
  2461. private _groupHeader;
  2462. /**
  2463. * Creates a new SelectorGroup
  2464. * @param name of group, used as a group heading
  2465. */
  2466. constructor(
  2467. /** name of SelectorGroup */
  2468. name: string);
  2469. /** Gets the groupPanel of the SelectorGroup */
  2470. readonly groupPanel: StackPanel;
  2471. /** Gets the selectors array */
  2472. readonly selectors: StackPanel[];
  2473. /** Gets and sets the group header */
  2474. header: string;
  2475. /** @hidden */
  2476. private _addGroupHeader;
  2477. /** @hidden*/
  2478. _getSelector(selectorNb: number): StackPanel | undefined;
  2479. /** Removes the selector at the given position
  2480. * @param selectorNb the position of the selector within the group
  2481. */
  2482. removeSelector(selectorNb: number): void;
  2483. }
  2484. /** Class used to create a CheckboxGroup
  2485. * which contains groups of checkbox buttons
  2486. */
  2487. export class CheckboxGroup extends SelectorGroup {
  2488. /** Adds a checkbox as a control
  2489. * @param text is the label for the selector
  2490. * @param func is the function called when the Selector is checked
  2491. * @param checked is true when Selector is checked
  2492. */
  2493. addCheckbox(text: string, func?: (s: boolean) => void, checked?: boolean): void;
  2494. /** @hidden */
  2495. _setSelectorLabel(selectorNb: number, label: string): void;
  2496. /** @hidden */
  2497. _setSelectorLabelColor(selectorNb: number, color: string): void;
  2498. /** @hidden */
  2499. _setSelectorButtonColor(selectorNb: number, color: string): void;
  2500. /** @hidden */
  2501. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  2502. }
  2503. /** Class used to create a RadioGroup
  2504. * which contains groups of radio buttons
  2505. */
  2506. export class RadioGroup extends SelectorGroup {
  2507. private _selectNb;
  2508. /** Adds a radio button as a control
  2509. * @param label is the label for the selector
  2510. * @param func is the function called when the Selector is checked
  2511. * @param checked is true when Selector is checked
  2512. */
  2513. addRadio(label: string, func?: (n: number) => void, checked?: boolean): void;
  2514. /** @hidden */
  2515. _setSelectorLabel(selectorNb: number, label: string): void;
  2516. /** @hidden */
  2517. _setSelectorLabelColor(selectorNb: number, color: string): void;
  2518. /** @hidden */
  2519. _setSelectorButtonColor(selectorNb: number, color: string): void;
  2520. /** @hidden */
  2521. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  2522. }
  2523. /** Class used to create a SliderGroup
  2524. * which contains groups of slider buttons
  2525. */
  2526. export class SliderGroup extends SelectorGroup {
  2527. /**
  2528. * Adds a slider to the SelectorGroup
  2529. * @param label is the label for the SliderBar
  2530. * @param func is the function called when the Slider moves
  2531. * @param unit is a string describing the units used, eg degrees or metres
  2532. * @param min is the minimum value for the Slider
  2533. * @param max is the maximum value for the Slider
  2534. * @param value is the start value for the Slider between min and max
  2535. * @param onValueChange is the function used to format the value displayed, eg radians to degrees
  2536. */
  2537. addSlider(label: string, func?: (v: number) => void, unit?: string, min?: number, max?: number, value?: number, onValueChange?: (v: number) => number): void;
  2538. /** @hidden */
  2539. _setSelectorLabel(selectorNb: number, label: string): void;
  2540. /** @hidden */
  2541. _setSelectorLabelColor(selectorNb: number, color: string): void;
  2542. /** @hidden */
  2543. _setSelectorButtonColor(selectorNb: number, color: string): void;
  2544. /** @hidden */
  2545. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  2546. }
  2547. /** Class used to hold the controls for the checkboxes, radio buttons and sliders
  2548. * @see http://doc.babylonjs.com/how_to/selector
  2549. */
  2550. export class SelectionPanel extends Rectangle {
  2551. /** name of SelectionPanel */
  2552. name: string;
  2553. /** an array of SelectionGroups */
  2554. groups: SelectorGroup[];
  2555. private _panel;
  2556. private _buttonColor;
  2557. private _buttonBackground;
  2558. private _headerColor;
  2559. private _barColor;
  2560. private _barHeight;
  2561. private _spacerHeight;
  2562. private _labelColor;
  2563. private _groups;
  2564. private _bars;
  2565. /**
  2566. * Creates a new SelectionPanel
  2567. * @param name of SelectionPanel
  2568. * @param groups is an array of SelectionGroups
  2569. */
  2570. constructor(
  2571. /** name of SelectionPanel */
  2572. name: string,
  2573. /** an array of SelectionGroups */
  2574. groups?: SelectorGroup[]);
  2575. protected _getTypeName(): string;
  2576. /** Gets or sets the headerColor */
  2577. headerColor: string;
  2578. private _setHeaderColor;
  2579. /** Gets or sets the button color */
  2580. buttonColor: string;
  2581. private _setbuttonColor;
  2582. /** Gets or sets the label color */
  2583. labelColor: string;
  2584. private _setLabelColor;
  2585. /** Gets or sets the button background */
  2586. buttonBackground: string;
  2587. private _setButtonBackground;
  2588. /** Gets or sets the color of separator bar */
  2589. barColor: string;
  2590. private _setBarColor;
  2591. /** Gets or sets the height of separator bar */
  2592. barHeight: string;
  2593. private _setBarHeight;
  2594. /** Gets or sets the height of spacers*/
  2595. spacerHeight: string;
  2596. private _setSpacerHeight;
  2597. /** Adds a bar between groups */
  2598. private _addSpacer;
  2599. /** Add a group to the selection panel
  2600. * @param group is the selector group to add
  2601. */
  2602. addGroup(group: SelectorGroup): void;
  2603. /** Remove the group from the given position
  2604. * @param groupNb is the position of the group in the list
  2605. */
  2606. removeGroup(groupNb: number): void;
  2607. /** Change a group header label
  2608. * @param label is the new group header label
  2609. * @param groupNb is the number of the group to relabel
  2610. * */
  2611. setHeaderName(label: string, groupNb: number): void;
  2612. /** Change selector label to the one given
  2613. * @param label is the new selector label
  2614. * @param groupNb is the number of the groupcontaining the selector
  2615. * @param selectorNb is the number of the selector within a group to relabel
  2616. * */
  2617. relabel(label: string, groupNb: number, selectorNb: number): void;
  2618. /** For a given group position remove the selector at the given position
  2619. * @param groupNb is the number of the group to remove the selector from
  2620. * @param selectorNb is the number of the selector within the group
  2621. */
  2622. removeFromGroupSelector(groupNb: number, selectorNb: number): void;
  2623. /** For a given group position of correct type add a checkbox button
  2624. * @param groupNb is the number of the group to remove the selector from
  2625. * @param label is the label for the selector
  2626. * @param func is the function called when the Selector is checked
  2627. * @param checked is true when Selector is checked
  2628. */
  2629. addToGroupCheckbox(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  2630. /** For a given group position of correct type add a radio button
  2631. * @param groupNb is the number of the group to remove the selector from
  2632. * @param label is the label for the selector
  2633. * @param func is the function called when the Selector is checked
  2634. * @param checked is true when Selector is checked
  2635. */
  2636. addToGroupRadio(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  2637. /**
  2638. * For a given slider group add a slider
  2639. * @param groupNb is the number of the group to add the slider to
  2640. * @param label is the label for the Slider
  2641. * @param func is the function called when the Slider moves
  2642. * @param unit is a string describing the units used, eg degrees or metres
  2643. * @param min is the minimum value for the Slider
  2644. * @param max is the maximum value for the Slider
  2645. * @param value is the start value for the Slider between min and max
  2646. * @param onVal is the function used to format the value displayed, eg radians to degrees
  2647. */
  2648. addToGroupSlider(groupNb: number, label: string, func?: () => void, unit?: string, min?: number, max?: number, value?: number, onVal?: (v: number) => number): void;
  2649. }
  2650. }
  2651. declare module BABYLON.GUI {
  2652. /**
  2653. * Class used to hold a the container for ScrollViewer
  2654. * @hidden
  2655. */
  2656. export class _ScrollViewerWindow extends Container {
  2657. parentClientWidth: number;
  2658. parentClientHeight: number;
  2659. /**
  2660. * Creates a new ScrollViewerWindow
  2661. * @param name of ScrollViewerWindow
  2662. */
  2663. constructor(name?: string);
  2664. protected _getTypeName(): string;
  2665. /** @hidden */
  2666. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2667. protected _postMeasure(): void;
  2668. }
  2669. }
  2670. declare module BABYLON.GUI {
  2671. /**
  2672. * Class used to create slider controls
  2673. */
  2674. export class ScrollBar extends BaseSlider {
  2675. name?: string | undefined;
  2676. private _background;
  2677. private _borderColor;
  2678. private _thumbMeasure;
  2679. /** Gets or sets border color */
  2680. borderColor: string;
  2681. /** Gets or sets background color */
  2682. background: string;
  2683. /**
  2684. * Creates a new Slider
  2685. * @param name defines the control name
  2686. */
  2687. constructor(name?: string | undefined);
  2688. protected _getTypeName(): string;
  2689. protected _getThumbThickness(): number;
  2690. _draw(context: CanvasRenderingContext2D): void;
  2691. private _first;
  2692. private _originX;
  2693. private _originY;
  2694. /** @hidden */
  2695. protected _updateValueFromPointer(x: number, y: number): void;
  2696. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  2697. }
  2698. }
  2699. declare module BABYLON.GUI {
  2700. /**
  2701. * Class used to hold a viewer window and sliders in a grid
  2702. */
  2703. export class ScrollViewer extends Rectangle {
  2704. private _grid;
  2705. private _horizontalBarSpace;
  2706. private _verticalBarSpace;
  2707. private _dragSpace;
  2708. private _horizontalBar;
  2709. private _verticalBar;
  2710. private _barColor;
  2711. private _barBackground;
  2712. private _barSize;
  2713. private _endLeft;
  2714. private _endTop;
  2715. private _window;
  2716. private _pointerIsOver;
  2717. private _wheelPrecision;
  2718. private _onPointerObserver;
  2719. private _clientWidth;
  2720. private _clientHeight;
  2721. /**
  2722. * Gets the horizontal scrollbar
  2723. */
  2724. readonly horizontalBar: ScrollBar;
  2725. /**
  2726. * Gets the vertical scrollbar
  2727. */
  2728. readonly verticalBar: ScrollBar;
  2729. /**
  2730. * Adds a new control to the current container
  2731. * @param control defines the control to add
  2732. * @returns the current container
  2733. */
  2734. addControl(control: BABYLON.Nullable<Control>): Container;
  2735. /**
  2736. * Removes a control from the current container
  2737. * @param control defines the control to remove
  2738. * @returns the current container
  2739. */
  2740. removeControl(control: Control): Container;
  2741. /** Gets the list of children */
  2742. readonly children: Control[];
  2743. _flagDescendantsAsMatrixDirty(): void;
  2744. /**
  2745. * Creates a new ScrollViewer
  2746. * @param name of ScrollViewer
  2747. */
  2748. constructor(name?: string);
  2749. /** Reset the scroll viewer window to initial size */
  2750. resetWindow(): void;
  2751. protected _getTypeName(): string;
  2752. private _buildClientSizes;
  2753. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2754. protected _postMeasure(): void;
  2755. /**
  2756. * Gets or sets the mouse wheel precision
  2757. * from 0 to 1 with a default value of 0.05
  2758. * */
  2759. wheelPrecision: number;
  2760. /** Gets or sets the bar color */
  2761. barColor: string;
  2762. /** Gets or sets the size of the bar */
  2763. barSize: number;
  2764. /** Gets or sets the bar background */
  2765. barBackground: string;
  2766. /** @hidden */
  2767. private _updateScroller;
  2768. _link(host: AdvancedDynamicTexture): void;
  2769. /** @hidden */
  2770. private _attachWheel;
  2771. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  2772. /** Releases associated resources */
  2773. dispose(): void;
  2774. }
  2775. }
  2776. declare module BABYLON.GUI {
  2777. /** Class used to render a grid */
  2778. export class DisplayGrid extends Control {
  2779. name?: string | undefined;
  2780. private _cellWidth;
  2781. private _cellHeight;
  2782. private _minorLineTickness;
  2783. private _minorLineColor;
  2784. private _majorLineTickness;
  2785. private _majorLineColor;
  2786. private _majorLineFrequency;
  2787. private _background;
  2788. private _displayMajorLines;
  2789. private _displayMinorLines;
  2790. /** Gets or sets a boolean indicating if minor lines must be rendered (true by default)) */
  2791. displayMinorLines: boolean;
  2792. /** Gets or sets a boolean indicating if major lines must be rendered (true by default)) */
  2793. displayMajorLines: boolean;
  2794. /** Gets or sets background color (Black by default) */
  2795. background: string;
  2796. /** Gets or sets the width of each cell (20 by default) */
  2797. cellWidth: number;
  2798. /** Gets or sets the height of each cell (20 by default) */
  2799. cellHeight: number;
  2800. /** Gets or sets the tickness of minor lines (1 by default) */
  2801. minorLineTickness: number;
  2802. /** Gets or sets the color of minor lines (DarkGray by default) */
  2803. minorLineColor: string;
  2804. /** Gets or sets the tickness of major lines (2 by default) */
  2805. majorLineTickness: number;
  2806. /** Gets or sets the color of major lines (White by default) */
  2807. majorLineColor: string;
  2808. /** Gets or sets the frequency of major lines (default is 1 every 5 minor lines)*/
  2809. majorLineFrequency: number;
  2810. /**
  2811. * Creates a new GridDisplayRectangle
  2812. * @param name defines the control name
  2813. */
  2814. constructor(name?: string | undefined);
  2815. _draw(context: CanvasRenderingContext2D): void;
  2816. protected _getTypeName(): string;
  2817. }
  2818. }
  2819. declare module BABYLON.GUI {
  2820. /**
  2821. * Class used to create slider controls based on images
  2822. */
  2823. export class ImageBasedSlider extends BaseSlider {
  2824. name?: string | undefined;
  2825. private _backgroundImage;
  2826. private _thumbImage;
  2827. private _valueBarImage;
  2828. private _tempMeasure;
  2829. displayThumb: boolean;
  2830. /**
  2831. * Gets or sets the image used to render the background
  2832. */
  2833. backgroundImage: Image;
  2834. /**
  2835. * Gets or sets the image used to render the value bar
  2836. */
  2837. valueBarImage: Image;
  2838. /**
  2839. * Gets or sets the image used to render the thumb
  2840. */
  2841. thumbImage: Image;
  2842. /**
  2843. * Creates a new ImageBasedSlider
  2844. * @param name defines the control name
  2845. */
  2846. constructor(name?: string | undefined);
  2847. protected _getTypeName(): string;
  2848. _draw(context: CanvasRenderingContext2D): void;
  2849. }
  2850. }
  2851. declare module BABYLON.GUI {
  2852. /**
  2853. * Forcing an export so that this code will execute
  2854. * @hidden
  2855. */
  2856. const name = "Statics";
  2857. }
  2858. declare module BABYLON.GUI {
  2859. /**
  2860. * This class can be used to get instrumentation data from a AdvancedDynamicTexture object
  2861. */
  2862. export class AdvancedDynamicTextureInstrumentation implements BABYLON.IDisposable {
  2863. /**
  2864. * Define the instrumented AdvancedDynamicTexture.
  2865. */
  2866. texture: AdvancedDynamicTexture;
  2867. private _captureRenderTime;
  2868. private _renderTime;
  2869. private _captureLayoutTime;
  2870. private _layoutTime;
  2871. private _onBeginRenderObserver;
  2872. private _onEndRenderObserver;
  2873. private _onBeginLayoutObserver;
  2874. private _onEndLayoutObserver;
  2875. /**
  2876. * Gets the perf counter used to capture render time
  2877. */
  2878. readonly renderTimeCounter: BABYLON.PerfCounter;
  2879. /**
  2880. * Gets the perf counter used to capture layout time
  2881. */
  2882. readonly layoutTimeCounter: BABYLON.PerfCounter;
  2883. /**
  2884. * Enable or disable the render time capture
  2885. */
  2886. captureRenderTime: boolean;
  2887. /**
  2888. * Enable or disable the layout time capture
  2889. */
  2890. captureLayoutTime: boolean;
  2891. /**
  2892. * Instantiates a new advanced dynamic texture instrumentation.
  2893. * This class can be used to get instrumentation data from an AdvancedDynamicTexture object
  2894. * @param texture Defines the AdvancedDynamicTexture to instrument
  2895. */
  2896. constructor(
  2897. /**
  2898. * Define the instrumented AdvancedDynamicTexture.
  2899. */
  2900. texture: AdvancedDynamicTexture);
  2901. /**
  2902. * Dispose and release associated resources.
  2903. */
  2904. dispose(): void;
  2905. }
  2906. }
  2907. declare module BABYLON.GUI {
  2908. /**
  2909. * Class used to create containers for controls
  2910. */
  2911. export class Container3D extends Control3D {
  2912. private _blockLayout;
  2913. /**
  2914. * Gets the list of child controls
  2915. */
  2916. protected _children: Control3D[];
  2917. /**
  2918. * Gets the list of child controls
  2919. */
  2920. readonly children: Array<Control3D>;
  2921. /**
  2922. * Gets or sets a boolean indicating if the layout must be blocked (default is false).
  2923. * This is helpful to optimize layout operation when adding multiple children in a row
  2924. */
  2925. blockLayout: boolean;
  2926. /**
  2927. * Creates a new container
  2928. * @param name defines the container name
  2929. */
  2930. constructor(name?: string);
  2931. /**
  2932. * Force the container to update the layout. Please note that it will not take blockLayout property in account
  2933. * @returns the current container
  2934. */
  2935. updateLayout(): Container3D;
  2936. /**
  2937. * Gets a boolean indicating if the given control is in the children of this control
  2938. * @param control defines the control to check
  2939. * @returns true if the control is in the child list
  2940. */
  2941. containsControl(control: Control3D): boolean;
  2942. /**
  2943. * Adds a control to the children of this control
  2944. * @param control defines the control to add
  2945. * @returns the current container
  2946. */
  2947. addControl(control: Control3D): Container3D;
  2948. /**
  2949. * This function will be called everytime a new control is added
  2950. */
  2951. protected _arrangeChildren(): void;
  2952. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  2953. /**
  2954. * Removes a control from the children of this control
  2955. * @param control defines the control to remove
  2956. * @returns the current container
  2957. */
  2958. removeControl(control: Control3D): Container3D;
  2959. protected _getTypeName(): string;
  2960. /**
  2961. * Releases all associated resources
  2962. */
  2963. dispose(): void;
  2964. /** Control rotation will remain unchanged */
  2965. static readonly UNSET_ORIENTATION: number;
  2966. /** Control will rotate to make it look at sphere central axis */
  2967. static readonly FACEORIGIN_ORIENTATION: number;
  2968. /** Control will rotate to make it look back at sphere central axis */
  2969. static readonly FACEORIGINREVERSED_ORIENTATION: number;
  2970. /** Control will rotate to look at z axis (0, 0, 1) */
  2971. static readonly FACEFORWARD_ORIENTATION: number;
  2972. /** Control will rotate to look at negative z axis (0, 0, -1) */
  2973. static readonly FACEFORWARDREVERSED_ORIENTATION: number;
  2974. }
  2975. }
  2976. declare module BABYLON.GUI {
  2977. /**
  2978. * Class used to manage 3D user interface
  2979. * @see http://doc.babylonjs.com/how_to/gui3d
  2980. */
  2981. export class GUI3DManager implements BABYLON.IDisposable {
  2982. private _scene;
  2983. private _sceneDisposeObserver;
  2984. private _utilityLayer;
  2985. private _rootContainer;
  2986. private _pointerObserver;
  2987. private _pointerOutObserver;
  2988. /** @hidden */
  2989. _lastPickedControl: Control3D;
  2990. /** @hidden */
  2991. _lastControlOver: {
  2992. [pointerId: number]: Control3D;
  2993. };
  2994. /** @hidden */
  2995. _lastControlDown: {
  2996. [pointerId: number]: Control3D;
  2997. };
  2998. /**
  2999. * BABYLON.Observable raised when the point picked by the pointer events changed
  3000. */
  3001. onPickedPointChangedObservable: BABYLON.Observable<BABYLON.Nullable<BABYLON.Vector3>>;
  3002. /** @hidden */
  3003. _sharedMaterials: {
  3004. [key: string]: BABYLON.Material;
  3005. };
  3006. /** Gets the hosting scene */
  3007. readonly scene: BABYLON.Scene;
  3008. /** Gets associated utility layer */
  3009. readonly utilityLayer: BABYLON.Nullable<BABYLON.UtilityLayerRenderer>;
  3010. /**
  3011. * Creates a new GUI3DManager
  3012. * @param scene
  3013. */
  3014. constructor(scene?: BABYLON.Scene);
  3015. private _handlePointerOut;
  3016. private _doPicking;
  3017. /**
  3018. * Gets the root container
  3019. */
  3020. readonly rootContainer: Container3D;
  3021. /**
  3022. * Gets a boolean indicating if the given control is in the root child list
  3023. * @param control defines the control to check
  3024. * @returns true if the control is in the root child list
  3025. */
  3026. containsControl(control: Control3D): boolean;
  3027. /**
  3028. * Adds a control to the root child list
  3029. * @param control defines the control to add
  3030. * @returns the current manager
  3031. */
  3032. addControl(control: Control3D): GUI3DManager;
  3033. /**
  3034. * Removes a control from the root child list
  3035. * @param control defines the control to remove
  3036. * @returns the current container
  3037. */
  3038. removeControl(control: Control3D): GUI3DManager;
  3039. /**
  3040. * Releases all associated resources
  3041. */
  3042. dispose(): void;
  3043. }
  3044. }
  3045. declare module BABYLON.GUI {
  3046. /**
  3047. * Class used to transport BABYLON.Vector3 information for pointer events
  3048. */
  3049. export class Vector3WithInfo extends BABYLON.Vector3 {
  3050. /** defines the current mouse button index */
  3051. buttonIndex: number;
  3052. /**
  3053. * Creates a new Vector3WithInfo
  3054. * @param source defines the vector3 data to transport
  3055. * @param buttonIndex defines the current mouse button index
  3056. */
  3057. constructor(source: BABYLON.Vector3,
  3058. /** defines the current mouse button index */
  3059. buttonIndex?: number);
  3060. }
  3061. }
  3062. declare module BABYLON.GUI {
  3063. /**
  3064. * Class used as base class for controls
  3065. */
  3066. export class Control3D implements BABYLON.IDisposable, BABYLON.IBehaviorAware<Control3D> {
  3067. /** Defines the control name */
  3068. name?: string | undefined;
  3069. /** @hidden */
  3070. _host: GUI3DManager;
  3071. private _node;
  3072. private _downCount;
  3073. private _enterCount;
  3074. private _downPointerIds;
  3075. private _isVisible;
  3076. /** Gets or sets the control position in world space */
  3077. position: BABYLON.Vector3;
  3078. /** Gets or sets the control scaling in world space */
  3079. scaling: BABYLON.Vector3;
  3080. /** Callback used to start pointer enter animation */
  3081. pointerEnterAnimation: () => void;
  3082. /** Callback used to start pointer out animation */
  3083. pointerOutAnimation: () => void;
  3084. /** Callback used to start pointer down animation */
  3085. pointerDownAnimation: () => void;
  3086. /** Callback used to start pointer up animation */
  3087. pointerUpAnimation: () => void;
  3088. /**
  3089. * An event triggered when the pointer move over the control
  3090. */
  3091. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector3>;
  3092. /**
  3093. * An event triggered when the pointer move out of the control
  3094. */
  3095. onPointerOutObservable: BABYLON.Observable<Control3D>;
  3096. /**
  3097. * An event triggered when the pointer taps the control
  3098. */
  3099. onPointerDownObservable: BABYLON.Observable<Vector3WithInfo>;
  3100. /**
  3101. * An event triggered when pointer is up
  3102. */
  3103. onPointerUpObservable: BABYLON.Observable<Vector3WithInfo>;
  3104. /**
  3105. * An event triggered when a control is clicked on (with a mouse)
  3106. */
  3107. onPointerClickObservable: BABYLON.Observable<Vector3WithInfo>;
  3108. /**
  3109. * An event triggered when pointer enters the control
  3110. */
  3111. onPointerEnterObservable: BABYLON.Observable<Control3D>;
  3112. /**
  3113. * Gets or sets the parent container
  3114. */
  3115. parent: BABYLON.Nullable<Container3D>;
  3116. private _behaviors;
  3117. /**
  3118. * Gets the list of attached behaviors
  3119. * @see http://doc.babylonjs.com/features/behaviour
  3120. */
  3121. readonly behaviors: BABYLON.Behavior<Control3D>[];
  3122. /**
  3123. * Attach a behavior to the control
  3124. * @see http://doc.babylonjs.com/features/behaviour
  3125. * @param behavior defines the behavior to attach
  3126. * @returns the current control
  3127. */
  3128. addBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  3129. /**
  3130. * Remove an attached behavior
  3131. * @see http://doc.babylonjs.com/features/behaviour
  3132. * @param behavior defines the behavior to attach
  3133. * @returns the current control
  3134. */
  3135. removeBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  3136. /**
  3137. * Gets an attached behavior by name
  3138. * @param name defines the name of the behavior to look for
  3139. * @see http://doc.babylonjs.com/features/behaviour
  3140. * @returns null if behavior was not found else the requested behavior
  3141. */
  3142. getBehaviorByName(name: string): BABYLON.Nullable<BABYLON.Behavior<Control3D>>;
  3143. /** Gets or sets a boolean indicating if the control is visible */
  3144. isVisible: boolean;
  3145. /**
  3146. * Creates a new control
  3147. * @param name defines the control name
  3148. */
  3149. constructor(
  3150. /** Defines the control name */
  3151. name?: string | undefined);
  3152. /**
  3153. * Gets a string representing the class name
  3154. */
  3155. readonly typeName: string;
  3156. /**
  3157. * Get the current class name of the control.
  3158. * @returns current class name
  3159. */
  3160. getClassName(): string;
  3161. protected _getTypeName(): string;
  3162. /**
  3163. * Gets the transform node used by this control
  3164. */
  3165. readonly node: BABYLON.Nullable<BABYLON.TransformNode>;
  3166. /**
  3167. * Gets the mesh used to render this control
  3168. */
  3169. readonly mesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  3170. /**
  3171. * Link the control as child of the given node
  3172. * @param node defines the node to link to. Use null to unlink the control
  3173. * @returns the current control
  3174. */
  3175. linkToTransformNode(node: BABYLON.Nullable<BABYLON.TransformNode>): Control3D;
  3176. /** @hidden **/
  3177. _prepareNode(scene: BABYLON.Scene): void;
  3178. /**
  3179. * Node creation.
  3180. * Can be overriden by children
  3181. * @param scene defines the scene where the node must be attached
  3182. * @returns the attached node or null if none. Must return a BABYLON.Mesh or BABYLON.AbstractMesh if there is an atttached visible object
  3183. */
  3184. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  3185. /**
  3186. * Affect a material to the given mesh
  3187. * @param mesh defines the mesh which will represent the control
  3188. */
  3189. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  3190. /** @hidden */
  3191. _onPointerMove(target: Control3D, coordinates: BABYLON.Vector3): void;
  3192. /** @hidden */
  3193. _onPointerEnter(target: Control3D): boolean;
  3194. /** @hidden */
  3195. _onPointerOut(target: Control3D): void;
  3196. /** @hidden */
  3197. _onPointerDown(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  3198. /** @hidden */
  3199. _onPointerUp(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  3200. /** @hidden */
  3201. forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  3202. /** @hidden */
  3203. _processObservables(type: number, pickedPoint: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  3204. /** @hidden */
  3205. _disposeNode(): void;
  3206. /**
  3207. * Releases all associated resources
  3208. */
  3209. dispose(): void;
  3210. }
  3211. }
  3212. declare module BABYLON.GUI {
  3213. /**
  3214. * Class used as a root to all buttons
  3215. */
  3216. export class AbstractButton3D extends Control3D {
  3217. /**
  3218. * Creates a new button
  3219. * @param name defines the control name
  3220. */
  3221. constructor(name?: string);
  3222. protected _getTypeName(): string;
  3223. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  3224. }
  3225. }
  3226. declare module BABYLON.GUI {
  3227. /**
  3228. * Class used to create a button in 3D
  3229. */
  3230. export class Button3D extends AbstractButton3D {
  3231. /** @hidden */
  3232. protected _currentMaterial: BABYLON.Material;
  3233. private _facadeTexture;
  3234. private _content;
  3235. private _contentResolution;
  3236. private _contentScaleRatio;
  3237. /**
  3238. * Gets or sets the texture resolution used to render content (512 by default)
  3239. */
  3240. contentResolution: BABYLON.int;
  3241. /**
  3242. * Gets or sets the texture scale ratio used to render content (2 by default)
  3243. */
  3244. contentScaleRatio: number;
  3245. protected _disposeFacadeTexture(): void;
  3246. protected _resetContent(): void;
  3247. /**
  3248. * Creates a new button
  3249. * @param name defines the control name
  3250. */
  3251. constructor(name?: string);
  3252. /**
  3253. * Gets or sets the GUI 2D content used to display the button's facade
  3254. */
  3255. content: Control;
  3256. /**
  3257. * Apply the facade texture (created from the content property).
  3258. * This function can be overloaded by child classes
  3259. * @param facadeTexture defines the AdvancedDynamicTexture to use
  3260. */
  3261. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  3262. protected _getTypeName(): string;
  3263. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  3264. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  3265. /**
  3266. * Releases all associated resources
  3267. */
  3268. dispose(): void;
  3269. }
  3270. }
  3271. declare module BABYLON.GUI {
  3272. /**
  3273. * Abstract class used to create a container panel deployed on the surface of a volume
  3274. */
  3275. export abstract class VolumeBasedPanel extends Container3D {
  3276. private _columns;
  3277. private _rows;
  3278. private _rowThenColum;
  3279. private _orientation;
  3280. protected _cellWidth: number;
  3281. protected _cellHeight: number;
  3282. /**
  3283. * Gets or sets the distance between elements
  3284. */
  3285. margin: number;
  3286. /**
  3287. * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)
  3288. * | Value | Type | Description |
  3289. * | ----- | ----------------------------------- | ----------- |
  3290. * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |
  3291. * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |
  3292. * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |
  3293. * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |
  3294. * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |
  3295. */
  3296. orientation: number;
  3297. /**
  3298. * Gets or sets the number of columns requested (10 by default).
  3299. * The panel will automatically compute the number of rows based on number of child controls.
  3300. */
  3301. columns: BABYLON.int;
  3302. /**
  3303. * Gets or sets a the number of rows requested.
  3304. * The panel will automatically compute the number of columns based on number of child controls.
  3305. */
  3306. rows: BABYLON.int;
  3307. /**
  3308. * Creates new VolumeBasedPanel
  3309. */
  3310. constructor();
  3311. protected _arrangeChildren(): void;
  3312. /** Child classes must implement this function to provide correct control positioning */
  3313. protected abstract _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  3314. /** Child classes can implement this function to provide additional processing */
  3315. protected _finalProcessing(): void;
  3316. }
  3317. }
  3318. declare module BABYLON.GUI {
  3319. /**
  3320. * Class used to create a container panel deployed on the surface of a cylinder
  3321. */
  3322. export class CylinderPanel extends VolumeBasedPanel {
  3323. private _radius;
  3324. /**
  3325. * Gets or sets the radius of the cylinder where to project controls (5 by default)
  3326. */
  3327. radius: BABYLON.float;
  3328. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  3329. private _cylindricalMapping;
  3330. }
  3331. }
  3332. declare module BABYLON.GUI {
  3333. /** @hidden */
  3334. export var fluentVertexShader: {
  3335. name: string;
  3336. shader: string;
  3337. };
  3338. }
  3339. declare module BABYLON.GUI {
  3340. /** @hidden */
  3341. export var fluentPixelShader: {
  3342. name: string;
  3343. shader: string;
  3344. };
  3345. }
  3346. declare module BABYLON.GUI {
  3347. /** @hidden */
  3348. export class FluentMaterialDefines extends BABYLON.MaterialDefines {
  3349. INNERGLOW: boolean;
  3350. BORDER: boolean;
  3351. HOVERLIGHT: boolean;
  3352. TEXTURE: boolean;
  3353. constructor();
  3354. }
  3355. /**
  3356. * Class used to render controls with fluent desgin
  3357. */
  3358. export class FluentMaterial extends BABYLON.PushMaterial {
  3359. /**
  3360. * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)
  3361. */
  3362. innerGlowColorIntensity: number;
  3363. /**
  3364. * Gets or sets the inner glow color (white by default)
  3365. */
  3366. innerGlowColor: BABYLON.Color3;
  3367. /**
  3368. * Gets or sets alpha value (default is 1.0)
  3369. */
  3370. alpha: number;
  3371. /**
  3372. * Gets or sets the albedo color (Default is BABYLON.Color3(0.3, 0.35, 0.4))
  3373. */
  3374. albedoColor: BABYLON.Color3;
  3375. /**
  3376. * Gets or sets a boolean indicating if borders must be rendered (default is false)
  3377. */
  3378. renderBorders: boolean;
  3379. /**
  3380. * Gets or sets border width (default is 0.5)
  3381. */
  3382. borderWidth: number;
  3383. /**
  3384. * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)
  3385. */
  3386. edgeSmoothingValue: number;
  3387. /**
  3388. * Gets or sets the minimum value that can be applied to border width (default is 0.1)
  3389. */
  3390. borderMinValue: number;
  3391. /**
  3392. * Gets or sets a boolean indicating if hover light must be rendered (default is false)
  3393. */
  3394. renderHoverLight: boolean;
  3395. /**
  3396. * Gets or sets the radius used to render the hover light (default is 1.0)
  3397. */
  3398. hoverRadius: number;
  3399. /**
  3400. * Gets or sets the color used to render the hover light (default is BABYLON.Color4(0.3, 0.3, 0.3, 1.0))
  3401. */
  3402. hoverColor: BABYLON.Color4;
  3403. /**
  3404. * Gets or sets the hover light position in world space (default is BABYLON.Vector3.Zero())
  3405. */
  3406. hoverPosition: BABYLON.Vector3;
  3407. private _albedoTexture;
  3408. /** Gets or sets the texture to use for albedo color */
  3409. albedoTexture: BABYLON.Nullable<BABYLON.BaseTexture>;
  3410. /**
  3411. * Creates a new Fluent material
  3412. * @param name defines the name of the material
  3413. * @param scene defines the hosting scene
  3414. */
  3415. constructor(name: string, scene: BABYLON.Scene);
  3416. needAlphaBlending(): boolean;
  3417. needAlphaTesting(): boolean;
  3418. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  3419. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  3420. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  3421. getActiveTextures(): BABYLON.BaseTexture[];
  3422. hasTexture(texture: BABYLON.BaseTexture): boolean;
  3423. dispose(forceDisposeEffect?: boolean): void;
  3424. clone(name: string): FluentMaterial;
  3425. serialize(): any;
  3426. getClassName(): string;
  3427. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): FluentMaterial;
  3428. }
  3429. }
  3430. declare module BABYLON.GUI {
  3431. /**
  3432. * Class used to create a holographic button in 3D
  3433. */
  3434. export class HolographicButton extends Button3D {
  3435. private _backPlate;
  3436. private _textPlate;
  3437. private _frontPlate;
  3438. private _text;
  3439. private _imageUrl;
  3440. private _shareMaterials;
  3441. private _frontMaterial;
  3442. private _backMaterial;
  3443. private _plateMaterial;
  3444. private _pickedPointObserver;
  3445. private _tooltipFade;
  3446. private _tooltipTextBlock;
  3447. private _tooltipTexture;
  3448. private _tooltipMesh;
  3449. private _tooltipHoverObserver;
  3450. private _tooltipOutObserver;
  3451. private _disposeTooltip;
  3452. /**
  3453. * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
  3454. */
  3455. tooltipText: BABYLON.Nullable<string>;
  3456. /**
  3457. * Gets or sets text for the button
  3458. */
  3459. text: string;
  3460. /**
  3461. * Gets or sets the image url for the button
  3462. */
  3463. imageUrl: string;
  3464. /**
  3465. * Gets the back material used by this button
  3466. */
  3467. readonly backMaterial: FluentMaterial;
  3468. /**
  3469. * Gets the front material used by this button
  3470. */
  3471. readonly frontMaterial: FluentMaterial;
  3472. /**
  3473. * Gets the plate material used by this button
  3474. */
  3475. readonly plateMaterial: BABYLON.StandardMaterial;
  3476. /**
  3477. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  3478. */
  3479. readonly shareMaterials: boolean;
  3480. /**
  3481. * Creates a new button
  3482. * @param name defines the control name
  3483. */
  3484. constructor(name?: string, shareMaterials?: boolean);
  3485. protected _getTypeName(): string;
  3486. private _rebuildContent;
  3487. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  3488. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  3489. private _createBackMaterial;
  3490. private _createFrontMaterial;
  3491. private _createPlateMaterial;
  3492. protected _affectMaterial(mesh: BABYLON.Mesh): void;
  3493. /**
  3494. * Releases all associated resources
  3495. */
  3496. dispose(): void;
  3497. }
  3498. }
  3499. declare module BABYLON.GUI {
  3500. /**
  3501. * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene
  3502. */
  3503. export class MeshButton3D extends Button3D {
  3504. /** @hidden */
  3505. protected _currentMesh: BABYLON.Mesh;
  3506. /**
  3507. * Creates a new 3D button based on a mesh
  3508. * @param mesh mesh to become a 3D button
  3509. * @param name defines the control name
  3510. */
  3511. constructor(mesh: BABYLON.Mesh, name?: string);
  3512. protected _getTypeName(): string;
  3513. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  3514. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  3515. }
  3516. }
  3517. declare module BABYLON.GUI {
  3518. /**
  3519. * Class used to create a container panel deployed on the surface of a plane
  3520. */
  3521. export class PlanePanel extends VolumeBasedPanel {
  3522. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  3523. }
  3524. }
  3525. declare module BABYLON.GUI {
  3526. /**
  3527. * Class used to create a container panel where items get randomized planar mapping
  3528. */
  3529. export class ScatterPanel extends VolumeBasedPanel {
  3530. private _iteration;
  3531. /**
  3532. * Gets or sets the number of iteration to use to scatter the controls (100 by default)
  3533. */
  3534. iteration: BABYLON.float;
  3535. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  3536. private _scatterMapping;
  3537. protected _finalProcessing(): void;
  3538. }
  3539. }
  3540. declare module BABYLON.GUI {
  3541. /**
  3542. * Class used to create a container panel deployed on the surface of a sphere
  3543. */
  3544. export class SpherePanel extends VolumeBasedPanel {
  3545. private _radius;
  3546. /**
  3547. * Gets or sets the radius of the sphere where to project controls (5 by default)
  3548. */
  3549. radius: BABYLON.float;
  3550. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  3551. private _sphericalMapping;
  3552. }
  3553. }
  3554. declare module BABYLON.GUI {
  3555. /**
  3556. * Class used to create a stack panel in 3D on XY plane
  3557. */
  3558. export class StackPanel3D extends Container3D {
  3559. private _isVertical;
  3560. /**
  3561. * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)
  3562. */
  3563. isVertical: boolean;
  3564. /**
  3565. * Gets or sets the distance between elements
  3566. */
  3567. margin: number;
  3568. /**
  3569. * Creates new StackPanel
  3570. * @param isVertical
  3571. */
  3572. constructor(isVertical?: boolean);
  3573. protected _arrangeChildren(): void;
  3574. }
  3575. }