SelectionEndSymbol.js 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 GraphicalObject_1 = require("./GraphicalObject");
  8. var DrawingEnums_1 = require("./DrawingEnums");
  9. var PointF2D_1 = require("../../Common/DataObjects/PointF2D");
  10. var BoundingBox_1 = require("./BoundingBox");
  11. var GraphicalLine_1 = require("./GraphicalLine");
  12. var collectionUtil_1 = require("../../Util/collectionUtil");
  13. var SelectionEndSymbol = (function (_super) {
  14. __extends(SelectionEndSymbol, _super);
  15. function SelectionEndSymbol(system, xPosition) {
  16. _super.call(this);
  17. var xCoordinate = xPosition;
  18. var yCoordinate = system.PositionAndShape.AbsolutePosition.y;
  19. var lineThickness = 0.4;
  20. var height = collectionUtil_1.CollectionUtil.last(system.StaffLines).PositionAndShape.RelativePosition.y + 4;
  21. this.verticalLine = new GraphicalLine_1.GraphicalLine(new PointF2D_1.PointF2D(xCoordinate, yCoordinate), new PointF2D_1.PointF2D(xCoordinate, yCoordinate + height), lineThickness, DrawingEnums_1.OutlineAndFillStyleEnum.SelectionSymbol);
  22. for (var idx = 0, len = system.StaffLines.length; idx < len; ++idx) {
  23. var staffLine = system.StaffLines[idx];
  24. var anchor = new PointF2D_1.PointF2D(xCoordinate, yCoordinate + staffLine.PositionAndShape.RelativePosition.y);
  25. var arrowPoints = new Array(3);
  26. anchor.y -= .2;
  27. arrowPoints[0].x = anchor.x - 3;
  28. arrowPoints[0].y = anchor.y + 1.2;
  29. arrowPoints[1].x = anchor.x - 2;
  30. arrowPoints[1].y = anchor.y + 0.4;
  31. arrowPoints[2].x = anchor.x - 2;
  32. arrowPoints[2].y = anchor.y + 2;
  33. this.arrows.push(arrowPoints);
  34. var linePoints = new Array(8);
  35. var arrowThickness = .8;
  36. anchor.x -= .1;
  37. anchor.y += .3;
  38. var hilfsVar = .2;
  39. linePoints[0].x = anchor.x - 2;
  40. linePoints[0].y = anchor.y + 1.5 - hilfsVar;
  41. linePoints[1].x = anchor.x - 1;
  42. linePoints[1].y = anchor.y + 1.5 - hilfsVar;
  43. linePoints[2].x = anchor.x - 1;
  44. linePoints[2].y = anchor.y + 2.5;
  45. linePoints[3].x = anchor.x - 2;
  46. linePoints[3].y = anchor.y + 2.5;
  47. linePoints[4].x = linePoints[0].x;
  48. linePoints[4].y = linePoints[0].y - arrowThickness;
  49. linePoints[5].x = linePoints[4].x + arrowThickness + 1;
  50. linePoints[5].y = linePoints[4].y;
  51. linePoints[6].x = linePoints[5].x;
  52. linePoints[6].y = linePoints[3].y + arrowThickness;
  53. linePoints[7].x = linePoints[3].x;
  54. linePoints[7].y = linePoints[6].y;
  55. this.arrowlines.push(linePoints);
  56. }
  57. this.boundingBox = new BoundingBox_1.BoundingBox(this);
  58. this.boundingBox.AbsolutePosition = new PointF2D_1.PointF2D(xCoordinate, yCoordinate);
  59. this.boundingBox.BorderLeft = -lineThickness;
  60. this.boundingBox.BorderRight = 4;
  61. this.boundingBox.BorderBottom = height;
  62. }
  63. return SelectionEndSymbol;
  64. }(GraphicalObject_1.GraphicalObject));
  65. exports.SelectionEndSymbol = SelectionEndSymbol;