import 'package:vid/us/vid_us_point.dart'; class VidUsRect { late double _left; late double _right; late double _top; late double _bottom; double get left => _left; double get right => _right; double get top => _top; double get bottom => _bottom; double get width => (_right - _left).abs(); double get height => (_bottom - _top).abs(); VidUsPoint get topLeft => new VidUsPoint(_left, _top); VidUsPoint get topRight => new VidUsPoint(_right, _top); VidUsPoint get bottomLeft => new VidUsPoint(_left, _bottom); VidUsPoint get bottomRight => new VidUsPoint(_right, _bottom); VidUsRect.xywh(double x, double y, double width, double height) { _left = topLeft.x; _top = topLeft.y; _right = _left + width; _bottom = _top + height; } VidUsRect.tlbr(VidUsPoint topLeft, VidUsPoint bottomRight) { _left = topLeft.x; _top = topLeft.y; _right = bottomRight.x; _bottom = bottomRight.y; } bool operator ==(other) { if (other is VidUsRect && runtimeType == other.runtimeType && _left == other._left && _right == other._right && _top == other._top && _bottom == other._bottom) { return true; } return false; } @override int get hashCode => _left.hashCode ^ _right.hashCode ^ _top.hashCode ^ _bottom.hashCode; }