|
|
|
|
|
|
|
|
|
export default class Position { |
|
|
|
|
|
|
|
|
|
|
|
|
|
constructor({ |
|
left = 0, |
|
top = 0, |
|
right = 0, |
|
bottom = 0, |
|
} = {}) { |
|
this.left = left; |
|
this.right = right; |
|
this.top = top; |
|
this.bottom = bottom; |
|
} |
|
|
|
|
|
|
|
|
|
|
|
canHighlight() { |
|
return this.left < this.right && this.top < this.bottom; |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
equals(position) { |
|
return Math.round(this.left) === Math.round(position.left) && |
|
Math.round(this.right) === Math.round(position.right) && |
|
Math.round(this.top) === Math.round(position.top) && |
|
Math.round(this.bottom) === Math.round(position.bottom); |
|
} |
|
} |
|
|