File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ class InfiniteGrid {
55 * @param {Object } [options.string_map] - Map grid values to strings.
66 */
77 constructor ( { defaultFactory = ( x , y ) => 0 , string_map = { } } = { } ) {
8- this . defaultFactory = defaultFactory ;
8+ this . defaultFactory = defaultFactory . bind ( this ) ;
99 this . string_map = string_map ;
1010 this . grid = new Map ( ) ;
1111 this . max_x = - Infinity ;
@@ -106,6 +106,7 @@ class InfiniteGrid {
106106 for ( let [ key , val ] of this . grid ) {
107107 new_map . set ( key , typeof val === 'object' ? JSON . parse ( JSON . stringify ( val ) ) : val ) ;
108108 }
109+ infinite_grid_clone . defaultFactory = this . defaultFactory . bind ( this ) ;
109110 infinite_grid_clone . string_map = JSON . parse ( JSON . stringify ( this . string_map ) ) ;
110111 infinite_grid_clone . grid = new_map ;
111112 infinite_grid_clone . max_x = this . max_x ;
You can’t perform that action at this time.
0 commit comments