File tree Expand file tree Collapse file tree 2 files changed +20
-10
lines changed Expand file tree Collapse file tree 2 files changed +20
-10
lines changed Original file line number Diff line number Diff line change @@ -236,17 +236,27 @@ class PointObj {
236
236
}
237
237
}
238
238
239
- get point ( ) {
240
- return this ;
241
- }
242
-
243
- get array ( ) {
244
- return [ this . x , this . y ] ;
239
+ get 0 ( ) { return this . x ; }
240
+ get 1 ( ) { return this . y ; }
241
+ set 0 ( x ) { this . x = x ; }
242
+ set 1 ( y ) { this . y = y ; }
243
+
244
+ [ Symbol . iterator ] ( ) {
245
+ const array = [ this . x , this . y ] ;
246
+ let i = 0 ;
247
+
248
+ return {
249
+ next ( ) {
250
+ const it = { value : array [ i ] , done : i >= 2 } ;
251
+ i += 1 ;
252
+ return it ;
253
+ }
254
+ } ;
245
255
}
246
256
247
- set array ( a ) {
248
- [ this . x , this . y ] = a ;
249
- }
257
+ get point ( ) { return this ; }
258
+ get array ( ) { return [ this . x , this . y ] ; }
259
+ set array ( a ) { [ this . x , this . y ] = a ; }
250
260
251
261
floor ( ) {
252
262
return new PointObj ( Math . floor ( this . x ) , Math . floor ( this . y ) ) ;
Original file line number Diff line number Diff line change 3
3
"name" : " basiccanvas" ,
4
4
"title" : " BasicCanvas" ,
5
5
"description" : " Simple JavaScript canvas abstractions." ,
6
- "version" : " 1.3.2 " ,
6
+ "version" : " 1.3.3 " ,
7
7
"main" : " lib/BasicCanvas.js" ,
8
8
"homepage" : " https://github.com/Demonstrandum/BasicCanvas/" ,
9
9
"author" : {
You can’t perform that action at this time.
0 commit comments