-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbox.js
31 lines (31 loc) · 1.11 KB
/
box.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
define(['coordinate', 'line'], function(Coordinate, Line){
var Box = function(topLeft, bottomRight) {
this.topLeft = topLeft;
this.bottomRight = bottomRight;
this.leftLine = function() {
var start = new Coordinate(this.topLeft.x, this.topLeft.y);
var end = new Coordinate(this.topLeft.x, this.bottomRight.y);
var line = new Line(start, end);
return line;
}
this.rightLine = function() {
var start = new Coordinate(this.bottomRight.x, this.topLeft.y);
var end = new Coordinate(this.bottomRight.x, this.bottomRight.y);
var line = new Line(start, end);
return line;
}
this.topLine = function() {
var start = new Coordinate(this.topLeft.x, this.topLeft.y);
var end = new Coordinate(this.bottomRight.x, this.topLeft.y);
var line = new Line(start, end);
return line;
}
this.bottomLine = function() {
var start = new Coordinate(this.topLeft.x, this.bottomRight.y);
var end = new Coordinate(this.bottomRight.x, this.bottomRight.y);
var line = new Line(start, end);
return line;
}
}
return Box;
});