OLD | NEW |
1 var math = dart.defineLibrary(math, {}); | 1 var math = dart.defineLibrary(math, {}); |
2 var core = dart.import(core); | 2 var core = dart.import(core); |
3 var _js_helper = dart.lazyImport(_js_helper); | 3 var _js_helper = dart.lazyImport(_js_helper); |
4 (function(exports, core, _js_helper) { | 4 (function(exports, core, _js_helper) { |
5 'use strict'; | 5 'use strict'; |
6 class _JenkinsSmiHash extends core.Object { | 6 class _JenkinsSmiHash extends core.Object { |
7 static combine(hash, value) { | 7 static combine(hash, value) { |
8 hash = 536870911 & dart.notNull(hash) + dart.notNull(value); | 8 hash = 536870911 & dart.notNull(hash) + dart.notNull(value); |
9 hash = 536870911 & dart.notNull(hash) + ((524287 & dart.notNull(hash)) <<
10); | 9 hash = 536870911 & dart.notNull(hash) + ((524287 & dart.notNull(hash)) <<
10); |
10 return dart.notNull(hash) ^ dart.notNull(hash) >> 6; | 10 return dart.notNull(hash) ^ dart.notNull(hash) >> 6; |
(...skipping 24 matching lines...) Expand all Loading... |
35 Point(x, y) { | 35 Point(x, y) { |
36 this.x = x; | 36 this.x = x; |
37 this.y = y; | 37 this.y = y; |
38 } | 38 } |
39 toString() { | 39 toString() { |
40 return `Point(${this.x}, ${this.y})`; | 40 return `Point(${this.x}, ${this.y})`; |
41 } | 41 } |
42 ['=='](other) { | 42 ['=='](other) { |
43 if (!dart.is(other, Point$())) | 43 if (!dart.is(other, Point$())) |
44 return false; | 44 return false; |
45 return dart.notNull(dart.equals(this.x, dart.dload(other, 'x'))) && dart
.notNull(dart.equals(this.y, dart.dload(other, 'y'))); | 45 return dart.equals(this.x, dart.dload(other, 'x')) && dart.equals(this.y
, dart.dload(other, 'y')); |
46 } | 46 } |
47 get hashCode() { | 47 get hashCode() { |
48 return _JenkinsSmiHash.hash2(dart.hashCode(this.x), dart.hashCode(this.y
)); | 48 return _JenkinsSmiHash.hash2(dart.hashCode(this.x), dart.hashCode(this.y
)); |
49 } | 49 } |
50 ['+'](other) { | 50 ['+'](other) { |
51 dart.as(other, Point$(T)); | 51 dart.as(other, Point$(T)); |
52 return new (Point$(T))(dart.as(this.x['+'](other.x), T), dart.as(this.y[
'+'](other.y), T)); | 52 return new (Point$(T))(dart.as(this.x['+'](other.x), T), dart.as(this.y[
'+'](other.y), T)); |
53 } | 53 } |
54 ['-'](other) { | 54 ['-'](other) { |
55 dart.as(other, Point$(T)); | 55 dart.as(other, Point$(T)); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 } | 106 } |
107 get bottom() { | 107 get bottom() { |
108 return dart.as(this.top['+'](this.height), T); | 108 return dart.as(this.top['+'](this.height), T); |
109 } | 109 } |
110 toString() { | 110 toString() { |
111 return `Rectangle (${this.left}, ${this.top}) ${this.width} x ${this.hei
ght}`; | 111 return `Rectangle (${this.left}, ${this.top}) ${this.width} x ${this.hei
ght}`; |
112 } | 112 } |
113 ['=='](other) { | 113 ['=='](other) { |
114 if (!dart.is(other, Rectangle)) | 114 if (!dart.is(other, Rectangle)) |
115 return false; | 115 return false; |
116 return dart.notNull(dart.equals(this.left, dart.dload(other, 'left'))) &
& dart.notNull(dart.equals(this.top, dart.dload(other, 'top'))) && dart.notNull(
dart.equals(this.right, dart.dload(other, 'right'))) && dart.notNull(dart.equals
(this.bottom, dart.dload(other, 'bottom'))); | 116 return dart.equals(this.left, dart.dload(other, 'left')) && dart.equals(
this.top, dart.dload(other, 'top')) && dart.equals(this.right, dart.dload(other,
'right')) && dart.equals(this.bottom, dart.dload(other, 'bottom')); |
117 } | 117 } |
118 get hashCode() { | 118 get hashCode() { |
119 return _JenkinsSmiHash.hash4(dart.hashCode(this.left), dart.hashCode(thi
s.top), dart.hashCode(this.right), dart.hashCode(this.bottom)); | 119 return _JenkinsSmiHash.hash4(dart.hashCode(this.left), dart.hashCode(thi
s.top), dart.hashCode(this.right), dart.hashCode(this.bottom)); |
120 } | 120 } |
121 intersection(other) { | 121 intersection(other) { |
122 dart.as(other, Rectangle$(T)); | 122 dart.as(other, Rectangle$(T)); |
123 let x0 = max(this.left, other.left); | 123 let x0 = max(this.left, other.left); |
124 let x1 = min(this.left['+'](this.width), other.left['+'](other.width)); | 124 let x1 = min(this.left['+'](this.width), other.left['+'](other.width)); |
125 if (dart.notNull(x0) <= dart.notNull(x1)) { | 125 if (dart.notNull(x0) <= dart.notNull(x1)) { |
126 let y0 = max(this.top, other.top); | 126 let y0 = max(this.top, other.top); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 }) | 172 }) |
173 }); | 173 }); |
174 return _RectangleBase; | 174 return _RectangleBase; |
175 }); | 175 }); |
176 let _RectangleBase = _RectangleBase$(); | 176 let _RectangleBase = _RectangleBase$(); |
177 let Rectangle$ = dart.generic(function(T) { | 177 let Rectangle$ = dart.generic(function(T) { |
178 class Rectangle extends _RectangleBase$(T) { | 178 class Rectangle extends _RectangleBase$(T) { |
179 Rectangle(left, top, width, height) { | 179 Rectangle(left, top, width, height) { |
180 this.left = left; | 180 this.left = left; |
181 this.top = top; | 181 this.top = top; |
182 this.width = dart.as(width['<'](0) ? dart.notNull(width['unary-']()) * 0
: width, T); | 182 this.width = dart.as(dart.notNull(width['<'](0)) ? dart.notNull(width['u
nary-']()) * 0 : width, T); |
183 this.height = dart.as(height['<'](0) ? dart.notNull(height['unary-']())
* 0 : height, T); | 183 this.height = dart.as(dart.notNull(height['<'](0)) ? dart.notNull(height
['unary-']()) * 0 : height, T); |
184 super._RectangleBase(); | 184 super._RectangleBase(); |
185 } | 185 } |
186 static fromPoints(a, b) { | 186 static fromPoints(a, b) { |
187 let left = dart.as(min(a.x, b.x), T); | 187 let left = dart.as(min(a.x, b.x), T); |
188 let width = dart.as(max(a.x, b.x)[dartx['-']](left), T); | 188 let width = dart.as(max(a.x, b.x)[dartx['-']](left), T); |
189 let top = dart.as(min(a.y, b.y), T); | 189 let top = dart.as(min(a.y, b.y), T); |
190 let height = dart.as(max(a.y, b.y)[dartx['-']](top), T); | 190 let height = dart.as(max(a.y, b.y)[dartx['-']](top), T); |
191 return new (Rectangle$(T))(left, top, width, height); | 191 return new (Rectangle$(T))(left, top, width, height); |
192 } | 192 } |
193 } | 193 } |
194 dart.setSignature(Rectangle, { | 194 dart.setSignature(Rectangle, { |
195 constructors: () => ({ | 195 constructors: () => ({ |
196 Rectangle: [Rectangle$(T), [T, T, T, T]], | 196 Rectangle: [Rectangle$(T), [T, T, T, T]], |
197 fromPoints: [Rectangle$(T), [Point$(T), Point$(T)]] | 197 fromPoints: [Rectangle$(T), [Point$(T), Point$(T)]] |
198 }) | 198 }) |
199 }); | 199 }); |
200 return Rectangle; | 200 return Rectangle; |
201 }); | 201 }); |
202 let Rectangle = Rectangle$(); | 202 let Rectangle = Rectangle$(); |
203 let _width = Symbol('_width'); | 203 let _width = Symbol('_width'); |
204 let _height = Symbol('_height'); | 204 let _height = Symbol('_height'); |
205 let MutableRectangle$ = dart.generic(function(T) { | 205 let MutableRectangle$ = dart.generic(function(T) { |
206 class MutableRectangle extends _RectangleBase$(T) { | 206 class MutableRectangle extends _RectangleBase$(T) { |
207 MutableRectangle(left, top, width, height) { | 207 MutableRectangle(left, top, width, height) { |
208 this.left = left; | 208 this.left = left; |
209 this.top = top; | 209 this.top = top; |
210 this[_width] = dart.as(width['<'](0) ? _clampToZero(width) : width, T); | 210 this[_width] = dart.as(dart.notNull(width['<'](0)) ? _clampToZero(width)
: width, T); |
211 this[_height] = dart.as(height['<'](0) ? _clampToZero(height) : height,
T); | 211 this[_height] = dart.as(dart.notNull(height['<'](0)) ? _clampToZero(heig
ht) : height, T); |
212 super._RectangleBase(); | 212 super._RectangleBase(); |
213 } | 213 } |
214 static fromPoints(a, b) { | 214 static fromPoints(a, b) { |
215 let left = dart.as(min(a.x, b.x), T); | 215 let left = dart.as(min(a.x, b.x), T); |
216 let width = dart.as(max(a.x, b.x)[dartx['-']](left), T); | 216 let width = dart.as(max(a.x, b.x)[dartx['-']](left), T); |
217 let top = dart.as(min(a.y, b.y), T); | 217 let top = dart.as(min(a.y, b.y), T); |
218 let height = dart.as(max(a.y, b.y)[dartx['-']](top), T); | 218 let height = dart.as(max(a.y, b.y)[dartx['-']](top), T); |
219 return new (MutableRectangle$(T))(left, top, width, height); | 219 return new (MutableRectangle$(T))(left, top, width, height); |
220 } | 220 } |
221 get width() { | 221 get width() { |
222 return this[_width]; | 222 return this[_width]; |
223 } | 223 } |
224 set width(width) { | 224 set width(width) { |
225 dart.as(width, T); | 225 dart.as(width, T); |
226 if (width['<'](0)) | 226 if (dart.notNull(width['<'](0))) |
227 width = dart.as(_clampToZero(width), T); | 227 width = dart.as(_clampToZero(width), T); |
228 this[_width] = width; | 228 this[_width] = width; |
229 } | 229 } |
230 get height() { | 230 get height() { |
231 return this[_height]; | 231 return this[_height]; |
232 } | 232 } |
233 set height(height) { | 233 set height(height) { |
234 dart.as(height, T); | 234 dart.as(height, T); |
235 if (height['<'](0)) | 235 if (dart.notNull(height['<'](0))) |
236 height = dart.as(_clampToZero(height), T); | 236 height = dart.as(_clampToZero(height), T); |
237 this[_height] = height; | 237 this[_height] = height; |
238 } | 238 } |
239 } | 239 } |
240 MutableRectangle[dart.implements] = () => [Rectangle$(T)]; | 240 MutableRectangle[dart.implements] = () => [Rectangle$(T)]; |
241 dart.setSignature(MutableRectangle, { | 241 dart.setSignature(MutableRectangle, { |
242 constructors: () => ({ | 242 constructors: () => ({ |
243 MutableRectangle: [MutableRectangle$(T), [T, T, T, T]], | 243 MutableRectangle: [MutableRectangle$(T), [T, T, T, T]], |
244 fromPoints: [MutableRectangle$(T), [Point$(T), Point$(T)]] | 244 fromPoints: [MutableRectangle$(T), [Point$(T), Point$(T)]] |
245 }) | 245 }) |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 if (dart.notNull(a) > dart.notNull(b)) | 290 if (dart.notNull(a) > dart.notNull(b)) |
291 return a; | 291 return a; |
292 if (dart.notNull(a) < dart.notNull(b)) | 292 if (dart.notNull(a) < dart.notNull(b)) |
293 return b; | 293 return b; |
294 if (typeof b == 'number') { | 294 if (typeof b == 'number') { |
295 if (typeof a == 'number') { | 295 if (typeof a == 'number') { |
296 if (a == 0.0) { | 296 if (a == 0.0) { |
297 return dart.notNull(a) + dart.notNull(b); | 297 return dart.notNull(a) + dart.notNull(b); |
298 } | 298 } |
299 } | 299 } |
300 if (b[dartx.isNaN]) | 300 if (dart.notNull(b[dartx.isNaN])) |
301 return b; | 301 return b; |
302 return a; | 302 return a; |
303 } | 303 } |
304 if (b == 0 && dart.notNull(a[dartx.isNegative])) | 304 if (b == 0 && dart.notNull(a[dartx.isNegative])) |
305 return b; | 305 return b; |
306 return a; | 306 return a; |
307 } | 307 } |
308 dart.fn(max, core.num, [core.num, core.num]); | 308 dart.fn(max, core.num, [core.num, core.num]); |
309 function atan2(a, b) { | 309 function atan2(a, b) { |
310 return Math.atan2(_js_helper.checkNum(a), _js_helper.checkNum(b)); | 310 return Math.atan2(_js_helper.checkNum(a), _js_helper.checkNum(b)); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 exports.sin = sin; | 515 exports.sin = sin; |
516 exports.cos = cos; | 516 exports.cos = cos; |
517 exports.tan = tan; | 517 exports.tan = tan; |
518 exports.acos = acos; | 518 exports.acos = acos; |
519 exports.asin = asin; | 519 exports.asin = asin; |
520 exports.atan = atan; | 520 exports.atan = atan; |
521 exports.sqrt = sqrt; | 521 exports.sqrt = sqrt; |
522 exports.exp = exp; | 522 exports.exp = exp; |
523 exports.log = log; | 523 exports.log = log; |
524 })(math, core, _js_helper); | 524 })(math, core, _js_helper); |
OLD | NEW |