in packages/sanddance/src/viewer.ts [634:705]
private createConfig(c?: VegaDeckGl.types.PresenterConfig): VegaDeckGl.types.ViewGlConfig {
const { getTextColor, getTextHighlightColor, getTextHighlightAlphaCutoff, onTextClick } = this.options;
const defaultPresenterConfig: VegaDeckGl.types.PresenterConfig = {
zAxisZindex,
getCharacterSet: stage => this._characterSet.getCharacterSet(stage),
getTextColor,
getTextHighlightColor,
getTextHighlightAlphaCutoff,
onTextClick: (e, t) => {
if (t.metaData && t.metaData.search) {
const search = getSearchGroupFromVegaValue(t.metaData.search);
if (this.options.onAxisClick) {
this.options.onAxisClick(e, search);
} else {
this.select(search);
}
}
if (onTextClick) {
onTextClick(e, t);
}
},
onCubeClick: this.onCubeClick.bind(this),
onCubeHover: this.onCubeHover.bind(this),
onTextHover: this.onTextHover.bind(this),
preStage: this.preStage.bind(this),
onPresent: this.options.onPresent,
onLayerClick: (info: VegaDeckGl.PickInfo<any>, e: MouseEvent) => {
if (!info || !info.object) {
this.deselect();
}
},
onLegendClick: (e: MouseEvent, legend: VegaDeckGl.types.Legend, clickedIndex: number) => {
const legendRow = clickedIndex !== null && legend.rows[clickedIndex] as LegendRowWithSearch;
if (legendRow) {
if (this.options.onLegendRowClick) {
this.options.onLegendRowClick(e, legendRow);
} else {
this.select(legendRow.search);
}
} else if (this.options.onLegendHeaderClick) {
//header clicked
this.options.onLegendHeaderClick(e);
}
},
onSceneRectAssignCubeOrdinal: datum => {
//TODO see if datum is a facet selection rect
return datum[GL_ORDINAL];
},
onTargetViewState: (h, w) => {
const { height, width } = this.insight.size;
let newViewStateTarget: boolean;
if (this.options.onNewViewStateTarget) {
newViewStateTarget = this.options.onNewViewStateTarget();
}
return { height, width, newViewStateTarget };
},
preserveDrawingBuffer: this.options.preserveDrawingBuffer
};
if (this.options.onBeforeCreateLayers) {
defaultPresenterConfig.preLayer = stage => {
this.options.onBeforeCreateLayers(stage, this.specCapabilities);
};
}
const config: VegaDeckGl.types.ViewGlConfig = {
presenter: this.presenter,
presenterConfig: Object.assign(defaultPresenterConfig, c)
};
if (this.options.transitionDurations) {
config.presenterConfig.transitionDurations = this.options.transitionDurations;
}
return config;
}