Commit 4bfbdac Dan Moran
committed
1 parent d2b6079 commit 4bfbdac Copy full SHA for 4bfbdac
File tree 2 files changed +4
-1
lines changed
2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ totally indebted to [Amit's](http://www.redblobgames.com/grids/hexagons/) expana
25
25
| scaleArea | Scale tile sizes proportional to value? | false |
26
26
| scaleHeight | Scale tile height proportional to their value? | true |
27
27
| palette | A predefined palette or palette as JSON string | redblue |
28
+ | flipPalette | Reverse the palette directions? | false |
28
29
| width | Width of map, in AFRAME units. | 1 |
29
30
| wireframeOn | Display wireframe overlay? | false |
30
31
| wireframeColor | Color of wireframe | #fff |
Original file line number Diff line number Diff line change 18
18
hexDensityMobile :{ type : "number" , default :0.1 } ,
19
19
20
20
palette : { type : "string" , default : 'redblue' } ,
21
+ flipPalette : { type : "boolean" , default : false } ,
21
22
scaleHeight : { type : "boolean" , default : true } , // Scale the height of each hex tile according to its value?
22
23
scaleArea : { type : "boolean" , default : true } , // Scale the area of each hex tile according to its value?
23
24
241
242
for ( idx = 0 ; idx < grid . numCells ; idx ++ ) {
242
243
if ( grid . cellValsAsArray [ idx ] === grid . NODATA ) continue ;
243
244
grid . cellValsAsArray [ idx ] = grid . cellValsAsArray [ idx ] / maxBin ;
244
- grid . cellColorsAsArray [ idx ] = elData . palette . length == 1 ? elData . palette [ 0 ] : G . scaleColor ( grid . cellValsAsArray [ idx ] ) ;
245
+
246
+ grid . cellColorsAsArray [ idx ] = elData . palette . length == 1 ? elData . palette [ 0 ] : G . scaleColor ( data . flipPalette ? ( 1 - grid . cellValsAsArray [ idx ] ) : grid . cellValsAsArray [ idx ] ) ;
245
247
grid . cellHeightsAsArray [ idx ] = grid . cellValsAsArray [ idx ] || 0 ;
246
248
grid . cellAreasAsArray [ idx ] = Math . min ( 0.5 , Math . max ( 0.3 , ( Math . log ( grid . cellValsAsArray [ idx ] ) + 1 ) / Math . log ( 1.8 ) ) ) ;
247
249
}
You can’t perform that action at this time.
0 commit comments