Source: lib/text/cue_region.js

  1. /*! @license
  2. * Shaka Player
  3. * Copyright 2016 Google LLC
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. goog.provide('shaka.text.CueRegion');
  7. /**
  8. * @export
  9. */
  10. shaka.text.CueRegion = class {
  11. /** */
  12. constructor() {
  13. const CueRegion = shaka.text.CueRegion;
  14. /**
  15. * Region identifier.
  16. * @type {string}
  17. * @export
  18. */
  19. this.id = '';
  20. /**
  21. * The X offset to start the rendering area in viewportAnchorUnits of the
  22. * video width.
  23. * @type {number}
  24. * @export
  25. */
  26. this.viewportAnchorX = 0;
  27. /**
  28. * The X offset to start the rendering area in viewportAnchorUnits of the
  29. * video height.
  30. * @type {number}
  31. * @export
  32. */
  33. this.viewportAnchorY = 0;
  34. /**
  35. * The X offset to start the rendering area in percentage (0-100) of this
  36. * region width.
  37. * @type {number}
  38. * @export
  39. */
  40. this.regionAnchorX = 0;
  41. /**
  42. * The Y offset to start the rendering area in percentage (0-100) of the
  43. * region height.
  44. * @type {number}
  45. * @export
  46. */
  47. this.regionAnchorY = 0;
  48. /**
  49. * The width of the rendering area in widthUnits.
  50. * @type {number}
  51. * @export
  52. */
  53. this.width = 100;
  54. /**
  55. * The width of the rendering area in heightUnits.
  56. * @type {number}
  57. * @export
  58. */
  59. this.height = 100;
  60. /**
  61. * The units (percentage, pixels or lines) the region height is in.
  62. * @type {shaka.text.CueRegion.units}
  63. * @export
  64. */
  65. this.heightUnits = CueRegion.units.PERCENTAGE;
  66. /**
  67. * The units (percentage or pixels) the region width is in.
  68. * @type {shaka.text.CueRegion.units}
  69. * @export
  70. */
  71. this.widthUnits = CueRegion.units.PERCENTAGE;
  72. /**
  73. * The units (percentage or pixels) the region viewportAnchors are in.
  74. * @type {shaka.text.CueRegion.units}
  75. * @export
  76. */
  77. this.viewportAnchorUnits = CueRegion.units.PERCENTAGE;
  78. /**
  79. * If scroll=UP, it means that cues in the region will be added to the
  80. * bottom of the region and will push any already displayed cues in the
  81. * region up. Otherwise (scroll=NONE) cues will stay fixed at the location
  82. * they were first painted in.
  83. * @type {shaka.text.CueRegion.scrollMode}
  84. * @export
  85. */
  86. this.scroll = CueRegion.scrollMode.NONE;
  87. }
  88. };
  89. /**
  90. * @enum {number}
  91. * @export
  92. */
  93. shaka.text.CueRegion.units = {
  94. 'PX': 0,
  95. 'PERCENTAGE': 1,
  96. 'LINES': 2,
  97. };
  98. /**
  99. * @enum {string}
  100. * @export
  101. */
  102. shaka.text.CueRegion.scrollMode = {
  103. 'NONE': '',
  104. 'UP': 'up',
  105. };