@ms-atlas-module/datastudio-datafactory 0.1.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of @ms-atlas-module/datastudio-datafactory might be problematic. Click here for more details.

Files changed (111) hide show
  1. package/_generated/ClientResources.js +1549 -0
  2. package/_generated/Framework.js +97 -0
  3. package/_generated/Svg.js +201 -0
  4. package/bootstrapper/BreadcrumbsKnockoutBinding.js +25 -0
  5. package/bootstrapper/CSS/Callout.css +43 -0
  6. package/bootstrapper/CSS/Common.css +22 -0
  7. package/bootstrapper/CSS/FormFields.css +133 -0
  8. package/bootstrapper/CSS/InlineBlock.css +34 -0
  9. package/bootstrapper/CSS/ParameterGroups.css +77 -0
  10. package/bootstrapper/CSS/Pivot.css +25 -0
  11. package/bootstrapper/CSS/Wizard.css +197 -0
  12. package/bootstrapper/CalloutBinding.js +52 -0
  13. package/bootstrapper/CollapsibleKnockoutBinding.js +70 -0
  14. package/bootstrapper/CopyBinding.js +150 -0
  15. package/bootstrapper/FilterFlyoutKnockoutBinding.js +114 -0
  16. package/bootstrapper/FormFields.js +397 -0
  17. package/bootstrapper/InlineBlockBinding.js +69 -0
  18. package/bootstrapper/JQueryUIBindings.js +152 -0
  19. package/bootstrapper/KnockoutBindings.js +635 -0
  20. package/bootstrapper/LoadingBinding.js +54 -0
  21. package/bootstrapper/MonacoEditorKnockoutBinding.js +67 -0
  22. package/bootstrapper/ParameterGroupsBinding.js +289 -0
  23. package/bootstrapper/PivotKnockoutBinding.js +61 -0
  24. package/bootstrapper/StatusCalendarFlyoutKnockoutBinding.js +398 -0
  25. package/bootstrapper/StatusCalendarKnockoutBinding.js +107 -0
  26. package/bootstrapper/TelemetryKnockoutBinding.js +68 -0
  27. package/bootstrapper/WinJSButtonKnockoutBinding.js +72 -0
  28. package/bootstrapper/WinJSKnockoutBindings.js +49 -0
  29. package/bootstrapper/WizardBinding.js +611 -0
  30. package/bootstrapper/startup.js +29 -0
  31. package/libs/VivaGraphControl/Content/CSS/Graph.css +157 -0
  32. package/libs/VivaGraphControl/Content/CSS/LightTheme.css +699 -0
  33. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Base/Base.TriggerableLifetimeManager.js +190 -0
  34. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Base/Base.js +647 -0
  35. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Base/Image.js +113 -0
  36. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Base/KnockoutExtensions.js +1064 -0
  37. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/DockedBalloon.js +18 -0
  38. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/Animation.js +192 -0
  39. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/Commands/MoveNodes.js +83 -0
  40. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/Geometry.js +167 -0
  41. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/GraphEntityViewModel.js +260 -0
  42. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/GraphViewModel.js +338 -0
  43. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/GraphWidget.Constants.js +178 -0
  44. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/GraphWidget.js +5190 -0
  45. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/MouseCapture.js +148 -0
  46. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/SvgUtils.js +164 -0
  47. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Util/Detection.js +658 -0
  48. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Util/Resize.js +241 -0
  49. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Util/Util.Private.js +236 -0
  50. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Util/Util.js +905 -0
  51. package/libs/WinJS/WinJs.min.js +61909 -0
  52. package/libs/WinJS/ui-light.css +8500 -0
  53. package/package.json +15 -0
  54. package/scripts/AppContext.js +262 -0
  55. package/scripts/ExposureControl.js +11 -0
  56. package/scripts/Framework/Model/ActivityWindowCache.js +390 -0
  57. package/scripts/Framework/Model/ArmDataFactoryCache.js +77 -0
  58. package/scripts/Framework/Model/Contracts/Activity.js +83 -0
  59. package/scripts/Framework/Model/Contracts/ActivityWindow.js +185 -0
  60. package/scripts/Framework/Model/Contracts/BaseEncodable.js +106 -0
  61. package/scripts/Framework/Model/Contracts/Common.js +19 -0
  62. package/scripts/Framework/Model/Contracts/DataArtifact.js +100 -0
  63. package/scripts/Framework/Model/Contracts/Diagram.js +9 -0
  64. package/scripts/Framework/Model/Contracts/Encodable.js +113 -0
  65. package/scripts/Framework/Model/Contracts/Gateway.js +98 -0
  66. package/scripts/Framework/Model/Contracts/LinkedService.js +200 -0
  67. package/scripts/Framework/Model/Contracts/Pipeline.js +197 -0
  68. package/scripts/Framework/Model/DataCache.js +105 -0
  69. package/scripts/Framework/Model/DataFactoryCache.js +24 -0
  70. package/scripts/Framework/Model/Filter.js +186 -0
  71. package/scripts/Framework/Model/Helpers/ActivityWindowHelper.js +185 -0
  72. package/scripts/Framework/Model/MonitoringView.js +40 -0
  73. package/scripts/Framework/Shared/Constants.js +27 -0
  74. package/scripts/Framework/Shared/DataConstants.js +61 -0
  75. package/scripts/Framework/Shared/Disposable.js +53 -0
  76. package/scripts/Framework/Shared/IconResources.js +59 -0
  77. package/scripts/Framework/Shared/Resources/IbizaSvgs.js +241 -0
  78. package/scripts/Framework/Shared/TypeDeclarations.js +4 -0
  79. package/scripts/Framework/Telemetry/Telemetry.js +78 -0
  80. package/scripts/Framework/UI/Breadcrumbs.js +84 -0
  81. package/scripts/Framework/UI/Command.js +231 -0
  82. package/scripts/Framework/UI/ContextMenu.js +80 -0
  83. package/scripts/Framework/UI/Loader.js +11 -0
  84. package/scripts/Framework/UI/Menu.js +65 -0
  85. package/scripts/Framework/UI/PanelMessage.js +25 -0
  86. package/scripts/Framework/UI/Refresh.js +70 -0
  87. package/scripts/Framework/UI/Spinner.js +61 -0
  88. package/scripts/Framework/UI/StatusCalendar.js +1070 -0
  89. package/scripts/Framework/UI/Toolbar.js +84 -0
  90. package/scripts/Framework/Util/Datetime.js +258 -0
  91. package/scripts/Framework/Util/Log.js +10 -0
  92. package/scripts/Framework/Util/ResourceIdUtil.js +56 -0
  93. package/scripts/Framework/Util/Security.js +73 -0
  94. package/scripts/Framework/Util/Util.js +332 -0
  95. package/scripts/Framework/Views/HoverFlyout.js +92 -0
  96. package/scripts/Handlers/ErrorHandler.js +176 -0
  97. package/scripts/Handlers/MessageHandler.js +115 -0
  98. package/scripts/Handlers/MonitoringViewHandler.js +199 -0
  99. package/scripts/Handlers/RoutingHandler.js +364 -0
  100. package/scripts/Handlers/WinJSHandlers.js +265 -0
  101. package/scripts/MonitoringViewContext.js +75 -0
  102. package/scripts/Services/AzureInsightsService.js +162 -0
  103. package/scripts/Services/AzureResourceManagerService.js +869 -0
  104. package/scripts/Services/BaseService.js +232 -0
  105. package/scripts/Services/DataFactoryService.js +204 -0
  106. package/scripts/Services/HDInsightArmService.js +59 -0
  107. package/scripts/ViewContext.js +9 -0
  108. package/stylesheets/main.css +1042 -0
  109. package/views/Edit/DateTimeFilterViewModel.js +211 -0
  110. package/views/Edit/FilterViewModel.js +131 -0
  111. package/views/Shared/ProvisioningState.js +11 -0
@@ -0,0 +1,18 @@
1
+ define(["require", "exports"], function (require, exports) {
2
+ "use strict";
3
+ var Main;
4
+ (function (Main) {
5
+ Main.classes = {
6
+ widget: "azc-dockedballoon",
7
+ };
8
+ function DismissAllBalloons() {}
9
+ Main.DismissAllBalloons = DismissAllBalloons;
10
+ var DockedBalloon = (function () {
11
+ function DockedBalloon() {}
12
+ return DockedBalloon;
13
+ })();
14
+ Main.DockedBalloon = DockedBalloon;
15
+ })(Main || (Main = {}));
16
+ return Main;
17
+ });
18
+ //# sourceMappingURL=DockedBalloon.js.map
@@ -0,0 +1,192 @@
1
+ define(["require", "exports", "./GraphWidget.Constants"], function (
2
+ require,
3
+ exports,
4
+ ConstantsGraphWidget
5
+ ) {
6
+ var Main;
7
+ (function (Main) {
8
+ "use strict";
9
+ var global = window;
10
+ /**
11
+ * The function used to get the current time. Tests can inject their own method and control time in
12
+ * a more rigorous manner.
13
+ */
14
+ Main.getCurrentTime = Date.now;
15
+ /**
16
+ * The function used to call a function after a certain amount of time. Tests can inject their own method and control time in
17
+ * a more rigorous manner.
18
+ */
19
+ Main.setTimeoutFromCurrentTime = setTimeout.bind(window);
20
+ /**
21
+ * A class that manages frame tweening for animating numeric properties.
22
+ */
23
+ var Animation = (function () {
24
+ /**
25
+ * Creates an animation that tweens some collection of values between start and end values.
26
+ *
27
+ * @param stepFunction callback for every frame of the animation
28
+ * @param animatedProperties a dictionary where the key is the name of the animated property and its value contains the start and end values.
29
+ * @param duration the length of the animation in milliseconds
30
+ * @param easingFunction a Callback that maps time to percentage complete for the animation.
31
+ */
32
+ function Animation(
33
+ stepFunction,
34
+ animatedProperties,
35
+ duration,
36
+ easingFunction
37
+ ) {
38
+ if (duration === void 0) {
39
+ duration = 800;
40
+ }
41
+ if (easingFunction === void 0) {
42
+ easingFunction = Animation._defaultEasing;
43
+ }
44
+ this._easingFunction = easingFunction;
45
+ this._duration = duration;
46
+ this._startTime = Main.getCurrentTime();
47
+ this._endTime = this._startTime + duration;
48
+ this._stepFunction = stepFunction;
49
+ this._animatedProperties = animatedProperties;
50
+ this.animationEnded = ko.observable(null);
51
+ this._animationStopped = false;
52
+ this._ignoreFrames = false;
53
+ for (var key in this._animatedProperties) {
54
+ if (isNaN(Number(animatedProperties[key].start))) {
55
+ throw (
56
+ "The property " + key + " lacks a numerical animation start value"
57
+ );
58
+ }
59
+ if (
60
+ isNaN(
61
+ Number(ko.utils.unwrapObservable(animatedProperties[key].end))
62
+ )
63
+ ) {
64
+ throw (
65
+ "The property " + key + " lacks a numerical animation end value"
66
+ );
67
+ }
68
+ }
69
+ }
70
+ Object.defineProperty(Animation, "requestAnimationFramePolyfill", {
71
+ /**
72
+ * A polyfill for requestAnimationFrame
73
+ */
74
+ get: function () {
75
+ var polyfill =
76
+ global.requestAnimationFrame ||
77
+ global.mozRequestAnimationFrame ||
78
+ global.webkitRequestAnimationFrame ||
79
+ global.msRequestAnimationFrame;
80
+ if (!polyfill) {
81
+ polyfill = function (callback) {
82
+ return setTimeout(callback, ConstantsGraphWidget.SixtyFPS);
83
+ };
84
+ }
85
+ // requestAnimationFrame will throw an illegal invocation error if 'this' isn't window.
86
+ return polyfill.bind(window);
87
+ },
88
+ enumerable: true,
89
+ configurable: true,
90
+ });
91
+ Object.defineProperty(Animation, "cancelAnimationFramePolyfill", {
92
+ get: function () {
93
+ // TSLint complains if we name this polyfill
94
+ var polyfill2 =
95
+ global.cancelAnimationFrame ||
96
+ global.msCancelRequestAnimationFrame ||
97
+ global.webkitCancelAnimationFrame ||
98
+ global.mozCancelAnimationFrame;
99
+ if (!polyfill2) {
100
+ polyfill2 = clearTimeout;
101
+ }
102
+ return polyfill2.bind(window);
103
+ },
104
+ enumerable: true,
105
+ configurable: true,
106
+ });
107
+ // We use this to avoid versioning issues with jquery's swing function
108
+ Animation._defaultEasing = function (percentTime) {
109
+ return (Math.sin((percentTime - 0.5) * Math.PI) + 1) / 2;
110
+ };
111
+ /**
112
+ * Starts the animation.
113
+ */
114
+ Animation.prototype.start = function () {
115
+ var _this = this;
116
+ if (this._animationStopped) {
117
+ throw new Error("Cannot start a previously stopped animation.");
118
+ }
119
+ Animation.requestAnimationFramePolyfill(function () {
120
+ _this._step();
121
+ });
122
+ };
123
+ /**
124
+ * Stops the animation
125
+ */
126
+ Animation.prototype.stop = function () {
127
+ if (this._animationStopped) {
128
+ throw new Error("Cannot stop an animation twice.");
129
+ }
130
+ this._animationStopped = true;
131
+ // Immediately fire the last frame so subscribers get notified immediately.
132
+ this._step();
133
+ };
134
+ Object.defineProperty(Animation.prototype, "animationStopped", {
135
+ /**
136
+ * Whether the animation is stopped (explicitly or the animation ended).
137
+ */
138
+ get: function () {
139
+ return this._animationStopped;
140
+ },
141
+ enumerable: true,
142
+ configurable: true,
143
+ });
144
+ Animation.prototype._step = function () {
145
+ var _this = this;
146
+ var percentTimeComplete =
147
+ (Main.getCurrentTime() - this._startTime) /
148
+ (this._endTime - this._startTime),
149
+ percentAnimationComplete =
150
+ percentTimeComplete < 1.0
151
+ ? this._easingFunction(percentTimeComplete)
152
+ : 1.0,
153
+ currentAnimationState = Object.create(null),
154
+ start,
155
+ end,
156
+ key;
157
+ // This prevents a race condition where we may have called requestAnimationFrame before calling stop
158
+ // meaning step will get called again. This ensures that the last frame that does anything is
159
+ // the one immediately proceeding .stop()
160
+ if (this._ignoreFrames) {
161
+ return;
162
+ }
163
+ for (key in this._animatedProperties) {
164
+ start = Number(this._animatedProperties[key].start);
165
+ end = Number(
166
+ ko.utils.unwrapObservable(this._animatedProperties[key].end)
167
+ );
168
+ currentAnimationState[key] =
169
+ start + (end - start) * percentAnimationComplete;
170
+ }
171
+ // If we stopped the animation (for completion or otherwise), make sure we don't call step again
172
+ // and notify subscribers that the animation ended
173
+ if (this._animationStopped) {
174
+ this.animationEnded.notifySubscribers(currentAnimationState);
175
+ this._ignoreFrames = true;
176
+ return;
177
+ }
178
+ this._stepFunction(currentAnimationState);
179
+ if (percentTimeComplete < 1.0) {
180
+ Animation.requestAnimationFramePolyfill(function () {
181
+ _this._step();
182
+ });
183
+ } else {
184
+ this.stop();
185
+ }
186
+ };
187
+ return Animation;
188
+ })();
189
+ Main.Animation = Animation;
190
+ })(Main || (Main = {}));
191
+ return Main;
192
+ });
@@ -0,0 +1,83 @@
1
+ define(["require", "exports", "../GraphWidget.Constants"], function (
2
+ require,
3
+ exports,
4
+ ConstantsGraphWidget
5
+ ) {
6
+ var Main;
7
+ (function (Main) {
8
+ "use strict";
9
+ /**
10
+ * A command that moves graph nodes on activation/undo
11
+ */
12
+ var MoveNodesCommand = (function () {
13
+ /**
14
+ * Creates a command that moves graph nodes.
15
+ *
16
+ * @param nodes a list of the nodes to move
17
+ * @param oldLocations the original locations of the nodes. Needed for undo.
18
+ * @param newLocation where the nodes should move.
19
+ */
20
+ function MoveNodesCommand(nodes, oldLocations, newLocations) {
21
+ this._nodes = nodes;
22
+ this._oldLocations = oldLocations;
23
+ this._newLocations = newLocations;
24
+ this.undone = false;
25
+ }
26
+ /**
27
+ * Moves the nodes by comitting the new location to the view model.
28
+ */
29
+ MoveNodesCommand.prototype.run = function () {
30
+ for (var i = 0; i < this._nodes.length; i++) {
31
+ this._nodes[i].commit(
32
+ this._newLocations[i].x,
33
+ this._newLocations[i].y,
34
+ this._newLocations[i].width,
35
+ this._newLocations[i].height
36
+ );
37
+ // if we need to animate
38
+ if (this.undone) {
39
+ this._nodes[i].revertStatic(
40
+ ConstantsGraphWidget.UndoAnimationDuration
41
+ );
42
+ }
43
+ }
44
+ this.undone = false;
45
+ };
46
+ /**
47
+ * Moves the nodes to their original location by comitting to the view model.
48
+ */
49
+ MoveNodesCommand.prototype.undo = function () {
50
+ for (var i = 0; i < this._nodes.length; i++) {
51
+ this._nodes[i].commit(
52
+ this._oldLocations[i].x,
53
+ this._oldLocations[i].y,
54
+ this._oldLocations[i].width,
55
+ this._oldLocations[i].height
56
+ );
57
+ this._nodes[i].revertStatic(
58
+ ConstantsGraphWidget.RedoAnimationDuration
59
+ );
60
+ }
61
+ this.undone = true;
62
+ };
63
+ /**
64
+ * Appends to a pre-existing command.
65
+ * @param nodes a list of the nodes to move
66
+ * @param oldLocations the original locations of the nodes. Needed for undo.
67
+ * @param newLocation where the nodes should move.
68
+ */
69
+ MoveNodesCommand.prototype.update = function (
70
+ nodes,
71
+ oldLocations,
72
+ newLocations
73
+ ) {
74
+ this._nodes = nodes;
75
+ this._oldLocations = oldLocations;
76
+ this._newLocations = newLocations;
77
+ };
78
+ return MoveNodesCommand;
79
+ })();
80
+ Main.MoveNodesCommand = MoveNodesCommand;
81
+ })(Main || (Main = {}));
82
+ return Main;
83
+ });
@@ -0,0 +1,167 @@
1
+ define(["require", "exports", "./GraphWidget.Constants"], function (
2
+ require,
3
+ exports,
4
+ GraphConstants
5
+ ) {
6
+ var Main;
7
+ (function (Main) {
8
+ "use strict";
9
+ /**
10
+ * Returns whether or not a completely lies in b
11
+ *
12
+ * @param a the rect to test for lying in b
13
+ * @param b the enclosing rect
14
+ * @return true if a lies completely in b. false otherwise.
15
+ */
16
+ function rectLiesInRect(a, b) {
17
+ return (
18
+ a.x + a.width <= b.x + b.width &&
19
+ a.x >= b.x &&
20
+ a.y + a.height <= b.y + b.height &&
21
+ a.y >= b.y
22
+ );
23
+ }
24
+ Main.rectLiesInRect = rectLiesInRect;
25
+ /**
26
+ * Returns the first point where the ray starting at p1 and ending at p2 intersects rect.
27
+ *
28
+ * @param p1 the start point for the line to test
29
+ * @param p2 the end point for the line to test
30
+ * @param rect the rectangle
31
+ * @return where the line and rectangle intersect on the exterior of the rectangle or null if they don't
32
+ */
33
+ function rayRectIntersection(p1, p2, rect) {
34
+ // Add padding to the rectangle so edges float a bit off it.
35
+ rect = {
36
+ x: rect.x - GraphConstants.NodeEdgePadding,
37
+ y: rect.y - GraphConstants.NodeEdgePadding,
38
+ height: rect.height + 2 * GraphConstants.NodeEdgePadding,
39
+ width: rect.width + 2 * GraphConstants.NodeEdgePadding,
40
+ };
41
+ // y = mx + b
42
+ var m = (p2.y - p1.y) / (p2.x - p1.x),
43
+ b = p1.y - m * p1.x,
44
+ rectRightX = rect.x + rect.width,
45
+ rectBottomY = rect.y + rect.height,
46
+ intersections,
47
+ x,
48
+ y,
49
+ minDSquared,
50
+ returnedPoint;
51
+ // A line can intersect a rectangle up to 2 times. We'll compute all intersections and return the one with the minimum distance to P1
52
+ intersections = [];
53
+ // Line is vertical, just check top and bottom lines of rectangle for intersection.
54
+ // This avoids dealing with colinear nonsense
55
+ if (Math.abs(m) === Infinity) {
56
+ if (Math.min(p1.y, p2.y) <= rect.y && Math.max(p1.y, p2.y) >= rect.y) {
57
+ intersections.push({
58
+ x: p1.x,
59
+ y: rect.y,
60
+ });
61
+ }
62
+ if (
63
+ Math.min(p1.y, p2.y) <= rectBottomY &&
64
+ Math.max(p1.y, p2.y) >= rectBottomY
65
+ ) {
66
+ intersections.push({
67
+ x: p1.x,
68
+ y: rectBottomY,
69
+ });
70
+ }
71
+ } else if (m === 0.0) {
72
+ if (Math.min(p1.x, p2.x) <= rect.x && Math.max(p1.x, p2.x) >= rect.x) {
73
+ intersections.push({
74
+ x: rect.x,
75
+ y: p1.y,
76
+ });
77
+ }
78
+ if (
79
+ Math.min(p1.x, p2.x) <= rectRightX &&
80
+ Math.max(p1.x, p2.x) >= rectRightX
81
+ ) {
82
+ intersections.push({
83
+ x: rectRightX,
84
+ y: p1.y,
85
+ });
86
+ }
87
+ } else {
88
+ // Does it intersect with left edge?
89
+ y = m * rect.x + b;
90
+ if (
91
+ y >= rect.y &&
92
+ y <= rectBottomY &&
93
+ Math.min(p1.x, p2.x) <= rect.x &&
94
+ rect.x <= Math.max(p1.x, p2.x) &&
95
+ Math.min(p1.y, p2.y) <= y &&
96
+ y <= Math.max(p1.y, p2.y)
97
+ ) {
98
+ intersections.push({
99
+ x: rect.x,
100
+ y: y,
101
+ });
102
+ }
103
+ // Does it intersect the right edge?
104
+ y = m * rectRightX + b;
105
+ if (
106
+ y >= rect.y &&
107
+ y <= rectBottomY &&
108
+ Math.min(p1.x, p2.x) <= rectRightX &&
109
+ rectRightX <= Math.max(p1.x, p2.x) &&
110
+ Math.min(p1.y, p2.y) <= y &&
111
+ y <= Math.max(p1.y, p2.y)
112
+ ) {
113
+ intersections.push({
114
+ x: rectRightX,
115
+ y: y,
116
+ });
117
+ }
118
+ //Does it intersect the top edge?
119
+ x = (rect.y - b) / m;
120
+ if (
121
+ x >= rect.x &&
122
+ x <= rectRightX &&
123
+ Math.min(p1.x, p2.x) <= x &&
124
+ x <= Math.max(p1.x, p2.x) &&
125
+ Math.min(p1.y, p2.y) <= rect.y &&
126
+ rect.y <= Math.max(p1.y, p2.y)
127
+ ) {
128
+ intersections.push({
129
+ x: x,
130
+ y: rect.y,
131
+ });
132
+ }
133
+ // Does it intersect the bottom edge?
134
+ x = (rectBottomY - b) / m;
135
+ if (
136
+ x >= rect.x &&
137
+ x <= rectRightX &&
138
+ Math.min(p1.x, p2.x) <= x &&
139
+ x <= Math.max(p1.x, p2.x) &&
140
+ Math.min(p1.y, p2.y) <= rectBottomY &&
141
+ rectBottomY <= Math.max(p1.y, p2.y)
142
+ ) {
143
+ intersections.push({
144
+ x: x,
145
+ y: rectBottomY,
146
+ });
147
+ }
148
+ }
149
+ minDSquared = Infinity;
150
+ returnedPoint = null;
151
+ // Because d = sqrt(dx^2 + dy^2), and dx and dy are real numbers, we're guaranteed the radical is positive. Thus,
152
+ // we can compare D^2 directly and forego the sqrt
153
+ intersections.forEach(function (point) {
154
+ var dx = point.x - p1.x,
155
+ dy = point.y - p1.y,
156
+ dSquared = dx * dx + dy * dy;
157
+ if (dSquared < minDSquared) {
158
+ minDSquared = dSquared;
159
+ returnedPoint = point;
160
+ }
161
+ });
162
+ return returnedPoint;
163
+ }
164
+ Main.rayRectIntersection = rayRectIntersection;
165
+ })(Main || (Main = {}));
166
+ return Main;
167
+ });