mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Rect now computes its own xRange and yRange
This commit is contained in:
parent
d99dee234f
commit
c13723d526
@ -131,7 +131,7 @@ window.Rect.prototype = {
|
|||||||
|
|
||||||
// ----------
|
// ----------
|
||||||
set right(value) {
|
set right(value) {
|
||||||
this.width = value - this.left;
|
this.width = value - this.left;
|
||||||
},
|
},
|
||||||
|
|
||||||
// ----------
|
// ----------
|
||||||
@ -141,9 +141,17 @@ window.Rect.prototype = {
|
|||||||
|
|
||||||
// ----------
|
// ----------
|
||||||
set bottom(value) {
|
set bottom(value) {
|
||||||
this.height = value - this.top;
|
this.height = value - this.top;
|
||||||
|
},
|
||||||
|
|
||||||
|
get xRange() {
|
||||||
|
return new Range(this.left,this.right);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
get yRange() {
|
||||||
|
return new Range(this.top,this.bottom);
|
||||||
|
},
|
||||||
|
|
||||||
// ----------
|
// ----------
|
||||||
intersects: function(rect) {
|
intersects: function(rect) {
|
||||||
return (rect.right > this.left
|
return (rect.right > this.left
|
||||||
@ -257,8 +265,13 @@ window.Rect.prototype = {
|
|||||||
// Constructor: Range
|
// Constructor: Range
|
||||||
// Creates a Range with the given min and max
|
// Creates a Range with the given min and max
|
||||||
window.Range = function(min, max) {
|
window.Range = function(min, max) {
|
||||||
this.min = min || 0;
|
if (isRange(min) && !max) { // if the one variable given is a range, copy it.
|
||||||
this.max = max || 0;
|
this.min = min.min;
|
||||||
|
this.max = min.max;
|
||||||
|
} else {
|
||||||
|
this.min = min || 0;
|
||||||
|
this.max = max || 0;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------
|
// ----------
|
||||||
|
Loading…
Reference in New Issue
Block a user