-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[geo] Add JS controls to remaining layers (#4272)
* Update viz.py * added JS controls * add JS to grid layout * add JS to hexagon layer * added JS controls to screengrid * update to js_data_mutator controls * remove .map()
- Loading branch information
1 parent
2b66ead
commit 2384ad4
Showing
6 changed files
with
86 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,26 @@ | ||
import { ArcLayer } from 'deck.gl'; | ||
|
||
export default function arcLayer(formData, payload) { | ||
import * as common from './common'; | ||
import sandboxedEval from '../../../javascripts/modules/sandbox'; | ||
|
||
export default function arcLayer(formData, payload, slice) { | ||
const fd = formData; | ||
const fc = fd.color_picker; | ||
const data = payload.data.arcs.map(d => ({ | ||
let data = payload.data.arcs.map(d => ({ | ||
...d, | ||
color: [fc.r, fc.g, fc.b, 255 * fc.a], | ||
})); | ||
|
||
if (fd.js_data_mutator) { | ||
// Applying user defined data mutator if defined | ||
const jsFnMutator = sandboxedEval(fd.js_data_mutator); | ||
data = jsFnMutator(data); | ||
} | ||
|
||
return new ArcLayer({ | ||
id: `path-layer-${fd.slice_id}`, | ||
data, | ||
strokeWidth: (fd.stroke_width) ? fd.stroke_width : 3, | ||
...common.commonLayerProps(fd, slice), | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters