File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -236,17 +236,27 @@ class PointObj {
236236 }
237237 }
238238
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+ } ;
245255 }
246256
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 ; }
250260
251261 floor ( ) {
252262 return new PointObj ( Math . floor ( this . x ) , Math . floor ( this . y ) ) ;
Original file line number Diff line number Diff line change 33 "name" : " basiccanvas" ,
44 "title" : " BasicCanvas" ,
55 "description" : " Simple JavaScript canvas abstractions." ,
6- "version" : " 1.3.2 " ,
6+ "version" : " 1.3.3 " ,
77 "main" : " lib/BasicCanvas.js" ,
88 "homepage" : " https://github.com/Demonstrandum/BasicCanvas/" ,
99 "author" : {
You can’t perform that action at this time.
0 commit comments