OLD | NEW |
| (Empty) |
1 part of dart.math; | |
2 abstract class _RectangleBase<T extends num> {const _RectangleBase(); | |
3 T get left; | |
4 T get top; | |
5 T get width; | |
6 T get height; | |
7 T get right => ((__x7) => DEVC$RT.cast(__x7, num, T, "CompositeCast", """line 3
3, column 18 of dart:math/rectangle.dart: """, __x7 is T, false))(left + width); | |
8 T get bottom => ((__x8) => DEVC$RT.cast(__x8, num, T, "CompositeCast", """line
35, column 19 of dart:math/rectangle.dart: """, __x8 is T, false))(top + height)
; | |
9 String toString() { | |
10 return 'Rectangle ($left, $top) $width x $height'; | |
11 } | |
12 bool operator ==(other) { | |
13 if (other is! Rectangle) return false; | |
14 return left == other.left && top == other.top && right == other.right && bott
om == other.bottom; | |
15 } | |
16 int get hashCode => _JenkinsSmiHash.hash4(left.hashCode, top.hashCode, right.ha
shCode, bottom.hashCode); | |
17 Rectangle<T> intersection(Rectangle<T> other) { | |
18 var x0 = max(left, other.left); | |
19 var x1 = min(left + width, other.left + other.width); | |
20 if (x0 <= x1) { | |
21 var y0 = max(top, other.top); | |
22 var y1 = min(top + height, other.top + other.height); | |
23 if (y0 <= y1) { | |
24 return new Rectangle<T>(DEVC$RT.cast(x0, num, T, "CompositeCast", """line
68, column 33 of dart:math/rectangle.dart: """, x0 is T, false), DEVC$RT.cast(y0
, num, T, "CompositeCast", """line 68, column 37 of dart:math/rectangle.dart: ""
", y0 is T, false), ((__x9) => DEVC$RT.cast(__x9, num, T, "CompositeCast", """li
ne 68, column 41 of dart:math/rectangle.dart: """, __x9 is T, false))(x1 - x0),
((__x10) => DEVC$RT.cast(__x10, num, T, "CompositeCast", """line 68, column 50 o
f dart:math/rectangle.dart: """, __x10 is T, false))(y1 - y0)); | |
25 } | |
26 } | |
27 return null; | |
28 } | |
29 bool intersects(Rectangle<num> other) { | |
30 return (left <= other.left + other.width && other.left <= left + width && top
<= other.top + other.height && other.top <= top + height); | |
31 } | |
32 Rectangle<T> boundingBox(Rectangle<T> other) { | |
33 var right = max(this.left + this.width, other.left + other.width); | |
34 var bottom = max(this.top + this.height, other.top + other.height); | |
35 var left = min(this.left, other.left); | |
36 var top = min(this.top, other.top); | |
37 return new Rectangle<T>(DEVC$RT.cast(left, num, T, "CompositeCast", """line 9
5, column 29 of dart:math/rectangle.dart: """, left is T, false), DEVC$RT.cast(t
op, num, T, "CompositeCast", """line 95, column 35 of dart:math/rectangle.dart:
""", top is T, false), ((__x11) => DEVC$RT.cast(__x11, num, T, "CompositeCast",
"""line 95, column 40 of dart:math/rectangle.dart: """, __x11 is T, false))(righ
t - left), ((__x12) => DEVC$RT.cast(__x12, num, T, "CompositeCast", """line 95,
column 54 of dart:math/rectangle.dart: """, __x12 is T, false))(bottom - top)); | |
38 } | |
39 bool containsRectangle(Rectangle<num> another) { | |
40 return left <= another.left && left + width >= another.left + another.width &&
top <= another.top && top + height >= another.top + another.height; | |
41 } | |
42 bool containsPoint(Point<num> another) { | |
43 return another.x >= left && another.x <= left + width && another.y >= top && a
nother.y <= top + height; | |
44 } | |
45 Point<T> get topLeft => new Point<T>(this.left, this.top); | |
46 Point<T> get topRight => new Point<T>(((__x13) => DEVC$RT.cast(__x13, num, T, "
CompositeCast", """line 119, column 41 of dart:math/rectangle.dart: """, __x13 i
s T, false))(this.left + this.width), this.top); | |
47 Point<T> get bottomRight => new Point<T>(((__x14) => DEVC$RT.cast(__x14, num, T
, "CompositeCast", """line 120, column 44 of dart:math/rectangle.dart: """, __x1
4 is T, false))(this.left + this.width), ((__x15) => DEVC$RT.cast(__x15, num, T,
"CompositeCast", """line 121, column 7 of dart:math/rectangle.dart: """, __x15
is T, false))(this.top + this.height)); | |
48 Point<T> get bottomLeft => new Point<T>(this.left, ((__x16) => DEVC$RT.cast(__x
16, num, T, "CompositeCast", """line 123, column 7 of dart:math/rectangle.dart:
""", __x16 is T, false))(this.top + this.height)); | |
49 } | |
50 class Rectangle<T extends num> extends _RectangleBase<T> {final T left; | |
51 final T top; | |
52 final T width; | |
53 final T height; | |
54 const Rectangle(this.left, this.top, T width, T height) : this.width = (width <
0) ? -width * 0 : width, this.height = (height < 0) ? -height * 0 : height; | |
55 factory Rectangle.fromPoints(Point<T> a, Point<T> b) { | |
56 T left = ((__x17) => DEVC$RT.cast(__x17, num, T, "CompositeCast", """line 167, c
olumn 14 of dart:math/rectangle.dart: """, __x17 is T, false))(min(a.x, b.x)); | |
57 T width = ((__x18) => DEVC$RT.cast(__x18, num, T, "CompositeCast", """line 168,
column 15 of dart:math/rectangle.dart: """, __x18 is T, false))(max(a.x, b.x) -
left); | |
58 T top = ((__x19) => DEVC$RT.cast(__x19, num, T, "CompositeCast", """line 169, c
olumn 13 of dart:math/rectangle.dart: """, __x19 is T, false))(min(a.y, b.y)); | |
59 T height = ((__x20) => DEVC$RT.cast(__x20, num, T, "CompositeCast", """line 170
, column 16 of dart:math/rectangle.dart: """, __x20 is T, false))(max(a.y, b.y)
- top); | |
60 return new Rectangle<T>(left, top, width, height); | |
61 } | |
62 } | |
63 class MutableRectangle<T extends num> extends _RectangleBase<T> implements Rect
angle<T> {T left; | |
64 T top; | |
65 T _width; | |
66 T _height; | |
67 MutableRectangle(this.left, this.top, T width, T height) : this._width = ((__x2
1) => DEVC$RT.cast(__x21, dynamic, T, "CompositeCast", """line 212, column 23 of
dart:math/rectangle.dart: """, __x21 is T, false))((width < 0) ? _clampToZero(w
idth) : width), this._height = ((__x22) => DEVC$RT.cast(__x22, dynamic, T, "Comp
ositeCast", """line 213, column 24 of dart:math/rectangle.dart: """, __x22 is T,
false))((height < 0) ? _clampToZero(height) : height); | |
68 factory MutableRectangle.fromPoints(Point<T> a, Point<T> b) { | |
69 T left = ((__x23) => DEVC$RT.cast(__x23, num, T, "CompositeCast", """line 228, c
olumn 14 of dart:math/rectangle.dart: """, __x23 is T, false))(min(a.x, b.x)); | |
70 T width = ((__x24) => DEVC$RT.cast(__x24, num, T, "CompositeCast", """line 229,
column 15 of dart:math/rectangle.dart: """, __x24 is T, false))(max(a.x, b.x) -
left); | |
71 T top = ((__x25) => DEVC$RT.cast(__x25, num, T, "CompositeCast", """line 230, c
olumn 13 of dart:math/rectangle.dart: """, __x25 is T, false))(min(a.y, b.y)); | |
72 T height = ((__x26) => DEVC$RT.cast(__x26, num, T, "CompositeCast", """line 231
, column 16 of dart:math/rectangle.dart: """, __x26 is T, false))(max(a.y, b.y)
- top); | |
73 return new MutableRectangle<T>(left, top, width, height); | |
74 } | |
75 T get width => _width; | |
76 void set width(T width) { | |
77 if (width < 0) width = ((__x27) => DEVC$RT.cast(__x27, num, T, "CompositeCast",
"""line 247, column 28 of dart:math/rectangle.dart: """, __x27 is T, false))(_cl
ampToZero(width)); | |
78 _width = width; | |
79 } | |
80 T get height => _height; | |
81 void set height(T height) { | |
82 if (height < 0) height = ((__x28) => DEVC$RT.cast(__x28, num, T, "CompositeCast"
, """line 263, column 30 of dart:math/rectangle.dart: """, __x28 is T, false))(_
clampToZero(height)); | |
83 _height = height; | |
84 } | |
85 } | |
86 num _clampToZero(num value) { | |
87 assert (value < 0); return -value * 0; | |
88 } | |
OLD | NEW |