diff --git a/src/compile/selection/region.ts b/src/compile/selection/region.ts index 6617621b2f..4bc2b27e28 100644 --- a/src/compile/selection/region.ts +++ b/src/compile/selection/region.ts @@ -4,11 +4,19 @@ import {SelectionCompiler, TUPLE, unitName} from '.'; import {warn} from '../../log'; import {BRUSH} from './interval'; import scales from './scales'; +import {SELECTION_ID} from '../../selection'; export const SCREEN_PATH = '_screen_path'; const region: SelectionCompiler<'region'> = { defined: selCmpt => selCmpt.type === 'region', + parse: (model, selCmpt, selDef) => { + // Region selections are only valid over the SELECTION_ID field. + // As a result, we don't expose "fields" as a valid property of the interface + // and instead hardwire it here during parsing. + selDef.select = {type: 'region', fields: [SELECTION_ID]} as any; + }, + signals: (model, selCmpt, signals) => { const name = selCmpt.name; const signalsToAdd: Signal[] = [];