babylon.gui.d.ts 133 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930
  1. /*Babylon.js GUI*/
  2. // Dependencies for this module:
  3. // ../../../../Tools/gulp/babylonjs
  4. // ../../../../Tools/gulp/2D
  5. declare module BABYLON.GUI {
  6. }
  7. declare module BABYLON.GUI {
  8. }
  9. declare module BABYLON.GUI {
  10. }
  11. declare module BABYLON.GUI {
  12. }
  13. declare module BABYLON.GUI {
  14. /**
  15. * Interface used to define a control that can receive focus
  16. */
  17. export interface IFocusableControl {
  18. /**
  19. * Function called when the control receives the focus
  20. */
  21. onFocus(): void;
  22. /**
  23. * Function called when the control loses the focus
  24. */
  25. onBlur(): void;
  26. /**
  27. * Function called to let the control handle keyboard events
  28. * @param evt defines the current keyboard event
  29. */
  30. processKeyboard(evt: KeyboardEvent): void;
  31. /**
  32. * Function called to get the list of controls that should not steal the focus from this control
  33. * @returns an array of controls
  34. */
  35. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  36. }
  37. /**
  38. * Class used to create texture to support 2D GUI elements
  39. * @see http://doc.babylonjs.com/how_to/gui
  40. */
  41. export class AdvancedDynamicTexture extends BABYLON.DynamicTexture {
  42. /** @hidden */
  43. _rootContainer: Container;
  44. /** @hidden */
  45. _lastPickedControl: Control;
  46. /** @hidden */
  47. _lastControlOver: {
  48. [pointerId: number]: Control;
  49. };
  50. /** @hidden */
  51. _lastControlDown: {
  52. [pointerId: number]: Control;
  53. };
  54. /** @hidden */
  55. _capturingControl: {
  56. [pointerId: number]: Control;
  57. };
  58. /** @hidden */
  59. _shouldBlockPointer: boolean;
  60. /** @hidden */
  61. _layerToDispose: BABYLON.Nullable<BABYLON.Layer>;
  62. /** @hidden */
  63. _linkedControls: Control[];
  64. /**
  65. * BABYLON.Observable event triggered each time an clipboard event is received from the rendering canvas
  66. */
  67. onClipboardObservable: BABYLON.Observable<BABYLON.ClipboardInfo>;
  68. /**
  69. * BABYLON.Observable event triggered each time a pointer down is intercepted by a control
  70. */
  71. onControlPickedObservable: BABYLON.Observable<Control>;
  72. /**
  73. * Gets or sets a boolean defining if alpha is stored as premultiplied
  74. */
  75. premulAlpha: boolean;
  76. /**
  77. * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
  78. * Useful when you want more antialiasing
  79. */
  80. renderScale: number;
  81. /** Gets or sets the background color */
  82. background: string;
  83. /**
  84. * Gets or sets the ideal width used to design controls.
  85. * The GUI will then rescale everything accordingly
  86. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  87. */
  88. idealWidth: number;
  89. /**
  90. * Gets or sets the ideal height used to design controls.
  91. * The GUI will then rescale everything accordingly
  92. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  93. */
  94. idealHeight: number;
  95. /**
  96. * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
  97. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  98. */
  99. useSmallestIdeal: boolean;
  100. /**
  101. * Gets or sets a boolean indicating if adaptive scaling must be used
  102. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  103. */
  104. renderAtIdealSize: boolean;
  105. /**
  106. * Gets the underlying layer used to render the texture when in fullscreen mode
  107. */
  108. readonly layer: BABYLON.Nullable<BABYLON.Layer>;
  109. /**
  110. * Gets the root container control
  111. */
  112. readonly rootContainer: Container;
  113. /**
  114. * Returns an array containing the root container.
  115. * This is mostly used to let the Inspector introspects the ADT
  116. * @returns an array containing the rootContainer
  117. */
  118. getChildren(): Array<Container>;
  119. /**
  120. * Will return all controls that are inside this texture
  121. * @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
  122. * @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
  123. * @return all child controls
  124. */
  125. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  126. /**
  127. * Gets or sets the current focused control
  128. */
  129. focusedControl: BABYLON.Nullable<IFocusableControl>;
  130. /**
  131. * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
  132. */
  133. isForeground: boolean;
  134. /**
  135. * Gets or set information about clipboardData
  136. */
  137. clipboardData: string;
  138. /**
  139. * Creates a new AdvancedDynamicTexture
  140. * @param name defines the name of the texture
  141. * @param width defines the width of the texture
  142. * @param height defines the height of the texture
  143. * @param scene defines the hosting scene
  144. * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
  145. * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
  146. */
  147. constructor(name: string, width: number | undefined, height: number | undefined, scene: BABYLON.Nullable<BABYLON.Scene>, generateMipMaps?: boolean, samplingMode?: number);
  148. /**
  149. * Get the current class name of the texture useful for serialization or dynamic coding.
  150. * @returns "AdvancedDynamicTexture"
  151. */
  152. getClassName(): string;
  153. /**
  154. * Function used to execute a function on all controls
  155. * @param func defines the function to execute
  156. * @param container defines the container where controls belong. If null the root container will be used
  157. */
  158. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  159. /**
  160. * Marks the texture as dirty forcing a complete update
  161. */
  162. markAsDirty(): void;
  163. /**
  164. * Helper function used to create a new style
  165. * @returns a new style
  166. * @see http://doc.babylonjs.com/how_to/gui#styles
  167. */
  168. createStyle(): Style;
  169. /**
  170. * Adds a new control to the root container
  171. * @param control defines the control to add
  172. * @returns the current texture
  173. */
  174. addControl(control: Control): AdvancedDynamicTexture;
  175. /**
  176. * Removes a control from the root container
  177. * @param control defines the control to remove
  178. * @returns the current texture
  179. */
  180. removeControl(control: Control): AdvancedDynamicTexture;
  181. /**
  182. * Release all resources
  183. */
  184. dispose(): void;
  185. /** @hidden */
  186. _getGlobalViewport(scene: BABYLON.Scene): BABYLON.Viewport;
  187. /**
  188. * Get screen coordinates for a vector3
  189. * @param position defines the position to project
  190. * @param worldMatrix defines the world matrix to use
  191. * @returns the projected position
  192. */
  193. getProjectedPosition(position: BABYLON.Vector3, worldMatrix: BABYLON.Matrix): BABYLON.Vector2;
  194. /** @hidden */
  195. _changeCursor(cursor: string): void;
  196. /** @hidden */
  197. _registerLastControlDown(control: Control, pointerId: number): void;
  198. /** @hidden */
  199. _cleanControlAfterRemovalFromList(list: {
  200. [pointerId: number]: Control;
  201. }, control: Control): void;
  202. /** @hidden */
  203. _cleanControlAfterRemoval(control: Control): void;
  204. /** Attach to all scene events required to support pointer events */
  205. attach(): void;
  206. /**
  207. * Register the clipboard Events onto the canvas
  208. */
  209. registerClipboardEvents(): void;
  210. /**
  211. * Unregister the clipboard Events from the canvas
  212. */
  213. unRegisterClipboardEvents(): void;
  214. /**
  215. * Connect the texture to a hosting mesh to enable interactions
  216. * @param mesh defines the mesh to attach to
  217. * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
  218. */
  219. attachToMesh(mesh: BABYLON.AbstractMesh, supportPointerMove?: boolean): void;
  220. /**
  221. * Move the focus to a specific control
  222. * @param control defines the control which will receive the focus
  223. */
  224. moveFocusToControl(control: IFocusableControl): void;
  225. /**
  226. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
  227. * @param mesh defines the mesh which will receive the texture
  228. * @param width defines the texture width (1024 by default)
  229. * @param height defines the texture height (1024 by default)
  230. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  231. * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)
  232. * @returns a new AdvancedDynamicTexture
  233. */
  234. static CreateForMesh(mesh: BABYLON.AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, onlyAlphaTesting?: boolean): AdvancedDynamicTexture;
  235. /**
  236. * Creates a new AdvancedDynamicTexture in fullscreen mode.
  237. * In this mode the texture will rely on a layer for its rendering.
  238. * This allows it to be treated like any other layer.
  239. * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
  240. * LayerMask is set through advancedTexture.layer.layerMask
  241. * @param name defines name for the texture
  242. * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
  243. * @param scene defines the hsoting scene
  244. * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
  245. * @returns a new AdvancedDynamicTexture
  246. */
  247. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: BABYLON.Nullable<BABYLON.Scene>, sampling?: number): AdvancedDynamicTexture;
  248. }
  249. }
  250. declare module BABYLON.GUI {
  251. /**
  252. * Class used to transport BABYLON.Vector2 information for pointer events
  253. */
  254. export class Vector2WithInfo extends BABYLON.Vector2 {
  255. /** defines the current mouse button index */
  256. buttonIndex: number;
  257. /**
  258. * Creates a new Vector2WithInfo
  259. * @param source defines the vector2 data to transport
  260. * @param buttonIndex defines the current mouse button index
  261. */
  262. constructor(source: BABYLON.Vector2,
  263. /** defines the current mouse button index */
  264. buttonIndex?: number);
  265. }
  266. /** Class used to provide 2D matrix features */
  267. export class Matrix2D {
  268. /** Gets the internal array of 6 floats used to store matrix data */
  269. m: Float32Array;
  270. /**
  271. * Creates a new matrix
  272. * @param m00 defines value for (0, 0)
  273. * @param m01 defines value for (0, 1)
  274. * @param m10 defines value for (1, 0)
  275. * @param m11 defines value for (1, 1)
  276. * @param m20 defines value for (2, 0)
  277. * @param m21 defines value for (2, 1)
  278. */
  279. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  280. /**
  281. * Fills the matrix from direct values
  282. * @param m00 defines value for (0, 0)
  283. * @param m01 defines value for (0, 1)
  284. * @param m10 defines value for (1, 0)
  285. * @param m11 defines value for (1, 1)
  286. * @param m20 defines value for (2, 0)
  287. * @param m21 defines value for (2, 1)
  288. * @returns the current modified matrix
  289. */
  290. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  291. /**
  292. * Gets matrix determinant
  293. * @returns the determinant
  294. */
  295. determinant(): number;
  296. /**
  297. * Inverses the matrix and stores it in a target matrix
  298. * @param result defines the target matrix
  299. * @returns the current matrix
  300. */
  301. invertToRef(result: Matrix2D): Matrix2D;
  302. /**
  303. * Multiplies the current matrix with another one
  304. * @param other defines the second operand
  305. * @param result defines the target matrix
  306. * @returns the current matrix
  307. */
  308. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  309. /**
  310. * Applies the current matrix to a set of 2 floats and stores the result in a vector2
  311. * @param x defines the x coordinate to transform
  312. * @param y defines the x coordinate to transform
  313. * @param result defines the target vector2
  314. * @returns the current matrix
  315. */
  316. transformCoordinates(x: number, y: number, result: BABYLON.Vector2): Matrix2D;
  317. /**
  318. * Creates an identity matrix
  319. * @returns a new matrix
  320. */
  321. static Identity(): Matrix2D;
  322. /**
  323. * Creates a translation matrix and stores it in a target matrix
  324. * @param x defines the x coordinate of the translation
  325. * @param y defines the y coordinate of the translation
  326. * @param result defines the target matrix
  327. */
  328. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  329. /**
  330. * Creates a scaling matrix and stores it in a target matrix
  331. * @param x defines the x coordinate of the scaling
  332. * @param y defines the y coordinate of the scaling
  333. * @param result defines the target matrix
  334. */
  335. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  336. /**
  337. * Creates a rotation matrix and stores it in a target matrix
  338. * @param angle defines the rotation angle
  339. * @param result defines the target matrix
  340. */
  341. static RotationToRef(angle: number, result: Matrix2D): void;
  342. /**
  343. * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
  344. * @param tx defines the x coordinate of the translation
  345. * @param ty defines the y coordinate of the translation
  346. * @param angle defines the rotation angle
  347. * @param scaleX defines the x coordinate of the scaling
  348. * @param scaleY defines the y coordinate of the scaling
  349. * @param parentMatrix defines the parent matrix to multiply by (can be null)
  350. * @param result defines the target matrix
  351. */
  352. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: BABYLON.Nullable<Matrix2D>, result: Matrix2D): void;
  353. }
  354. }
  355. declare module BABYLON.GUI {
  356. /**
  357. * Class used to store 2D control sizes
  358. */
  359. export class Measure {
  360. /** defines left coordinate */
  361. left: number;
  362. /** defines top coordinate */
  363. top: number;
  364. /** defines width dimension */
  365. width: number;
  366. /** defines height dimension */
  367. height: number;
  368. /**
  369. * Creates a new measure
  370. * @param left defines left coordinate
  371. * @param top defines top coordinate
  372. * @param width defines width dimension
  373. * @param height defines height dimension
  374. */
  375. constructor(
  376. /** defines left coordinate */
  377. left: number,
  378. /** defines top coordinate */
  379. top: number,
  380. /** defines width dimension */
  381. width: number,
  382. /** defines height dimension */
  383. height: number);
  384. /**
  385. * Copy from another measure
  386. * @param other defines the other measure to copy from
  387. */
  388. copyFrom(other: Measure): void;
  389. /**
  390. * Copy from a group of 4 floats
  391. * @param left defines left coordinate
  392. * @param top defines top coordinate
  393. * @param width defines width dimension
  394. * @param height defines height dimension
  395. */
  396. copyFromFloats(left: number, top: number, width: number, height: number): void;
  397. /**
  398. * Check equality between this measure and another one
  399. * @param other defines the other measures
  400. * @returns true if both measures are equals
  401. */
  402. isEqualsTo(other: Measure): boolean;
  403. /**
  404. * Creates an empty measure
  405. * @returns a new measure
  406. */
  407. static Empty(): Measure;
  408. }
  409. }
  410. declare module BABYLON.GUI {
  411. /**
  412. * Class used to store a point for a MultiLine object.
  413. * The point can be pure 2D coordinates, a mesh or a control
  414. */
  415. export class MultiLinePoint {
  416. /** @hidden */
  417. _point: BABYLON.Vector2;
  418. /**
  419. * Creates a new MultiLinePoint
  420. * @param multiLine defines the source MultiLine object
  421. */
  422. constructor(multiLine: MultiLine);
  423. /** Gets or sets x coordinate */
  424. x: string | number;
  425. /** Gets or sets y coordinate */
  426. y: string | number;
  427. /** Gets or sets the control associated with this point */
  428. control: BABYLON.Nullable<Control>;
  429. /** Gets or sets the mesh associated with this point */
  430. mesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  431. /** Resets links */
  432. resetLinks(): void;
  433. /**
  434. * Gets a translation vector
  435. * @returns the translation vector
  436. */
  437. translate(): BABYLON.Vector2;
  438. /** Release associated resources */
  439. dispose(): void;
  440. }
  441. }
  442. declare module BABYLON.GUI {
  443. /**
  444. * Define a style used by control to automatically setup properties based on a template.
  445. * Only support font related properties so far
  446. */
  447. export class Style implements BABYLON.IDisposable {
  448. /** @hidden */
  449. _host: AdvancedDynamicTexture;
  450. /** @hidden */
  451. _fontSize: ValueAndUnit;
  452. /**
  453. * BABYLON.Observable raised when the style values are changed
  454. */
  455. onChangedObservable: BABYLON.Observable<Style>;
  456. /**
  457. * Creates a new style object
  458. * @param host defines the AdvancedDynamicTexture which hosts this style
  459. */
  460. constructor(host: AdvancedDynamicTexture);
  461. /**
  462. * Gets or sets the font size
  463. */
  464. fontSize: string | number;
  465. /**
  466. * Gets or sets the font family
  467. */
  468. fontFamily: string;
  469. /**
  470. * Gets or sets the font style
  471. */
  472. fontStyle: string;
  473. /** Gets or sets font weight */
  474. fontWeight: string;
  475. /** Dispose all associated resources */
  476. dispose(): void;
  477. }
  478. }
  479. declare module BABYLON.GUI {
  480. /**
  481. * Class used to specific a value and its associated unit
  482. */
  483. export class ValueAndUnit {
  484. /** defines the unit to store */
  485. unit: number;
  486. /** defines a boolean indicating if the value can be negative */
  487. negativeValueAllowed: boolean;
  488. /**
  489. * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
  490. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  491. */
  492. ignoreAdaptiveScaling: boolean;
  493. /**
  494. * Creates a new ValueAndUnit
  495. * @param value defines the value to store
  496. * @param unit defines the unit to store
  497. * @param negativeValueAllowed defines a boolean indicating if the value can be negative
  498. */
  499. constructor(value: number,
  500. /** defines the unit to store */
  501. unit?: number,
  502. /** defines a boolean indicating if the value can be negative */
  503. negativeValueAllowed?: boolean);
  504. /** Gets a boolean indicating if the value is a percentage */
  505. readonly isPercentage: boolean;
  506. /** Gets a boolean indicating if the value is store as pixel */
  507. readonly isPixel: boolean;
  508. /** Gets direct internal value */
  509. readonly internalValue: number;
  510. /**
  511. * Gets value as pixel
  512. * @param host defines the root host
  513. * @param refValue defines the reference value for percentages
  514. * @returns the value as pixel
  515. */
  516. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  517. /**
  518. * Update the current value and unit. This should be done cautiously as the GUi won't be marked as dirty with this function.
  519. * @param value defines the value to store
  520. * @param unit defines the unit to store
  521. * @returns the current ValueAndUnit
  522. */
  523. updateInPlace(value: number, unit?: number): ValueAndUnit;
  524. /**
  525. * Gets the value accordingly to its unit
  526. * @param host defines the root host
  527. * @returns the value
  528. */
  529. getValue(host: AdvancedDynamicTexture): number;
  530. /**
  531. * Gets a string representation of the value
  532. * @param host defines the root host
  533. * @returns a string
  534. */
  535. toString(host: AdvancedDynamicTexture): string;
  536. /**
  537. * Store a value parsed from a string
  538. * @param source defines the source string
  539. * @returns true if the value was successfully parsed
  540. */
  541. fromString(source: string | number): boolean;
  542. /** UNITMODE_PERCENTAGE */
  543. static readonly UNITMODE_PERCENTAGE: number;
  544. /** UNITMODE_PIXEL */
  545. static readonly UNITMODE_PIXEL: number;
  546. }
  547. }
  548. declare module BABYLON.GUI {
  549. }
  550. declare module BABYLON.GUI {
  551. }
  552. declare module BABYLON.GUI {
  553. /**
  554. * Class used to manage 3D user interface
  555. * @see http://doc.babylonjs.com/how_to/gui3d
  556. */
  557. export class GUI3DManager implements BABYLON.IDisposable {
  558. /** @hidden */
  559. _lastPickedControl: Control3D;
  560. /** @hidden */
  561. _lastControlOver: {
  562. [pointerId: number]: Control3D;
  563. };
  564. /** @hidden */
  565. _lastControlDown: {
  566. [pointerId: number]: Control3D;
  567. };
  568. /**
  569. * BABYLON.Observable raised when the point picked by the pointer events changed
  570. */
  571. onPickedPointChangedObservable: BABYLON.Observable<BABYLON.Nullable<BABYLON.Vector3>>;
  572. /** @hidden */
  573. _sharedMaterials: {
  574. [key: string]: BABYLON.Material;
  575. };
  576. /** Gets the hosting scene */
  577. readonly scene: BABYLON.Scene;
  578. /** Gets associated utility layer */
  579. readonly utilityLayer: BABYLON.Nullable<BABYLON.UtilityLayerRenderer>;
  580. /**
  581. * Creates a new GUI3DManager
  582. * @param scene
  583. */
  584. constructor(scene?: BABYLON.Scene);
  585. /**
  586. * Gets the root container
  587. */
  588. readonly rootContainer: Container3D;
  589. /**
  590. * Gets a boolean indicating if the given control is in the root child list
  591. * @param control defines the control to check
  592. * @returns true if the control is in the root child list
  593. */
  594. containsControl(control: Control3D): boolean;
  595. /**
  596. * Adds a control to the root child list
  597. * @param control defines the control to add
  598. * @returns the current manager
  599. */
  600. addControl(control: Control3D): GUI3DManager;
  601. /**
  602. * Removes a control from the root child list
  603. * @param control defines the control to remove
  604. * @returns the current container
  605. */
  606. removeControl(control: Control3D): GUI3DManager;
  607. /**
  608. * Releases all associated resources
  609. */
  610. dispose(): void;
  611. }
  612. }
  613. declare module BABYLON.GUI {
  614. /**
  615. * Class used to transport BABYLON.Vector3 information for pointer events
  616. */
  617. export class Vector3WithInfo extends BABYLON.Vector3 {
  618. /** defines the current mouse button index */
  619. buttonIndex: number;
  620. /**
  621. * Creates a new Vector3WithInfo
  622. * @param source defines the vector3 data to transport
  623. * @param buttonIndex defines the current mouse button index
  624. */
  625. constructor(source: BABYLON.Vector3,
  626. /** defines the current mouse button index */
  627. buttonIndex?: number);
  628. }
  629. }
  630. declare module BABYLON.GUI {
  631. /**
  632. * Class used to create 2D buttons
  633. */
  634. export class Button extends Rectangle {
  635. name?: string | undefined;
  636. /**
  637. * Function called to generate a pointer enter animation
  638. */
  639. pointerEnterAnimation: () => void;
  640. /**
  641. * Function called to generate a pointer out animation
  642. */
  643. pointerOutAnimation: () => void;
  644. /**
  645. * Function called to generate a pointer down animation
  646. */
  647. pointerDownAnimation: () => void;
  648. /**
  649. * Function called to generate a pointer up animation
  650. */
  651. pointerUpAnimation: () => void;
  652. /**
  653. * Returns the image part of the button (if any)
  654. */
  655. readonly image: BABYLON.Nullable<Image>;
  656. /**
  657. * Returns the image part of the button (if any)
  658. */
  659. readonly textBlock: BABYLON.Nullable<TextBlock>;
  660. /**
  661. * Creates a new Button
  662. * @param name defines the name of the button
  663. */
  664. constructor(name?: string | undefined);
  665. protected _getTypeName(): string;
  666. /** @hidden */
  667. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  668. /** @hidden */
  669. _onPointerEnter(target: Control): boolean;
  670. /** @hidden */
  671. _onPointerOut(target: Control): void;
  672. /** @hidden */
  673. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  674. /** @hidden */
  675. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  676. /**
  677. * Creates a new button made with an image and a text
  678. * @param name defines the name of the button
  679. * @param text defines the text of the button
  680. * @param imageUrl defines the url of the image
  681. * @returns a new Button
  682. */
  683. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  684. /**
  685. * Creates a new button made with an image
  686. * @param name defines the name of the button
  687. * @param imageUrl defines the url of the image
  688. * @returns a new Button
  689. */
  690. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  691. /**
  692. * Creates a new button made with a text
  693. * @param name defines the name of the button
  694. * @param text defines the text of the button
  695. * @returns a new Button
  696. */
  697. static CreateSimpleButton(name: string, text: string): Button;
  698. /**
  699. * Creates a new button made with an image and a centered text
  700. * @param name defines the name of the button
  701. * @param text defines the text of the button
  702. * @param imageUrl defines the url of the image
  703. * @returns a new Button
  704. */
  705. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  706. }
  707. }
  708. declare module BABYLON.GUI {
  709. /**
  710. * Class used to represent a 2D checkbox
  711. */
  712. export class Checkbox extends Control {
  713. name?: string | undefined;
  714. /** Gets or sets border thickness */
  715. thickness: number;
  716. /**
  717. * BABYLON.Observable raised when isChecked property changes
  718. */
  719. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  720. /** Gets or sets a value indicating the ratio between overall size and check size */
  721. checkSizeRatio: number;
  722. /** Gets or sets background color */
  723. background: string;
  724. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  725. isChecked: boolean;
  726. /**
  727. * Creates a new CheckBox
  728. * @param name defines the control name
  729. */
  730. constructor(name?: string | undefined);
  731. protected _getTypeName(): string;
  732. /** @hidden */
  733. _draw(context: CanvasRenderingContext2D): void;
  734. /** @hidden */
  735. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  736. /**
  737. * Utility function to easily create a checkbox with a header
  738. * @param title defines the label to use for the header
  739. * @param onValueChanged defines the callback to call when value changes
  740. * @returns a StackPanel containing the checkbox and a textBlock
  741. */
  742. static AddCheckBoxWithHeader(title: string, onValueChanged: (value: boolean) => void): StackPanel;
  743. }
  744. }
  745. declare module BABYLON.GUI {
  746. /** Class used to create color pickers */
  747. export class ColorPicker extends Control {
  748. name?: string | undefined;
  749. /**
  750. * BABYLON.Observable raised when the value changes
  751. */
  752. onValueChangedObservable: BABYLON.Observable<BABYLON.Color3>;
  753. /** Gets or sets the color of the color picker */
  754. value: BABYLON.Color3;
  755. /** Gets or sets control width */
  756. width: string | number;
  757. /** Gets or sets control height */
  758. height: string | number;
  759. /** Gets or sets control size */
  760. size: string | number;
  761. /**
  762. * Creates a new ColorPicker
  763. * @param name defines the control name
  764. */
  765. constructor(name?: string | undefined);
  766. protected _getTypeName(): string;
  767. /** @hidden */
  768. _draw(context: CanvasRenderingContext2D): void;
  769. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  770. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  771. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  772. }
  773. }
  774. declare module BABYLON.GUI {
  775. /**
  776. * Root class for 2D containers
  777. * @see http://doc.babylonjs.com/how_to/gui#containers
  778. */
  779. export class Container extends Control {
  780. name?: string | undefined;
  781. /** @hidden */
  782. protected _children: Control[];
  783. /** @hidden */
  784. protected _measureForChildren: Measure;
  785. /** @hidden */
  786. protected _background: string;
  787. /** @hidden */
  788. protected _adaptWidthToChildren: boolean;
  789. /** @hidden */
  790. protected _adaptHeightToChildren: boolean;
  791. /** @hidden */
  792. protected _rebuildLayout: boolean;
  793. /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
  794. adaptHeightToChildren: boolean;
  795. /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
  796. adaptWidthToChildren: boolean;
  797. /** Gets or sets background color */
  798. background: string;
  799. /** Gets the list of children */
  800. readonly children: Control[];
  801. /**
  802. * Creates a new Container
  803. * @param name defines the name of the container
  804. */
  805. constructor(name?: string | undefined);
  806. protected _getTypeName(): string;
  807. _flagDescendantsAsMatrixDirty(): void;
  808. /**
  809. * Gets a child using its name
  810. * @param name defines the child name to look for
  811. * @returns the child control if found
  812. */
  813. getChildByName(name: string): BABYLON.Nullable<Control>;
  814. /**
  815. * Gets a child using its type and its name
  816. * @param name defines the child name to look for
  817. * @param type defines the child type to look for
  818. * @returns the child control if found
  819. */
  820. getChildByType(name: string, type: string): BABYLON.Nullable<Control>;
  821. /**
  822. * Search for a specific control in children
  823. * @param control defines the control to look for
  824. * @returns true if the control is in child list
  825. */
  826. containsControl(control: Control): boolean;
  827. /**
  828. * Adds a new control to the current container
  829. * @param control defines the control to add
  830. * @returns the current container
  831. */
  832. addControl(control: BABYLON.Nullable<Control>): Container;
  833. /**
  834. * Removes all controls from the current container
  835. * @returns the current container
  836. */
  837. clearControls(): Container;
  838. /**
  839. * Removes a control from the current container
  840. * @param control defines the control to remove
  841. * @returns the current container
  842. */
  843. removeControl(control: Control): Container;
  844. /** @hidden */
  845. _reOrderControl(control: Control): void;
  846. /** @hidden */
  847. _offsetLeft(offset: number): void;
  848. /** @hidden */
  849. _offsetTop(offset: number): void;
  850. /** @hidden */
  851. _markAllAsDirty(): void;
  852. /** @hidden */
  853. protected _localDraw(context: CanvasRenderingContext2D): void;
  854. /** @hidden */
  855. _link(host: AdvancedDynamicTexture): void;
  856. /** @hidden */
  857. protected _beforeLayout(): void;
  858. /** @hidden */
  859. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  860. protected _postMeasure(): void;
  861. /** @hidden */
  862. _draw(context: CanvasRenderingContext2D): void;
  863. /** @hidden */
  864. _getDescendants(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  865. /** @hidden */
  866. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  867. /** @hidden */
  868. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  869. /** Releases associated resources */
  870. dispose(): void;
  871. }
  872. }
  873. declare module BABYLON.GUI {
  874. /**
  875. * Root class used for all 2D controls
  876. * @see http://doc.babylonjs.com/how_to/gui#controls
  877. */
  878. export class Control {
  879. /** defines the name of the control */
  880. name?: string | undefined;
  881. /**
  882. * Gets or sets a boolean indicating if alpha must be an inherited value (false by default)
  883. */
  884. static AllowAlphaInheritance: boolean;
  885. /** @hidden */
  886. _host: AdvancedDynamicTexture;
  887. /** Gets or sets the control parent */
  888. parent: BABYLON.Nullable<Container>;
  889. /** @hidden */
  890. _currentMeasure: Measure;
  891. /** @hidden */
  892. _width: ValueAndUnit;
  893. /** @hidden */
  894. _height: ValueAndUnit;
  895. /** @hidden */
  896. protected _fontOffset: {
  897. ascent: number;
  898. height: number;
  899. descent: number;
  900. };
  901. /** @hidden */
  902. protected _horizontalAlignment: number;
  903. /** @hidden */
  904. protected _verticalAlignment: number;
  905. /** @hidden */
  906. protected _isDirty: boolean;
  907. /** @hidden */
  908. _tempParentMeasure: Measure;
  909. /** @hidden */
  910. protected _cachedParentMeasure: Measure;
  911. /** @hidden */
  912. _left: ValueAndUnit;
  913. /** @hidden */
  914. _top: ValueAndUnit;
  915. /** @hidden */
  916. protected _invertTransformMatrix: Matrix2D;
  917. /** @hidden */
  918. protected _transformedPosition: BABYLON.Vector2;
  919. /** @hidden */
  920. _linkedMesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  921. protected _isEnabled: boolean;
  922. protected _disabledColor: string;
  923. /** @hidden */
  924. _isClipped: boolean;
  925. /** @hidden */
  926. _tag: any;
  927. /**
  928. * 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
  929. */
  930. uniqueId: number;
  931. /**
  932. * Gets or sets an object used to store user defined information for the node
  933. */
  934. metadata: any;
  935. /** Gets or sets a boolean indicating if the control can be hit with pointer events */
  936. isHitTestVisible: boolean;
  937. /** Gets or sets a boolean indicating if the control can block pointer events */
  938. isPointerBlocker: boolean;
  939. /** Gets or sets a boolean indicating if the control can be focusable */
  940. isFocusInvisible: boolean;
  941. /** Gets or sets a boolean indicating if the children are clipped to the current control bounds */
  942. clipChildren: boolean;
  943. /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
  944. shadowOffsetX: number;
  945. /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
  946. shadowOffsetY: number;
  947. /** Gets or sets a value indicating the amount of blur to use to render the shadow */
  948. shadowBlur: number;
  949. /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
  950. shadowColor: string;
  951. /** Gets or sets the cursor to use when the control is hovered */
  952. hoverCursor: string;
  953. /** @hidden */
  954. protected _linkOffsetX: ValueAndUnit;
  955. /** @hidden */
  956. protected _linkOffsetY: ValueAndUnit;
  957. /** Gets the control type name */
  958. readonly typeName: string;
  959. /**
  960. * Get the current class name of the control.
  961. * @returns current class name
  962. */
  963. getClassName(): string;
  964. /**
  965. * An event triggered when the pointer move over the control.
  966. */
  967. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector2>;
  968. /**
  969. * An event triggered when the pointer move out of the control.
  970. */
  971. onPointerOutObservable: BABYLON.Observable<Control>;
  972. /**
  973. * An event triggered when the pointer taps the control
  974. */
  975. onPointerDownObservable: BABYLON.Observable<Vector2WithInfo>;
  976. /**
  977. * An event triggered when pointer up
  978. */
  979. onPointerUpObservable: BABYLON.Observable<Vector2WithInfo>;
  980. /**
  981. * An event triggered when a control is clicked on
  982. */
  983. onPointerClickObservable: BABYLON.Observable<Vector2WithInfo>;
  984. /**
  985. * An event triggered when pointer enters the control
  986. */
  987. onPointerEnterObservable: BABYLON.Observable<Control>;
  988. /**
  989. * An event triggered when the control is marked as dirty
  990. */
  991. onDirtyObservable: BABYLON.Observable<Control>;
  992. /**
  993. * An event triggered before drawing the control
  994. */
  995. onBeforeDrawObservable: BABYLON.Observable<Control>;
  996. /**
  997. * An event triggered after the control was drawn
  998. */
  999. onAfterDrawObservable: BABYLON.Observable<Control>;
  1000. /** Gets or set information about font offsets (used to render and align text) */
  1001. fontOffset: {
  1002. ascent: number;
  1003. height: number;
  1004. descent: number;
  1005. };
  1006. /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
  1007. alpha: number;
  1008. /**
  1009. * Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)
  1010. */
  1011. isHighlighted: boolean;
  1012. /** Gets or sets a value indicating the scale factor on X axis (1 by default)
  1013. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1014. */
  1015. scaleX: number;
  1016. /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
  1017. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1018. */
  1019. scaleY: number;
  1020. /** Gets or sets the rotation angle (0 by default)
  1021. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1022. */
  1023. rotation: number;
  1024. /** Gets or sets the transformation center on Y axis (0 by default)
  1025. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1026. */
  1027. transformCenterY: number;
  1028. /** Gets or sets the transformation center on X axis (0 by default)
  1029. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1030. */
  1031. transformCenterX: number;
  1032. /**
  1033. * Gets or sets the horizontal alignment
  1034. * @see http://doc.babylonjs.com/how_to/gui#alignments
  1035. */
  1036. horizontalAlignment: number;
  1037. /**
  1038. * Gets or sets the vertical alignment
  1039. * @see http://doc.babylonjs.com/how_to/gui#alignments
  1040. */
  1041. verticalAlignment: number;
  1042. /**
  1043. * Gets or sets control width
  1044. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1045. */
  1046. width: string | number;
  1047. /**
  1048. * Gets control width in pixel
  1049. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1050. */
  1051. readonly widthInPixels: number;
  1052. /**
  1053. * Gets or sets control height
  1054. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1055. */
  1056. height: string | number;
  1057. /**
  1058. * Gets control height in pixel
  1059. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1060. */
  1061. readonly heightInPixels: number;
  1062. /** Gets or set font family */
  1063. fontFamily: string;
  1064. /** Gets or sets font style */
  1065. fontStyle: string;
  1066. /** Gets or sets font weight */
  1067. fontWeight: string;
  1068. /**
  1069. * Gets or sets style
  1070. * @see http://doc.babylonjs.com/how_to/gui#styles
  1071. */
  1072. style: BABYLON.Nullable<Style>;
  1073. /** @hidden */
  1074. readonly _isFontSizeInPercentage: boolean;
  1075. /** Gets font size in pixels */
  1076. readonly fontSizeInPixels: number;
  1077. /** Gets or sets font size */
  1078. fontSize: string | number;
  1079. /** Gets or sets foreground color */
  1080. color: string;
  1081. /** Gets or sets z index which is used to reorder controls on the z axis */
  1082. zIndex: number;
  1083. /** Gets or sets a boolean indicating if the control can be rendered */
  1084. notRenderable: boolean;
  1085. /** Gets or sets a boolean indicating if the control is visible */
  1086. isVisible: boolean;
  1087. /** Gets a boolean indicating that the control needs to update its rendering */
  1088. readonly isDirty: boolean;
  1089. /**
  1090. * Gets the current linked mesh (or null if none)
  1091. */
  1092. readonly linkedMesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  1093. /**
  1094. * Gets or sets a value indicating the padding to use on the left of the control
  1095. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1096. */
  1097. paddingLeft: string | number;
  1098. /**
  1099. * Gets a value indicating the padding in pixels to use on the left of the control
  1100. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1101. */
  1102. readonly paddingLeftInPixels: number;
  1103. /**
  1104. * Gets or sets a value indicating the padding to use on the right of the control
  1105. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1106. */
  1107. paddingRight: string | number;
  1108. /**
  1109. * Gets a value indicating the padding in pixels to use on the right of the control
  1110. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1111. */
  1112. readonly paddingRightInPixels: number;
  1113. /**
  1114. * Gets or sets a value indicating the padding to use on the top of the control
  1115. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1116. */
  1117. paddingTop: string | number;
  1118. /**
  1119. * Gets a value indicating the padding in pixels to use on the top of the control
  1120. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1121. */
  1122. readonly paddingTopInPixels: number;
  1123. /**
  1124. * Gets or sets a value indicating the padding to use on the bottom of the control
  1125. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1126. */
  1127. paddingBottom: string | number;
  1128. /**
  1129. * Gets a value indicating the padding in pixels to use on the bottom of the control
  1130. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1131. */
  1132. readonly paddingBottomInPixels: number;
  1133. /**
  1134. * Gets or sets a value indicating the left coordinate of the control
  1135. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1136. */
  1137. left: string | number;
  1138. /**
  1139. * Gets a value indicating the left coordinate in pixels of the control
  1140. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1141. */
  1142. readonly leftInPixels: number;
  1143. /**
  1144. * Gets or sets a value indicating the top coordinate of the control
  1145. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1146. */
  1147. top: string | number;
  1148. /**
  1149. * Gets a value indicating the top coordinate in pixels of the control
  1150. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1151. */
  1152. readonly topInPixels: number;
  1153. /**
  1154. * Gets or sets a value indicating the offset on X axis to the linked mesh
  1155. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1156. */
  1157. linkOffsetX: string | number;
  1158. /**
  1159. * Gets a value indicating the offset in pixels on X axis to the linked mesh
  1160. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1161. */
  1162. readonly linkOffsetXInPixels: number;
  1163. /**
  1164. * Gets or sets a value indicating the offset on Y axis to the linked mesh
  1165. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1166. */
  1167. linkOffsetY: string | number;
  1168. /**
  1169. * Gets a value indicating the offset in pixels on Y axis to the linked mesh
  1170. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1171. */
  1172. readonly linkOffsetYInPixels: number;
  1173. /** Gets the center coordinate on X axis */
  1174. readonly centerX: number;
  1175. /** Gets the center coordinate on Y axis */
  1176. readonly centerY: number;
  1177. /** Gets or sets if control is Enabled*/
  1178. isEnabled: boolean;
  1179. /** Gets or sets background color of control if it's disabled*/
  1180. disabledColor: string;
  1181. /**
  1182. * Creates a new control
  1183. * @param name defines the name of the control
  1184. */
  1185. constructor(
  1186. /** defines the name of the control */
  1187. name?: string | undefined);
  1188. /** @hidden */
  1189. protected _getTypeName(): string;
  1190. /**
  1191. * Gets the first ascendant in the hierarchy of the given type
  1192. * @param className defines the required type
  1193. * @returns the ascendant or null if not found
  1194. */
  1195. getAscendantOfClass(className: string): BABYLON.Nullable<Control>;
  1196. /** @hidden */
  1197. _resetFontCache(): void;
  1198. /**
  1199. * Determines if a container is an ascendant of the current control
  1200. * @param container defines the container to look for
  1201. * @returns true if the container is one of the ascendant of the control
  1202. */
  1203. isAscendant(container: Control): boolean;
  1204. /**
  1205. * Gets coordinates in local control space
  1206. * @param globalCoordinates defines the coordinates to transform
  1207. * @returns the new coordinates in local space
  1208. */
  1209. getLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  1210. /**
  1211. * Gets coordinates in local control space
  1212. * @param globalCoordinates defines the coordinates to transform
  1213. * @param result defines the target vector2 where to store the result
  1214. * @returns the current control
  1215. */
  1216. getLocalCoordinatesToRef(globalCoordinates: BABYLON.Vector2, result: BABYLON.Vector2): Control;
  1217. /**
  1218. * Gets coordinates in parent local control space
  1219. * @param globalCoordinates defines the coordinates to transform
  1220. * @returns the new coordinates in parent local space
  1221. */
  1222. getParentLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  1223. /**
  1224. * Move the current control to a vector3 position projected onto the screen.
  1225. * @param position defines the target position
  1226. * @param scene defines the hosting scene
  1227. */
  1228. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene): void;
  1229. /** @hidden */
  1230. _getDescendants(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  1231. /**
  1232. * Will return all controls that have this control as ascendant
  1233. * @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
  1234. * @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
  1235. * @return all child controls
  1236. */
  1237. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  1238. /**
  1239. * Link current control with a target mesh
  1240. * @param mesh defines the mesh to link with
  1241. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1242. */
  1243. linkWithMesh(mesh: BABYLON.Nullable<BABYLON.AbstractMesh>): void;
  1244. /** @hidden */
  1245. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3): void;
  1246. /** @hidden */
  1247. _offsetLeft(offset: number): void;
  1248. /** @hidden */
  1249. _offsetTop(offset: number): void;
  1250. /** @hidden */
  1251. _markMatrixAsDirty(): void;
  1252. /** @hidden */
  1253. _flagDescendantsAsMatrixDirty(): void;
  1254. /** @hidden */
  1255. _markAsDirty(force?: boolean): void;
  1256. /** @hidden */
  1257. _markAllAsDirty(): void;
  1258. /** @hidden */
  1259. _link(host: AdvancedDynamicTexture): void;
  1260. /** @hidden */
  1261. protected _transform(context: CanvasRenderingContext2D): void;
  1262. /** @hidden */
  1263. _renderHighlight(context: CanvasRenderingContext2D): void;
  1264. /** @hidden */
  1265. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  1266. /** @hidden */
  1267. protected _applyStates(context: CanvasRenderingContext2D): void;
  1268. /** @hidden */
  1269. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  1270. /** @hidden */
  1271. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1272. /** @hidden */
  1273. _measure(): void;
  1274. /** @hidden */
  1275. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1276. /** @hidden */
  1277. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1278. /** @hidden */
  1279. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1280. /** @hidden */
  1281. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  1282. /** @hidden */
  1283. _render(context: CanvasRenderingContext2D): boolean;
  1284. /** @hidden */
  1285. _draw(context: CanvasRenderingContext2D): void;
  1286. /**
  1287. * Tests if a given coordinates belong to the current control
  1288. * @param x defines x coordinate to test
  1289. * @param y defines y coordinate to test
  1290. * @returns true if the coordinates are inside the control
  1291. */
  1292. contains(x: number, y: number): boolean;
  1293. /** @hidden */
  1294. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  1295. /** @hidden */
  1296. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  1297. /** @hidden */
  1298. _onPointerEnter(target: Control): boolean;
  1299. /** @hidden */
  1300. _onPointerOut(target: Control): void;
  1301. /** @hidden */
  1302. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  1303. /** @hidden */
  1304. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  1305. /** @hidden */
  1306. _forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  1307. /** @hidden */
  1308. _processObservables(type: number, x: number, y: number, pointerId: number, buttonIndex: number): boolean;
  1309. /** Releases associated resources */
  1310. dispose(): void;
  1311. /** HORIZONTAL_ALIGNMENT_LEFT */
  1312. static readonly HORIZONTAL_ALIGNMENT_LEFT: number;
  1313. /** HORIZONTAL_ALIGNMENT_RIGHT */
  1314. static readonly HORIZONTAL_ALIGNMENT_RIGHT: number;
  1315. /** HORIZONTAL_ALIGNMENT_CENTER */
  1316. static readonly HORIZONTAL_ALIGNMENT_CENTER: number;
  1317. /** VERTICAL_ALIGNMENT_TOP */
  1318. static readonly VERTICAL_ALIGNMENT_TOP: number;
  1319. /** VERTICAL_ALIGNMENT_BOTTOM */
  1320. static readonly VERTICAL_ALIGNMENT_BOTTOM: number;
  1321. /** VERTICAL_ALIGNMENT_CENTER */
  1322. static readonly VERTICAL_ALIGNMENT_CENTER: number;
  1323. /** @hidden */
  1324. static _GetFontOffset(font: string): {
  1325. ascent: number;
  1326. height: number;
  1327. descent: number;
  1328. };
  1329. /**
  1330. * Creates a stack panel that can be used to render headers
  1331. * @param control defines the control to associate with the header
  1332. * @param text defines the text of the header
  1333. * @param size defines the size of the header
  1334. * @param options defines options used to configure the header
  1335. * @returns a new StackPanel
  1336. * @ignore
  1337. * @hidden
  1338. */
  1339. static AddHeader: (control: Control, text: string, size: string | number, options: {
  1340. isHorizontal: boolean;
  1341. controlFirst: boolean;
  1342. }) => any;
  1343. /** @hidden */
  1344. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  1345. }
  1346. }
  1347. declare module BABYLON.GUI {
  1348. /** Class used to create 2D ellipse containers */
  1349. export class Ellipse extends Container {
  1350. name?: string | undefined;
  1351. /** Gets or sets border thickness */
  1352. thickness: number;
  1353. /**
  1354. * Creates a new Ellipse
  1355. * @param name defines the control name
  1356. */
  1357. constructor(name?: string | undefined);
  1358. protected _getTypeName(): string;
  1359. protected _localDraw(context: CanvasRenderingContext2D): void;
  1360. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1361. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  1362. }
  1363. }
  1364. declare module BABYLON.GUI {
  1365. /**
  1366. * Class used to create a 2D grid container
  1367. */
  1368. export class Grid extends Container {
  1369. name?: string | undefined;
  1370. /**
  1371. * Gets the number of columns
  1372. */
  1373. readonly columnCount: number;
  1374. /**
  1375. * Gets the number of rows
  1376. */
  1377. readonly rowCount: number;
  1378. /** Gets the list of children */
  1379. readonly children: Control[];
  1380. /**
  1381. * Gets the definition of a specific row
  1382. * @param index defines the index of the row
  1383. * @returns the row definition
  1384. */
  1385. getRowDefinition(index: number): BABYLON.Nullable<ValueAndUnit>;
  1386. /**
  1387. * Gets the definition of a specific column
  1388. * @param index defines the index of the column
  1389. * @returns the column definition
  1390. */
  1391. getColumnDefinition(index: number): BABYLON.Nullable<ValueAndUnit>;
  1392. /**
  1393. * Adds a new row to the grid
  1394. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  1395. * @param isPixel defines if the height is expressed in pixel (or in percentage)
  1396. * @returns the current grid
  1397. */
  1398. addRowDefinition(height: number, isPixel?: boolean): Grid;
  1399. /**
  1400. * Adds a new column to the grid
  1401. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  1402. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  1403. * @returns the current grid
  1404. */
  1405. addColumnDefinition(width: number, isPixel?: boolean): Grid;
  1406. /**
  1407. * Update a row definition
  1408. * @param index defines the index of the row to update
  1409. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  1410. * @param isPixel defines if the weight is expressed in pixel (or in percentage)
  1411. * @returns the current grid
  1412. */
  1413. setRowDefinition(index: number, height: number, isPixel?: boolean): Grid;
  1414. /**
  1415. * Update a column definition
  1416. * @param index defines the index of the column to update
  1417. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  1418. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  1419. * @returns the current grid
  1420. */
  1421. setColumnDefinition(index: number, width: number, isPixel?: boolean): Grid;
  1422. /**
  1423. * Gets the list of children stored in a specific cell
  1424. * @param row defines the row to check
  1425. * @param column defines the column to check
  1426. * @returns the list of controls
  1427. */
  1428. getChildrenAt(row: number, column: number): BABYLON.Nullable<Array<Control>>;
  1429. /**
  1430. * Remove a column definition at specified index
  1431. * @param index defines the index of the column to remove
  1432. * @returns the current grid
  1433. */
  1434. removeColumnDefinition(index: number): Grid;
  1435. /**
  1436. * Remove a row definition at specified index
  1437. * @param index defines the index of the row to remove
  1438. * @returns the current grid
  1439. */
  1440. removeRowDefinition(index: number): Grid;
  1441. /**
  1442. * Adds a new control to the current grid
  1443. * @param control defines the control to add
  1444. * @param row defines the row where to add the control (0 by default)
  1445. * @param column defines the column where to add the control (0 by default)
  1446. * @returns the current grid
  1447. */
  1448. addControl(control: Control, row?: number, column?: number): Grid;
  1449. /**
  1450. * Removes a control from the current container
  1451. * @param control defines the control to remove
  1452. * @returns the current container
  1453. */
  1454. removeControl(control: Control): Container;
  1455. /**
  1456. * Creates a new Grid
  1457. * @param name defines control name
  1458. */
  1459. constructor(name?: string | undefined);
  1460. protected _getTypeName(): string;
  1461. protected _getGridDefinitions(definitionCallback: (lefts: number[], tops: number[], widths: number[], heights: number[]) => void): void;
  1462. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1463. _flagDescendantsAsMatrixDirty(): void;
  1464. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  1465. /** Releases associated resources */
  1466. dispose(): void;
  1467. }
  1468. }
  1469. declare module BABYLON.GUI {
  1470. /**
  1471. * Class used to create 2D images
  1472. */
  1473. export class Image extends Control {
  1474. name?: string | undefined;
  1475. /**
  1476. * BABYLON.Observable notified when the content is loaded
  1477. */
  1478. onImageLoadedObservable: BABYLON.Observable<Image>;
  1479. /**
  1480. * Gets a boolean indicating that the content is loaded
  1481. */
  1482. readonly isLoaded: boolean;
  1483. /**
  1484. * Gets or sets the left coordinate in the source image
  1485. */
  1486. sourceLeft: number;
  1487. /**
  1488. * Gets or sets the top coordinate in the source image
  1489. */
  1490. sourceTop: number;
  1491. /**
  1492. * Gets or sets the width to capture in the source image
  1493. */
  1494. sourceWidth: number;
  1495. /**
  1496. * Gets or sets the height to capture in the source image
  1497. */
  1498. sourceHeight: number;
  1499. /**
  1500. * Gets or sets a boolean indicating if the image can force its container to adapt its size
  1501. * @see http://doc.babylonjs.com/how_to/gui#image
  1502. */
  1503. autoScale: boolean;
  1504. /** Gets or sets the streching mode used by the image */
  1505. stretch: number;
  1506. /**
  1507. * Gets or sets the internal DOM image used to render the control
  1508. */
  1509. domImage: HTMLImageElement;
  1510. /**
  1511. * Gets or sets image source url
  1512. */
  1513. source: BABYLON.Nullable<string>;
  1514. /**
  1515. * Gets or sets the cell width to use when animation sheet is enabled
  1516. * @see http://doc.babylonjs.com/how_to/gui#image
  1517. */
  1518. cellWidth: number;
  1519. /**
  1520. * Gets or sets the cell height to use when animation sheet is enabled
  1521. * @see http://doc.babylonjs.com/how_to/gui#image
  1522. */
  1523. cellHeight: number;
  1524. /**
  1525. * Gets or sets the cell id to use (this will turn on the animation sheet mode)
  1526. * @see http://doc.babylonjs.com/how_to/gui#image
  1527. */
  1528. cellId: number;
  1529. /**
  1530. * Creates a new Image
  1531. * @param name defines the control name
  1532. * @param url defines the image url
  1533. */
  1534. constructor(name?: string | undefined, url?: BABYLON.Nullable<string>);
  1535. protected _getTypeName(): string;
  1536. /** Force the control to synchronize with its content */
  1537. synchronizeSizeWithContent(): void;
  1538. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1539. _draw(context: CanvasRenderingContext2D): void;
  1540. dispose(): void;
  1541. /** STRETCH_NONE */
  1542. static readonly STRETCH_NONE: number;
  1543. /** STRETCH_FILL */
  1544. static readonly STRETCH_FILL: number;
  1545. /** STRETCH_UNIFORM */
  1546. static readonly STRETCH_UNIFORM: number;
  1547. /** STRETCH_EXTEND */
  1548. static readonly STRETCH_EXTEND: number;
  1549. }
  1550. }
  1551. declare module BABYLON.GUI {
  1552. /**
  1553. * Class used to create input text control
  1554. */
  1555. export class InputText extends Control implements IFocusableControl {
  1556. name?: string | undefined;
  1557. /** @hidden */
  1558. _connectedVirtualKeyboard: BABYLON.Nullable<VirtualKeyboard>;
  1559. /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
  1560. promptMessage: string;
  1561. /** BABYLON.Observable raised when the text changes */
  1562. onTextChangedObservable: BABYLON.Observable<InputText>;
  1563. /** BABYLON.Observable raised just before an entered character is to be added */
  1564. onBeforeKeyAddObservable: BABYLON.Observable<InputText>;
  1565. /** BABYLON.Observable raised when the control gets the focus */
  1566. onFocusObservable: BABYLON.Observable<InputText>;
  1567. /** BABYLON.Observable raised when the control loses the focus */
  1568. onBlurObservable: BABYLON.Observable<InputText>;
  1569. /**Observable raised when the text is highlighted */
  1570. onTextHighlightObservable: BABYLON.Observable<InputText>;
  1571. /**Observable raised when copy event is triggered */
  1572. onTextCopyObservable: BABYLON.Observable<InputText>;
  1573. /** BABYLON.Observable raised when cut event is triggered */
  1574. onTextCutObservable: BABYLON.Observable<InputText>;
  1575. /** BABYLON.Observable raised when paste event is triggered */
  1576. onTextPasteObservable: BABYLON.Observable<InputText>;
  1577. /** Gets or sets the maximum width allowed by the control */
  1578. maxWidth: string | number;
  1579. /** Gets the maximum width allowed by the control in pixels */
  1580. readonly maxWidthInPixels: number;
  1581. /** Gets or sets the text highlighter transparency; default: 0.4 */
  1582. highligherOpacity: number;
  1583. /** Gets or sets a boolean indicating whether to select complete text by default on input focus */
  1584. onFocusSelectAll: boolean;
  1585. /** Gets or sets the text hightlight color */
  1586. textHighlightColor: string;
  1587. /** Gets or sets control margin */
  1588. margin: string;
  1589. /** Gets control margin in pixels */
  1590. readonly marginInPixels: number;
  1591. /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
  1592. autoStretchWidth: boolean;
  1593. /** Gets or sets border thickness */
  1594. thickness: number;
  1595. /** Gets or sets the background color when focused */
  1596. focusedBackground: string;
  1597. /** Gets or sets the background color */
  1598. background: string;
  1599. /** Gets or sets the placeholder color */
  1600. placeholderColor: string;
  1601. /** Gets or sets the text displayed when the control is empty */
  1602. placeholderText: string;
  1603. /** Gets or sets the dead key flag */
  1604. deadKey: boolean;
  1605. /** Gets or sets the highlight text */
  1606. highlightedText: string;
  1607. /** Gets or sets if the current key should be added */
  1608. addKey: boolean;
  1609. /** Gets or sets the value of the current key being entered */
  1610. currentKey: string;
  1611. /** Gets or sets the text displayed in the control */
  1612. text: string;
  1613. /** Gets or sets control width */
  1614. width: string | number;
  1615. /**
  1616. * Creates a new InputText
  1617. * @param name defines the control name
  1618. * @param text defines the text of the control
  1619. */
  1620. constructor(name?: string | undefined, text?: string);
  1621. /** @hidden */
  1622. onBlur(): void;
  1623. /** @hidden */
  1624. onFocus(): void;
  1625. protected _getTypeName(): string;
  1626. /**
  1627. * Function called to get the list of controls that should not steal the focus from this control
  1628. * @returns an array of controls
  1629. */
  1630. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  1631. /** @hidden */
  1632. processKey(keyCode: number, key?: string, evt?: KeyboardEvent): void;
  1633. /**
  1634. * Handles the keyboard event
  1635. * @param evt Defines the KeyboardEvent
  1636. */
  1637. processKeyboard(evt: KeyboardEvent): void;
  1638. _draw(context: CanvasRenderingContext2D): void;
  1639. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  1640. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  1641. protected _beforeRenderText(text: string): string;
  1642. dispose(): void;
  1643. }
  1644. }
  1645. declare module BABYLON.GUI {
  1646. /**
  1647. * Class used to create a password control
  1648. */
  1649. export class InputPassword extends InputText {
  1650. protected _beforeRenderText(text: string): string;
  1651. }
  1652. }
  1653. declare module BABYLON.GUI {
  1654. /** Class used to render 2D lines */
  1655. export class Line extends Control {
  1656. name?: string | undefined;
  1657. /** Gets or sets the dash pattern */
  1658. dash: Array<number>;
  1659. /** Gets or sets the control connected with the line end */
  1660. connectedControl: Control;
  1661. /** Gets or sets start coordinates on X axis */
  1662. x1: string | number;
  1663. /** Gets or sets start coordinates on Y axis */
  1664. y1: string | number;
  1665. /** Gets or sets end coordinates on X axis */
  1666. x2: string | number;
  1667. /** Gets or sets end coordinates on Y axis */
  1668. y2: string | number;
  1669. /** Gets or sets line width */
  1670. lineWidth: number;
  1671. /** Gets or sets horizontal alignment */
  1672. horizontalAlignment: number;
  1673. /** Gets or sets vertical alignment */
  1674. verticalAlignment: number;
  1675. /**
  1676. * Creates a new Line
  1677. * @param name defines the control name
  1678. */
  1679. constructor(name?: string | undefined);
  1680. protected _getTypeName(): string;
  1681. _draw(context: CanvasRenderingContext2D): void;
  1682. _measure(): void;
  1683. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1684. /**
  1685. * Move one end of the line given 3D cartesian coordinates.
  1686. * @param position Targeted world position
  1687. * @param scene BABYLON.Scene
  1688. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  1689. */
  1690. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene, end?: boolean): void;
  1691. /**
  1692. * Move one end of the line to a position in screen absolute space.
  1693. * @param projectedPosition Position in screen absolute space (X, Y)
  1694. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  1695. */
  1696. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3, end?: boolean): void;
  1697. }
  1698. }
  1699. declare module BABYLON.GUI {
  1700. /**
  1701. * Class used to create multi line control
  1702. */
  1703. export class MultiLine extends Control {
  1704. name?: string | undefined;
  1705. /**
  1706. * Creates a new MultiLine
  1707. * @param name defines the control name
  1708. */
  1709. constructor(name?: string | undefined);
  1710. /** Gets or sets dash pattern */
  1711. dash: Array<number>;
  1712. /**
  1713. * Gets point stored at specified index
  1714. * @param index defines the index to look for
  1715. * @returns the requested point if found
  1716. */
  1717. getAt(index: number): MultiLinePoint;
  1718. /** Function called when a point is updated */
  1719. onPointUpdate: () => void;
  1720. /**
  1721. * Adds new points to the point collection
  1722. * @param items defines the list of items (mesh, control or 2d coordiantes) to add
  1723. * @returns the list of created MultiLinePoint
  1724. */
  1725. add(...items: (AbstractMesh | Control | {
  1726. x: string | number;
  1727. y: string | number;
  1728. })[]): MultiLinePoint[];
  1729. /**
  1730. * Adds a new point to the point collection
  1731. * @param item defines the item (mesh, control or 2d coordiantes) to add
  1732. * @returns the created MultiLinePoint
  1733. */
  1734. push(item?: (AbstractMesh | Control | {
  1735. x: string | number;
  1736. y: string | number;
  1737. })): MultiLinePoint;
  1738. /**
  1739. * Remove a specific value or point from the active point collection
  1740. * @param value defines the value or point to remove
  1741. */
  1742. remove(value: number | MultiLinePoint): void;
  1743. /**
  1744. * Resets this object to initial state (no point)
  1745. */
  1746. reset(): void;
  1747. /**
  1748. * Resets all links
  1749. */
  1750. resetLinks(): void;
  1751. /** Gets or sets line width */
  1752. lineWidth: number;
  1753. horizontalAlignment: number;
  1754. verticalAlignment: number;
  1755. protected _getTypeName(): string;
  1756. _draw(context: CanvasRenderingContext2D): void;
  1757. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1758. _measure(): void;
  1759. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1760. dispose(): void;
  1761. }
  1762. }
  1763. declare module BABYLON.GUI {
  1764. /**
  1765. * Class used to create radio button controls
  1766. */
  1767. export class RadioButton extends Control {
  1768. name?: string | undefined;
  1769. /** Gets or sets border thickness */
  1770. thickness: number;
  1771. /** Gets or sets group name */
  1772. group: string;
  1773. /** BABYLON.Observable raised when isChecked is changed */
  1774. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  1775. /** Gets or sets a value indicating the ratio between overall size and check size */
  1776. checkSizeRatio: number;
  1777. /** Gets or sets background color */
  1778. background: string;
  1779. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  1780. isChecked: boolean;
  1781. /**
  1782. * Creates a new RadioButton
  1783. * @param name defines the control name
  1784. */
  1785. constructor(name?: string | undefined);
  1786. protected _getTypeName(): string;
  1787. _draw(context: CanvasRenderingContext2D): void;
  1788. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  1789. /**
  1790. * Utility function to easily create a radio button with a header
  1791. * @param title defines the label to use for the header
  1792. * @param group defines the group to use for the radio button
  1793. * @param isChecked defines the initial state of the radio button
  1794. * @param onValueChanged defines the callback to call when value changes
  1795. * @returns a StackPanel containing the radio button and a textBlock
  1796. */
  1797. static AddRadioButtonWithHeader(title: string, group: string, isChecked: boolean, onValueChanged: (button: RadioButton, value: boolean) => void): StackPanel;
  1798. }
  1799. }
  1800. declare module BABYLON.GUI {
  1801. /**
  1802. * Class used to create a 2D stack panel container
  1803. */
  1804. export class StackPanel extends Container {
  1805. name?: string | undefined;
  1806. /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
  1807. isVertical: boolean;
  1808. /**
  1809. * Gets or sets panel width.
  1810. * This value should not be set when in horizontal mode as it will be computed automatically
  1811. */
  1812. width: string | number;
  1813. /**
  1814. * Gets or sets panel height.
  1815. * This value should not be set when in vertical mode as it will be computed automatically
  1816. */
  1817. height: string | number;
  1818. /**
  1819. * Creates a new StackPanel
  1820. * @param name defines control name
  1821. */
  1822. constructor(name?: string | undefined);
  1823. protected _getTypeName(): string;
  1824. /** @hidden */
  1825. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1826. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1827. protected _postMeasure(): void;
  1828. }
  1829. }
  1830. declare module BABYLON.GUI {
  1831. /** Class used to create a RadioGroup
  1832. * which contains groups of radio buttons
  1833. */
  1834. export class SelectorGroup {
  1835. /** name of SelectorGroup */
  1836. name: string;
  1837. /**
  1838. * Creates a new SelectorGroup
  1839. * @param name of group, used as a group heading
  1840. */
  1841. constructor(
  1842. /** name of SelectorGroup */
  1843. name: string);
  1844. /** Gets the groupPanel of the SelectorGroup */
  1845. readonly groupPanel: StackPanel;
  1846. /** Gets the selectors array */
  1847. readonly selectors: StackPanel[];
  1848. /** Gets and sets the group header */
  1849. header: string;
  1850. /** @hidden*/
  1851. _getSelector(selectorNb: number): StackPanel | undefined;
  1852. /** Removes the selector at the given position
  1853. * @param selectorNb the position of the selector within the group
  1854. */
  1855. removeSelector(selectorNb: number): void;
  1856. }
  1857. /** Class used to create a CheckboxGroup
  1858. * which contains groups of checkbox buttons
  1859. */
  1860. export class CheckboxGroup extends SelectorGroup {
  1861. /** Adds a checkbox as a control
  1862. * @param text is the label for the selector
  1863. * @param func is the function called when the Selector is checked
  1864. * @param checked is true when Selector is checked
  1865. */
  1866. addCheckbox(text: string, func?: (s: boolean) => void, checked?: boolean): void;
  1867. /** @hidden */
  1868. _setSelectorLabel(selectorNb: number, label: string): void;
  1869. /** @hidden */
  1870. _setSelectorLabelColor(selectorNb: number, color: string): void;
  1871. /** @hidden */
  1872. _setSelectorButtonColor(selectorNb: number, color: string): void;
  1873. /** @hidden */
  1874. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  1875. }
  1876. /** Class used to create a RadioGroup
  1877. * which contains groups of radio buttons
  1878. */
  1879. export class RadioGroup extends SelectorGroup {
  1880. /** Adds a radio button as a control
  1881. * @param label is the label for the selector
  1882. * @param func is the function called when the Selector is checked
  1883. * @param checked is true when Selector is checked
  1884. */
  1885. addRadio(label: string, func?: (n: number) => void, checked?: boolean): void;
  1886. /** @hidden */
  1887. _setSelectorLabel(selectorNb: number, label: string): void;
  1888. /** @hidden */
  1889. _setSelectorLabelColor(selectorNb: number, color: string): void;
  1890. /** @hidden */
  1891. _setSelectorButtonColor(selectorNb: number, color: string): void;
  1892. /** @hidden */
  1893. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  1894. }
  1895. /** Class used to create a SliderGroup
  1896. * which contains groups of slider buttons
  1897. */
  1898. export class SliderGroup extends SelectorGroup {
  1899. /**
  1900. * Adds a slider to the SelectorGroup
  1901. * @param label is the label for the SliderBar
  1902. * @param func is the function called when the Slider moves
  1903. * @param unit is a string describing the units used, eg degrees or metres
  1904. * @param min is the minimum value for the Slider
  1905. * @param max is the maximum value for the Slider
  1906. * @param value is the start value for the Slider between min and max
  1907. * @param onValueChange is the function used to format the value displayed, eg radians to degrees
  1908. */
  1909. addSlider(label: string, func?: (v: number) => void, unit?: string, min?: number, max?: number, value?: number, onValueChange?: (v: number) => number): void;
  1910. /** @hidden */
  1911. _setSelectorLabel(selectorNb: number, label: string): void;
  1912. /** @hidden */
  1913. _setSelectorLabelColor(selectorNb: number, color: string): void;
  1914. /** @hidden */
  1915. _setSelectorButtonColor(selectorNb: number, color: string): void;
  1916. /** @hidden */
  1917. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  1918. }
  1919. /** Class used to hold the controls for the checkboxes, radio buttons and sliders
  1920. * @see http://doc.babylonjs.com/how_to/selector
  1921. */
  1922. export class SelectionPanel extends Rectangle {
  1923. /** name of SelectionPanel */
  1924. name: string;
  1925. /** an array of SelectionGroups */
  1926. groups: SelectorGroup[];
  1927. /**
  1928. * Creates a new SelectionPanel
  1929. * @param name of SelectionPanel
  1930. * @param groups is an array of SelectionGroups
  1931. */
  1932. constructor(
  1933. /** name of SelectionPanel */
  1934. name: string,
  1935. /** an array of SelectionGroups */
  1936. groups?: SelectorGroup[]);
  1937. protected _getTypeName(): string;
  1938. /** Gets or sets the headerColor */
  1939. headerColor: string;
  1940. /** Gets or sets the button color */
  1941. buttonColor: string;
  1942. /** Gets or sets the label color */
  1943. labelColor: string;
  1944. /** Gets or sets the button background */
  1945. buttonBackground: string;
  1946. /** Gets or sets the color of separator bar */
  1947. barColor: string;
  1948. /** Gets or sets the height of separator bar */
  1949. barHeight: string;
  1950. /** Gets or sets the height of spacers*/
  1951. spacerHeight: string;
  1952. /** Add a group to the selection panel
  1953. * @param group is the selector group to add
  1954. */
  1955. addGroup(group: SelectorGroup): void;
  1956. /** Remove the group from the given position
  1957. * @param groupNb is the position of the group in the list
  1958. */
  1959. removeGroup(groupNb: number): void;
  1960. /** Change a group header label
  1961. * @param label is the new group header label
  1962. * @param groupNb is the number of the group to relabel
  1963. * */
  1964. setHeaderName(label: string, groupNb: number): void;
  1965. /** Change selector label to the one given
  1966. * @param label is the new selector label
  1967. * @param groupNb is the number of the groupcontaining the selector
  1968. * @param selectorNb is the number of the selector within a group to relabel
  1969. * */
  1970. relabel(label: string, groupNb: number, selectorNb: number): void;
  1971. /** For a given group position remove the selector at the given position
  1972. * @param groupNb is the number of the group to remove the selector from
  1973. * @param selectorNb is the number of the selector within the group
  1974. */
  1975. removeFromGroupSelector(groupNb: number, selectorNb: number): void;
  1976. /** For a given group position of correct type add a checkbox button
  1977. * @param groupNb is the number of the group to remove the selector from
  1978. * @param label is the label for the selector
  1979. * @param func is the function called when the Selector is checked
  1980. * @param checked is true when Selector is checked
  1981. */
  1982. addToGroupCheckbox(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  1983. /** For a given group position of correct type add a radio button
  1984. * @param groupNb is the number of the group to remove the selector from
  1985. * @param label is the label for the selector
  1986. * @param func is the function called when the Selector is checked
  1987. * @param checked is true when Selector is checked
  1988. */
  1989. addToGroupRadio(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  1990. /**
  1991. * For a given slider group add a slider
  1992. * @param groupNb is the number of the group to add the slider to
  1993. * @param label is the label for the Slider
  1994. * @param func is the function called when the Slider moves
  1995. * @param unit is a string describing the units used, eg degrees or metres
  1996. * @param min is the minimum value for the Slider
  1997. * @param max is the maximum value for the Slider
  1998. * @param value is the start value for the Slider between min and max
  1999. * @param onVal is the function used to format the value displayed, eg radians to degrees
  2000. */
  2001. addToGroupSlider(groupNb: number, label: string, func?: () => void, unit?: string, min?: number, max?: number, value?: number, onVal?: (v: number) => number): void;
  2002. }
  2003. }
  2004. declare module BABYLON.GUI {
  2005. /**
  2006. * Class used to hold a viewer window and sliders in a grid
  2007. */
  2008. export class ScrollViewer extends Rectangle {
  2009. /**
  2010. * Adds a new control to the current container
  2011. * @param control defines the control to add
  2012. * @returns the current container
  2013. */
  2014. addControl(control: BABYLON.Nullable<Control>): Container;
  2015. /**
  2016. * Removes a control from the current container
  2017. * @param control defines the control to remove
  2018. * @returns the current container
  2019. */
  2020. removeControl(control: Control): Container;
  2021. /** Gets the list of children */
  2022. readonly children: Control[];
  2023. _flagDescendantsAsMatrixDirty(): void;
  2024. /**
  2025. * Creates a new ScrollViewer
  2026. * @param name of ScrollViewer
  2027. */
  2028. constructor(name?: string);
  2029. /** Reset the scroll viewer window to initial size */
  2030. resetWindow(): void;
  2031. protected _getTypeName(): string;
  2032. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2033. protected _postMeasure(): void;
  2034. /**
  2035. * Gets or sets the mouse wheel precision
  2036. * from 0 to 1 with a default value of 0.05
  2037. * */
  2038. wheelPrecision: number;
  2039. /** Gets or sets the bar color */
  2040. barColor: string;
  2041. /** Gets or sets the size of the bar */
  2042. barSize: number;
  2043. /** Gets or sets the bar color */
  2044. barBorderColor: string;
  2045. /** Gets or sets the bar background */
  2046. barBackground: string;
  2047. _link(host: AdvancedDynamicTexture): void;
  2048. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  2049. /** Releases associated resources */
  2050. dispose(): void;
  2051. }
  2052. }
  2053. declare module BABYLON.GUI {
  2054. /**
  2055. * Enum that determines the text-wrapping mode to use.
  2056. */
  2057. export enum TextWrapping {
  2058. /**
  2059. * Clip the text when it's larger than Control.width; this is the default mode.
  2060. */
  2061. Clip = 0,
  2062. /**
  2063. * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.
  2064. */
  2065. WordWrap = 1,
  2066. /**
  2067. * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.
  2068. */
  2069. Ellipsis = 2
  2070. }
  2071. /**
  2072. * Class used to create text block control
  2073. */
  2074. export class TextBlock extends Control {
  2075. /**
  2076. * Defines the name of the control
  2077. */
  2078. name?: string | undefined;
  2079. /**
  2080. * An event triggered after the text is changed
  2081. */
  2082. onTextChangedObservable: BABYLON.Observable<TextBlock>;
  2083. /**
  2084. * An event triggered after the text was broken up into lines
  2085. */
  2086. onLinesReadyObservable: BABYLON.Observable<TextBlock>;
  2087. /**
  2088. * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
  2089. */
  2090. readonly lines: any[];
  2091. /**
  2092. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  2093. */
  2094. resizeToFit: boolean;
  2095. /**
  2096. * Gets or sets a boolean indicating if text must be wrapped
  2097. */
  2098. textWrapping: TextWrapping | boolean;
  2099. /**
  2100. * Gets or sets text to display
  2101. */
  2102. text: string;
  2103. /**
  2104. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  2105. */
  2106. textHorizontalAlignment: number;
  2107. /**
  2108. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  2109. */
  2110. textVerticalAlignment: number;
  2111. /**
  2112. * Gets or sets line spacing value
  2113. */
  2114. lineSpacing: string | number;
  2115. /**
  2116. * Gets or sets outlineWidth of the text to display
  2117. */
  2118. outlineWidth: number;
  2119. /**
  2120. * Gets or sets outlineColor of the text to display
  2121. */
  2122. outlineColor: string;
  2123. /**
  2124. * Creates a new TextBlock object
  2125. * @param name defines the name of the control
  2126. * @param text defines the text to display (emptry string by default)
  2127. */
  2128. constructor(
  2129. /**
  2130. * Defines the name of the control
  2131. */
  2132. name?: string | undefined, text?: string);
  2133. protected _getTypeName(): string;
  2134. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2135. /** @hidden */
  2136. _draw(context: CanvasRenderingContext2D): void;
  2137. protected _applyStates(context: CanvasRenderingContext2D): void;
  2138. protected _breakLines(refWidth: number, context: CanvasRenderingContext2D): object[];
  2139. protected _parseLine(line: string | undefined, context: CanvasRenderingContext2D): object;
  2140. protected _parseLineEllipsis(line: string | undefined, width: number, context: CanvasRenderingContext2D): object;
  2141. protected _parseLineWordWrap(line: string | undefined, width: number, context: CanvasRenderingContext2D): object[];
  2142. protected _renderLines(context: CanvasRenderingContext2D): void;
  2143. /**
  2144. * Given a width constraint applied on the text block, find the expected height
  2145. * @returns expected height
  2146. */
  2147. computeExpectedHeight(): number;
  2148. dispose(): void;
  2149. }
  2150. }
  2151. declare module BABYLON.GUI {
  2152. /**
  2153. * Class used to store key control properties
  2154. */
  2155. export class KeyPropertySet {
  2156. /** Width */
  2157. width?: string;
  2158. /** Height */
  2159. height?: string;
  2160. /** Left padding */
  2161. paddingLeft?: string;
  2162. /** Right padding */
  2163. paddingRight?: string;
  2164. /** Top padding */
  2165. paddingTop?: string;
  2166. /** Bottom padding */
  2167. paddingBottom?: string;
  2168. /** Foreground color */
  2169. color?: string;
  2170. /** Background color */
  2171. background?: string;
  2172. }
  2173. /**
  2174. * Class used to create virtual keyboard
  2175. */
  2176. export class VirtualKeyboard extends StackPanel {
  2177. /** BABYLON.Observable raised when a key is pressed */
  2178. onKeyPressObservable: BABYLON.Observable<string>;
  2179. /** Gets or sets default key button width */
  2180. defaultButtonWidth: string;
  2181. /** Gets or sets default key button height */
  2182. defaultButtonHeight: string;
  2183. /** Gets or sets default key button left padding */
  2184. defaultButtonPaddingLeft: string;
  2185. /** Gets or sets default key button right padding */
  2186. defaultButtonPaddingRight: string;
  2187. /** Gets or sets default key button top padding */
  2188. defaultButtonPaddingTop: string;
  2189. /** Gets or sets default key button bottom padding */
  2190. defaultButtonPaddingBottom: string;
  2191. /** Gets or sets default key button foreground color */
  2192. defaultButtonColor: string;
  2193. /** Gets or sets default key button background color */
  2194. defaultButtonBackground: string;
  2195. /** Gets or sets shift button foreground color */
  2196. shiftButtonColor: string;
  2197. /** Gets or sets shift button thickness*/
  2198. selectedShiftThickness: number;
  2199. /** Gets shift key state */
  2200. shiftState: number;
  2201. protected _getTypeName(): string;
  2202. /**
  2203. * Adds a new row of keys
  2204. * @param keys defines the list of keys to add
  2205. * @param propertySets defines the associated property sets
  2206. */
  2207. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  2208. /**
  2209. * Set the shift key to a specific state
  2210. * @param shiftState defines the new shift state
  2211. */
  2212. applyShiftState(shiftState: number): void;
  2213. /** Gets the input text control currently attached to the keyboard */
  2214. readonly connectedInputText: BABYLON.Nullable<InputText>;
  2215. /**
  2216. * Connects the keyboard with an input text control
  2217. *
  2218. * @param input defines the target control
  2219. */
  2220. connect(input: InputText): void;
  2221. /**
  2222. * Disconnects the keyboard from connected InputText controls
  2223. *
  2224. * @param input optionally defines a target control, otherwise all are disconnected
  2225. */
  2226. disconnect(input?: InputText): void;
  2227. /**
  2228. * Release all resources
  2229. */
  2230. dispose(): void;
  2231. /**
  2232. * Creates a new keyboard using a default layout
  2233. *
  2234. * @param name defines control name
  2235. * @returns a new VirtualKeyboard
  2236. */
  2237. static CreateDefaultLayout(name?: string): VirtualKeyboard;
  2238. }
  2239. }
  2240. declare module BABYLON.GUI {
  2241. /** Class used to create rectangle container */
  2242. export class Rectangle extends Container {
  2243. name?: string | undefined;
  2244. /** Gets or sets border thickness */
  2245. thickness: number;
  2246. /** Gets or sets the corner radius angle */
  2247. cornerRadius: number;
  2248. /**
  2249. * Creates a new Rectangle
  2250. * @param name defines the control name
  2251. */
  2252. constructor(name?: string | undefined);
  2253. protected _getTypeName(): string;
  2254. protected _localDraw(context: CanvasRenderingContext2D): void;
  2255. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2256. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  2257. }
  2258. }
  2259. declare module BABYLON.GUI {
  2260. /** Class used to render a grid */
  2261. export class DisplayGrid extends Control {
  2262. name?: string | undefined;
  2263. /** Gets or sets a boolean indicating if minor lines must be rendered (true by default)) */
  2264. displayMinorLines: boolean;
  2265. /** Gets or sets a boolean indicating if major lines must be rendered (true by default)) */
  2266. displayMajorLines: boolean;
  2267. /** Gets or sets background color (Black by default) */
  2268. background: string;
  2269. /** Gets or sets the width of each cell (20 by default) */
  2270. cellWidth: number;
  2271. /** Gets or sets the height of each cell (20 by default) */
  2272. cellHeight: number;
  2273. /** Gets or sets the tickness of minor lines (1 by default) */
  2274. minorLineTickness: number;
  2275. /** Gets or sets the color of minor lines (DarkGray by default) */
  2276. minorLineColor: string;
  2277. /** Gets or sets the tickness of major lines (2 by default) */
  2278. majorLineTickness: number;
  2279. /** Gets or sets the color of major lines (White by default) */
  2280. majorLineColor: string;
  2281. /** Gets or sets the frequency of major lines (default is 1 every 5 minor lines)*/
  2282. majorLineFrequency: number;
  2283. /**
  2284. * Creates a new GridDisplayRectangle
  2285. * @param name defines the control name
  2286. */
  2287. constructor(name?: string | undefined);
  2288. _draw(context: CanvasRenderingContext2D): void;
  2289. protected _getTypeName(): string;
  2290. }
  2291. }
  2292. declare module BABYLON.GUI {
  2293. /**
  2294. * Class used to create slider controls
  2295. */
  2296. export class BaseSlider extends Control {
  2297. name?: string | undefined;
  2298. protected _thumbWidth: ValueAndUnit;
  2299. protected _barOffset: ValueAndUnit;
  2300. protected _displayThumb: boolean;
  2301. protected _effectiveBarOffset: number;
  2302. protected _renderLeft: number;
  2303. protected _renderTop: number;
  2304. protected _renderWidth: number;
  2305. protected _renderHeight: number;
  2306. protected _backgroundBoxLength: number;
  2307. protected _backgroundBoxThickness: number;
  2308. protected _effectiveThumbThickness: number;
  2309. /** BABYLON.Observable raised when the sldier value changes */
  2310. onValueChangedObservable: BABYLON.Observable<number>;
  2311. /** Gets or sets a boolean indicating if the thumb must be rendered */
  2312. displayThumb: boolean;
  2313. /** Gets or sets main bar offset (ie. the margin applied to the value bar) */
  2314. barOffset: string | number;
  2315. /** Gets main bar offset in pixels*/
  2316. readonly barOffsetInPixels: number;
  2317. /** Gets or sets thumb width */
  2318. thumbWidth: string | number;
  2319. /** Gets thumb width in pixels */
  2320. readonly thumbWidthInPixels: number;
  2321. /** Gets or sets minimum value */
  2322. minimum: number;
  2323. /** Gets or sets maximum value */
  2324. maximum: number;
  2325. /** Gets or sets current value */
  2326. value: number;
  2327. /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */
  2328. isVertical: boolean;
  2329. /** Gets or sets a value indicating if the thumb can go over main bar extends */
  2330. isThumbClamped: boolean;
  2331. /**
  2332. * Creates a new BaseSlider
  2333. * @param name defines the control name
  2334. */
  2335. constructor(name?: string | undefined);
  2336. protected _getTypeName(): string;
  2337. protected _getThumbPosition(): number;
  2338. protected _getThumbThickness(type: string): number;
  2339. protected _prepareRenderingData(type: string): void;
  2340. /** @hidden */
  2341. protected _updateValueFromPointer(x: number, y: number): void;
  2342. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  2343. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  2344. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  2345. }
  2346. }
  2347. declare module BABYLON.GUI {
  2348. /**
  2349. * Class used to create slider controls
  2350. */
  2351. export class Slider extends BaseSlider {
  2352. name?: string | undefined;
  2353. protected _displayValueBar: boolean;
  2354. /** Gets or sets a boolean indicating if the value bar must be rendered */
  2355. displayValueBar: boolean;
  2356. /** Gets or sets border color */
  2357. borderColor: string;
  2358. /** Gets or sets background color */
  2359. background: string;
  2360. /** Gets or sets a boolean indicating if the thumb should be round or square */
  2361. isThumbCircle: boolean;
  2362. /**
  2363. * Creates a new Slider
  2364. * @param name defines the control name
  2365. */
  2366. constructor(name?: string | undefined);
  2367. protected _getTypeName(): string;
  2368. _draw(context: CanvasRenderingContext2D): void;
  2369. }
  2370. }
  2371. declare module BABYLON.GUI {
  2372. /**
  2373. * Class used to create slider controls based on images
  2374. */
  2375. export class ImageBasedSlider extends BaseSlider {
  2376. name?: string | undefined;
  2377. displayThumb: boolean;
  2378. /**
  2379. * Gets or sets the image used to render the background
  2380. */
  2381. backgroundImage: Image;
  2382. /**
  2383. * Gets or sets the image used to render the value bar
  2384. */
  2385. valueBarImage: Image;
  2386. /**
  2387. * Gets or sets the image used to render the thumb
  2388. */
  2389. thumbImage: Image;
  2390. /**
  2391. * Creates a new ImageBasedSlider
  2392. * @param name defines the control name
  2393. */
  2394. constructor(name?: string | undefined);
  2395. protected _getTypeName(): string;
  2396. _draw(context: CanvasRenderingContext2D): void;
  2397. }
  2398. }
  2399. declare module BABYLON.GUI {
  2400. /**
  2401. * Forcing an export so that this code will execute
  2402. * @hidden
  2403. */
  2404. const name = "Statics";
  2405. }
  2406. declare module BABYLON.GUI {
  2407. /**
  2408. * Class used as a root to all buttons
  2409. */
  2410. export class AbstractButton3D extends Control3D {
  2411. /**
  2412. * Creates a new button
  2413. * @param name defines the control name
  2414. */
  2415. constructor(name?: string);
  2416. protected _getTypeName(): string;
  2417. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  2418. }
  2419. }
  2420. declare module BABYLON.GUI {
  2421. /**
  2422. * Class used to create a button in 3D
  2423. */
  2424. export class Button3D extends AbstractButton3D {
  2425. /** @hidden */
  2426. protected _currentMaterial: BABYLON.Material;
  2427. /**
  2428. * Gets or sets the texture resolution used to render content (512 by default)
  2429. */
  2430. contentResolution: BABYLON.int;
  2431. /**
  2432. * Gets or sets the texture scale ratio used to render content (2 by default)
  2433. */
  2434. contentScaleRatio: number;
  2435. protected _disposeFacadeTexture(): void;
  2436. protected _resetContent(): void;
  2437. /**
  2438. * Creates a new button
  2439. * @param name defines the control name
  2440. */
  2441. constructor(name?: string);
  2442. /**
  2443. * Gets or sets the GUI 2D content used to display the button's facade
  2444. */
  2445. content: Control;
  2446. /**
  2447. * Apply the facade texture (created from the content property).
  2448. * This function can be overloaded by child classes
  2449. * @param facadeTexture defines the AdvancedDynamicTexture to use
  2450. */
  2451. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  2452. protected _getTypeName(): string;
  2453. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  2454. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  2455. /**
  2456. * Releases all associated resources
  2457. */
  2458. dispose(): void;
  2459. }
  2460. }
  2461. declare module BABYLON.GUI {
  2462. /**
  2463. * Class used to create containers for controls
  2464. */
  2465. export class Container3D extends Control3D {
  2466. /**
  2467. * Gets the list of child controls
  2468. */
  2469. protected _children: Control3D[];
  2470. /**
  2471. * Gets the list of child controls
  2472. */
  2473. readonly children: Array<Control3D>;
  2474. /**
  2475. * Gets or sets a boolean indicating if the layout must be blocked (default is false).
  2476. * This is helpful to optimize layout operation when adding multiple children in a row
  2477. */
  2478. blockLayout: boolean;
  2479. /**
  2480. * Creates a new container
  2481. * @param name defines the container name
  2482. */
  2483. constructor(name?: string);
  2484. /**
  2485. * Force the container to update the layout. Please note that it will not take blockLayout property in account
  2486. * @returns the current container
  2487. */
  2488. updateLayout(): Container3D;
  2489. /**
  2490. * Gets a boolean indicating if the given control is in the children of this control
  2491. * @param control defines the control to check
  2492. * @returns true if the control is in the child list
  2493. */
  2494. containsControl(control: Control3D): boolean;
  2495. /**
  2496. * Adds a control to the children of this control
  2497. * @param control defines the control to add
  2498. * @returns the current container
  2499. */
  2500. addControl(control: Control3D): Container3D;
  2501. /**
  2502. * This function will be called everytime a new control is added
  2503. */
  2504. protected _arrangeChildren(): void;
  2505. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  2506. /**
  2507. * Removes a control from the children of this control
  2508. * @param control defines the control to remove
  2509. * @returns the current container
  2510. */
  2511. removeControl(control: Control3D): Container3D;
  2512. protected _getTypeName(): string;
  2513. /**
  2514. * Releases all associated resources
  2515. */
  2516. dispose(): void;
  2517. /** Control rotation will remain unchanged */
  2518. static readonly UNSET_ORIENTATION: number;
  2519. /** Control will rotate to make it look at sphere central axis */
  2520. static readonly FACEORIGIN_ORIENTATION: number;
  2521. /** Control will rotate to make it look back at sphere central axis */
  2522. static readonly FACEORIGINREVERSED_ORIENTATION: number;
  2523. /** Control will rotate to look at z axis (0, 0, 1) */
  2524. static readonly FACEFORWARD_ORIENTATION: number;
  2525. /** Control will rotate to look at negative z axis (0, 0, -1) */
  2526. static readonly FACEFORWARDREVERSED_ORIENTATION: number;
  2527. }
  2528. }
  2529. declare module BABYLON.GUI {
  2530. /**
  2531. * Class used as base class for controls
  2532. */
  2533. export class Control3D implements BABYLON.IDisposable, BABYLON.IBehaviorAware<Control3D> {
  2534. /** Defines the control name */
  2535. name?: string | undefined;
  2536. /** @hidden */
  2537. _host: GUI3DManager;
  2538. /** Gets or sets the control position in world space */
  2539. position: BABYLON.Vector3;
  2540. /** Gets or sets the control scaling in world space */
  2541. scaling: BABYLON.Vector3;
  2542. /** Callback used to start pointer enter animation */
  2543. pointerEnterAnimation: () => void;
  2544. /** Callback used to start pointer out animation */
  2545. pointerOutAnimation: () => void;
  2546. /** Callback used to start pointer down animation */
  2547. pointerDownAnimation: () => void;
  2548. /** Callback used to start pointer up animation */
  2549. pointerUpAnimation: () => void;
  2550. /**
  2551. * An event triggered when the pointer move over the control
  2552. */
  2553. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector3>;
  2554. /**
  2555. * An event triggered when the pointer move out of the control
  2556. */
  2557. onPointerOutObservable: BABYLON.Observable<Control3D>;
  2558. /**
  2559. * An event triggered when the pointer taps the control
  2560. */
  2561. onPointerDownObservable: BABYLON.Observable<Vector3WithInfo>;
  2562. /**
  2563. * An event triggered when pointer is up
  2564. */
  2565. onPointerUpObservable: BABYLON.Observable<Vector3WithInfo>;
  2566. /**
  2567. * An event triggered when a control is clicked on (with a mouse)
  2568. */
  2569. onPointerClickObservable: BABYLON.Observable<Vector3WithInfo>;
  2570. /**
  2571. * An event triggered when pointer enters the control
  2572. */
  2573. onPointerEnterObservable: BABYLON.Observable<Control3D>;
  2574. /**
  2575. * Gets or sets the parent container
  2576. */
  2577. parent: BABYLON.Nullable<Container3D>;
  2578. /**
  2579. * Gets the list of attached behaviors
  2580. * @see http://doc.babylonjs.com/features/behaviour
  2581. */
  2582. readonly behaviors: BABYLON.Behavior<Control3D>[];
  2583. /**
  2584. * Attach a behavior to the control
  2585. * @see http://doc.babylonjs.com/features/behaviour
  2586. * @param behavior defines the behavior to attach
  2587. * @returns the current control
  2588. */
  2589. addBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  2590. /**
  2591. * Remove an attached behavior
  2592. * @see http://doc.babylonjs.com/features/behaviour
  2593. * @param behavior defines the behavior to attach
  2594. * @returns the current control
  2595. */
  2596. removeBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  2597. /**
  2598. * Gets an attached behavior by name
  2599. * @param name defines the name of the behavior to look for
  2600. * @see http://doc.babylonjs.com/features/behaviour
  2601. * @returns null if behavior was not found else the requested behavior
  2602. */
  2603. getBehaviorByName(name: string): BABYLON.Nullable<BABYLON.Behavior<Control3D>>;
  2604. /** Gets or sets a boolean indicating if the control is visible */
  2605. isVisible: boolean;
  2606. /**
  2607. * Creates a new control
  2608. * @param name defines the control name
  2609. */
  2610. constructor(
  2611. /** Defines the control name */
  2612. name?: string | undefined);
  2613. /**
  2614. * Gets a string representing the class name
  2615. */
  2616. readonly typeName: string;
  2617. /**
  2618. * Get the current class name of the control.
  2619. * @returns current class name
  2620. */
  2621. getClassName(): string;
  2622. protected _getTypeName(): string;
  2623. /**
  2624. * Gets the transform node used by this control
  2625. */
  2626. readonly node: BABYLON.Nullable<BABYLON.TransformNode>;
  2627. /**
  2628. * Gets the mesh used to render this control
  2629. */
  2630. readonly mesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  2631. /**
  2632. * Link the control as child of the given node
  2633. * @param node defines the node to link to. Use null to unlink the control
  2634. * @returns the current control
  2635. */
  2636. linkToTransformNode(node: BABYLON.Nullable<BABYLON.TransformNode>): Control3D;
  2637. /** @hidden **/
  2638. _prepareNode(scene: BABYLON.Scene): void;
  2639. /**
  2640. * Node creation.
  2641. * Can be overriden by children
  2642. * @param scene defines the scene where the node must be attached
  2643. * @returns the attached node or null if none. Must return a BABYLON.Mesh or BABYLON.AbstractMesh if there is an atttached visible object
  2644. */
  2645. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  2646. /**
  2647. * Affect a material to the given mesh
  2648. * @param mesh defines the mesh which will represent the control
  2649. */
  2650. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  2651. /** @hidden */
  2652. _onPointerMove(target: Control3D, coordinates: BABYLON.Vector3): void;
  2653. /** @hidden */
  2654. _onPointerEnter(target: Control3D): boolean;
  2655. /** @hidden */
  2656. _onPointerOut(target: Control3D): void;
  2657. /** @hidden */
  2658. _onPointerDown(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  2659. /** @hidden */
  2660. _onPointerUp(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  2661. /** @hidden */
  2662. forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  2663. /** @hidden */
  2664. _processObservables(type: number, pickedPoint: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  2665. /** @hidden */
  2666. _disposeNode(): void;
  2667. /**
  2668. * Releases all associated resources
  2669. */
  2670. dispose(): void;
  2671. }
  2672. }
  2673. declare module BABYLON.GUI {
  2674. /**
  2675. * Class used to create a container panel deployed on the surface of a cylinder
  2676. */
  2677. export class CylinderPanel extends VolumeBasedPanel {
  2678. /**
  2679. * Gets or sets the radius of the cylinder where to project controls (5 by default)
  2680. */
  2681. radius: BABYLON.float;
  2682. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  2683. }
  2684. }
  2685. declare module BABYLON.GUI {
  2686. /**
  2687. * Class used to create a holographic button in 3D
  2688. */
  2689. export class HolographicButton extends Button3D {
  2690. /**
  2691. * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
  2692. */
  2693. tooltipText: BABYLON.Nullable<string>;
  2694. /**
  2695. * Gets or sets text for the button
  2696. */
  2697. text: string;
  2698. /**
  2699. * Gets or sets the image url for the button
  2700. */
  2701. imageUrl: string;
  2702. /**
  2703. * Gets the back material used by this button
  2704. */
  2705. readonly backMaterial: FluentMaterial;
  2706. /**
  2707. * Gets the front material used by this button
  2708. */
  2709. readonly frontMaterial: FluentMaterial;
  2710. /**
  2711. * Gets the plate material used by this button
  2712. */
  2713. readonly plateMaterial: BABYLON.StandardMaterial;
  2714. /**
  2715. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  2716. */
  2717. readonly shareMaterials: boolean;
  2718. /**
  2719. * Creates a new button
  2720. * @param name defines the control name
  2721. */
  2722. constructor(name?: string, shareMaterials?: boolean);
  2723. protected _getTypeName(): string;
  2724. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  2725. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  2726. protected _affectMaterial(mesh: BABYLON.Mesh): void;
  2727. /**
  2728. * Releases all associated resources
  2729. */
  2730. dispose(): void;
  2731. }
  2732. }
  2733. declare module BABYLON.GUI {
  2734. /**
  2735. * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene
  2736. */
  2737. export class MeshButton3D extends Button3D {
  2738. /** @hidden */
  2739. protected _currentMesh: BABYLON.Mesh;
  2740. /**
  2741. * Creates a new 3D button based on a mesh
  2742. * @param mesh mesh to become a 3D button
  2743. * @param name defines the control name
  2744. */
  2745. constructor(mesh: BABYLON.Mesh, name?: string);
  2746. protected _getTypeName(): string;
  2747. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  2748. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  2749. }
  2750. }
  2751. declare module BABYLON.GUI {
  2752. /**
  2753. * Class used to create a container panel deployed on the surface of a plane
  2754. */
  2755. export class PlanePanel extends VolumeBasedPanel {
  2756. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  2757. }
  2758. }
  2759. declare module BABYLON.GUI {
  2760. /**
  2761. * Class used to create a container panel where items get randomized planar mapping
  2762. */
  2763. export class ScatterPanel extends VolumeBasedPanel {
  2764. /**
  2765. * Gets or sets the number of iteration to use to scatter the controls (100 by default)
  2766. */
  2767. iteration: BABYLON.float;
  2768. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  2769. protected _finalProcessing(): void;
  2770. }
  2771. }
  2772. declare module BABYLON.GUI {
  2773. /**
  2774. * Class used to create a container panel deployed on the surface of a sphere
  2775. */
  2776. export class SpherePanel extends VolumeBasedPanel {
  2777. /**
  2778. * Gets or sets the radius of the sphere where to project controls (5 by default)
  2779. */
  2780. radius: BABYLON.float;
  2781. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  2782. }
  2783. }
  2784. declare module BABYLON.GUI {
  2785. /**
  2786. * Class used to create a stack panel in 3D on XY plane
  2787. */
  2788. export class StackPanel3D extends Container3D {
  2789. /**
  2790. * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)
  2791. */
  2792. isVertical: boolean;
  2793. /**
  2794. * Gets or sets the distance between elements
  2795. */
  2796. margin: number;
  2797. /**
  2798. * Creates new StackPanel
  2799. * @param isVertical
  2800. */
  2801. constructor(isVertical?: boolean);
  2802. protected _arrangeChildren(): void;
  2803. }
  2804. }
  2805. declare module BABYLON.GUI {
  2806. /**
  2807. * Abstract class used to create a container panel deployed on the surface of a volume
  2808. */
  2809. export abstract class VolumeBasedPanel extends Container3D {
  2810. protected _cellWidth: number;
  2811. protected _cellHeight: number;
  2812. /**
  2813. * Gets or sets the distance between elements
  2814. */
  2815. margin: number;
  2816. /**
  2817. * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)
  2818. * | Value | Type | Description |
  2819. * | ----- | ----------------------------------- | ----------- |
  2820. * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |
  2821. * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |
  2822. * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |
  2823. * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |
  2824. * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |
  2825. */
  2826. orientation: number;
  2827. /**
  2828. * Gets or sets the number of columns requested (10 by default).
  2829. * The panel will automatically compute the number of rows based on number of child controls.
  2830. */
  2831. columns: BABYLON.int;
  2832. /**
  2833. * Gets or sets a the number of rows requested.
  2834. * The panel will automatically compute the number of columns based on number of child controls.
  2835. */
  2836. rows: BABYLON.int;
  2837. /**
  2838. * Creates new VolumeBasedPanel
  2839. */
  2840. constructor();
  2841. protected _arrangeChildren(): void;
  2842. /** Child classes must implement this function to provide correct control positioning */
  2843. protected abstract _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  2844. /** Child classes can implement this function to provide additional processing */
  2845. protected _finalProcessing(): void;
  2846. }
  2847. }
  2848. declare module BABYLON.GUI {
  2849. /** @hidden */
  2850. export class FluentMaterialDefines extends BABYLON.MaterialDefines {
  2851. INNERGLOW: boolean;
  2852. BORDER: boolean;
  2853. HOVERLIGHT: boolean;
  2854. TEXTURE: boolean;
  2855. constructor();
  2856. }
  2857. /**
  2858. * Class used to render controls with fluent desgin
  2859. */
  2860. export class FluentMaterial extends BABYLON.PushMaterial {
  2861. /**
  2862. * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)
  2863. */
  2864. innerGlowColorIntensity: number;
  2865. /**
  2866. * Gets or sets the inner glow color (white by default)
  2867. */
  2868. innerGlowColor: BABYLON.Color3;
  2869. /**
  2870. * Gets or sets alpha value (default is 1.0)
  2871. */
  2872. alpha: number;
  2873. /**
  2874. * Gets or sets the albedo color (Default is BABYLON.Color3(0.3, 0.35, 0.4))
  2875. */
  2876. albedoColor: BABYLON.Color3;
  2877. /**
  2878. * Gets or sets a boolean indicating if borders must be rendered (default is false)
  2879. */
  2880. renderBorders: boolean;
  2881. /**
  2882. * Gets or sets border width (default is 0.5)
  2883. */
  2884. borderWidth: number;
  2885. /**
  2886. * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)
  2887. */
  2888. edgeSmoothingValue: number;
  2889. /**
  2890. * Gets or sets the minimum value that can be applied to border width (default is 0.1)
  2891. */
  2892. borderMinValue: number;
  2893. /**
  2894. * Gets or sets a boolean indicating if hover light must be rendered (default is false)
  2895. */
  2896. renderHoverLight: boolean;
  2897. /**
  2898. * Gets or sets the radius used to render the hover light (default is 1.0)
  2899. */
  2900. hoverRadius: number;
  2901. /**
  2902. * Gets or sets the color used to render the hover light (default is BABYLON.Color4(0.3, 0.3, 0.3, 1.0))
  2903. */
  2904. hoverColor: BABYLON.Color4;
  2905. /**
  2906. * Gets or sets the hover light position in world space (default is BABYLON.Vector3.Zero())
  2907. */
  2908. hoverPosition: BABYLON.Vector3;
  2909. /** Gets or sets the texture to use for albedo color */
  2910. albedoTexture: BABYLON.Nullable<BABYLON.BaseTexture>;
  2911. /**
  2912. * Creates a new Fluent material
  2913. * @param name defines the name of the material
  2914. * @param scene defines the hosting scene
  2915. */
  2916. constructor(name: string, scene: BABYLON.Scene);
  2917. needAlphaBlending(): boolean;
  2918. needAlphaTesting(): boolean;
  2919. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  2920. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  2921. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  2922. getActiveTextures(): BABYLON.BaseTexture[];
  2923. hasTexture(texture: BABYLON.BaseTexture): boolean;
  2924. dispose(forceDisposeEffect?: boolean): void;
  2925. clone(name: string): FluentMaterial;
  2926. serialize(): any;
  2927. getClassName(): string;
  2928. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): FluentMaterial;
  2929. }
  2930. }