GraphicalMusicPage.js 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. "use strict";
  2. var __extends = (this && this.__extends) || function (d, b) {
  3. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  4. function __() { this.constructor = d; }
  5. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6. };
  7. var BoundingBox_1 = require("./BoundingBox");
  8. var GraphicalObject_1 = require("./GraphicalObject");
  9. var PointF2D_1 = require("../../Common/DataObjects/PointF2D");
  10. var GraphicalMusicPage = (function (_super) {
  11. __extends(GraphicalMusicPage, _super);
  12. function GraphicalMusicPage(parent) {
  13. _super.call(this);
  14. this.musicSystems = [];
  15. this.labels = [];
  16. this.parent = parent;
  17. this.boundingBox = new BoundingBox_1.BoundingBox(this, undefined);
  18. }
  19. Object.defineProperty(GraphicalMusicPage.prototype, "MusicSystems", {
  20. get: function () {
  21. return this.musicSystems;
  22. },
  23. set: function (value) {
  24. this.musicSystems = value;
  25. },
  26. enumerable: true,
  27. configurable: true
  28. });
  29. Object.defineProperty(GraphicalMusicPage.prototype, "Labels", {
  30. get: function () {
  31. return this.labels;
  32. },
  33. set: function (value) {
  34. this.labels = value;
  35. },
  36. enumerable: true,
  37. configurable: true
  38. });
  39. Object.defineProperty(GraphicalMusicPage.prototype, "Parent", {
  40. get: function () {
  41. return this.parent;
  42. },
  43. set: function (value) {
  44. this.parent = value;
  45. },
  46. enumerable: true,
  47. configurable: true
  48. });
  49. GraphicalMusicPage.prototype.setMusicPageAbsolutePosition = function (pageIndex, rules) {
  50. if (rules.PagePlacement === PagePlacementEnum.Down) {
  51. return new PointF2D_1.PointF2D(0.0, pageIndex * rules.PageHeight);
  52. }
  53. else if (rules.PagePlacement === PagePlacementEnum.Right) {
  54. return new PointF2D_1.PointF2D(pageIndex * this.parent.ParentMusicSheet.pageWidth, 0.0);
  55. }
  56. else {
  57. if (pageIndex % 2 === 0) {
  58. if (pageIndex === 0) {
  59. return new PointF2D_1.PointF2D(0.0, pageIndex * rules.PageHeight);
  60. }
  61. else {
  62. return new PointF2D_1.PointF2D(0.0, (pageIndex - 1) * rules.PageHeight);
  63. }
  64. }
  65. else {
  66. if (pageIndex === 1) {
  67. return new PointF2D_1.PointF2D(this.parent.ParentMusicSheet.pageWidth, (pageIndex - 1) * rules.PageHeight);
  68. }
  69. else {
  70. return new PointF2D_1.PointF2D(this.parent.ParentMusicSheet.pageWidth, (pageIndex - 2) * rules.PageHeight);
  71. }
  72. }
  73. }
  74. };
  75. return GraphicalMusicPage;
  76. }(GraphicalObject_1.GraphicalObject));
  77. exports.GraphicalMusicPage = GraphicalMusicPage;
  78. (function (PagePlacementEnum) {
  79. PagePlacementEnum[PagePlacementEnum["Down"] = 0] = "Down";
  80. PagePlacementEnum[PagePlacementEnum["Right"] = 1] = "Right";
  81. PagePlacementEnum[PagePlacementEnum["RightDown"] = 2] = "RightDown";
  82. })(exports.PagePlacementEnum || (exports.PagePlacementEnum = {}));
  83. var PagePlacementEnum = exports.PagePlacementEnum;